x-star-editor 0.2.2 → 0.2.4

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.
Files changed (79) hide show
  1. package/dist/components/FileInput.js +2 -2
  2. package/dist/components/Toolbar.js +80 -67
  3. package/dist/icons/Blockquote.d.ts +4 -0
  4. package/dist/icons/Blockquote.js +16 -0
  5. package/dist/icons/Code.d.ts +4 -0
  6. package/dist/icons/Code.js +15 -0
  7. package/dist/icons/Delete.d.ts +4 -0
  8. package/dist/icons/Delete.js +15 -0
  9. package/dist/icons/Emphasis.d.ts +4 -0
  10. package/dist/icons/Emphasis.js +15 -0
  11. package/dist/icons/EnterFullscreen.d.ts +4 -0
  12. package/dist/icons/EnterFullscreen.js +15 -0
  13. package/dist/icons/ExitFullscreen.d.ts +4 -0
  14. package/dist/icons/ExitFullscreen.js +15 -0
  15. package/dist/icons/Heading.d.ts +4 -0
  16. package/dist/icons/Heading.js +15 -0
  17. package/dist/icons/Image.d.ts +4 -0
  18. package/dist/icons/Image.js +15 -0
  19. package/dist/icons/InlineCode.d.ts +4 -0
  20. package/dist/icons/InlineCode.js +19 -0
  21. package/dist/icons/InlineMath.d.ts +4 -0
  22. package/dist/icons/InlineMath.js +25 -0
  23. package/dist/icons/Link.d.ts +4 -0
  24. package/dist/icons/Link.js +15 -0
  25. package/dist/icons/Math.d.ts +4 -0
  26. package/dist/icons/Math.js +15 -0
  27. package/dist/icons/OrderedList.d.ts +4 -0
  28. package/dist/icons/OrderedList.js +15 -0
  29. package/dist/icons/Redo.d.ts +4 -0
  30. package/dist/icons/Redo.js +15 -0
  31. package/dist/icons/Strong.d.ts +4 -0
  32. package/dist/icons/Strong.js +15 -0
  33. package/dist/icons/Table.d.ts +4 -0
  34. package/dist/icons/Table.js +15 -0
  35. package/dist/icons/ThematicBreak.d.ts +4 -0
  36. package/dist/icons/ThematicBreak.js +15 -0
  37. package/dist/icons/ToHtml.d.ts +4 -0
  38. package/dist/icons/ToHtml.js +15 -0
  39. package/dist/icons/ToMarkdown.d.ts +4 -0
  40. package/dist/icons/ToMarkdown.js +15 -0
  41. package/dist/icons/Undo.d.ts +4 -0
  42. package/dist/icons/Undo.js +15 -0
  43. package/dist/icons/UnorderedList.d.ts +4 -0
  44. package/dist/icons/UnorderedList.js +15 -0
  45. package/dist/locales/en_US.d.ts +5 -0
  46. package/dist/locales/en_US.js +6 -1
  47. package/dist/locales/index.d.ts +20 -0
  48. package/dist/locales/zh_CN.d.ts +5 -0
  49. package/dist/locales/zh_CN.js +6 -1
  50. package/dist/styles/index.css +8 -69
  51. package/dist/utils/container.d.ts +2 -3
  52. package/dist/utils/container.js +2 -7
  53. package/dist/utils/markdown.d.ts +2 -2
  54. package/dist/utils/markdown.js +46 -20
  55. package/dist/x-star-editor/index.js +3 -3
  56. package/dist/x-star-md-editor/index.js +4 -3
  57. package/dist/x-star-md-viewer/index.js +32 -14
  58. package/package.json +9 -5
  59. package/dist/styles/icons/blockquote.svg +0 -18
  60. package/dist/styles/icons/code.svg +0 -18
  61. package/dist/styles/icons/delete.svg +0 -18
  62. package/dist/styles/icons/emphasis.svg +0 -18
  63. package/dist/styles/icons/fullscreen-enter.svg +0 -18
  64. package/dist/styles/icons/fullscreen-exit.svg +0 -18
  65. package/dist/styles/icons/heading.svg +0 -16
  66. package/dist/styles/icons/image.svg +0 -18
  67. package/dist/styles/icons/inline-code.svg +0 -19
  68. package/dist/styles/icons/inline-math.svg +0 -20
  69. package/dist/styles/icons/link.svg +0 -18
  70. package/dist/styles/icons/math.svg +0 -17
  71. package/dist/styles/icons/ordered-list.svg +0 -18
  72. package/dist/styles/icons/redo.svg +0 -18
  73. package/dist/styles/icons/strong.svg +0 -18
  74. package/dist/styles/icons/table.svg +0 -18
  75. package/dist/styles/icons/thematic-break.svg +0 -18
  76. package/dist/styles/icons/to-html.svg +0 -18
  77. package/dist/styles/icons/to-markdown.svg +0 -18
  78. package/dist/styles/icons/undo.svg +0 -18
  79. package/dist/styles/icons/unordered-list.svg +0 -18
@@ -0,0 +1,4 @@
1
+ import type { SVGProps } from 'react';
2
+ import React from 'react';
3
+ declare const SvgStrong: (props: SVGProps<SVGSVGElement>) => React.JSX.Element;
4
+ export default SvgStrong;
@@ -0,0 +1,15 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React from 'react';
3
+ var SvgStrong = function SvgStrong(props) {
4
+ return /*#__PURE__*/React.createElement("svg", _extends({
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ width: "1em",
7
+ height: "1em",
8
+ viewBox: "0 0 24 24"
9
+ }, props), /*#__PURE__*/React.createElement("path", {
10
+ fill: "currentColor",
11
+ fillRule: "nonzero",
12
+ d: "M14.5 11.553a2.627 2.627 0 0 0 .737-1.825V9.59c0-1.462-1.197-2.649-2.672-2.649h-4.02a.373.373 0 0 0-.373.373v9.227c0 .221.18.4.4.4h4.33c1.59 0 2.879-1.28 2.879-2.86v-.15c0-.991-.509-1.865-1.28-2.378ZM9.477 8.246h3.053c.776 0 1.404.603 1.404 1.349v.129c0 .745-.63 1.35-1.404 1.35H9.476V8.245Zm4.981 5.834c0 .855-.702 1.548-1.57 1.548h-3.41v-3.242h3.41c.868 0 1.57.693 1.57 1.547v.147Z"
13
+ }));
14
+ };
15
+ export default SvgStrong;
@@ -0,0 +1,4 @@
1
+ import type { SVGProps } from 'react';
2
+ import React from 'react';
3
+ declare const SvgTable: (props: SVGProps<SVGSVGElement>) => React.JSX.Element;
4
+ export default SvgTable;
@@ -0,0 +1,15 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React from 'react';
3
+ var SvgTable = function SvgTable(props) {
4
+ return /*#__PURE__*/React.createElement("svg", _extends({
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ width: "1em",
7
+ height: "1em",
8
+ viewBox: "0 0 24 24"
9
+ }, props), /*#__PURE__*/React.createElement("path", {
10
+ fill: "currentColor",
11
+ fillRule: "nonzero",
12
+ d: "M17.013 9.594H6.987a.446.446 0 0 0-.456.437v6.344c0 .242.204.438.456.438h10.025a.446.446 0 0 0 .455-.438v-6.344a.444.444 0 0 0-.454-.437Zm-7.091 6.234H7.516v-2.187h2.406v2.187Zm0-3.062H7.516v-2.188h2.406v2.188Zm3.281 3.062h-2.406v-2.187h2.406v2.187Zm0-3.062h-2.406v-2.188h2.406v2.188Zm3.281 3.062h-2.406v-2.187h2.406v2.187Zm0-3.062h-2.406v-2.188h2.406v2.188Zm.875-5.579H6.641a.11.11 0 0 0-.11.11V8.39c0 .06.05.109.11.109h10.718c.06 0 .11-.05.11-.11V7.298a.11.11 0 0 0-.11-.11Z"
13
+ }));
14
+ };
15
+ export default SvgTable;
@@ -0,0 +1,4 @@
1
+ import type { SVGProps } from 'react';
2
+ import React from 'react';
3
+ declare const SvgThematicBreak: (props: SVGProps<SVGSVGElement>) => React.JSX.Element;
4
+ export default SvgThematicBreak;
@@ -0,0 +1,15 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React from 'react';
3
+ var SvgThematicBreak = function SvgThematicBreak(props) {
4
+ return /*#__PURE__*/React.createElement("svg", _extends({
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ width: "1em",
7
+ height: "1em",
8
+ viewBox: "0 0 24 24"
9
+ }, props), /*#__PURE__*/React.createElement("path", {
10
+ fill: "currentColor",
11
+ fillRule: "nonzero",
12
+ d: "M17.36 11.508H6.64a.11.11 0 0 0-.109.11v.765c0 .06.05.11.11.11h10.718c.06 0 .11-.05.11-.11v-.766a.11.11 0 0 0-.11-.11Z"
13
+ }));
14
+ };
15
+ export default SvgThematicBreak;
@@ -0,0 +1,4 @@
1
+ import type { SVGProps } from 'react';
2
+ import React from 'react';
3
+ declare const SvgToHtml: (props: SVGProps<SVGSVGElement>) => React.JSX.Element;
4
+ export default SvgToHtml;
@@ -0,0 +1,15 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React from 'react';
3
+ var SvgToHtml = function SvgToHtml(props) {
4
+ return /*#__PURE__*/React.createElement("svg", _extends({
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ width: "1em",
7
+ height: "1em",
8
+ viewBox: "0 0 24 24"
9
+ }, props), /*#__PURE__*/React.createElement("path", {
10
+ fill: "currentColor",
11
+ fillRule: "nonzero",
12
+ d: "m16.684 8.946-2.942-2.942a.437.437 0 0 0-.31-.129H7.626a.437.437 0 0 0-.438.438v11.375c0 .241.196.437.438.437h8.75a.437.437 0 0 0 .438-.438v-8.43a.44.44 0 0 0-.129-.311Zm-.88.511H13.23V6.884l2.574 2.573ZM12.3 6.859v2.954c0 .317.257.574.574.574h2.953v6.754H8.172V6.859H12.3ZM10.99 11.5h-.3a.2.2 0 0 0-.2.2v3.6c0 .11.09.2.2.2h.3a.2.2 0 0 0 .2-.2v-1.452l.01.002h1.6a.2.2 0 0 0 .1-.027V15.3c0 .11.09.2.2.2h.3a.2.2 0 0 0 .2-.2v-3.6a.2.2 0 0 0-.2-.2h-.3a.2.2 0 0 0-.2.2v1.477a.2.2 0 0 0-.1-.027h-1.61V11.7a.2.2 0 0 0-.2-.2Z"
13
+ }));
14
+ };
15
+ export default SvgToHtml;
@@ -0,0 +1,4 @@
1
+ import type { SVGProps } from 'react';
2
+ import React from 'react';
3
+ declare const SvgToMarkdown: (props: SVGProps<SVGSVGElement>) => React.JSX.Element;
4
+ export default SvgToMarkdown;
@@ -0,0 +1,15 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React from 'react';
3
+ var SvgToMarkdown = function SvgToMarkdown(props) {
4
+ return /*#__PURE__*/React.createElement("svg", _extends({
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ width: "1em",
7
+ height: "1em",
8
+ viewBox: "0 0 24 24"
9
+ }, props), /*#__PURE__*/React.createElement("path", {
10
+ fill: "currentColor",
11
+ fillRule: "nonzero",
12
+ d: "m16.684 8.946-2.942-2.942a.437.437 0 0 0-.31-.129H7.626a.437.437 0 0 0-.438.438v11.375c0 .241.196.437.438.437h8.75a.437.437 0 0 0 .438-.438v-8.43a.44.44 0 0 0-.129-.311Zm-.88.511H13.23V6.884l2.574 2.573Zm.024 7.684H8.172V6.859H12.3v2.954c0 .317.257.574.574.574h2.953v6.754Zm-4.963-5.562a.163.163 0 0 0-.15-.099h-.479a.165.165 0 0 0-.164.165v3.718c0 .09.074.164.164.164h.37c.091 0 .165-.073.165-.164v-2.405l.913 2.054a.164.164 0 0 0 .15.097h.33a.167.167 0 0 0 .15-.097l.914-2.06v2.411c0 .09.074.164.164.164h.372c.09 0 .164-.073.164-.164v-3.718a.165.165 0 0 0-.164-.165h-.475a.163.163 0 0 0-.15.099l-1.136 2.611-1.138-2.611Z"
13
+ }));
14
+ };
15
+ export default SvgToMarkdown;
@@ -0,0 +1,4 @@
1
+ import type { SVGProps } from 'react';
2
+ import React from 'react';
3
+ declare const SvgUndo: (props: SVGProps<SVGSVGElement>) => React.JSX.Element;
4
+ export default SvgUndo;
@@ -0,0 +1,15 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React from 'react';
3
+ var SvgUndo = function SvgUndo(props) {
4
+ return /*#__PURE__*/React.createElement("svg", _extends({
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ width: "1em",
7
+ height: "1em",
8
+ viewBox: "0 0 24 24"
9
+ }, props), /*#__PURE__*/React.createElement("path", {
10
+ fill: "currentColor",
11
+ fillRule: "nonzero",
12
+ d: "M15.842 8.309h-5.838V7.297a.11.11 0 0 0-.176-.086L7.886 8.742a.11.11 0 0 0 0 .172l1.942 1.532a.11.11 0 0 0 .176-.087V9.348h5.674v6.425H7.393a.11.11 0 0 0-.11.11v.82c0 .06.05.11.11.11h8.449a.876.876 0 0 0 .875-.875V9.184a.876.876 0 0 0-.875-.875Z"
13
+ }));
14
+ };
15
+ export default SvgUndo;
@@ -0,0 +1,4 @@
1
+ import type { SVGProps } from 'react';
2
+ import React from 'react';
3
+ declare const SvgUnorderedList: (props: SVGProps<SVGSVGElement>) => React.JSX.Element;
4
+ export default SvgUnorderedList;
@@ -0,0 +1,15 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React from 'react';
3
+ var SvgUnorderedList = function SvgUnorderedList(props) {
4
+ return /*#__PURE__*/React.createElement("svg", _extends({
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ width: "1em",
7
+ height: "1em",
8
+ viewBox: "0 0 24 24"
9
+ }, props), /*#__PURE__*/React.createElement("path", {
10
+ fill: "currentColor",
11
+ fillRule: "nonzero",
12
+ d: "M17.469 7.625H9.484a.11.11 0 0 0-.109.11V8.5c0 .06.05.11.11.11h7.984c.06 0 .11-.05.11-.11v-.766a.11.11 0 0 0-.11-.109Zm0 3.883H9.484a.11.11 0 0 0-.109.11v.765c0 .06.05.11.11.11h7.984c.06 0 .11-.05.11-.11v-.766a.11.11 0 0 0-.11-.11Zm0 3.883H9.484a.11.11 0 0 0-.109.109v.766c0 .06.05.109.11.109h7.984c.06 0 .11-.05.11-.11V15.5a.11.11 0 0 0-.11-.11ZM6.422 8.117a.766.766 0 1 0 1.531 0 .766.766 0 0 0-1.531 0Zm0 3.883a.766.766 0 1 0 1.531 0 .766.766 0 0 0-1.531 0Zm0 3.883a.766.766 0 1 0 1.531 0 .766.766 0 0 0-1.531 0Z"
13
+ }));
14
+ };
15
+ export default SvgUnorderedList;
@@ -12,18 +12,23 @@ declare const _default: {
12
12
  readonly code: "Code Block";
13
13
  readonly delete: "Strikethrough";
14
14
  readonly emphasis: "Italic";
15
+ readonly enterFullscreen: "Enter Fullscreen";
16
+ readonly exitFullscreen: "Exit Fullscreen";
15
17
  readonly heading: "Heading";
16
18
  readonly image: "Image";
17
19
  readonly inlineCode: "Inline Code";
18
20
  readonly inlineMath: "Inline Formula";
19
21
  readonly link: "Link";
20
22
  readonly math: "Formula Block";
23
+ readonly orderedList: "Ordered List";
21
24
  readonly redo: "Redo";
22
25
  readonly strong: "Bold";
26
+ readonly table: "Table";
23
27
  readonly thematicBreak: "Thematic Break";
24
28
  readonly toHTML: "To HTML";
25
29
  readonly toMarkdown: "To Markdown";
26
30
  readonly undo: "Undo";
31
+ readonly unorderedList: "Unordered List";
27
32
  };
28
33
  };
29
34
  export default _default;
@@ -12,17 +12,22 @@ export default {
12
12
  code: 'Code Block',
13
13
  delete: 'Strikethrough',
14
14
  emphasis: 'Italic',
15
+ enterFullscreen: 'Enter Fullscreen',
16
+ exitFullscreen: 'Exit Fullscreen',
15
17
  heading: 'Heading',
16
18
  image: 'Image',
17
19
  inlineCode: 'Inline Code',
18
20
  inlineMath: 'Inline Formula',
19
21
  link: 'Link',
20
22
  math: 'Formula Block',
23
+ orderedList: 'Ordered List',
21
24
  redo: 'Redo',
22
25
  strong: 'Bold',
26
+ table: 'Table',
23
27
  thematicBreak: 'Thematic Break',
24
28
  toHTML: 'To HTML',
25
29
  toMarkdown: 'To Markdown',
26
- undo: 'Undo'
30
+ undo: 'Undo',
31
+ unorderedList: 'Unordered List'
27
32
  }
28
33
  };
@@ -23,18 +23,23 @@ export declare const useLocale: <T extends "fileInput" | "toolbarItem">(slice: T
23
23
  readonly code: "代码块";
24
24
  readonly delete: "删除线";
25
25
  readonly emphasis: "斜体";
26
+ readonly enterFullscreen: "进入全屏";
27
+ readonly exitFullscreen: "退出全屏";
26
28
  readonly heading: "标题";
27
29
  readonly image: "图片";
28
30
  readonly inlineCode: "行内代码";
29
31
  readonly inlineMath: "行内公式";
30
32
  readonly link: "链接";
31
33
  readonly math: "公式块";
34
+ readonly orderedList: "有序列表";
32
35
  readonly redo: "恢复";
33
36
  readonly strong: "粗体";
37
+ readonly table: "表格";
34
38
  readonly thematicBreak: "分隔线";
35
39
  readonly toHTML: "转成 HTML";
36
40
  readonly toMarkdown: "转成 Markdown";
37
41
  readonly undo: "撤销";
42
+ readonly unorderedList: "无序列表";
38
43
  };
39
44
  } | {
40
45
  readonly fileInput: {
@@ -50,18 +55,23 @@ export declare const useLocale: <T extends "fileInput" | "toolbarItem">(slice: T
50
55
  readonly code: "Code Block";
51
56
  readonly delete: "Strikethrough";
52
57
  readonly emphasis: "Italic";
58
+ readonly enterFullscreen: "Enter Fullscreen";
59
+ readonly exitFullscreen: "Exit Fullscreen";
53
60
  readonly heading: "Heading";
54
61
  readonly image: "Image";
55
62
  readonly inlineCode: "Inline Code";
56
63
  readonly inlineMath: "Inline Formula";
57
64
  readonly link: "Link";
58
65
  readonly math: "Formula Block";
66
+ readonly orderedList: "Ordered List";
59
67
  readonly redo: "Redo";
60
68
  readonly strong: "Bold";
69
+ readonly table: "Table";
61
70
  readonly thematicBreak: "Thematic Break";
62
71
  readonly toHTML: "To HTML";
63
72
  readonly toMarkdown: "To Markdown";
64
73
  readonly undo: "Undo";
74
+ readonly unorderedList: "Unordered List";
65
75
  };
66
76
  })[T][U];
67
77
  };
@@ -79,18 +89,23 @@ export declare const getFormat: <T extends "fileInput" | "toolbarItem">(locale:
79
89
  readonly code: "代码块";
80
90
  readonly delete: "删除线";
81
91
  readonly emphasis: "斜体";
92
+ readonly enterFullscreen: "进入全屏";
93
+ readonly exitFullscreen: "退出全屏";
82
94
  readonly heading: "标题";
83
95
  readonly image: "图片";
84
96
  readonly inlineCode: "行内代码";
85
97
  readonly inlineMath: "行内公式";
86
98
  readonly link: "链接";
87
99
  readonly math: "公式块";
100
+ readonly orderedList: "有序列表";
88
101
  readonly redo: "恢复";
89
102
  readonly strong: "粗体";
103
+ readonly table: "表格";
90
104
  readonly thematicBreak: "分隔线";
91
105
  readonly toHTML: "转成 HTML";
92
106
  readonly toMarkdown: "转成 Markdown";
93
107
  readonly undo: "撤销";
108
+ readonly unorderedList: "无序列表";
94
109
  };
95
110
  } | {
96
111
  readonly fileInput: {
@@ -106,18 +121,23 @@ export declare const getFormat: <T extends "fileInput" | "toolbarItem">(locale:
106
121
  readonly code: "Code Block";
107
122
  readonly delete: "Strikethrough";
108
123
  readonly emphasis: "Italic";
124
+ readonly enterFullscreen: "Enter Fullscreen";
125
+ readonly exitFullscreen: "Exit Fullscreen";
109
126
  readonly heading: "Heading";
110
127
  readonly image: "Image";
111
128
  readonly inlineCode: "Inline Code";
112
129
  readonly inlineMath: "Inline Formula";
113
130
  readonly link: "Link";
114
131
  readonly math: "Formula Block";
132
+ readonly orderedList: "Ordered List";
115
133
  readonly redo: "Redo";
116
134
  readonly strong: "Bold";
135
+ readonly table: "Table";
117
136
  readonly thematicBreak: "Thematic Break";
118
137
  readonly toHTML: "To HTML";
119
138
  readonly toMarkdown: "To Markdown";
120
139
  readonly undo: "Undo";
140
+ readonly unorderedList: "Unordered List";
121
141
  };
122
142
  })[T][U];
123
143
  export {};
@@ -12,18 +12,23 @@ declare const _default: {
12
12
  readonly code: "代码块";
13
13
  readonly delete: "删除线";
14
14
  readonly emphasis: "斜体";
15
+ readonly enterFullscreen: "进入全屏";
16
+ readonly exitFullscreen: "退出全屏";
15
17
  readonly heading: "标题";
16
18
  readonly image: "图片";
17
19
  readonly inlineCode: "行内代码";
18
20
  readonly inlineMath: "行内公式";
19
21
  readonly link: "链接";
20
22
  readonly math: "公式块";
23
+ readonly orderedList: "有序列表";
21
24
  readonly redo: "恢复";
22
25
  readonly strong: "粗体";
26
+ readonly table: "表格";
23
27
  readonly thematicBreak: "分隔线";
24
28
  readonly toHTML: "转成 HTML";
25
29
  readonly toMarkdown: "转成 Markdown";
26
30
  readonly undo: "撤销";
31
+ readonly unorderedList: "无序列表";
27
32
  };
28
33
  };
29
34
  export default _default;
@@ -12,17 +12,22 @@ export default {
12
12
  code: '代码块',
13
13
  delete: '删除线',
14
14
  emphasis: '斜体',
15
+ enterFullscreen: '进入全屏',
16
+ exitFullscreen: '退出全屏',
15
17
  heading: '标题',
16
18
  image: '图片',
17
19
  inlineCode: '行内代码',
18
20
  inlineMath: '行内公式',
19
21
  link: '链接',
20
22
  math: '公式块',
23
+ orderedList: '有序列表',
21
24
  redo: '恢复',
22
25
  strong: '粗体',
26
+ table: '表格',
23
27
  thematicBreak: '分隔线',
24
28
  toHTML: '转成 HTML',
25
29
  toMarkdown: '转成 Markdown',
26
- undo: '撤销'
30
+ undo: '撤销',
31
+ unorderedList: '无序列表'
27
32
  }
28
33
  };
@@ -79,11 +79,12 @@
79
79
  display: flex;
80
80
  flex-wrap: wrap;
81
81
  gap: 0.5em;
82
- color: rgba(0, 0, 0, 0.88);
83
82
  background-color: #e6f7ff;
84
83
  border: 1px solid #dedede;
85
84
  border-top-left-radius: 0.3em;
86
85
  border-top-right-radius: 0.3em;
86
+ position: relative;
87
+ color: rgba(0, 0, 0, 0.88);
87
88
  }
88
89
  .x-star-editor-toolbar .x-star-editor-button-container {
89
90
  position: relative;
@@ -91,6 +92,9 @@
91
92
  .x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button {
92
93
  width: 2em;
93
94
  height: 2em;
95
+ display: flex;
96
+ align-items: center;
97
+ justify-content: center;
94
98
  border-radius: 0.3em;
95
99
  cursor: pointer;
96
100
  user-select: none;
@@ -106,72 +110,7 @@
106
110
  background-color: #cbedfd;
107
111
  }
108
112
  .x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon {
109
- width: 100%;
110
- height: 100%;
111
- background-size: contain;
112
- }
113
- .x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-blockquote {
114
- background-image: url(icons/blockquote.svg);
115
- }
116
- .x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-code {
117
- background-image: url(icons/code.svg);
118
- }
119
- .x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-delete {
120
- background-image: url(icons/delete.svg);
121
- }
122
- .x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-emphasis {
123
- background-image: url(icons/emphasis.svg);
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
- }
131
- .x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-heading {
132
- background-image: url(icons/heading.svg);
133
- }
134
- .x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-image {
135
- background-image: url(icons/image.svg);
136
- }
137
- .x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-inline-code {
138
- background-image: url(icons/inline-code.svg);
139
- }
140
- .x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-inline-math {
141
- background-image: url(icons/inline-math.svg);
142
- }
143
- .x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-link {
144
- background-image: url(icons/link.svg);
145
- }
146
- .x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-math {
147
- background-image: url(icons/math.svg);
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
- }
152
- .x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-redo {
153
- background-image: url(icons/redo.svg);
154
- }
155
- .x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-strong {
156
- background-image: url(icons/strong.svg);
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
- }
161
- .x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-thematic-break {
162
- background-image: url(icons/thematic-break.svg);
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
- }
170
- .x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-undo {
171
- background-image: url(icons/undo.svg);
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);
113
+ font-size: 1.75em;
175
114
  }
176
115
  .x-star-editor-toolbar .x-star-editor-button-container .x-star-editor-tooltip {
177
116
  position: absolute;
@@ -253,11 +192,9 @@
253
192
  }
254
193
 
255
194
  .x-star-editor-md-editor {
256
- position: relative;
257
195
  padding: 0 1em;
258
196
  line-height: 1.6em;
259
197
  white-space: break-spaces;
260
- color: rgba(0, 0, 0, 0.88);
261
198
  background-color: #fff;
262
199
  border: 1px solid #dedede;
263
200
  border-top: none;
@@ -265,6 +202,8 @@
265
202
  border-bottom-left-radius: 0.3em;
266
203
  outline: none;
267
204
  overflow: auto;
205
+ position: relative;
206
+ color: rgba(0, 0, 0, 0.88);
268
207
  }
269
208
  .x-star-editor-md-editor > :first-child {
270
209
  margin-top: 1em;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * 容器选区,表示从锚点到焦点的文本
4
3
  */
@@ -33,10 +32,10 @@ export declare const getRange: ({ anchorOffset, focusOffset, }: ContainerSelecti
33
32
  /**
34
33
  * 获取一个可以设置文本和选区的容器
35
34
  *
35
+ * @param ref 容器挂载的 DOM 节点
36
36
  * @returns 容器
37
37
  */
38
- export declare const useContainer: () => {
39
- ref: import("react").RefObject<HTMLDivElement>;
38
+ export declare const useContainer: (ref: React.RefObject<HTMLDivElement>) => {
40
39
  normalize: () => void;
41
40
  getText: () => string;
42
41
  setText: (text: string) => void;
@@ -39,14 +39,10 @@ export var getRange = function getRange(_ref) {
39
39
  /**
40
40
  * 获取一个可以设置文本和选区的容器
41
41
  *
42
+ * @param ref 容器挂载的 DOM 节点
42
43
  * @returns 容器
43
44
  */
44
- export var useContainer = function useContainer() {
45
- /**
46
- * 容器挂载的 DOM 节点
47
- */
48
- var ref = useRef(null);
49
-
45
+ export var useContainer = function useContainer(ref) {
50
46
  /**
51
47
  * 是否在遍历时忽略节点及其子节点
52
48
  *
@@ -362,7 +358,6 @@ export var useContainer = function useContainer() {
362
358
  }
363
359
  };
364
360
  return useRef({
365
- ref: ref,
366
361
  normalize: normalize,
367
362
  getText: getText,
368
363
  setText: setText,
@@ -15,14 +15,14 @@ declare const toHastProcessor: import("unified").FrozenProcessor<import("mdast")
15
15
  /**
16
16
  * Hast 根节点
17
17
  */
18
- export type HastRoot = ReturnType<(typeof toHastProcessor)['runSync']>;
18
+ export type HastRoot = Awaited<ReturnType<(typeof toHastProcessor)['run']>>;
19
19
  /**
20
20
  * 将 Markdown 文本转成 Hast 树
21
21
  *
22
22
  * @param sourceCode Markdown 文本
23
23
  * @returns Hast 树
24
24
  */
25
- export declare const preViewerRender: (sourceCode: string) => import("hast").Root;
25
+ export declare const preViewerRender: (sourceCode: string) => Promise<import("hast").Root>;
26
26
  /**
27
27
  * 过滤模式
28
28
  */