x-star-editor 0.4.2 → 0.5.0

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.
@@ -28,25 +28,25 @@ var FileInput = function FileInput(_ref) {
28
28
  var _useLocale = useLocale('fileInput'),
29
29
  t = _useLocale.format;
30
30
  return /*#__PURE__*/React.createElement("div", {
31
- className: classNames("".concat(prefix, "file-input"))
31
+ className: classNames("".concat(prefix, "-file-input"))
32
32
  }, /*#__PURE__*/React.createElement("div", {
33
- className: classNames("".concat(prefix, "tabs"))
33
+ className: classNames("".concat(prefix, "-tabs"))
34
34
  }, /*#__PURE__*/React.createElement("div", {
35
- className: classNames("".concat(prefix, "tab"), _defineProperty({}, "".concat(prefix, "active"), type === 'file')),
35
+ className: classNames("".concat(prefix, "-tab"), _defineProperty({}, "".concat(prefix, "-active"), type === 'file')),
36
36
  onClick: function onClick() {
37
37
  return setType('file');
38
38
  }
39
39
  }, t('file')), /*#__PURE__*/React.createElement("div", {
40
- className: classNames("".concat(prefix, "tab"), _defineProperty({}, "".concat(prefix, "active"), type === 'url')),
40
+ className: classNames("".concat(prefix, "-tab"), _defineProperty({}, "".concat(prefix, "-active"), type === 'url')),
41
41
  onClick: function onClick() {
42
42
  return setType('url');
43
43
  }
44
44
  }, t('url'))), type === 'file' ? /*#__PURE__*/React.createElement("label", {
45
- className: classNames("".concat(prefix, "field"))
45
+ className: classNames("".concat(prefix, "-field"))
46
46
  }, t('file'), /*#__PURE__*/React.createElement("div", {
47
- className: classNames("".concat(prefix, "file-container"))
47
+ className: classNames("".concat(prefix, "-file-container"))
48
48
  }, /*#__PURE__*/React.createElement("input", {
49
- className: classNames("".concat(prefix, "hidden")),
49
+ className: classNames("".concat(prefix, "-hidden")),
50
50
  type: "file",
51
51
  accept: image ? 'image/*' : undefined,
52
52
  onChange: function onChange(e) {
@@ -54,30 +54,30 @@ var FileInput = function FileInput(_ref) {
54
54
  return setFile((_e$target$files = e.target.files) === null || _e$target$files === void 0 ? void 0 : _e$target$files[0]);
55
55
  }
56
56
  }), /*#__PURE__*/React.createElement("input", {
57
- className: classNames("".concat(prefix, "input")),
57
+ className: classNames("".concat(prefix, "-input")),
58
58
  readOnly: true,
59
59
  value: (_file$name = file === null || file === void 0 ? void 0 : file.name) !== null && _file$name !== void 0 ? _file$name : ''
60
60
  }), /*#__PURE__*/React.createElement("button", {
61
- className: classNames("".concat(prefix, "button")),
61
+ className: classNames("".concat(prefix, "-button")),
62
62
  type: "button"
63
63
  }, t('chooseFile')))) : /*#__PURE__*/React.createElement("label", {
64
- className: classNames("".concat(prefix, "field"))
64
+ className: classNames("".concat(prefix, "-field"))
65
65
  }, t('url'), /*#__PURE__*/React.createElement("input", {
66
- className: classNames("".concat(prefix, "input")),
66
+ className: classNames("".concat(prefix, "-input")),
67
67
  onChange: function onChange(e) {
68
68
  return setURL(e.target.value);
69
69
  }
70
70
  })), /*#__PURE__*/React.createElement("label", {
71
- className: classNames("".concat(prefix, "field"))
71
+ className: classNames("".concat(prefix, "-field"))
72
72
  }, t('description'), /*#__PURE__*/React.createElement("input", {
73
- className: classNames("".concat(prefix, "input")),
73
+ className: classNames("".concat(prefix, "-input")),
74
74
  onChange: function onChange(e) {
75
75
  return setDescription(e.target.value);
76
76
  }
77
77
  })), /*#__PURE__*/React.createElement("div", {
78
- className: classNames("".concat(prefix, "buttons"))
78
+ className: classNames("".concat(prefix, "-buttons"))
79
79
  }, /*#__PURE__*/React.createElement("button", {
80
- className: classNames("".concat(prefix, "button"), "".concat(prefix, "primary")),
80
+ className: classNames("".concat(prefix, "-button"), "".concat(prefix, "-primary")),
81
81
  type: "button",
82
82
  onClick: function onClick() {
83
83
  if (type === 'file' && file) {
@@ -95,7 +95,7 @@ var FileInput = function FileInput(_ref) {
95
95
  }
96
96
  }
97
97
  }, t('confirm')), /*#__PURE__*/React.createElement("button", {
98
- className: classNames("".concat(prefix, "button")),
98
+ className: classNames("".concat(prefix, "-button")),
99
99
  type: "button",
100
100
  onClick: onCancel
101
101
  }, t('cancel'))));
@@ -76,9 +76,9 @@ var Item = function Item(_ref) {
76
76
  }
77
77
  }, [popoverMount]);
78
78
  return /*#__PURE__*/React.createElement("div", {
79
- className: classNames("".concat(prefix, "item-container"))
79
+ className: classNames("".concat(prefix, "-item-container"))
80
80
  }, /*#__PURE__*/React.createElement("div", {
81
- className: classNames("".concat(prefix, "item"), (_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "disabled"), disabled), _defineProperty(_classNames, "".concat(prefix, "active"), popoverMount), _classNames)),
81
+ className: classNames("".concat(prefix, "-item"), (_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "-disabled"), disabled), _defineProperty(_classNames, "".concat(prefix, "-active"), popoverMount), _classNames)),
82
82
  onClick: function onClick() {
83
83
  if (!disabled) {
84
84
  setTooltipOpen(false);
@@ -98,14 +98,14 @@ var Item = function Item(_ref) {
98
98
  timeout: 300
99
99
  }, /*#__PURE__*/React.createElement("div", {
100
100
  ref: tooltipRef,
101
- className: classNames("".concat(prefix, "tooltip"))
101
+ className: classNames("".concat(prefix, "-tooltip"))
102
102
  }, tooltip)), /*#__PURE__*/React.createElement(Fade, {
103
103
  nodeRef: popoverRef,
104
104
  appear: popoverMount,
105
105
  timeout: 300
106
106
  }, /*#__PURE__*/React.createElement("div", {
107
107
  ref: popoverRef,
108
- className: classNames("".concat(prefix, "popover"))
108
+ className: classNames("".concat(prefix, "-popover"))
109
109
  }, popover)));
110
110
  };
111
111
  var codeOptions = [{
@@ -220,7 +220,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
220
220
  return {
221
221
  blockquote: {
222
222
  children: /*#__PURE__*/React.createElement(SvgBlockquote, {
223
- className: classNames("".concat(prefix, "icon"))
223
+ className: classNames("".concat(prefix, "-icon"))
224
224
  }),
225
225
  tooltip: t('blockquote'),
226
226
  onClick: function onClick(exec) {
@@ -231,7 +231,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
231
231
  },
232
232
  code: {
233
233
  children: /*#__PURE__*/React.createElement(SvgCode, {
234
- className: classNames("".concat(prefix, "icon"))
234
+ className: classNames("".concat(prefix, "-icon"))
235
235
  }),
236
236
  tooltip: t('code'),
237
237
  popoverRender: function popoverRender(exec, close) {
@@ -240,7 +240,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
240
240
  lang = _ref2.lang;
241
241
  return /*#__PURE__*/React.createElement("div", {
242
242
  key: label,
243
- className: classNames("".concat(prefix, "option")),
243
+ className: classNames("".concat(prefix, "-option")),
244
244
  onClick: function onClick() {
245
245
  exec(toggleHandler({
246
246
  type: 'code',
@@ -256,7 +256,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
256
256
  },
257
257
  delete: {
258
258
  children: /*#__PURE__*/React.createElement(SvgDelete, {
259
- className: classNames("".concat(prefix, "icon"))
259
+ className: classNames("".concat(prefix, "-icon"))
260
260
  }),
261
261
  tooltip: t('delete'),
262
262
  onClick: function onClick(exec) {
@@ -267,7 +267,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
267
267
  },
268
268
  emphasis: {
269
269
  children: /*#__PURE__*/React.createElement(SvgEmphasis, {
270
- className: classNames("".concat(prefix, "icon"))
270
+ className: classNames("".concat(prefix, "-icon"))
271
271
  }),
272
272
  tooltip: t('emphasis'),
273
273
  onClick: function onClick(exec) {
@@ -278,7 +278,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
278
278
  },
279
279
  heading: {
280
280
  children: /*#__PURE__*/React.createElement(SvgHeading, {
281
- className: classNames("".concat(prefix, "icon"))
281
+ className: classNames("".concat(prefix, "-icon"))
282
282
  }),
283
283
  tooltip: t('heading'),
284
284
  popoverRender: function popoverRender(exec, close) {
@@ -287,7 +287,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
287
287
  fontSize = _ref3.fontSize;
288
288
  return /*#__PURE__*/React.createElement("div", {
289
289
  key: depth,
290
- className: classNames("".concat(prefix, "option")),
290
+ className: classNames("".concat(prefix, "-option")),
291
291
  style: {
292
292
  fontSize: fontSize
293
293
  },
@@ -304,13 +304,13 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
304
304
  },
305
305
  help: {
306
306
  children: /*#__PURE__*/React.createElement(SvgHelp, {
307
- className: classNames("".concat(prefix, "icon"))
307
+ className: classNames("".concat(prefix, "-icon"))
308
308
  }),
309
309
  tooltip: t('help')
310
310
  },
311
311
  image: {
312
312
  children: /*#__PURE__*/React.createElement(SvgImage, {
313
- className: classNames("".concat(prefix, "icon"))
313
+ className: classNames("".concat(prefix, "-icon"))
314
314
  }),
315
315
  tooltip: t('image'),
316
316
  popoverRender: function popoverRender(exec, close) {
@@ -337,7 +337,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
337
337
  },
338
338
  inlineCode: {
339
339
  children: /*#__PURE__*/React.createElement(SvgInlineCode, {
340
- className: classNames("".concat(prefix, "icon"))
340
+ className: classNames("".concat(prefix, "-icon"))
341
341
  }),
342
342
  tooltip: t('inlineCode'),
343
343
  onClick: function onClick(exec) {
@@ -348,7 +348,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
348
348
  },
349
349
  inlineMath: {
350
350
  children: /*#__PURE__*/React.createElement(SvgInlineMath, {
351
- className: classNames("".concat(prefix, "icon"))
351
+ className: classNames("".concat(prefix, "-icon"))
352
352
  }),
353
353
  tooltip: t('inlineMath'),
354
354
  onClick: function onClick(exec) {
@@ -359,7 +359,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
359
359
  },
360
360
  link: {
361
361
  children: /*#__PURE__*/React.createElement(SvgLink, {
362
- className: classNames("".concat(prefix, "icon"))
362
+ className: classNames("".concat(prefix, "-icon"))
363
363
  }),
364
364
  tooltip: t('link'),
365
365
  popoverRender: function popoverRender(exec, close) {
@@ -385,7 +385,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
385
385
  },
386
386
  math: {
387
387
  children: /*#__PURE__*/React.createElement(SvgMath, {
388
- className: classNames("".concat(prefix, "icon"))
388
+ className: classNames("".concat(prefix, "-icon"))
389
389
  }),
390
390
  tooltip: t('math'),
391
391
  onClick: function onClick(exec) {
@@ -396,7 +396,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
396
396
  },
397
397
  mermaid: {
398
398
  children: /*#__PURE__*/React.createElement(SvgMermaid, {
399
- className: classNames("".concat(prefix, "icon"))
399
+ className: classNames("".concat(prefix, "-icon"))
400
400
  }),
401
401
  tooltip: t('mermaid'),
402
402
  popoverRender: function popoverRender(exec, close) {
@@ -405,7 +405,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
405
405
  value = _ref4.value;
406
406
  return /*#__PURE__*/React.createElement("div", {
407
407
  key: label,
408
- className: classNames("".concat(prefix, "option")),
408
+ className: classNames("".concat(prefix, "-option")),
409
409
  onClick: function onClick() {
410
410
  exec(toggleHandler({
411
411
  type: 'code',
@@ -421,7 +421,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
421
421
  },
422
422
  orderedList: {
423
423
  children: /*#__PURE__*/React.createElement(SvgOrderedList, {
424
- className: classNames("".concat(prefix, "icon"))
424
+ className: classNames("".concat(prefix, "-icon"))
425
425
  }),
426
426
  tooltip: t('orderedList'),
427
427
  onClick: function onClick(exec) {
@@ -434,7 +434,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
434
434
  var history = _ref5.history;
435
435
  return {
436
436
  children: /*#__PURE__*/React.createElement(SvgRedo, {
437
- className: classNames("".concat(prefix, "icon"))
437
+ className: classNames("".concat(prefix, "-icon"))
438
438
  }),
439
439
  disabled: history.index === history.states.length - 1,
440
440
  tooltip: t('redo'),
@@ -445,7 +445,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
445
445
  },
446
446
  strong: {
447
447
  children: /*#__PURE__*/React.createElement(SvgStrong, {
448
- className: classNames("".concat(prefix, "icon"))
448
+ className: classNames("".concat(prefix, "-icon"))
449
449
  }),
450
450
  tooltip: t('strong'),
451
451
  onClick: function onClick(exec) {
@@ -456,7 +456,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
456
456
  },
457
457
  table: {
458
458
  children: /*#__PURE__*/React.createElement(SvgTable, {
459
- className: classNames("".concat(prefix, "icon"))
459
+ className: classNames("".concat(prefix, "-icon"))
460
460
  }),
461
461
  tooltip: t('table'),
462
462
  onClick: function onClick(exec) {
@@ -467,7 +467,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
467
467
  },
468
468
  taskList: {
469
469
  children: /*#__PURE__*/React.createElement(SvgTaskList, {
470
- className: classNames("".concat(prefix, "icon"))
470
+ className: classNames("".concat(prefix, "-icon"))
471
471
  }),
472
472
  tooltip: t('taskList'),
473
473
  onClick: function onClick(exec) {
@@ -478,7 +478,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
478
478
  },
479
479
  thematicBreak: {
480
480
  children: /*#__PURE__*/React.createElement(SvgThematicBreak, {
481
- className: classNames("".concat(prefix, "icon"))
481
+ className: classNames("".concat(prefix, "-icon"))
482
482
  }),
483
483
  tooltip: t('thematicBreak'),
484
484
  onClick: function onClick(exec) {
@@ -489,7 +489,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
489
489
  },
490
490
  toHTML: {
491
491
  children: /*#__PURE__*/React.createElement(SvgToHTML, {
492
- className: classNames("".concat(prefix, "icon"))
492
+ className: classNames("".concat(prefix, "-icon"))
493
493
  }),
494
494
  tooltip: t('toHTML'),
495
495
  onClick: function onClick(exec) {
@@ -510,7 +510,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
510
510
  },
511
511
  toMarkdown: {
512
512
  children: /*#__PURE__*/React.createElement(SvgToMarkdown, {
513
- className: classNames("".concat(prefix, "icon"))
513
+ className: classNames("".concat(prefix, "-icon"))
514
514
  }),
515
515
  tooltip: t('toMarkdown'),
516
516
  onClick: function onClick(exec) {
@@ -533,7 +533,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
533
533
  var history = _ref8.history;
534
534
  return {
535
535
  children: /*#__PURE__*/React.createElement(SvgUndo, {
536
- className: classNames("".concat(prefix, "icon"))
536
+ className: classNames("".concat(prefix, "-icon"))
537
537
  }),
538
538
  disabled: !history.index,
539
539
  tooltip: t('undo'),
@@ -544,7 +544,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap(locale,
544
544
  },
545
545
  unorderedList: {
546
546
  children: /*#__PURE__*/React.createElement(SvgUnorderedList, {
547
- className: classNames("".concat(prefix, "icon"))
547
+ className: classNames("".concat(prefix, "-icon"))
548
548
  }),
549
549
  tooltip: t('unorderedList'),
550
550
  onClick: function onClick(exec) {
@@ -573,13 +573,13 @@ var Toolbar = function Toolbar(_ref9) {
573
573
  });
574
574
  return /*#__PURE__*/React.createElement("div", {
575
575
  ref: toolbarRef,
576
- className: classNames("".concat(prefix, "toolbar"), className),
576
+ className: classNames("".concat(prefix, "-toolbar"), className),
577
577
  style: style
578
578
  }, items.map(function (group, index) {
579
579
  return /*#__PURE__*/React.createElement(React.Fragment, {
580
580
  key: index
581
581
  }, !!index && /*#__PURE__*/React.createElement("div", {
582
- className: classNames("".concat(prefix, "divider"))
582
+ className: classNames("".concat(prefix, "-divider"))
583
583
  }), group.map(function (item, index) {
584
584
  var toolbarItem = typeof item === 'string' ? itemMap[item] : item;
585
585
  if (!toolbarItem) {
@@ -109,9 +109,14 @@ export var useContainer = function useContainer(ref) {
109
109
  for (; oldChild && newChild;) {
110
110
  var oldNext = oldChild.nextSibling;
111
111
  var newNext = newChild.nextSibling;
112
- if (oldChild.nodeName !== newChild.nodeName || oldChild.nodeType === Node.TEXT_NODE) {
113
- // 节点名称不同,或节点均为文本类型,直接替换
112
+ if (oldChild.nodeName !== newChild.nodeName) {
113
+ // 节点名称不同,直接替换
114
114
  oldChild.replaceWith(newChild);
115
+ } else if (oldChild.nodeType === Node.TEXT_NODE) {
116
+ // 节点均为文本类型,更新文本内容
117
+ if (oldChild.nodeValue !== newChild.nodeValue) {
118
+ oldChild.nodeValue = newChild.nodeValue;
119
+ }
115
120
  } else {
116
121
  // 节点名称相同,更新属性和子节点
117
122
  if (oldChild instanceof HTMLElement && newChild instanceof HTMLElement) {
@@ -1 +1 @@
1
- export declare const prefix = "x-star-editor-";
1
+ export declare const prefix = "x-star-editor";
@@ -1 +1 @@
1
- export var prefix = 'x-star-editor-';
1
+ export var prefix = 'x-star-editor';
@@ -20,14 +20,6 @@ export declare const preViewerRender: (sourceCode: string) => Promise<HastRoot>;
20
20
  */
21
21
  export type Schema = typeof defaultSchema;
22
22
  export declare const getDefaultSchema: () => Schema;
23
- /**
24
- * 将 Hast 树转成新的 Hast 树
25
- *
26
- * @param root Hast 树
27
- * @param schema 过滤模式
28
- * @returns 新的 Hast 树
29
- */
30
- export declare const viewerRender: (root: HastRoot, schema: Schema) => HastRoot;
31
23
  /**
32
24
  * 将 Hast 树映射到 React 虚拟 DOM 树
33
25
  *
@@ -15,7 +15,7 @@ import rehypeMermaid from 'rehype-mermaidjs';
15
15
  import rehypePrism from 'rehype-prism-plus';
16
16
  import rehypeRaw from 'rehype-raw';
17
17
  import rehypeRemark, { defaultHandlers } from 'rehype-remark';
18
- import rehypeSanitize, { defaultSchema } from 'rehype-sanitize';
18
+ import { defaultSchema } from 'rehype-sanitize';
19
19
  import rehypeStringify from 'rehype-stringify';
20
20
  import remarkBreaks from 'remark-breaks';
21
21
  import remarkGfm from 'remark-gfm';
@@ -26,7 +26,6 @@ import remarkStringify from 'remark-stringify';
26
26
  import { unified } from 'unified';
27
27
  import { prefix } from "./global";
28
28
  import rehypeCustom from "./rehype/rehype-custom";
29
- import rehypeLine from "./rehype/rehype-line";
30
29
  import rehypeMath, { isMathNode } from "./rehype/rehype-math";
31
30
  import rehypeRawPositions from "./rehype/rehype-raw-positions";
32
31
 
@@ -59,7 +58,7 @@ export var editorRender = function editorRender(sourceCode) {
59
58
  /**
60
59
  * CSS 类名前缀
61
60
  */
62
- var mdPrefix = "".concat(prefix, "md-");
61
+ var mdPrefix = "".concat(prefix, "-md");
63
62
 
64
63
  /**
65
64
  * 扫描偏移量,表示已经添加到 DOM 树的文本
@@ -101,9 +100,9 @@ export var editorRender = function editorRender(sourceCode) {
101
100
 
102
101
  // 如果节点为流内容,则将样式添加到该行的 `<div>` 元素上,否则添加到该节点的元素上
103
102
  var styleElement = stack[index && !isFlowContent(stack[index - 1].node) ? index : 0].element;
104
- styleElement.classList.add("".concat(mdPrefix).concat(node.type));
103
+ styleElement.classList.add("".concat(mdPrefix, "-").concat(node.type));
105
104
  if (node.type === 'heading') {
106
- styleElement.classList.add("".concat(mdPrefix, "heading-").concat(node.depth));
105
+ styleElement.classList.add("".concat(mdPrefix, "-heading-").concat(node.depth));
107
106
  }
108
107
 
109
108
  // 如果索引为 0,则父节点为块级元素,否则为前一个索引的 DOM 元素
@@ -130,7 +129,7 @@ export var editorRender = function editorRender(sourceCode) {
130
129
  var createDelimiter = function createDelimiter(text) {
131
130
  var temp = document.createElement('span');
132
131
  temp.append(text);
133
- temp.classList.add("".concat(mdPrefix, "delimiter"));
132
+ temp.classList.add("".concat(mdPrefix, "-delimiter"));
134
133
  return temp;
135
134
  };
136
135
 
@@ -324,17 +323,6 @@ export var getDefaultSchema = function getDefaultSchema() {
324
323
  tagNames: [].concat(_toConsumableArray((_defaultSchema$tagNam = defaultSchema.tagNames) !== null && _defaultSchema$tagNam !== void 0 ? _defaultSchema$tagNam : []), ['custom'])
325
324
  });
326
325
  };
327
-
328
- /**
329
- * 将 Hast 树转成新的 Hast 树
330
- *
331
- * @param root Hast 树
332
- * @param schema 过滤模式
333
- * @returns 新的 Hast 树
334
- */
335
- export var viewerRender = function viewerRender(root, schema) {
336
- return unified().use(rehypeRawPositions).use(rehypeRaw).use(rehypeMath).use(rehypeSanitize, schema).use(rehypeLine).runSync(root);
337
- };
338
326
  var Input = function Input(_ref2) {
339
327
  var checked = _ref2.checked,
340
328
  props = _objectWithoutProperties(_ref2, _excluded);
@@ -22,7 +22,7 @@ export interface XStarEditorProps {
22
22
  */
23
23
  locale?: XStarMdEditorProps['locale'];
24
24
  /**
25
- * 配置未输入时的提示语
25
+ * 文本为空时显示的提示
26
26
  */
27
27
  placeholder?: string;
28
28
  /**
@@ -37,10 +37,6 @@ export interface XStarEditorProps {
37
37
  * 是否只读
38
38
  */
39
39
  readOnly?: XStarMdEditorProps['readOnly'];
40
- /**
41
- * 是否启用 Web Worker
42
- */
43
- enableWebWorker?: XStarMdViewerProps['enableWebWorker'];
44
40
  /**
45
41
  * 编辑器属性
46
42
  */
@@ -48,7 +44,7 @@ export interface XStarEditorProps {
48
44
  /**
49
45
  * 查看器属性
50
46
  */
51
- viewerProps?: Omit<XStarMdViewerProps, 'height' | 'value' | 'enableWebWorker'>;
47
+ viewerProps?: Omit<XStarMdViewerProps, 'height' | 'value'>;
52
48
  /**
53
49
  * 自定义查看器渲染函数
54
50
  */
@@ -29,7 +29,7 @@ var ViewerRenderWrapper = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
29
29
  }, []);
30
30
  return /*#__PURE__*/React.createElement("div", {
31
31
  ref: containerRef,
32
- className: classNames("".concat(prefix, "md-viewer"), className),
32
+ className: classNames("".concat(prefix, "-md-viewer"), className),
33
33
  style: _objectSpread(_objectSpread({}, style), {}, {
34
34
  height: height
35
35
  })
@@ -46,7 +46,6 @@ var XStarEditor = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
46
46
  initialValue = _ref2$initialValue === void 0 ? '' : _ref2$initialValue,
47
47
  value = _ref2.value,
48
48
  readOnly = _ref2.readOnly,
49
- enableWebWorker = _ref2.enableWebWorker,
50
49
  editorProps = _ref2.editorProps,
51
50
  viewerProps = _ref2.viewerProps,
52
51
  viewerRender = _ref2.viewerRender,
@@ -182,7 +181,7 @@ var XStarEditor = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
182
181
  var t = getFormat(locale, 'toolbarItem');
183
182
  ctx.toolbarItemMap.editOnly = {
184
183
  children: /*#__PURE__*/React.createElement(SvgEditOnly, {
185
- className: classNames("".concat(prefix, "icon"), _defineProperty({}, "".concat(prefix, "active"), editOnly))
184
+ className: classNames("".concat(prefix, "-icon"), _defineProperty({}, "".concat(prefix, "-active"), editOnly))
186
185
  }),
187
186
  tooltip: t('editOnly'),
188
187
  onClick: function onClick() {
@@ -191,7 +190,7 @@ var XStarEditor = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
191
190
  };
192
191
  ctx.toolbarItemMap.viewOnly = {
193
192
  children: /*#__PURE__*/React.createElement(SvgViewOnly, {
194
- className: classNames("".concat(prefix, "icon"), _defineProperty({}, "".concat(prefix, "active"), viewOnly))
193
+ className: classNames("".concat(prefix, "-icon"), _defineProperty({}, "".concat(prefix, "-active"), viewOnly))
195
194
  }),
196
195
  tooltip: t('viewOnly'),
197
196
  onClick: function onClick() {
@@ -200,9 +199,9 @@ var XStarEditor = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
200
199
  };
201
200
  ctx.toolbarItemMap.fullscreen = {
202
201
  children: fullscreen ? /*#__PURE__*/React.createElement(SvgExitFullscreen, {
203
- className: classNames("".concat(prefix, "icon"))
202
+ className: classNames("".concat(prefix, "-icon"))
204
203
  }) : /*#__PURE__*/React.createElement(SvgEnterFullscreen, {
205
- className: classNames("".concat(prefix, "icon"))
204
+ className: classNames("".concat(prefix, "-icon"))
206
205
  }),
207
206
  tooltip: fullscreen ? t('exitFullscreen') : t('enterFullscreen'),
208
207
  onClick: function onClick() {
@@ -241,12 +240,12 @@ var XStarEditor = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
241
240
  setSourceCode = _useState6[1];
242
241
  return /*#__PURE__*/React.createElement("div", {
243
242
  ref: containerRef,
244
- className: classNames("".concat(prefix, "editor"), _defineProperty({}, "".concat(prefix, "fullscreen"), fullscreen), className),
243
+ className: classNames("".concat(prefix, "-editor"), _defineProperty({}, "".concat(prefix, "-fullscreen"), fullscreen), className),
245
244
  style: style
246
245
  }, /*#__PURE__*/React.createElement(XStarMdEditor, _extends({
247
246
  ref: editorRef
248
247
  }, editorProps, {
249
- className: classNames((_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefix, "active"), editOnly), _defineProperty(_classNames4, "".concat(prefix, "hidden"), viewOnly), _classNames4), editorProps === null || editorProps === void 0 ? void 0 : editorProps.className),
248
+ className: classNames((_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefix, "-active"), editOnly), _defineProperty(_classNames4, "".concat(prefix, "-hidden"), viewOnly), _classNames4), editorProps === null || editorProps === void 0 ? void 0 : editorProps.className),
250
249
  height: height,
251
250
  locale: locale,
252
251
  placeholder: placeholder,
@@ -260,16 +259,15 @@ var XStarEditor = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
260
259
  onInsertFile: onInsertFile
261
260
  })), viewerRender ? /*#__PURE__*/React.createElement(ViewerRenderWrapper, {
262
261
  ref: viewerRef,
263
- className: classNames((_classNames5 = {}, _defineProperty(_classNames5, "".concat(prefix, "active"), viewOnly), _defineProperty(_classNames5, "".concat(prefix, "hidden"), editOnly), _classNames5), viewerProps === null || viewerProps === void 0 ? void 0 : viewerProps.className),
262
+ className: classNames((_classNames5 = {}, _defineProperty(_classNames5, "".concat(prefix, "-active"), viewOnly), _defineProperty(_classNames5, "".concat(prefix, "-hidden"), editOnly), _classNames5), viewerProps === null || viewerProps === void 0 ? void 0 : viewerProps.className),
264
263
  style: viewerProps === null || viewerProps === void 0 ? void 0 : viewerProps.style,
265
264
  height: height
266
265
  }, viewerRender(value !== null && value !== void 0 ? value : sourceCode)) : /*#__PURE__*/React.createElement(XStarMdViewer, _extends({
267
266
  ref: viewerRef
268
267
  }, viewerProps, {
269
- className: classNames((_classNames6 = {}, _defineProperty(_classNames6, "".concat(prefix, "active"), viewOnly), _defineProperty(_classNames6, "".concat(prefix, "hidden"), editOnly), _classNames6), viewerProps === null || viewerProps === void 0 ? void 0 : viewerProps.className),
268
+ className: classNames((_classNames6 = {}, _defineProperty(_classNames6, "".concat(prefix, "-active"), viewOnly), _defineProperty(_classNames6, "".concat(prefix, "-hidden"), editOnly), _classNames6), viewerProps === null || viewerProps === void 0 ? void 0 : viewerProps.className),
270
269
  height: height,
271
- value: value !== null && value !== void 0 ? value : sourceCode,
272
- enableWebWorker: enableWebWorker
270
+ value: value !== null && value !== void 0 ? value : sourceCode
273
271
  })));
274
272
  });
275
273
  if (process.env.NODE_ENV !== 'production') {
@@ -401,7 +401,7 @@ var XStarMdEditor = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
401
401
  exec: exec
402
402
  }), /*#__PURE__*/React.createElement("div", {
403
403
  ref: containerRef,
404
- className: classNames("".concat(prefix, "md-editor"), _defineProperty({}, "".concat(prefix, "empty"), !sourceCode), className),
404
+ className: classNames("".concat(prefix, "-md-editor"), _defineProperty({}, "".concat(prefix, "-empty"), !sourceCode), className),
405
405
  style: _objectSpread(_objectSpread({}, style), {}, {
406
406
  height: height
407
407
  }),
@@ -48,10 +48,6 @@ export interface XStarMdViewerProps {
48
48
  * 插件
49
49
  */
50
50
  plugins?: XStarMdViewerPlugin[];
51
- /**
52
- * 是否启用 Web Worker
53
- */
54
- enableWebWorker?: boolean;
55
51
  }
56
52
  declare const XStarMdViewer: React.ForwardRefExoticComponent<XStarMdViewerProps & React.RefAttributes<XStarMdViewerHandle>>;
57
53
  export default XStarMdViewer;