dtable-ui-component 0.3.20 → 0.3.21
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/lib/AutoNumberFormatter/index.js +2 -9
- package/lib/ButtonFormatter/index.js +4 -17
- package/lib/CTimeFormatter/index.js +2 -15
- package/lib/CheckboxEditor/index.js +0 -13
- package/lib/CheckboxFormatter/index.js +2 -11
- package/lib/CollaboratorEditor/index.js +6 -44
- package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +2 -27
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +2 -20
- package/lib/CollaboratorFormatter/index.js +6 -23
- package/lib/CollaboratorItem/index.js +2 -14
- package/lib/CreatorFormatter/index.js +6 -22
- package/lib/DTableCustomizeCollaboratorSelect/index.js +16 -37
- package/lib/DTableCustomizeCollaboratorSelect/utils.js +6 -5
- package/lib/DTableCustomizeSelect/index.js +14 -37
- package/lib/DTablePopover/index.js +8 -26
- package/lib/DTableRadio/index.js +0 -2
- package/lib/DTableSearchInput/index.js +12 -36
- package/lib/DTableSelect/index.js +13 -27
- package/lib/DTableSwitch/index.js +4 -6
- package/lib/DateEditor/index.js +8 -27
- package/lib/DateEditor/mb-date-editor-popover/index.js +8 -42
- package/lib/DateEditor/pc-date-editor-popover.js +7 -27
- package/lib/DateFormatter/index.js +3 -12
- package/lib/DigitalSignFormatter/index.js +8 -26
- package/lib/DigitalSignFormatter/utils.js +3 -6
- package/lib/DurationFormatter/index.js +3 -10
- package/lib/EditEditorButton/index.js +0 -7
- package/lib/EmailFormatter/index.js +2 -9
- package/lib/FieldDisplaySetting/field-item.js +6 -20
- package/lib/FieldDisplaySetting/index.js +8 -13
- package/lib/FileEditor/index.js +0 -8
- package/lib/FileFormatter/index.js +3 -14
- package/lib/FileItemFormatter/index.js +0 -13
- package/lib/FileItemFormatter/utils.js +0 -6
- package/lib/FileUploader/index.js +0 -16
- package/lib/FormulaFormatter/cell-value-validator.js +0 -10
- package/lib/FormulaFormatter/index.js +8 -38
- package/lib/FormulaFormatter/utils.js +0 -17
- package/lib/GeolocationFormatter/index.js +4 -13
- package/lib/HtmlLongTextFormatter/index.js +0 -21
- package/lib/HtmlLongTextFormatter/markdown2html.js +2 -17
- package/lib/HtmlLongTextFormatter/unified/index.js +29 -102
- package/lib/HtmlLongTextFormatter/vfile/core.js +13 -32
- package/lib/HtmlLongTextFormatter/vfile/index.js +4 -11
- package/lib/ImageFormatter/images-lazy-load.js +5 -35
- package/lib/ImageFormatter/index.js +7 -34
- package/lib/ImageFormatter/utils.js +0 -1
- package/lib/ImagePreviewerLightbox/index.js +11 -13
- package/lib/LastModifierFormatter/index.js +6 -22
- package/lib/LinkEditor/index.js +23 -69
- package/lib/LinkEditor/link-editor-option.js +2 -18
- package/lib/LinkEditor/mb-link-editor-popover/index.js +2 -27
- package/lib/LinkEditor/pc-link-editor-popover/index.js +2 -20
- package/lib/LinkFormatter/index.js +12 -35
- package/lib/LongTextFormatter/index.js +2 -6
- package/lib/MBEditorHeader/index.js +6 -13
- package/lib/MTimeFormatter/index.js +2 -15
- package/lib/ModalPortal/index.js +0 -8
- package/lib/MultipleSelectEditor/index.js +4 -42
- package/lib/MultipleSelectFormatter/index.js +4 -17
- package/lib/NotificationPopover/index.js +3 -22
- package/lib/NumberEditor/index.js +7 -35
- package/lib/NumberFormatter/index.js +3 -12
- package/lib/RateFormatter/index.js +10 -25
- package/lib/RowExpandEmailFormatter/index.js +2 -13
- package/lib/RowExpandFileFormatter/index.js +6 -15
- package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +6 -24
- package/lib/RowExpandFormatter/index.js +10 -60
- package/lib/RowExpandFormulaFormatter/index.js +10 -41
- package/lib/RowExpandImageFormatter/index.js +8 -27
- package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +11 -27
- package/lib/RowExpandImageFormatter/utils.js +0 -1
- package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +4 -35
- package/lib/RowExpandLinkFormatter/index.js +6 -28
- package/lib/RowExpandLinkFormatter/utils.js +0 -4
- package/lib/RowExpandLinkFormatter/value-display-utils.js +2 -2
- package/lib/RowExpandRateFormatter/index.js +8 -23
- package/lib/RowExpandUrlFormatter/index.js +2 -14
- package/lib/SelectItem/index.js +2 -13
- package/lib/SelectOptionGroup/index.js +13 -42
- package/lib/SelectOptionGroup/option.js +0 -14
- package/lib/SimpleLongTextFormatter/index.js +0 -26
- package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +2 -12
- package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +1 -16
- package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +0 -17
- package/lib/SingleSelectEditor/index.js +4 -37
- package/lib/SingleSelectFormatter/index.js +5 -17
- package/lib/TextEditor/index.js +3 -22
- package/lib/TextFormatter/index.js +2 -15
- package/lib/UrlFormatter/index.js +2 -9
- package/lib/cellFormatterFactory/index.js +0 -5
- package/lib/common/delete-tip.js +4 -16
- package/lib/common/modal-portal.js +0 -8
- package/lib/formatterConfig/base-formatter-config.js +0 -2
- package/lib/formatterConfig/index.js +0 -4
- package/lib/index.js +12 -6
- package/lib/lang/index.js +0 -7
- package/lib/select-editor/mb-select-editor-popover/index.js +6 -38
- package/lib/select-editor/pc-select-editor-popover/index.js +3 -25
- package/lib/select-editor/select-editor-option.js +2 -17
- package/lib/toaster/alert.js +0 -12
- package/lib/toaster/toast.js +1 -22
- package/lib/toaster/toastManager.js +7 -30
- package/lib/toaster/toaster.js +4 -15
- package/lib/utils/editor-utils.js +0 -20
- package/lib/utils/utils.js +2 -5
- package/package.json +5 -5
|
@@ -10,67 +10,50 @@ import TextFormatter from '../TextFormatter';
|
|
|
10
10
|
import { isArrayFormatColumn, isSimpleCellFormatter, isFunction, getFormulaArrayValue, convertValueToDtableLongTextValue } from './utils';
|
|
11
11
|
import cellValueValidator from './cell-value-validator';
|
|
12
12
|
import './index.css';
|
|
13
|
-
|
|
14
13
|
var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
|
|
15
14
|
_inherits(FormulaFormatter, _React$Component);
|
|
16
|
-
|
|
17
15
|
var _super = _createSuper(FormulaFormatter);
|
|
18
|
-
|
|
19
16
|
function FormulaFormatter() {
|
|
20
17
|
var _this;
|
|
21
|
-
|
|
22
18
|
_classCallCheck(this, FormulaFormatter);
|
|
23
|
-
|
|
24
19
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
20
|
args[_key] = arguments[_key];
|
|
26
21
|
}
|
|
27
|
-
|
|
28
22
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
29
|
-
|
|
30
23
|
_this.getGridCellClassName = function (resultType) {
|
|
31
24
|
switch (resultType) {
|
|
32
25
|
case FORMULA_RESULT_TYPE.NUMBER:
|
|
33
26
|
{
|
|
34
27
|
return 'text-right';
|
|
35
28
|
}
|
|
36
|
-
|
|
37
29
|
default:
|
|
38
30
|
{
|
|
39
31
|
return '';
|
|
40
32
|
}
|
|
41
33
|
}
|
|
42
34
|
};
|
|
43
|
-
|
|
44
35
|
_this.renderOtherColumnFormatter = function () {
|
|
45
36
|
var _this$props = _this.props,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
value = _this$props.value,
|
|
38
|
+
column = _this$props.column,
|
|
39
|
+
collaborators = _this$props.collaborators;
|
|
49
40
|
var columnData = column.data;
|
|
50
41
|
var array_type = columnData.array_type,
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
array_data = columnData.array_data;
|
|
53
43
|
if (!array_type || array_type === CellType.LINK) {
|
|
54
44
|
return null;
|
|
55
45
|
}
|
|
56
|
-
|
|
57
46
|
var Formatter = BaseFormatterConfig[array_type];
|
|
58
|
-
|
|
59
47
|
var formatterProps = _this.getFormatterProps(array_type, array_data, collaborators);
|
|
60
|
-
|
|
61
48
|
if (isArrayFormatColumn(array_type)) {
|
|
62
49
|
formatterProps.value = value;
|
|
63
50
|
return _this.createColumnFormatter(Formatter, formatterProps);
|
|
64
51
|
}
|
|
65
|
-
|
|
66
52
|
var _isSimpleCellFormatterColumn = isSimpleCellFormatter(array_type);
|
|
67
|
-
|
|
68
53
|
var cellValue = value;
|
|
69
|
-
|
|
70
54
|
if (!Array.isArray(value)) {
|
|
71
55
|
cellValue = cellValueValidator(value, array_type) ? [value] : [];
|
|
72
56
|
}
|
|
73
|
-
|
|
74
57
|
var contentItemClassName = "formula-formatter-content-item ".concat(_isSimpleCellFormatterColumn ? 'simple-cell-formatter' : '');
|
|
75
58
|
return /*#__PURE__*/React.createElement("div", {
|
|
76
59
|
className: "dtable-ui formula-formatter multiple"
|
|
@@ -82,7 +65,6 @@ var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
82
65
|
}, _this.createColumnFormatter(Formatter, formatterProps));
|
|
83
66
|
}));
|
|
84
67
|
};
|
|
85
|
-
|
|
86
68
|
_this.getFormatterProps = function (array_type, array_data, collaborators) {
|
|
87
69
|
switch (array_type) {
|
|
88
70
|
case CellType.DURATION:
|
|
@@ -92,7 +74,6 @@ var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
92
74
|
format: duration_format
|
|
93
75
|
};
|
|
94
76
|
}
|
|
95
|
-
|
|
96
77
|
case CellType.NUMBER:
|
|
97
78
|
case CellType.RATE:
|
|
98
79
|
case CellType.GEOLOCATION:
|
|
@@ -101,7 +82,6 @@ var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
101
82
|
data: array_data
|
|
102
83
|
};
|
|
103
84
|
}
|
|
104
|
-
|
|
105
85
|
default:
|
|
106
86
|
{
|
|
107
87
|
return _objectSpread(_objectSpread({}, array_data), {}, {
|
|
@@ -110,10 +90,8 @@ var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
110
90
|
}
|
|
111
91
|
}
|
|
112
92
|
};
|
|
113
|
-
|
|
114
93
|
return _this;
|
|
115
94
|
}
|
|
116
|
-
|
|
117
95
|
_createClass(FormulaFormatter, [{
|
|
118
96
|
key: "createColumnFormatter",
|
|
119
97
|
value: function createColumnFormatter(Formatter, formatterProps) {
|
|
@@ -122,39 +100,33 @@ var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
122
100
|
} else if (isFunction(Formatter)) {
|
|
123
101
|
return /*#__PURE__*/React.createElement(Formatter, formatterProps);
|
|
124
102
|
}
|
|
125
|
-
|
|
126
103
|
return /*#__PURE__*/React.createElement(TextFormatter, formatterProps);
|
|
127
104
|
}
|
|
128
105
|
}, {
|
|
129
106
|
key: "render",
|
|
130
107
|
value: function render() {
|
|
131
108
|
var _this$props2 = this.props,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
109
|
+
containerClassName = _this$props2.containerClassName,
|
|
110
|
+
column = _this$props2.column,
|
|
111
|
+
collaborators = _this$props2.collaborators;
|
|
135
112
|
var data = column.data;
|
|
136
113
|
var array_type = data.array_type,
|
|
137
|
-
|
|
114
|
+
resultType = data.result_type;
|
|
138
115
|
var value = this.props.value;
|
|
139
|
-
|
|
140
116
|
if (Array.isArray(value)) {
|
|
141
117
|
value = getFormulaArrayValue(value);
|
|
142
|
-
|
|
143
118
|
if (array_type === CellType.LONG_TEXT) {
|
|
144
119
|
value = value.map(function (item) {
|
|
145
120
|
return convertValueToDtableLongTextValue(item);
|
|
146
121
|
});
|
|
147
122
|
}
|
|
148
123
|
}
|
|
149
|
-
|
|
150
124
|
if (resultType === FORMULA_RESULT_TYPE.ARRAY) {
|
|
151
125
|
return this.renderOtherColumnFormatter();
|
|
152
126
|
}
|
|
153
|
-
|
|
154
127
|
if (typeof value === 'object') {
|
|
155
128
|
return null;
|
|
156
129
|
}
|
|
157
|
-
|
|
158
130
|
var gridCellClassName = this.getGridCellClassName(resultType);
|
|
159
131
|
var formattedValue = getFormulaDisplayString(value, data, {
|
|
160
132
|
collaborators: collaborators
|
|
@@ -166,8 +138,6 @@ var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
166
138
|
}, formattedValue);
|
|
167
139
|
}
|
|
168
140
|
}]);
|
|
169
|
-
|
|
170
141
|
return FormulaFormatter;
|
|
171
142
|
}(React.Component);
|
|
172
|
-
|
|
173
143
|
export default FormulaFormatter;
|
|
@@ -20,36 +20,28 @@ export var isValidCellValue = function isValidCellValue(value) {
|
|
|
20
20
|
};
|
|
21
21
|
export var getFormulaArrayValue = function getFormulaArrayValue(value) {
|
|
22
22
|
var isFlat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
23
|
-
|
|
24
23
|
if (!Array.isArray(value)) {
|
|
25
24
|
return [];
|
|
26
25
|
}
|
|
27
|
-
|
|
28
26
|
if (!isFlat) {
|
|
29
27
|
return getTwoDimensionArrayValue(value);
|
|
30
28
|
}
|
|
31
|
-
|
|
32
29
|
return value.map(function (item) {
|
|
33
30
|
if (Object.prototype.toString.call(item) !== '[object Object]' || !Object.prototype.hasOwnProperty.call(item, 'display_value')) {
|
|
34
31
|
return item;
|
|
35
32
|
}
|
|
36
|
-
|
|
37
33
|
var display_value = item.display_value;
|
|
38
|
-
|
|
39
34
|
if (!Array.isArray(display_value) || display_value.length === 0) {
|
|
40
35
|
return display_value;
|
|
41
36
|
}
|
|
42
|
-
|
|
43
37
|
return display_value.map(function (i) {
|
|
44
38
|
if (Object.prototype.toString.call(i) === '[object Object]') {
|
|
45
39
|
if (!Object.prototype.hasOwnProperty.call(i, 'display_value')) {
|
|
46
40
|
return i;
|
|
47
41
|
}
|
|
48
|
-
|
|
49
42
|
var _display_value = i.display_value;
|
|
50
43
|
return _display_value;
|
|
51
44
|
}
|
|
52
|
-
|
|
53
45
|
return i;
|
|
54
46
|
});
|
|
55
47
|
}).flat().filter(function (item) {
|
|
@@ -62,41 +54,32 @@ export var getTwoDimensionArrayValue = function getTwoDimensionArrayValue(value)
|
|
|
62
54
|
if (Object.prototype.toString.call(item) !== '[object Object]') {
|
|
63
55
|
return item;
|
|
64
56
|
}
|
|
65
|
-
|
|
66
57
|
if (!Object.prototype.hasOwnProperty.call(item, 'display_value')) {
|
|
67
58
|
return item;
|
|
68
59
|
}
|
|
69
|
-
|
|
70
60
|
var display_value = item.display_value;
|
|
71
|
-
|
|
72
61
|
if (!Array.isArray(display_value) || display_value.length === 0) {
|
|
73
62
|
return display_value;
|
|
74
63
|
}
|
|
75
|
-
|
|
76
64
|
return display_value.map(function (i) {
|
|
77
65
|
if (Object.prototype.toString.call(i) === '[object Object]') {
|
|
78
66
|
if (!Object.prototype.hasOwnProperty.call(i, 'display_value')) {
|
|
79
67
|
return i;
|
|
80
68
|
}
|
|
81
|
-
|
|
82
69
|
var _display_value2 = i.display_value;
|
|
83
70
|
return _display_value2;
|
|
84
71
|
}
|
|
85
|
-
|
|
86
72
|
return i;
|
|
87
73
|
});
|
|
88
74
|
});
|
|
89
75
|
};
|
|
90
76
|
export var convertValueToDtableLongTextValue = function convertValueToDtableLongTextValue(value) {
|
|
91
77
|
var valueType = Object.prototype.toString.call(value);
|
|
92
|
-
|
|
93
78
|
if (value && valueType === '[object String]') {
|
|
94
79
|
return getPreviewContent(value);
|
|
95
80
|
}
|
|
96
|
-
|
|
97
81
|
if (valueType === '[object Object]') {
|
|
98
82
|
return value;
|
|
99
83
|
}
|
|
100
|
-
|
|
101
84
|
return '';
|
|
102
85
|
};
|
|
@@ -6,32 +6,25 @@ import React from 'react';
|
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import { getGeolocationDisplayString } from 'dtable-utils';
|
|
8
8
|
import './index.css';
|
|
9
|
-
|
|
10
9
|
var GeolocationFormatter = /*#__PURE__*/function (_React$Component) {
|
|
11
10
|
_inherits(GeolocationFormatter, _React$Component);
|
|
12
|
-
|
|
13
11
|
var _super = _createSuper(GeolocationFormatter);
|
|
14
|
-
|
|
15
12
|
function GeolocationFormatter() {
|
|
16
13
|
_classCallCheck(this, GeolocationFormatter);
|
|
17
|
-
|
|
18
14
|
return _super.apply(this, arguments);
|
|
19
15
|
}
|
|
20
|
-
|
|
21
16
|
_createClass(GeolocationFormatter, [{
|
|
22
17
|
key: "render",
|
|
23
18
|
value: function render() {
|
|
24
19
|
var _this$props = this.props,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
value = _this$props.value,
|
|
21
|
+
data = _this$props.data,
|
|
22
|
+
containerClassName = _this$props.containerClassName,
|
|
23
|
+
isBaiduMap = _this$props.isBaiduMap;
|
|
29
24
|
var className = classnames('dtable-ui cell-formatter-container geolocation-formatter', containerClassName);
|
|
30
|
-
|
|
31
25
|
if (typeof value !== 'object') {
|
|
32
26
|
return null;
|
|
33
27
|
}
|
|
34
|
-
|
|
35
28
|
return /*#__PURE__*/React.createElement("div", {
|
|
36
29
|
className: className
|
|
37
30
|
}, getGeolocationDisplayString(value, data, {
|
|
@@ -40,10 +33,8 @@ var GeolocationFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
40
33
|
}));
|
|
41
34
|
}
|
|
42
35
|
}]);
|
|
43
|
-
|
|
44
36
|
return GeolocationFormatter;
|
|
45
37
|
}(React.Component);
|
|
46
|
-
|
|
47
38
|
GeolocationFormatter.defaultProps = {
|
|
48
39
|
value: {
|
|
49
40
|
province: '',
|
|
@@ -6,63 +6,45 @@ import React, { Component } from 'react';
|
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import { processor } from './markdown2html';
|
|
8
8
|
import './index.css';
|
|
9
|
-
|
|
10
9
|
var HtmlLongTextFormatter = /*#__PURE__*/function (_Component) {
|
|
11
10
|
_inherits(HtmlLongTextFormatter, _Component);
|
|
12
|
-
|
|
13
11
|
var _super = _createSuper(HtmlLongTextFormatter);
|
|
14
|
-
|
|
15
12
|
function HtmlLongTextFormatter(_props) {
|
|
16
13
|
var _this;
|
|
17
|
-
|
|
18
14
|
_classCallCheck(this, HtmlLongTextFormatter);
|
|
19
|
-
|
|
20
15
|
_this = _super.call(this, _props);
|
|
21
|
-
|
|
22
16
|
_this.translateValue = function (props) {
|
|
23
17
|
var value = props.value;
|
|
24
|
-
|
|
25
18
|
if (!value) {
|
|
26
19
|
_this.setState({
|
|
27
20
|
innerHtml: null
|
|
28
21
|
});
|
|
29
|
-
|
|
30
22
|
return;
|
|
31
23
|
}
|
|
32
|
-
|
|
33
24
|
var valueType = Object.prototype.toString.call(value);
|
|
34
|
-
|
|
35
25
|
if (valueType === '[object String]') {
|
|
36
26
|
_this.convertMarkdown(value);
|
|
37
|
-
|
|
38
27
|
return;
|
|
39
28
|
}
|
|
40
|
-
|
|
41
29
|
if (valueType === '[object Object]') {
|
|
42
30
|
_this.convertMarkdown(value.text);
|
|
43
|
-
|
|
44
31
|
return;
|
|
45
32
|
}
|
|
46
|
-
|
|
47
33
|
return;
|
|
48
34
|
};
|
|
49
|
-
|
|
50
35
|
_this.convertMarkdown = function (mdFile) {
|
|
51
36
|
processor.process(mdFile).then(function (result) {
|
|
52
37
|
var innerHtml = String(result).replace(/<a /ig, '<a target="_blank" ');
|
|
53
|
-
|
|
54
38
|
_this.setState({
|
|
55
39
|
innerHtml: innerHtml
|
|
56
40
|
});
|
|
57
41
|
});
|
|
58
42
|
};
|
|
59
|
-
|
|
60
43
|
_this.state = {
|
|
61
44
|
innerHtml: null
|
|
62
45
|
};
|
|
63
46
|
return _this;
|
|
64
47
|
}
|
|
65
|
-
|
|
66
48
|
_createClass(HtmlLongTextFormatter, [{
|
|
67
49
|
key: "componentDidMount",
|
|
68
50
|
value: function componentDidMount() {
|
|
@@ -72,7 +54,6 @@ var HtmlLongTextFormatter = /*#__PURE__*/function (_Component) {
|
|
|
72
54
|
key: "UNSAFE_componentWillReceiveProps",
|
|
73
55
|
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
74
56
|
var value = this.props.value;
|
|
75
|
-
|
|
76
57
|
if (nextProps.value !== value) {
|
|
77
58
|
this.translateValue(nextProps);
|
|
78
59
|
}
|
|
@@ -92,8 +73,6 @@ var HtmlLongTextFormatter = /*#__PURE__*/function (_Component) {
|
|
|
92
73
|
});
|
|
93
74
|
}
|
|
94
75
|
}]);
|
|
95
|
-
|
|
96
76
|
return HtmlLongTextFormatter;
|
|
97
77
|
}(Component);
|
|
98
|
-
|
|
99
78
|
export default HtmlLongTextFormatter;
|
|
@@ -1,31 +1,17 @@
|
|
|
1
1
|
var markdown = require('remark-parse');
|
|
2
|
-
|
|
3
2
|
var slug = require('remark-slug');
|
|
4
|
-
|
|
5
3
|
var breaks = require('remark-breaks');
|
|
6
|
-
|
|
7
4
|
var remark2rehype = require('remark-rehype');
|
|
8
|
-
|
|
9
5
|
var format = require('rehype-format');
|
|
10
|
-
|
|
11
6
|
var raw = require('rehype-raw');
|
|
12
|
-
|
|
13
7
|
var xtend = require('xtend');
|
|
14
|
-
|
|
15
8
|
var toHTML = require('hast-util-to-html');
|
|
16
|
-
|
|
17
9
|
var sanitize = require('hast-util-sanitize');
|
|
18
|
-
|
|
19
10
|
var gh = require('hast-util-sanitize/lib/github');
|
|
20
|
-
|
|
21
11
|
var deepmerge = require('deepmerge').default;
|
|
22
|
-
|
|
23
12
|
var mathjax = require('rehype-mathjax/browser');
|
|
24
|
-
|
|
25
13
|
var math = require('remark-math/block');
|
|
26
|
-
|
|
27
14
|
var unified = require('./unified').default;
|
|
28
|
-
|
|
29
15
|
function stringify(config) {
|
|
30
16
|
var settings = xtend(config, this.data('settings'));
|
|
31
17
|
var schema = deepmerge(gh, {
|
|
@@ -39,16 +25,15 @@ function stringify(config) {
|
|
|
39
25
|
'tagNames': ['input', 'code', 'span', 'div']
|
|
40
26
|
});
|
|
41
27
|
this.Compiler = compiler;
|
|
42
|
-
|
|
43
28
|
function compiler(tree) {
|
|
44
29
|
// use sanity to remove dangerous html, the default is
|
|
45
30
|
// GitHub style sanitation
|
|
46
31
|
var hast = sanitize(tree, schema);
|
|
47
32
|
return toHTML(hast, settings);
|
|
48
33
|
}
|
|
49
|
-
}
|
|
50
|
-
|
|
34
|
+
}
|
|
51
35
|
|
|
36
|
+
// markdown -> mdast -> html AST -> html
|
|
52
37
|
var processor = unified().use(markdown, {
|
|
53
38
|
commonmark: true
|
|
54
39
|
}).use(math).use(breaks).use(slug).use(remark2rehype, {
|