x-star-editor 0.2.1 → 0.2.2
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/dist/components/Toolbar.js +98 -15
- package/dist/locales/en_US.d.ts +2 -0
- package/dist/locales/en_US.js +2 -0
- package/dist/locales/index.d.ts +8 -0
- package/dist/locales/zh_CN.d.ts +2 -0
- package/dist/locales/zh_CN.js +2 -0
- package/dist/styles/icons/fullscreen-enter.svg +18 -0
- package/dist/styles/icons/fullscreen-exit.svg +18 -0
- package/dist/styles/icons/ordered-list.svg +18 -0
- package/dist/styles/icons/table.svg +18 -0
- package/dist/styles/icons/to-html.svg +18 -0
- package/dist/styles/icons/to-markdown.svg +18 -0
- package/dist/styles/icons/unordered-list.svg +18 -0
- package/dist/styles/index.css +21 -0
- package/dist/utils/markdown.js +1 -1
- package/dist/x-star-editor/index.d.ts +3 -2
- package/dist/x-star-editor/index.js +12 -6
- package/dist/x-star-md-viewer/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -3,8 +3,10 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import React, { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { getFormat } from "../locales";
|
|
6
|
+
import { createSelection } from "../utils/container";
|
|
6
7
|
import { prefix } from "../utils/global";
|
|
7
8
|
import { redoHandler, toggleHandler, undoHandler } from "../utils/handler";
|
|
9
|
+
import { toHTML, toMarkdown } from "../utils/markdown";
|
|
8
10
|
import Fade from "./Fade";
|
|
9
11
|
import FileInput from "./FileInput";
|
|
10
12
|
var Button = function Button(_ref) {
|
|
@@ -145,6 +147,17 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
|
|
|
145
147
|
}));
|
|
146
148
|
}
|
|
147
149
|
},
|
|
150
|
+
// fullscreen: {
|
|
151
|
+
// children: (
|
|
152
|
+
// <div
|
|
153
|
+
// className={classNames(
|
|
154
|
+
// `${prefix}icon`,
|
|
155
|
+
// `${iconPrefix}fullscreen-enter`,
|
|
156
|
+
// )}
|
|
157
|
+
// />
|
|
158
|
+
// ),
|
|
159
|
+
// },
|
|
160
|
+
|
|
148
161
|
heading: {
|
|
149
162
|
children: /*#__PURE__*/React.createElement("div", {
|
|
150
163
|
className: classNames("".concat(prefix, "icon"), "".concat(iconPrefix, "heading"))
|
|
@@ -254,6 +267,14 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
|
|
|
254
267
|
}));
|
|
255
268
|
}
|
|
256
269
|
},
|
|
270
|
+
// orderedList: {
|
|
271
|
+
// children: (
|
|
272
|
+
// <div
|
|
273
|
+
// className={classNames(`${prefix}icon`, `${iconPrefix}ordered-list`)}
|
|
274
|
+
// />
|
|
275
|
+
// ),
|
|
276
|
+
// },
|
|
277
|
+
|
|
257
278
|
redo: function redo(_ref2) {
|
|
258
279
|
var history = _ref2.history;
|
|
259
280
|
return {
|
|
@@ -278,6 +299,12 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
|
|
|
278
299
|
}));
|
|
279
300
|
}
|
|
280
301
|
},
|
|
302
|
+
// table: {
|
|
303
|
+
// children: (
|
|
304
|
+
// <div className={classNames(`${prefix}icon`, `${iconPrefix}table`)} />
|
|
305
|
+
// ),
|
|
306
|
+
// },
|
|
307
|
+
|
|
281
308
|
thematicBreak: {
|
|
282
309
|
children: /*#__PURE__*/React.createElement("div", {
|
|
283
310
|
className: classNames("".concat(prefix, "icon"), "".concat(iconPrefix, "thematic-break"))
|
|
@@ -289,8 +316,50 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
|
|
|
289
316
|
}));
|
|
290
317
|
}
|
|
291
318
|
},
|
|
292
|
-
|
|
293
|
-
|
|
319
|
+
toHTML: {
|
|
320
|
+
children: /*#__PURE__*/React.createElement("div", {
|
|
321
|
+
className: classNames("".concat(prefix, "icon"), "".concat(iconPrefix, "to-html"))
|
|
322
|
+
}),
|
|
323
|
+
tooltip: t('toHTML'),
|
|
324
|
+
onClick: function onClick(exec) {
|
|
325
|
+
return exec(function (_ref3) {
|
|
326
|
+
var sourceCode = _ref3.sourceCode,
|
|
327
|
+
selection = _ref3.selection,
|
|
328
|
+
dispatch = _ref3.dispatch;
|
|
329
|
+
return dispatch({
|
|
330
|
+
type: 'set',
|
|
331
|
+
payload: {
|
|
332
|
+
sourceCode: toHTML(sourceCode),
|
|
333
|
+
selection: createSelection(0)
|
|
334
|
+
},
|
|
335
|
+
selection: selection
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
toMarkdown: {
|
|
341
|
+
children: /*#__PURE__*/React.createElement("div", {
|
|
342
|
+
className: classNames("".concat(prefix, "icon"), "".concat(iconPrefix, "to-markdown"))
|
|
343
|
+
}),
|
|
344
|
+
tooltip: t('toMarkdown'),
|
|
345
|
+
onClick: function onClick(exec) {
|
|
346
|
+
return exec(function (_ref4) {
|
|
347
|
+
var sourceCode = _ref4.sourceCode,
|
|
348
|
+
selection = _ref4.selection,
|
|
349
|
+
dispatch = _ref4.dispatch;
|
|
350
|
+
return dispatch({
|
|
351
|
+
type: 'set',
|
|
352
|
+
payload: {
|
|
353
|
+
sourceCode: toMarkdown(sourceCode),
|
|
354
|
+
selection: createSelection(0)
|
|
355
|
+
},
|
|
356
|
+
selection: selection
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
undo: function undo(_ref5) {
|
|
362
|
+
var history = _ref5.history;
|
|
294
363
|
return {
|
|
295
364
|
children: /*#__PURE__*/React.createElement("div", {
|
|
296
365
|
className: classNames("".concat(prefix, "icon"), "".concat(iconPrefix, "undo"))
|
|
@@ -302,17 +371,31 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
|
|
|
302
371
|
}
|
|
303
372
|
};
|
|
304
373
|
}
|
|
374
|
+
|
|
375
|
+
// unorderedList: {
|
|
376
|
+
// children: (
|
|
377
|
+
// <div
|
|
378
|
+
// className={classNames(`${prefix}icon`, `${iconPrefix}unordered-list`)}
|
|
379
|
+
// />
|
|
380
|
+
// ),
|
|
381
|
+
// },
|
|
305
382
|
};
|
|
306
383
|
};
|
|
384
|
+
|
|
307
385
|
export var getDefaultToolbarItems = function getDefaultToolbarItems() {
|
|
308
|
-
return [['heading', 'strong', 'emphasis', 'delete'], ['thematicBreak', 'blockquote'],
|
|
386
|
+
return [['heading', 'strong', 'emphasis', 'delete'], ['thematicBreak', 'blockquote'],
|
|
387
|
+
// ['table', 'orderedList', 'unorderedList'],
|
|
388
|
+
['link', 'image'], ['inlineCode', 'code', 'inlineMath', 'math'], ['toMarkdown', 'toHTML'], ['undo', 'redo']
|
|
389
|
+
// ['fullscreen'],
|
|
390
|
+
];
|
|
309
391
|
};
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
392
|
+
|
|
393
|
+
var Toolbar = function Toolbar(_ref6) {
|
|
394
|
+
var className = _ref6.className,
|
|
395
|
+
style = _ref6.style,
|
|
396
|
+
itemMap = _ref6.itemMap,
|
|
397
|
+
items = _ref6.items,
|
|
398
|
+
exec = _ref6.exec;
|
|
316
399
|
var toolbarRef = useRef(null);
|
|
317
400
|
var ctx = exec(function (ctx) {
|
|
318
401
|
return ctx;
|
|
@@ -331,12 +414,12 @@ var Toolbar = function Toolbar(_ref4) {
|
|
|
331
414
|
if (!toolbarItem) {
|
|
332
415
|
return undefined;
|
|
333
416
|
}
|
|
334
|
-
var
|
|
335
|
-
children =
|
|
336
|
-
disabled =
|
|
337
|
-
tooltip =
|
|
338
|
-
_popoverRender =
|
|
339
|
-
_onClick2 =
|
|
417
|
+
var _ref7 = typeof toolbarItem === 'function' ? toolbarItem(ctx) : toolbarItem,
|
|
418
|
+
children = _ref7.children,
|
|
419
|
+
disabled = _ref7.disabled,
|
|
420
|
+
tooltip = _ref7.tooltip,
|
|
421
|
+
_popoverRender = _ref7.popoverRender,
|
|
422
|
+
_onClick2 = _ref7.onClick;
|
|
340
423
|
return /*#__PURE__*/React.createElement(Button, {
|
|
341
424
|
key: index,
|
|
342
425
|
toolbarRef: toolbarRef,
|
package/dist/locales/en_US.d.ts
CHANGED
package/dist/locales/en_US.js
CHANGED
package/dist/locales/index.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export declare const useLocale: <T extends "fileInput" | "toolbarItem">(slice: T
|
|
|
32
32
|
readonly redo: "恢复";
|
|
33
33
|
readonly strong: "粗体";
|
|
34
34
|
readonly thematicBreak: "分隔线";
|
|
35
|
+
readonly toHTML: "转成 HTML";
|
|
36
|
+
readonly toMarkdown: "转成 Markdown";
|
|
35
37
|
readonly undo: "撤销";
|
|
36
38
|
};
|
|
37
39
|
} | {
|
|
@@ -57,6 +59,8 @@ export declare const useLocale: <T extends "fileInput" | "toolbarItem">(slice: T
|
|
|
57
59
|
readonly redo: "Redo";
|
|
58
60
|
readonly strong: "Bold";
|
|
59
61
|
readonly thematicBreak: "Thematic Break";
|
|
62
|
+
readonly toHTML: "To HTML";
|
|
63
|
+
readonly toMarkdown: "To Markdown";
|
|
60
64
|
readonly undo: "Undo";
|
|
61
65
|
};
|
|
62
66
|
})[T][U];
|
|
@@ -84,6 +88,8 @@ export declare const getFormat: <T extends "fileInput" | "toolbarItem">(locale:
|
|
|
84
88
|
readonly redo: "恢复";
|
|
85
89
|
readonly strong: "粗体";
|
|
86
90
|
readonly thematicBreak: "分隔线";
|
|
91
|
+
readonly toHTML: "转成 HTML";
|
|
92
|
+
readonly toMarkdown: "转成 Markdown";
|
|
87
93
|
readonly undo: "撤销";
|
|
88
94
|
};
|
|
89
95
|
} | {
|
|
@@ -109,6 +115,8 @@ export declare const getFormat: <T extends "fileInput" | "toolbarItem">(locale:
|
|
|
109
115
|
readonly redo: "Redo";
|
|
110
116
|
readonly strong: "Bold";
|
|
111
117
|
readonly thematicBreak: "Thematic Break";
|
|
118
|
+
readonly toHTML: "To HTML";
|
|
119
|
+
readonly toMarkdown: "To Markdown";
|
|
112
120
|
readonly undo: "Undo";
|
|
113
121
|
};
|
|
114
122
|
})[T][U];
|
package/dist/locales/zh_CN.d.ts
CHANGED
package/dist/locales/zh_CN.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>icon-全屏(进入)@1x</title>
|
|
4
|
+
<g id="markdown编辑器" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
|
+
<g id="mark-down编辑器" transform="translate(-888.000000, -90.000000)" fill="#333333" fill-rule="nonzero">
|
|
6
|
+
<g id="方案一" transform="translate(274.000000, 82.000000)">
|
|
7
|
+
<g id="icon" transform="translate(16.000000, 8.000000)">
|
|
8
|
+
<g id="icon-全屏(进入)" transform="translate(598.000000, 0.000000)">
|
|
9
|
+
<g id="expend-outlined" transform="translate(5.000000, 5.000000)">
|
|
10
|
+
<rect id="矩形" opacity="0" x="0" y="0" width="14" height="14"></rect>
|
|
11
|
+
<path d="M4.79481132,1.5 L1.91509434,1.5 C1.68549528,1.5 1.5,1.68549528 1.5,1.91509434 L1.5,4.82075472 C1.5,4.93490566 1.59339623,5.02830189 1.70754717,5.02830189 L2.33018868,5.02830189 C2.44433962,5.02830189 2.53773585,4.93490566 2.53773585,4.82075472 L2.53773585,2.53773585 L4.79481132,2.53773585 C4.90896226,2.53773585 5.00235849,2.44433962 5.00235849,2.33018868 L5.00235849,1.70754717 C5.00235849,1.59339623 4.90896226,1.5 4.79481132,1.5 Z M12.2924528,8.97169811 L11.6698113,8.97169811 C11.5556604,8.97169811 11.4622642,9.06509434 11.4622642,9.17924528 L11.4622642,11.4622642 L9.20518868,11.4622642 C9.09103774,11.4622642 8.99764151,11.5556604 8.99764151,11.6698113 L8.99764151,12.2924528 C8.99764151,12.4066038 9.09103774,12.5 9.20518868,12.5 L12.0849057,12.5 C12.3145047,12.5 12.5,12.3145047 12.5,12.0849057 L12.5,9.17924528 C12.5,9.06509434 12.4066038,8.97169811 12.2924528,8.97169811 Z M4.79481132,11.4622642 L2.53773585,11.4622642 L2.53773585,9.17924528 C2.53773585,9.06509434 2.44433962,8.97169811 2.33018868,8.97169811 L1.70754717,8.97169811 C1.59339623,8.97169811 1.5,9.06509434 1.5,9.17924528 L1.5,12.0849057 C1.5,12.3145047 1.68549528,12.5 1.91509434,12.5 L4.79481132,12.5 C4.90896226,12.5 5.00235849,12.4066038 5.00235849,12.2924528 L5.00235849,11.6698113 C5.00235849,11.5556604 4.90896226,11.4622642 4.79481132,11.4622642 Z M12.0849057,1.5 L9.20518868,1.5 C9.09103774,1.5 8.99764151,1.59339623 8.99764151,1.70754717 L8.99764151,2.33018868 C8.99764151,2.44433962 9.09103774,2.53773585 9.20518868,2.53773585 L11.4622642,2.53773585 L11.4622642,4.82075472 C11.4622642,4.93490566 11.5556604,5.02830189 11.6698113,5.02830189 L12.2924528,5.02830189 C12.4066038,5.02830189 12.5,4.93490566 12.5,4.82075472 L12.5,1.91509434 C12.5,1.68549528 12.3145047,1.5 12.0849057,1.5 Z" id="形状"></path>
|
|
12
|
+
</g>
|
|
13
|
+
</g>
|
|
14
|
+
</g>
|
|
15
|
+
</g>
|
|
16
|
+
</g>
|
|
17
|
+
</g>
|
|
18
|
+
</svg>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>icon-全屏(退出)@1x</title>
|
|
4
|
+
<g id="markdown编辑器" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
|
+
<g id="mark-down编辑器" transform="translate(-889.000000, -493.000000)" fill="#333333" fill-rule="nonzero">
|
|
6
|
+
<g id="方案二" transform="translate(274.000000, 485.000000)">
|
|
7
|
+
<g id="icon" transform="translate(16.000000, 8.000000)">
|
|
8
|
+
<g id="icon-全屏(退出)" transform="translate(599.000000, 0.000000)">
|
|
9
|
+
<g id="compress-outlined" transform="translate(5.000000, 5.000000)">
|
|
10
|
+
<rect id="矩形" opacity="0" x="0" y="0" width="14" height="14"></rect>
|
|
11
|
+
<path d="M4.58726415,8.97169811 L1.70754717,8.97169811 C1.59339623,8.97169811 1.5,9.06509434 1.5,9.17924528 L1.5,9.80188679 C1.5,9.91603774 1.59339623,10.009434 1.70754717,10.009434 L3.96462264,10.009434 L3.96462264,12.2924528 C3.96462264,12.4066038 4.05801887,12.5 4.17216981,12.5 L4.79481132,12.5 C4.90896226,12.5 5.00235849,12.4066038 5.00235849,12.2924528 L5.00235849,9.38679245 C5.00235849,9.1571934 4.81686321,8.97169811 4.58726415,8.97169811 Z M4.79481132,1.5 L4.17216981,1.5 C4.05801887,1.5 3.96462264,1.59339623 3.96462264,1.70754717 L3.96462264,3.99056604 L1.70754717,3.99056604 C1.59339623,3.99056604 1.5,4.08396226 1.5,4.19811321 L1.5,4.82075472 C1.5,4.93490566 1.59339623,5.02830189 1.70754717,5.02830189 L4.58726415,5.02830189 C4.81686321,5.02830189 5.00235849,4.8428066 5.00235849,4.61320755 L5.00235849,1.70754717 C5.00235849,1.59339623 4.90896226,1.5 4.79481132,1.5 Z M12.2924528,8.97169811 L9.41273585,8.97169811 C9.18313679,8.97169811 8.99764151,9.1571934 8.99764151,9.38679245 L8.99764151,12.2924528 C8.99764151,12.4066038 9.09103774,12.5 9.20518868,12.5 L9.82783019,12.5 C9.94198113,12.5 10.0353774,12.4066038 10.0353774,12.2924528 L10.0353774,10.009434 L12.2924528,10.009434 C12.4066038,10.009434 12.5,9.91603774 12.5,9.80188679 L12.5,9.17924528 C12.5,9.06509434 12.4066038,8.97169811 12.2924528,8.97169811 Z M12.2924528,3.99056604 L10.0353774,3.99056604 L10.0353774,1.70754717 C10.0353774,1.59339623 9.94198113,1.5 9.82783019,1.5 L9.20518868,1.5 C9.09103774,1.5 8.99764151,1.59339623 8.99764151,1.70754717 L8.99764151,4.61320755 C8.99764151,4.8428066 9.18313679,5.02830189 9.41273585,5.02830189 L12.2924528,5.02830189 C12.4066038,5.02830189 12.5,4.93490566 12.5,4.82075472 L12.5,4.19811321 C12.5,4.08396226 12.4066038,3.99056604 12.2924528,3.99056604 Z" id="形状"></path>
|
|
12
|
+
</g>
|
|
13
|
+
</g>
|
|
14
|
+
</g>
|
|
15
|
+
</g>
|
|
16
|
+
</g>
|
|
17
|
+
</g>
|
|
18
|
+
</svg>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>icon-有序列表@1x</title>
|
|
4
|
+
<g id="markdown编辑器" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
|
+
<g id="mark-down编辑器" transform="translate(-816.000000, -493.000000)" fill="#333333" fill-rule="nonzero">
|
|
6
|
+
<g id="方案二" transform="translate(274.000000, 485.000000)">
|
|
7
|
+
<g id="icon" transform="translate(16.000000, 8.000000)">
|
|
8
|
+
<g id="icon-有序列表" transform="translate(526.000000, 0.000000)">
|
|
9
|
+
<g id="orderedlist-outlined" transform="translate(5.000000, 5.000000)">
|
|
10
|
+
<rect id="矩形" opacity="0" x="0" y="0" width="14" height="14"></rect>
|
|
11
|
+
<path d="M12.578125,10.390625 L4.59375,10.390625 C4.53359375,10.390625 4.484375,10.4398437 4.484375,10.5 L4.484375,11.265625 C4.484375,11.3257813 4.53359375,11.375 4.59375,11.375 L12.578125,11.375 C12.6382813,11.375 12.6875,11.3257813 12.6875,11.265625 L12.6875,10.5 C12.6875,10.4398437 12.6382813,10.390625 12.578125,10.390625 Z M12.578125,2.625 L4.59375,2.625 C4.53359375,2.625 4.484375,2.67421875 4.484375,2.734375 L4.484375,3.5 C4.484375,3.56015625 4.53359375,3.609375 4.59375,3.609375 L12.578125,3.609375 C12.6382813,3.609375 12.6875,3.56015625 12.6875,3.5 L12.6875,2.734375 C12.6875,2.67421875 12.6382813,2.625 12.578125,2.625 Z M12.578125,6.5078125 L4.59375,6.5078125 C4.53359375,6.5078125 4.484375,6.55703125 4.484375,6.6171875 L4.484375,7.3828125 C4.484375,7.44296875 4.53359375,7.4921875 4.59375,7.4921875 L12.578125,7.4921875 C12.6382813,7.4921875 12.6875,7.44296875 12.6875,7.3828125 L12.6875,6.6171875 C12.6875,6.55703125 12.6382813,6.5078125 12.578125,6.5078125 Z M2.953125,9.734375 L1.3671875,9.734375 C1.33710938,9.734375 1.3125,9.75898437 1.3125,9.7890625 L1.3125,10.2539062 C1.3125,10.2839844 1.33710938,10.3085938 1.3671875,10.3085938 L2.35703125,10.3085938 L2.35703125,10.5888672 L1.86894531,10.5888672 C1.83886719,10.5888672 1.81425781,10.6134766 1.81425781,10.6435547 L1.81425781,11.1083984 C1.81425781,11.1384766 1.83886719,11.1630859 1.86894531,11.1630859 L2.35703125,11.1630859 L2.35703125,11.4570312 L1.3671875,11.4570312 C1.33710938,11.4570312 1.3125,11.4816406 1.3125,11.5117188 L1.3125,11.9765625 C1.3125,12.0066406 1.33710938,12.03125 1.3671875,12.03125 L2.953125,12.03125 C2.98320312,12.03125 3.0078125,12.0066406 3.0078125,11.9765625 L3.0078125,9.7890625 C3.0078125,9.75898437 2.98320312,9.734375 2.953125,9.734375 Z M1.3671875,2.5703125 L1.88671875,2.5703125 L1.88671875,4.2109375 C1.88671875,4.24101562 1.91132813,4.265625 1.94140625,4.265625 L2.48828125,4.265625 C2.51835937,4.265625 2.54296875,4.24101562 2.54296875,4.2109375 L2.54296875,2.078125 C2.54296875,2.01796875 2.49375,1.96875 2.43359375,1.96875 L1.3671875,1.96875 C1.33710938,1.96875 1.3125,1.99335938 1.3125,2.0234375 L1.3125,2.515625 C1.3125,2.54570312 1.33710938,2.5703125 1.3671875,2.5703125 Z M2.953125,5.8515625 L1.3671875,5.8515625 C1.33710938,5.8515625 1.3125,5.87617188 1.3125,5.90625 L1.3125,6.3984375 C1.3125,6.42851563 1.33710938,6.453125 1.3671875,6.453125 L2.30234375,6.453125 L1.34121094,7.51542969 C1.3234375,7.5359375 1.3125,7.56191406 1.3125,7.58925781 L1.3125,8.09375 C1.3125,8.12382813 1.33710938,8.1484375 1.3671875,8.1484375 L2.953125,8.1484375 C2.98320312,8.1484375 3.0078125,8.12382813 3.0078125,8.09375 L3.0078125,7.6015625 C3.0078125,7.57148437 2.98320312,7.546875 2.953125,7.546875 L2.01796875,7.546875 L2.97910156,6.48457031 C2.996875,6.4640625 3.0078125,6.43808594 3.0078125,6.41074219 L3.0078125,5.90625 C3.0078125,5.87617188 2.98320312,5.8515625 2.953125,5.8515625 L2.953125,5.8515625 Z" id="形状"></path>
|
|
12
|
+
</g>
|
|
13
|
+
</g>
|
|
14
|
+
</g>
|
|
15
|
+
</g>
|
|
16
|
+
</g>
|
|
17
|
+
</g>
|
|
18
|
+
</svg>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>icon-表格@1x</title>
|
|
4
|
+
<g id="markdown编辑器" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
|
+
<g id="mark-down编辑器" transform="translate(-784.000000, -493.000000)" fill="#333333" fill-rule="nonzero">
|
|
6
|
+
<g id="方案二" transform="translate(274.000000, 485.000000)">
|
|
7
|
+
<g id="icon" transform="translate(16.000000, 8.000000)">
|
|
8
|
+
<g id="icon-表格" transform="translate(494.000000, 0.000000)">
|
|
9
|
+
<g id="insertrowabove-outlined" transform="translate(5.000000, 5.000000)">
|
|
10
|
+
<rect id="矩形" opacity="0" x="0" y="0" width="14" height="14"></rect>
|
|
11
|
+
<path d="M12.0134766,4.59375 L1.98652344,4.59375 C1.73496094,4.59375 1.53125,4.78925781 1.53125,5.03125 L1.53125,11.375 C1.53125,11.6169922 1.73496094,11.8125 1.98652344,11.8125 L12.0121094,11.8125 C12.2636719,11.8125 12.4673897,11.6169922 12.4673897,11.375 L12.4673897,5.03125 C12.46875,4.78925781 12.2650391,4.59375 12.0134766,4.59375 L12.0134766,4.59375 Z M4.921875,10.828125 L2.515625,10.828125 L2.515625,8.640625 L4.921875,8.640625 L4.921875,10.828125 Z M4.921875,7.765625 L2.515625,7.765625 L2.515625,5.578125 L4.921875,5.578125 L4.921875,7.765625 Z M8.203125,10.828125 L5.796875,10.828125 L5.796875,8.640625 L8.203125,8.640625 L8.203125,10.828125 Z M8.203125,7.765625 L5.796875,7.765625 L5.796875,5.578125 L8.203125,5.578125 L8.203125,7.765625 Z M11.484375,10.828125 L9.078125,10.828125 L9.078125,8.640625 L11.484375,8.640625 L11.484375,10.828125 Z M11.484375,7.765625 L9.078125,7.765625 L9.078125,5.578125 L11.484375,5.578125 L11.484375,7.765625 Z M12.359375,2.1875 L1.640625,2.1875 C1.58046875,2.1875 1.53125,2.23671875 1.53125,2.296875 L1.53125,3.390625 C1.53125,3.45078125 1.58046875,3.5 1.640625,3.5 L12.359375,3.5 C12.4195312,3.5 12.46875,3.45078125 12.46875,3.390625 L12.46875,2.296875 C12.46875,2.23671875 12.4195312,2.1875 12.359375,2.1875 Z" id="形状"></path>
|
|
12
|
+
</g>
|
|
13
|
+
</g>
|
|
14
|
+
</g>
|
|
15
|
+
</g>
|
|
16
|
+
</g>
|
|
17
|
+
</g>
|
|
18
|
+
</svg>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>icon-HTML@1x</title>
|
|
4
|
+
<g id="markdown编辑器" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
|
+
<g id="mark-down编辑器" transform="translate(-993.000000, -90.000000)" fill="#333333" fill-rule="nonzero">
|
|
6
|
+
<g id="方案一" transform="translate(274.000000, 82.000000)">
|
|
7
|
+
<g id="icon" transform="translate(16.000000, 8.000000)">
|
|
8
|
+
<g id="icon-HTML" transform="translate(703.000000, 0.000000)">
|
|
9
|
+
<g id="file-markdown-outlined" transform="translate(5.000000, 5.000000)">
|
|
10
|
+
<rect id="矩形" opacity="0" x="0" y="0" width="14" height="14"></rect>
|
|
11
|
+
<path d="M11.6839844,3.94570313 L8.74179687,1.00351563 C8.65976562,0.921484375 8.54902344,0.875 8.4328125,0.875 L2.625,0.875 C2.38300781,0.875 2.1875,1.07050781 2.1875,1.3125 L2.1875,12.6875 C2.1875,12.9294922 2.38300781,13.125 2.625,13.125 L11.375,13.125 C11.6169922,13.125 11.8125,12.9294922 11.8125,12.6875 L11.8125,4.25605469 C11.8125,4.13984375 11.7660156,4.02773437 11.6839844,3.94570313 Z M10.8035156,4.45703125 L8.23046875,4.45703125 L8.23046875,1.88398438 L10.8035156,4.45703125 Z M7.30078125,1.859375 L7.30078125,4.8125 C7.30078125,5.1296875 7.5578125,5.38671875 7.875,5.38671875 L10.828125,5.38671875 L10.828125,12.140625 L3.171875,12.140625 L3.171875,1.859375 L7.30078125,1.859375 Z M5.99,6.5 L5.69,6.5 C5.57954305,6.5 5.49,6.58954305 5.49,6.7 L5.49,10.3 C5.49,10.4104569 5.57954305,10.5 5.69,10.5 L5.99,10.5 C6.10045695,10.5 6.19,10.4104569 6.19,10.3 L6.1895,8.848 L6.2,8.85 L7.8,8.85 C7.83643545,8.85 7.8705953,8.84025697 7.90001632,8.82323412 L7.9,10.3 C7.9,10.4104569 7.98954305,10.5 8.1,10.5 L8.4,10.5 C8.51045695,10.5 8.6,10.4104569 8.6,10.3 L8.6,6.7 C8.6,6.58954305 8.51045695,6.5 8.4,6.5 L8.1,6.5 C7.98954305,6.5 7.9,6.58954305 7.9,6.7 L7.90001632,8.17676588 C7.8705953,8.15974303 7.83643545,8.15 7.8,8.15 L6.2,8.15 C6.19652651,8.15 6.19307371,8.15008855 6.18964371,8.15026351 L6.19,6.7 C6.19,6.58954305 6.10045695,6.5 5.99,6.5 Z" id="形状"></path>
|
|
12
|
+
</g>
|
|
13
|
+
</g>
|
|
14
|
+
</g>
|
|
15
|
+
</g>
|
|
16
|
+
</g>
|
|
17
|
+
</g>
|
|
18
|
+
</svg>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>icon-Markdown@1x</title>
|
|
4
|
+
<g id="markdown编辑器" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
|
+
<g id="mark-down编辑器" transform="translate(-961.000000, -90.000000)" fill="#333333" fill-rule="nonzero">
|
|
6
|
+
<g id="方案一" transform="translate(274.000000, 82.000000)">
|
|
7
|
+
<g id="icon" transform="translate(16.000000, 8.000000)">
|
|
8
|
+
<g id="icon-Markdown" transform="translate(671.000000, 0.000000)">
|
|
9
|
+
<g id="file-markdown-outlined" transform="translate(5.000000, 5.000000)">
|
|
10
|
+
<rect id="矩形" opacity="0" x="0" y="0" width="14" height="14"></rect>
|
|
11
|
+
<path d="M11.6839844,3.94570313 L8.74179687,1.00351563 C8.65976562,0.921484375 8.54902344,0.875 8.4328125,0.875 L2.625,0.875 C2.38300781,0.875 2.1875,1.07050781 2.1875,1.3125 L2.1875,12.6875 C2.1875,12.9294922 2.38300781,13.125 2.625,13.125 L11.375,13.125 C11.6169922,13.125 11.8125,12.9294922 11.8125,12.6875 L11.8125,4.25605469 C11.8125,4.13984375 11.7660156,4.02773437 11.6839844,3.94570313 Z M10.8035156,4.45703125 L8.23046875,4.45703125 L8.23046875,1.88398438 L10.8035156,4.45703125 Z M10.828125,12.140625 L3.171875,12.140625 L3.171875,1.859375 L7.30078125,1.859375 L7.30078125,4.8125 C7.30078125,5.1296875 7.5578125,5.38671875 7.875,5.38671875 L10.828125,5.38671875 L10.828125,12.140625 Z M5.86523438,6.57890625 C5.83925781,6.51875 5.78046875,6.48046875 5.71484375,6.48046875 L5.23632812,6.48046875 C5.14609375,6.48046875 5.07226562,6.55429687 5.07226562,6.64453125 L5.07226562,10.3632812 C5.07226562,10.4535156 5.14609375,10.5273438 5.23632812,10.5273438 L5.60683594,10.5273438 C5.69707031,10.5273438 5.77089844,10.4535156 5.77089844,10.3632812 L5.77089844,7.95839844 L6.68417969,10.0119141 C6.71015625,10.0707031 6.76894531,10.1089844 6.83457031,10.1089844 L7.1640625,10.1089844 C7.22832031,10.1089844 7.28710938,10.0707031 7.31445312,10.0119141 L8.22773437,7.95292969 L8.22773437,10.3632812 C8.22773437,10.4535156 8.3015625,10.5273438 8.39179687,10.5273438 L8.76367188,10.5273438 C8.85390625,10.5273438 8.92773438,10.4535156 8.92773438,10.3632812 L8.92773438,6.64453125 C8.92773438,6.55429687 8.85390625,6.48046875 8.76367188,6.48046875 L8.28925781,6.48046875 C8.22363281,6.48046875 8.16484375,6.51875 8.13886719,6.57890625 L7.00273437,9.19023438 L5.86523437,6.57890625 L5.86523438,6.57890625 Z" id="形状"></path>
|
|
12
|
+
</g>
|
|
13
|
+
</g>
|
|
14
|
+
</g>
|
|
15
|
+
</g>
|
|
16
|
+
</g>
|
|
17
|
+
</g>
|
|
18
|
+
</svg>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>icon-无序列表@1x</title>
|
|
4
|
+
<g id="markdown编辑器" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
|
+
<g id="mark-down编辑器" transform="translate(-848.000000, -493.000000)" fill="#333333" fill-rule="nonzero">
|
|
6
|
+
<g id="方案二" transform="translate(274.000000, 485.000000)">
|
|
7
|
+
<g id="icon" transform="translate(16.000000, 8.000000)">
|
|
8
|
+
<g id="icon-无序列表" transform="translate(558.000000, 0.000000)">
|
|
9
|
+
<g id="unorderedlist-outlined" transform="translate(5.000000, 5.000000)">
|
|
10
|
+
<rect id="矩形" opacity="0" x="0" y="0" width="14" height="14"></rect>
|
|
11
|
+
<path d="M12.46875,2.625 L4.484375,2.625 C4.42421875,2.625 4.375,2.67421875 4.375,2.734375 L4.375,3.5 C4.375,3.56015625 4.42421875,3.609375 4.484375,3.609375 L12.46875,3.609375 C12.5289062,3.609375 12.578125,3.56015625 12.578125,3.5 L12.578125,2.734375 C12.578125,2.67421875 12.5289062,2.625 12.46875,2.625 Z M12.46875,6.5078125 L4.484375,6.5078125 C4.42421875,6.5078125 4.375,6.55703125 4.375,6.6171875 L4.375,7.3828125 C4.375,7.44296875 4.42421875,7.4921875 4.484375,7.4921875 L12.46875,7.4921875 C12.5289062,7.4921875 12.578125,7.44296875 12.578125,7.3828125 L12.578125,6.6171875 C12.578125,6.55703125 12.5289062,6.5078125 12.46875,6.5078125 Z M12.46875,10.390625 L4.484375,10.390625 C4.42421875,10.390625 4.375,10.4398437 4.375,10.5 L4.375,11.265625 C4.375,11.3257813 4.42421875,11.375 4.484375,11.375 L12.46875,11.375 C12.5289062,11.375 12.578125,11.3257813 12.578125,11.265625 L12.578125,10.5 C12.578125,10.4398437 12.5289062,10.390625 12.46875,10.390625 Z M1.421875,3.1171875 C1.421875,3.39071897 1.5678023,3.64347247 1.8046875,3.78023821 C2.0415727,3.91700395 2.3334273,3.91700395 2.5703125,3.78023821 C2.8071977,3.64347247 2.953125,3.39071897 2.953125,3.1171875 C2.953125,2.84365603 2.8071977,2.59090253 2.5703125,2.45413679 C2.3334273,2.31737105 2.0415727,2.31737105 1.8046875,2.45413679 C1.5678023,2.59090253 1.421875,2.84365603 1.421875,3.1171875 L1.421875,3.1171875 Z M1.421875,7 C1.421875,7.27353147 1.5678023,7.52628497 1.8046875,7.66305071 C2.0415727,7.79981645 2.3334273,7.79981645 2.5703125,7.66305071 C2.8071977,7.52628497 2.953125,7.27353147 2.953125,7 C2.953125,6.72646853 2.8071977,6.47371503 2.5703125,6.33694929 C2.3334273,6.20018355 2.0415727,6.20018355 1.8046875,6.33694929 C1.5678023,6.47371503 1.421875,6.72646853 1.421875,7 L1.421875,7 Z M1.421875,10.8828125 C1.421875,11.156344 1.5678023,11.4090975 1.8046875,11.5458632 C2.0415727,11.6826289 2.3334273,11.6826289 2.5703125,11.5458632 C2.8071977,11.4090975 2.953125,11.156344 2.953125,10.8828125 C2.953125,10.609281 2.8071977,10.3565275 2.5703125,10.2197618 C2.3334273,10.0829961 2.0415727,10.0829961 1.8046875,10.2197618 C1.5678023,10.3565275 1.421875,10.609281 1.421875,10.8828125 L1.421875,10.8828125 Z" id="形状"></path>
|
|
12
|
+
</g>
|
|
13
|
+
</g>
|
|
14
|
+
</g>
|
|
15
|
+
</g>
|
|
16
|
+
</g>
|
|
17
|
+
</g>
|
|
18
|
+
</svg>
|
package/dist/styles/index.css
CHANGED
|
@@ -122,6 +122,12 @@
|
|
|
122
122
|
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-emphasis {
|
|
123
123
|
background-image: url(icons/emphasis.svg);
|
|
124
124
|
}
|
|
125
|
+
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-fullscreen-enter {
|
|
126
|
+
background-image: url(icons/fullscreen-enter.svg);
|
|
127
|
+
}
|
|
128
|
+
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-fullscreen-exit {
|
|
129
|
+
background-image: url(icons/fullscreen-exit.svg);
|
|
130
|
+
}
|
|
125
131
|
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-heading {
|
|
126
132
|
background-image: url(icons/heading.svg);
|
|
127
133
|
}
|
|
@@ -140,18 +146,33 @@
|
|
|
140
146
|
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-math {
|
|
141
147
|
background-image: url(icons/math.svg);
|
|
142
148
|
}
|
|
149
|
+
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-ordered-list {
|
|
150
|
+
background-image: url(icons/ordered-list.svg);
|
|
151
|
+
}
|
|
143
152
|
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-redo {
|
|
144
153
|
background-image: url(icons/redo.svg);
|
|
145
154
|
}
|
|
146
155
|
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-strong {
|
|
147
156
|
background-image: url(icons/strong.svg);
|
|
148
157
|
}
|
|
158
|
+
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-table {
|
|
159
|
+
background-image: url(icons/table.svg);
|
|
160
|
+
}
|
|
149
161
|
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-thematic-break {
|
|
150
162
|
background-image: url(icons/thematic-break.svg);
|
|
151
163
|
}
|
|
164
|
+
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-to-html {
|
|
165
|
+
background-image: url(icons/to-html.svg);
|
|
166
|
+
}
|
|
167
|
+
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-to-markdown {
|
|
168
|
+
background-image: url(icons/to-markdown.svg);
|
|
169
|
+
}
|
|
152
170
|
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-undo {
|
|
153
171
|
background-image: url(icons/undo.svg);
|
|
154
172
|
}
|
|
173
|
+
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-unordered-list {
|
|
174
|
+
background-image: url(icons/unordered-list.svg);
|
|
175
|
+
}
|
|
155
176
|
.x-star-editor-toolbar .x-star-editor-button-container .x-star-editor-tooltip {
|
|
156
177
|
position: absolute;
|
|
157
178
|
top: 3em;
|
package/dist/utils/markdown.js
CHANGED
|
@@ -386,7 +386,7 @@ var toMarkdownProcessor = unified().use(rehypeRemark).use(remarkGfm).use(remarkS
|
|
|
386
386
|
export var toMarkdown = function toMarkdown(sourceCode) {
|
|
387
387
|
return toMarkdownProcessor.stringify(toMarkdownProcessor.runSync(toHTMLProcessor.runSync(toHTMLProcessor.parse(sourceCode))));
|
|
388
388
|
};
|
|
389
|
-
var toTextProcessor = unified().use(strip).freeze();
|
|
389
|
+
var toTextProcessor = unified().use(remarkParse).use(remarkGfm).use(strip).use(remarkStringify).freeze();
|
|
390
390
|
|
|
391
391
|
/**
|
|
392
392
|
* 将 Markdown 文本转成纯文本
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { XStarMdEditorHandle, XStarMdEditorProps } from '../x-star-md-editor';
|
|
3
3
|
import type { XStarMdViewerHandle, XStarMdViewerProps } from '../x-star-md-viewer';
|
|
4
4
|
export interface XStarEditorHandle extends XStarMdEditorHandle, XStarMdViewerHandle {
|
|
5
|
+
getContainer: () => HTMLDivElement;
|
|
5
6
|
}
|
|
6
7
|
export interface XStarEditorProps {
|
|
7
8
|
/**
|
|
@@ -13,7 +14,7 @@ export interface XStarEditorProps {
|
|
|
13
14
|
*/
|
|
14
15
|
style?: React.CSSProperties;
|
|
15
16
|
/**
|
|
16
|
-
*
|
|
17
|
+
* 编辑器和查看器的高度(不包括工具栏)
|
|
17
18
|
*/
|
|
18
19
|
height?: React.CSSProperties['height'];
|
|
19
20
|
/**
|
|
@@ -33,7 +34,7 @@ export interface XStarEditorProps {
|
|
|
33
34
|
*/
|
|
34
35
|
editorProps?: Omit<XStarMdEditorProps, 'height' | 'locale' | 'initialValue' | 'onChange' | 'onInsertFile'>;
|
|
35
36
|
/**
|
|
36
|
-
*
|
|
37
|
+
* 查看器属性
|
|
37
38
|
*/
|
|
38
39
|
viewerProps?: Omit<XStarMdViewerProps, 'height' | 'value' | 'enableWebWorker'>;
|
|
39
40
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import React, { useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
6
6
|
import { prefix } from "../utils/global";
|
|
@@ -17,14 +17,15 @@ var XStarEditor = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
17
17
|
viewerProps = _ref.viewerProps,
|
|
18
18
|
_onChange = _ref.onChange,
|
|
19
19
|
onInsertFile = _ref.onInsertFile;
|
|
20
|
-
var _useState = useState(initialValue),
|
|
21
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
22
|
-
value = _useState2[0],
|
|
23
|
-
setValue = _useState2[1];
|
|
24
20
|
var editorRef = useMdEditorRef();
|
|
25
21
|
var viewerRef = useMdViewerRef();
|
|
22
|
+
var container = useRef(null);
|
|
26
23
|
useImperativeHandle(ref, function () {
|
|
27
|
-
return _objectSpread(_objectSpread({}, editorRef.current), viewerRef.current)
|
|
24
|
+
return _objectSpread(_objectSpread(_objectSpread({}, editorRef.current), viewerRef.current), {}, {
|
|
25
|
+
getContainer: function getContainer() {
|
|
26
|
+
return container.current;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
28
29
|
}, []);
|
|
29
30
|
|
|
30
31
|
// 同步滚动
|
|
@@ -129,7 +130,12 @@ var XStarEditor = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
129
130
|
});
|
|
130
131
|
};
|
|
131
132
|
}, []);
|
|
133
|
+
var _useState = useState(initialValue),
|
|
134
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
135
|
+
value = _useState2[0],
|
|
136
|
+
setValue = _useState2[1];
|
|
132
137
|
return /*#__PURE__*/React.createElement("div", {
|
|
138
|
+
ref: container,
|
|
133
139
|
className: classNames("".concat(prefix, "editor"), className),
|
|
134
140
|
style: style
|
|
135
141
|
}, /*#__PURE__*/React.createElement(XStarMdEditor, _extends({
|