@daoyi/nmtl-ui 2.0.1-beta.51 → 2.0.1-beta.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/lib/components/Autocomplete-3dae80ca.js +0 -335
- package/lib/components/Autocomplete.js +0 -13
- package/lib/components/Avatar.js +0 -49
- package/lib/components/BackTop.js +0 -109
- package/lib/components/BarChart.js +0 -762
- package/lib/components/Breadcrumbs.js +0 -122
- package/lib/components/Button-433372aa.js +0 -92
- package/lib/components/Button.js +0 -6
- package/lib/components/Carousel.js +0 -4654
- package/lib/components/Checkbox.js +0 -37
- package/lib/components/CollapseContent.js +0 -179
- package/lib/components/ContactModal-66bcb5d3.js +0 -10779
- package/lib/components/ContactModal.js +0 -22
- package/lib/components/Drawer-df3535c2.js +0 -157
- package/lib/components/Drawer.js +0 -11
- package/lib/components/Dropdown.js +0 -134
- package/lib/components/Empty-7318f658.js +0 -45
- package/lib/components/Empty.js +0 -5
- package/lib/components/ExportButton.js +0 -112
- package/lib/components/ExtraTools-81223f02.js +0 -3534
- package/lib/components/ExtraTools.js +0 -10
- package/lib/components/Filter.js +0 -776
- package/lib/components/Footer.js +0 -271
- package/lib/components/ForwardLink-0571e627.js +0 -105
- package/lib/components/ForwardLink.js +0 -9
- package/lib/components/Header.js +0 -187
- package/lib/components/Image.js +0 -61
- package/lib/components/Input.js +0 -77
- package/lib/components/InputMethod.js +0 -33963
- package/lib/components/KeywordSearch-568a8a44.js +0 -139
- package/lib/components/KeywordSearch.js +0 -15
- package/lib/components/KeywordTicker.js +0 -190
- package/lib/components/Keywords.js +0 -317
- package/lib/components/Loading.js +0 -28
- package/lib/components/MUITheme.js +0 -2627
- package/lib/components/Modal-64c4ab0d.js +0 -108
- package/lib/components/Modal.js +0 -9
- package/lib/components/MoreButton-6654cc5b.js +0 -110
- package/lib/components/MoreButton.js +0 -6
- package/lib/components/Radio.js +0 -78
- package/lib/components/SNA.js +0 -1691
- package/lib/components/Select-113372b2.js +0 -115
- package/lib/components/Select.js +0 -8
- package/lib/components/Spin-8a5a600d.js +0 -75
- package/lib/components/Spin.js +0 -6
- package/lib/components/Table.js +0 -51
- package/lib/components/Tooltip-abe1205f.js +0 -70
- package/lib/components/Tooltip.js +0 -7
- package/lib/components/_commonjsHelpers-70de2c37.js +0 -28
- package/lib/components/_rollupPluginBabelHelpers-3d9c8289.js +0 -478
- package/lib/components/createSvgIcon-a79ae4b1.js +0 -576
- package/lib/components/dataExport-d55d6fa3.js +0 -92
- package/lib/components/debounce-127da66c.js +0 -355
- package/lib/components/defaultTheme-19a14721.js +0 -1485
- package/lib/components/globalConfig.js +0 -172
- package/lib/components/hoist-non-react-statics.cjs-3f408ad2.js +0 -105
- package/lib/components/index-66babe67.js +0 -61
- package/lib/components/index-fdcc884e.js +0 -481
- package/lib/components/isObjectLike-e111475d.js +0 -190
- package/lib/components/style-inject.es-1f59c1d0.js +0 -28
- package/lib/components/transform-3a04288b.js +0 -5475
- package/lib/index.d.ts +0 -36
- package/lib/index.js +0 -36
- package/lib/utils/_rollupPluginBabelHelpers-8dd26e1a.js +0 -121
- package/lib/utils/arrayMerge.js +0 -100
- package/lib/utils/chunkArray.js +0 -15
- package/lib/utils/convert2HtmlEntities.js +0 -42
- package/lib/utils/domToImage.js +0 -802
- package/lib/utils/downloadGephi.js +0 -106
- package/lib/utils/exportXlsx.js +0 -219
- package/lib/utils/historyAppendSearch.js +0 -502
- package/lib/utils/index.d.ts +0 -13
- package/lib/utils/index.js +0 -13
- package/lib/utils/isDevelopMode.js +0 -5
- package/lib/utils/parseYMD.js +0 -36
- package/lib/utils/removeDuplicateItem.js +0 -11
- package/lib/utils/sendEmail.js +0 -39
- package/lib/utils/snaDefine-6a2bcd94.js +0 -5
- package/lib/utils/snaDefine.js +0 -1
- package/lib/utils/snaPreProcess.js +0 -84
package/lib/index.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export { default as Avatar } from './components/Avatar';
|
|
2
|
-
export { default as Autocomplete } from './components/Autocomplete';
|
|
3
|
-
export { default as Button } from './components/Button';
|
|
4
|
-
export { default as BackTop } from './components/BackTop';
|
|
5
|
-
export { default as Carousel } from './components/Carousel';
|
|
6
|
-
export { default as Checkbox } from './components/Checkbox';
|
|
7
|
-
export { default as Drawer } from './components/Drawer';
|
|
8
|
-
export { default as Empty } from './components/Empty';
|
|
9
|
-
export { default as Image } from './components/Image';
|
|
10
|
-
export { default as InputMethod } from './components/InputMethod';
|
|
11
|
-
export { default as Loading } from './components/Loading';
|
|
12
|
-
export { default as Modal } from './components/Modal';
|
|
13
|
-
export { default as Radio } from './components/Radio';
|
|
14
|
-
export { default as Select } from './components/Select';
|
|
15
|
-
export { default as Spin } from './components/Spin';
|
|
16
|
-
export { default as Table } from './components/Table';
|
|
17
|
-
export { default as Tooltip } from './components/Tooltip';
|
|
18
|
-
export { default as Input } from './components/Input';
|
|
19
|
-
export { default as Dropdown } from './components/Dropdown';
|
|
20
|
-
export { default as Breadcrumbs } from './components/Breadcrumbs';
|
|
21
|
-
export { default as ExportButton } from './components/ExportButton';
|
|
22
|
-
export { default as SNA } from './components/SNA';
|
|
23
|
-
export { default as BarChart } from './components/BarChart';
|
|
24
|
-
export { default as ForwardLink } from './components/ForwardLink';
|
|
25
|
-
|
|
26
|
-
export { default as ContactModal } from './components/ContactModal';
|
|
27
|
-
export { default as KeywordSearch } from './components/KeywordSearch';
|
|
28
|
-
export { default as MUITheme } from './components/MUITheme';
|
|
29
|
-
export { default as Header } from './components/Header';
|
|
30
|
-
export { default as Footer } from './components/Footer';
|
|
31
|
-
export { default as Keywords } from './components/Keywords';
|
|
32
|
-
export { default as CollapseContent } from './components/CollapseContent';
|
|
33
|
-
export { default as MoreButton } from './components/MoreButton';
|
|
34
|
-
export { default as KeywordTicker } from './components/KeywordTicker';
|
|
35
|
-
export { default as ExtraTools } from './components/ExtraTools';
|
|
36
|
-
export { default as Filter } from './components/Filter';
|
package/lib/index.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export { default as Avatar } from './components/Avatar';
|
|
2
|
-
export { default as Autocomplete } from './components/Autocomplete';
|
|
3
|
-
export { default as Button } from './components/Button';
|
|
4
|
-
export { default as BackTop } from './components/BackTop';
|
|
5
|
-
export { default as Carousel } from './components/Carousel';
|
|
6
|
-
export { default as Checkbox } from './components/Checkbox';
|
|
7
|
-
export { default as Drawer } from './components/Drawer';
|
|
8
|
-
export { default as Empty } from './components/Empty';
|
|
9
|
-
export { default as Image } from './components/Image';
|
|
10
|
-
export { default as InputMethod } from './components/InputMethod';
|
|
11
|
-
export { default as Loading } from './components/Loading';
|
|
12
|
-
export { default as Modal } from './components/Modal';
|
|
13
|
-
export { default as Radio } from './components/Radio';
|
|
14
|
-
export { default as Select } from './components/Select';
|
|
15
|
-
export { default as Spin } from './components/Spin';
|
|
16
|
-
export { default as Table } from './components/Table';
|
|
17
|
-
export { default as Tooltip } from './components/Tooltip';
|
|
18
|
-
export { default as Input } from './components/Input';
|
|
19
|
-
export { default as Dropdown } from './components/Dropdown';
|
|
20
|
-
export { default as Breadcrumbs } from './components/Breadcrumbs';
|
|
21
|
-
export { default as ExportButton } from './components/ExportButton';
|
|
22
|
-
export { default as SNA } from './components/SNA';
|
|
23
|
-
export { default as BarChart } from './components/BarChart';
|
|
24
|
-
export { default as ForwardLink } from './components/ForwardLink';
|
|
25
|
-
|
|
26
|
-
export { default as ContactModal } from './components/ContactModal';
|
|
27
|
-
export { default as KeywordSearch } from './components/KeywordSearch';
|
|
28
|
-
export { default as MUITheme } from './components/MUITheme';
|
|
29
|
-
export { default as Header } from './components/Header';
|
|
30
|
-
export { default as Footer } from './components/Footer';
|
|
31
|
-
export { default as Keywords } from './components/Keywords';
|
|
32
|
-
export { default as CollapseContent } from './components/CollapseContent';
|
|
33
|
-
export { default as MoreButton } from './components/MoreButton';
|
|
34
|
-
export { default as KeywordTicker } from './components/KeywordTicker';
|
|
35
|
-
export { default as ExtraTools } from './components/ExtraTools';
|
|
36
|
-
export { default as Filter } from './components/Filter';
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) {
|
|
2
|
-
var keys = Object.keys(object);
|
|
3
|
-
if (Object.getOwnPropertySymbols) {
|
|
4
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
5
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
6
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
7
|
-
})), keys.push.apply(keys, symbols);
|
|
8
|
-
}
|
|
9
|
-
return keys;
|
|
10
|
-
}
|
|
11
|
-
function _objectSpread2(target) {
|
|
12
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
13
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
14
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
15
|
-
_defineProperty(target, key, source[key]);
|
|
16
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
17
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return target;
|
|
21
|
-
}
|
|
22
|
-
function _defineProperty(obj, key, value) {
|
|
23
|
-
if (key in obj) {
|
|
24
|
-
Object.defineProperty(obj, key, {
|
|
25
|
-
value: value,
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true
|
|
29
|
-
});
|
|
30
|
-
} else {
|
|
31
|
-
obj[key] = value;
|
|
32
|
-
}
|
|
33
|
-
return obj;
|
|
34
|
-
}
|
|
35
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
36
|
-
if (source == null) return {};
|
|
37
|
-
var target = {};
|
|
38
|
-
var sourceKeys = Object.keys(source);
|
|
39
|
-
var key, i;
|
|
40
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
41
|
-
key = sourceKeys[i];
|
|
42
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
43
|
-
target[key] = source[key];
|
|
44
|
-
}
|
|
45
|
-
return target;
|
|
46
|
-
}
|
|
47
|
-
function _objectWithoutProperties(source, excluded) {
|
|
48
|
-
if (source == null) return {};
|
|
49
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
50
|
-
var key, i;
|
|
51
|
-
if (Object.getOwnPropertySymbols) {
|
|
52
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
53
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
54
|
-
key = sourceSymbolKeys[i];
|
|
55
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
56
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
57
|
-
target[key] = source[key];
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return target;
|
|
61
|
-
}
|
|
62
|
-
function _slicedToArray(arr, i) {
|
|
63
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
64
|
-
}
|
|
65
|
-
function _toConsumableArray(arr) {
|
|
66
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
67
|
-
}
|
|
68
|
-
function _arrayWithoutHoles(arr) {
|
|
69
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
70
|
-
}
|
|
71
|
-
function _arrayWithHoles(arr) {
|
|
72
|
-
if (Array.isArray(arr)) return arr;
|
|
73
|
-
}
|
|
74
|
-
function _iterableToArray(iter) {
|
|
75
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
76
|
-
}
|
|
77
|
-
function _iterableToArrayLimit(arr, i) {
|
|
78
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
79
|
-
if (_i == null) return;
|
|
80
|
-
var _arr = [];
|
|
81
|
-
var _n = true;
|
|
82
|
-
var _d = false;
|
|
83
|
-
var _s, _e;
|
|
84
|
-
try {
|
|
85
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
86
|
-
_arr.push(_s.value);
|
|
87
|
-
if (i && _arr.length === i) break;
|
|
88
|
-
}
|
|
89
|
-
} catch (err) {
|
|
90
|
-
_d = true;
|
|
91
|
-
_e = err;
|
|
92
|
-
} finally {
|
|
93
|
-
try {
|
|
94
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
95
|
-
} finally {
|
|
96
|
-
if (_d) throw _e;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return _arr;
|
|
100
|
-
}
|
|
101
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
102
|
-
if (!o) return;
|
|
103
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
104
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
105
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
106
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
107
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
108
|
-
}
|
|
109
|
-
function _arrayLikeToArray(arr, len) {
|
|
110
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
111
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
112
|
-
return arr2;
|
|
113
|
-
}
|
|
114
|
-
function _nonIterableSpread() {
|
|
115
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
116
|
-
}
|
|
117
|
-
function _nonIterableRest() {
|
|
118
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export { _toConsumableArray as _, _slicedToArray as a, _objectWithoutProperties as b, _objectSpread2 as c };
|
package/lib/utils/arrayMerge.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
var arrayMerge = {};
|
|
2
|
-
|
|
3
|
-
// 根據 id 合併其它所有鍵值為 array
|
|
4
|
-
// input:
|
|
5
|
-
// [{author: "AAA", authorId: "PER1", id: "PUB001"}, {author: "BBB", authorId: "PER2", id: "PUB001"}]
|
|
6
|
-
// return:
|
|
7
|
-
// [{author: ["AAA", "BBB"], authorId: ["PER1", "PER2"],
|
|
8
|
-
// authors:[{author:"AAA", authorId:"PER1"}, {author:"BBB", authorId:"PER2"}], id: "PUB001"}]
|
|
9
|
-
var arrayMergeAuthors = function arrayMergeAuthors(input, key) {
|
|
10
|
-
return input.reduce(function (re, obj) {
|
|
11
|
-
// 如果 key 不存在,就不處理
|
|
12
|
-
if (Object.keys(obj).indexOf(key) < 0) {
|
|
13
|
-
re.push(obj);
|
|
14
|
-
return re;
|
|
15
|
-
}
|
|
16
|
-
var item = re.find(function (o) {
|
|
17
|
-
return o[key] === obj[key];
|
|
18
|
-
});
|
|
19
|
-
if (item) {
|
|
20
|
-
// 過濾重覆的作者名
|
|
21
|
-
item.authors = obj.authorId && !item.authors.find(function (a) {
|
|
22
|
-
return a.authorId === obj.authorId;
|
|
23
|
-
}) ? item.authors.concat({
|
|
24
|
-
author: obj.author,
|
|
25
|
-
authorId: obj.authorId
|
|
26
|
-
}) : item.authors;
|
|
27
|
-
item.authorId = obj.authorId && !item.authorId.find(function (arId) {
|
|
28
|
-
return arId === obj.authorId;
|
|
29
|
-
}) ? item.authorId.concat(obj.authorId) : item.authorId;
|
|
30
|
-
item.author = obj.author && !item.author.find(function (arId) {
|
|
31
|
-
return arId === obj.author;
|
|
32
|
-
}) ? item.author.concat(obj.author) : item.author;
|
|
33
|
-
} else {
|
|
34
|
-
// eslint-disable-next-line no-param-reassign
|
|
35
|
-
obj.authors = [{
|
|
36
|
-
author: obj.author,
|
|
37
|
-
authorId: obj.authorId
|
|
38
|
-
}];
|
|
39
|
-
|
|
40
|
-
// eslint-disable-next-line no-param-reassign
|
|
41
|
-
obj.authorId = obj.authorId ? [obj.authorId] : [];
|
|
42
|
-
// eslint-disable-next-line no-param-reassign
|
|
43
|
-
obj.author = obj.author ? [obj.author] : [];
|
|
44
|
-
re.push(obj);
|
|
45
|
-
}
|
|
46
|
-
return re;
|
|
47
|
-
}, []);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
// 根據 id 合併其它所有鍵值為 array
|
|
51
|
-
// input: 'graph', 'startDate', 'authorName', 'type'
|
|
52
|
-
// [{graph: "全臺詩", startDate: "PER1", authorName: "作者名", type: '詩文作品', source: '作品名1', typeId: 'ART111'},
|
|
53
|
-
// {graph: "全臺詩", startDate: "PER1", authorName: "作者名", type: '詩文作品', source: '作品名2', typeId: 'ART222'},]
|
|
54
|
-
// return:
|
|
55
|
-
// [{graph: "全臺詩", startDate: "PER1", authorName: "作者名", type: '詩文作品', source: '作品名1', typeId: 'ART111',
|
|
56
|
-
// mergedList: {source: ['作品名1', '作品名2'], typeId: ['ART111', 'ART222']}}]
|
|
57
|
-
var arrayMergeTimeline = function arrayMergeTimeline(input, keys, mergeKeys) {
|
|
58
|
-
var mergedName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'mergedList';
|
|
59
|
-
return input.reduce(function (re, obj) {
|
|
60
|
-
var item = re.find(function (o) {
|
|
61
|
-
var match = true;
|
|
62
|
-
|
|
63
|
-
// 不存在此 property
|
|
64
|
-
keys.forEach(function (key) {
|
|
65
|
-
// not found
|
|
66
|
-
if (Object.keys(obj).indexOf(key) < 0) {
|
|
67
|
-
match = false;
|
|
68
|
-
}
|
|
69
|
-
if (Object.keys(o).indexOf(key) < 0) {
|
|
70
|
-
match = false;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// not the same
|
|
74
|
-
if (o[key] !== obj[key]) {
|
|
75
|
-
match = false;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
return match ? o : null;
|
|
79
|
-
});
|
|
80
|
-
var mergedObj = function mergedObj(inObj, inKeys) {
|
|
81
|
-
var mObj = {};
|
|
82
|
-
inKeys.forEach(function (k) {
|
|
83
|
-
mObj[k] = inObj[k];
|
|
84
|
-
});
|
|
85
|
-
return mObj;
|
|
86
|
-
};
|
|
87
|
-
if (item) {
|
|
88
|
-
item[mergedName] = item[mergedName].concat(mergedObj(obj, mergeKeys));
|
|
89
|
-
} else {
|
|
90
|
-
// eslint-disable-next-line no-param-reassign
|
|
91
|
-
obj[mergedName] = [mergedObj(obj, mergeKeys)];
|
|
92
|
-
re.push(obj);
|
|
93
|
-
}
|
|
94
|
-
return re;
|
|
95
|
-
}, []);
|
|
96
|
-
};
|
|
97
|
-
arrayMerge.author = arrayMergeAuthors;
|
|
98
|
-
arrayMerge.timeline = arrayMergeTimeline;
|
|
99
|
-
|
|
100
|
-
export { arrayMerge as default };
|
package/lib/utils/chunkArray.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Examples
|
|
2
|
-
// chunkArray([1, 2, 3, 4, 5, 6, 7, 8], 3); // [[1, 2, 3], [4, 5, 6], [7, 8]]
|
|
3
|
-
// chunkArray([1, 2, 3, 4, 5, 6, 7, 8], 4); // [[1, 2, 3, 4], [5, 6, 7, 8]]
|
|
4
|
-
var chunkArray = function chunkArray(arr, size) {
|
|
5
|
-
return arr.reduce(function (acc, e, i) {
|
|
6
|
-
if (i % size) {
|
|
7
|
-
acc[acc.length - 1].push(e);
|
|
8
|
-
} else {
|
|
9
|
-
acc.push([e]);
|
|
10
|
-
}
|
|
11
|
-
return acc;
|
|
12
|
-
}, []);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export { chunkArray as default };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
var HtmlToReactParser = require('html-to-react').Parser;
|
|
2
|
-
var htmlToReactParser = new HtmlToReactParser();
|
|
3
|
-
|
|
4
|
-
// full options list (defaults)
|
|
5
|
-
var md = require('markdown-it')({
|
|
6
|
-
html: true,
|
|
7
|
-
// Enable HTML tags in source
|
|
8
|
-
xhtmlOut: true,
|
|
9
|
-
// Use '/' to close single tags (<br />).
|
|
10
|
-
// This is only for full CommonMark compatibility.
|
|
11
|
-
breaks: true,
|
|
12
|
-
// Convert '\n' in paragraphs into <br>
|
|
13
|
-
langPrefix: 'language-',
|
|
14
|
-
// CSS language prefix for fenced blocks. Can be
|
|
15
|
-
// useful for external highlighters.
|
|
16
|
-
linkify: false,
|
|
17
|
-
// Autoconvert URL-like text to links
|
|
18
|
-
|
|
19
|
-
// Enable some language-neutral replacement + quotes beautification
|
|
20
|
-
// For the full list of replacements, see https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js
|
|
21
|
-
typographer: false,
|
|
22
|
-
// Double + single quotes replacement pairs, when typographer enabled,
|
|
23
|
-
// and smartquotes on. Could be either a String or an Array.
|
|
24
|
-
//
|
|
25
|
-
// For example, you can use '«»„“' for Russian, '„“‚‘' for German,
|
|
26
|
-
// and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
|
|
27
|
-
quotes: '“”‘’',
|
|
28
|
-
// Highlighter function. Should return escaped HTML,
|
|
29
|
-
// or '' if the source string is not changed and should be escaped externally.
|
|
30
|
-
// If result starts with <pre... internal wrapper is skipped.
|
|
31
|
-
highlight: function highlight() {
|
|
32
|
-
return '';
|
|
33
|
-
} /* str, lang */
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// eslint-disable-next-line import/prefer-default-export
|
|
37
|
-
var convert2HtmlEntities = function convert2HtmlEntities(text) {
|
|
38
|
-
if (text === undefined) return '';
|
|
39
|
-
return htmlToReactParser.parse(md.render(text));
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export { convert2HtmlEntities as default };
|