x-star-editor 0.2.1 → 0.2.3
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/FileInput.js +2 -2
- package/dist/components/Toolbar.js +184 -44
- package/dist/icons/Blockquote.d.ts +4 -0
- package/dist/icons/Blockquote.js +16 -0
- package/dist/icons/Code.d.ts +4 -0
- package/dist/icons/Code.js +15 -0
- package/dist/icons/Delete.d.ts +4 -0
- package/dist/icons/Delete.js +15 -0
- package/dist/icons/Emphasis.d.ts +4 -0
- package/dist/icons/Emphasis.js +15 -0
- package/dist/icons/EnterFullscreen.d.ts +4 -0
- package/dist/icons/EnterFullscreen.js +15 -0
- package/dist/icons/ExitFullscreen.d.ts +4 -0
- package/dist/icons/ExitFullscreen.js +15 -0
- package/dist/icons/Heading.d.ts +4 -0
- package/dist/icons/Heading.js +15 -0
- package/dist/icons/Image.d.ts +4 -0
- package/dist/icons/Image.js +15 -0
- package/dist/icons/InlineCode.d.ts +4 -0
- package/dist/icons/InlineCode.js +19 -0
- package/dist/icons/InlineMath.d.ts +4 -0
- package/dist/icons/InlineMath.js +25 -0
- package/dist/icons/Link.d.ts +4 -0
- package/dist/icons/Link.js +15 -0
- package/dist/icons/Math.d.ts +4 -0
- package/dist/icons/Math.js +15 -0
- package/dist/icons/OrderedList.d.ts +4 -0
- package/dist/icons/OrderedList.js +15 -0
- package/dist/icons/Redo.d.ts +4 -0
- package/dist/icons/Redo.js +15 -0
- package/dist/icons/Strong.d.ts +4 -0
- package/dist/icons/Strong.js +15 -0
- package/dist/icons/Table.d.ts +4 -0
- package/dist/icons/Table.js +15 -0
- package/dist/icons/ThematicBreak.d.ts +4 -0
- package/dist/icons/ThematicBreak.js +15 -0
- package/dist/icons/ToHtml.d.ts +4 -0
- package/dist/icons/ToHtml.js +15 -0
- package/dist/icons/ToMarkdown.d.ts +4 -0
- package/dist/icons/ToMarkdown.js +15 -0
- package/dist/icons/Undo.d.ts +4 -0
- package/dist/icons/Undo.js +15 -0
- package/dist/icons/UnorderedList.d.ts +4 -0
- package/dist/icons/UnorderedList.js +15 -0
- package/dist/locales/en_US.d.ts +7 -0
- package/dist/locales/en_US.js +8 -1
- package/dist/locales/index.d.ts +28 -0
- package/dist/locales/zh_CN.d.ts +7 -0
- package/dist/locales/zh_CN.js +8 -1
- package/dist/styles/index.css +8 -48
- package/dist/utils/container.d.ts +2 -3
- package/dist/utils/container.js +2 -7
- package/dist/utils/markdown.d.ts +6 -6
- package/dist/utils/markdown.js +147 -50
- package/dist/x-star-editor/index.d.ts +3 -2
- package/dist/x-star-editor/index.js +12 -6
- package/dist/x-star-md-editor/index.js +4 -3
- package/dist/x-star-md-viewer/index.d.ts +1 -1
- package/dist/x-star-md-viewer/index.js +44 -14
- package/package.json +9 -5
- package/dist/styles/icons/blockquote.svg +0 -18
- package/dist/styles/icons/code.svg +0 -18
- package/dist/styles/icons/delete.svg +0 -18
- package/dist/styles/icons/emphasis.svg +0 -18
- package/dist/styles/icons/heading.svg +0 -16
- package/dist/styles/icons/image.svg +0 -18
- package/dist/styles/icons/inline-code.svg +0 -19
- package/dist/styles/icons/inline-math.svg +0 -20
- package/dist/styles/icons/link.svg +0 -18
- package/dist/styles/icons/math.svg +0 -17
- package/dist/styles/icons/redo.svg +0 -18
- package/dist/styles/icons/strong.svg +0 -18
- package/dist/styles/icons/thematic-break.svg +0 -18
- package/dist/styles/icons/undo.svg +0 -18
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
var SvgMath = function SvgMath(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: "evenodd",
|
|
12
|
+
d: "M15.7 7a.1.1 0 0 1 .074.033.2.2 0 0 1 .077.093l.891 2.242a.1.1 0 0 1-.093.137h-.784a.1.1 0 0 1-.093-.063l-.575-1.443H8.708l3.867 3.865a.2.2 0 0 1 .038.23l-.038.053-.566.565-3.284 3.282H15.2l.572-1.436a.1.1 0 0 1 .054-.055l.039-.008h.784a.1.1 0 0 1 .093.137l-.891 2.242a.2.2 0 0 1-.186.126H14.8l-7.3-.006a.2.2 0 0 1-.2-.2v-.8h.01l3.992-3.989-4.002-4V7.2c0-.11.09-.2.2-.2h8.2Z"
|
|
13
|
+
}));
|
|
14
|
+
};
|
|
15
|
+
export default SvgMath;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
var SvgOrderedList = function SvgOrderedList(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.578 15.39H9.594a.11.11 0 0 0-.11.11v.766c0 .06.05.109.11.109h7.984c.06 0 .11-.05.11-.11V15.5a.11.11 0 0 0-.11-.11Zm0-7.765H9.594a.11.11 0 0 0-.11.11V8.5c0 .06.05.11.11.11h7.984c.06 0 .11-.05.11-.11v-.766a.11.11 0 0 0-.11-.109Zm0 3.883H9.594a.11.11 0 0 0-.11.11v.765c0 .06.05.11.11.11h7.984c.06 0 .11-.05.11-.11v-.766a.11.11 0 0 0-.11-.11Zm-9.625 3.226H6.367a.055.055 0 0 0-.054.055v.465c0 .03.024.055.054.055h.99v.28h-.488a.055.055 0 0 0-.055.055v.464c0 .03.025.055.055.055h.488v.294h-.99a.055.055 0 0 0-.054.055v.465c0 .03.024.054.054.054h1.586c.03 0 .055-.024.055-.054v-2.188a.055.055 0 0 0-.055-.055ZM6.367 7.57h.52v1.64c0 .031.024.056.054.056h.547c.03 0 .055-.025.055-.055V7.078a.11.11 0 0 0-.11-.11H6.368a.055.055 0 0 0-.054.055v.493c0 .03.024.054.054.054Zm1.586 3.282H6.367a.055.055 0 0 0-.054.054v.492c0 .03.024.055.054.055h.935l-.96 1.062a.113.113 0 0 0-.03.074v.505c0 .03.025.054.055.054h1.586c.03 0 .055-.024.055-.054v-.492a.055.055 0 0 0-.055-.055h-.935l.961-1.062a.113.113 0 0 0 .029-.074v-.505a.055.055 0 0 0-.055-.054Z"
|
|
13
|
+
}));
|
|
14
|
+
};
|
|
15
|
+
export default SvgOrderedList;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
var SvgRedo = function SvgRedo(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: "M8.158 8.309h5.838V7.297a.11.11 0 0 1 .176-.086l1.942 1.531a.11.11 0 0 1 0 .172l-1.942 1.532a.11.11 0 0 1-.176-.087V9.348H8.322v6.425h8.285c.06 0 .11.05.11.11v.82c0 .06-.05.11-.11.11H8.158a.876.876 0 0 1-.875-.875V9.184c0-.483.393-.875.875-.875Z"
|
|
13
|
+
}));
|
|
14
|
+
};
|
|
15
|
+
export default SvgRedo;
|
|
@@ -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,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,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,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,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,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,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;
|
package/dist/locales/en_US.d.ts
CHANGED
|
@@ -12,16 +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";
|
|
28
|
+
readonly toHTML: "To HTML";
|
|
29
|
+
readonly toMarkdown: "To Markdown";
|
|
24
30
|
readonly undo: "Undo";
|
|
31
|
+
readonly unorderedList: "Unordered List";
|
|
25
32
|
};
|
|
26
33
|
};
|
|
27
34
|
export default _default;
|
package/dist/locales/en_US.js
CHANGED
|
@@ -12,15 +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',
|
|
29
|
+
toMarkdown: 'To Markdown',
|
|
30
|
+
undo: 'Undo',
|
|
31
|
+
unorderedList: 'Unordered List'
|
|
25
32
|
}
|
|
26
33
|
};
|
package/dist/locales/index.d.ts
CHANGED
|
@@ -23,16 +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: "分隔线";
|
|
39
|
+
readonly toHTML: "转成 HTML";
|
|
40
|
+
readonly toMarkdown: "转成 Markdown";
|
|
35
41
|
readonly undo: "撤销";
|
|
42
|
+
readonly unorderedList: "无序列表";
|
|
36
43
|
};
|
|
37
44
|
} | {
|
|
38
45
|
readonly fileInput: {
|
|
@@ -48,16 +55,23 @@ export declare const useLocale: <T extends "fileInput" | "toolbarItem">(slice: T
|
|
|
48
55
|
readonly code: "Code Block";
|
|
49
56
|
readonly delete: "Strikethrough";
|
|
50
57
|
readonly emphasis: "Italic";
|
|
58
|
+
readonly enterFullscreen: "Enter Fullscreen";
|
|
59
|
+
readonly exitFullscreen: "Exit Fullscreen";
|
|
51
60
|
readonly heading: "Heading";
|
|
52
61
|
readonly image: "Image";
|
|
53
62
|
readonly inlineCode: "Inline Code";
|
|
54
63
|
readonly inlineMath: "Inline Formula";
|
|
55
64
|
readonly link: "Link";
|
|
56
65
|
readonly math: "Formula Block";
|
|
66
|
+
readonly orderedList: "Ordered List";
|
|
57
67
|
readonly redo: "Redo";
|
|
58
68
|
readonly strong: "Bold";
|
|
69
|
+
readonly table: "Table";
|
|
59
70
|
readonly thematicBreak: "Thematic Break";
|
|
71
|
+
readonly toHTML: "To HTML";
|
|
72
|
+
readonly toMarkdown: "To Markdown";
|
|
60
73
|
readonly undo: "Undo";
|
|
74
|
+
readonly unorderedList: "Unordered List";
|
|
61
75
|
};
|
|
62
76
|
})[T][U];
|
|
63
77
|
};
|
|
@@ -75,16 +89,23 @@ export declare const getFormat: <T extends "fileInput" | "toolbarItem">(locale:
|
|
|
75
89
|
readonly code: "代码块";
|
|
76
90
|
readonly delete: "删除线";
|
|
77
91
|
readonly emphasis: "斜体";
|
|
92
|
+
readonly enterFullscreen: "进入全屏";
|
|
93
|
+
readonly exitFullscreen: "退出全屏";
|
|
78
94
|
readonly heading: "标题";
|
|
79
95
|
readonly image: "图片";
|
|
80
96
|
readonly inlineCode: "行内代码";
|
|
81
97
|
readonly inlineMath: "行内公式";
|
|
82
98
|
readonly link: "链接";
|
|
83
99
|
readonly math: "公式块";
|
|
100
|
+
readonly orderedList: "有序列表";
|
|
84
101
|
readonly redo: "恢复";
|
|
85
102
|
readonly strong: "粗体";
|
|
103
|
+
readonly table: "表格";
|
|
86
104
|
readonly thematicBreak: "分隔线";
|
|
105
|
+
readonly toHTML: "转成 HTML";
|
|
106
|
+
readonly toMarkdown: "转成 Markdown";
|
|
87
107
|
readonly undo: "撤销";
|
|
108
|
+
readonly unorderedList: "无序列表";
|
|
88
109
|
};
|
|
89
110
|
} | {
|
|
90
111
|
readonly fileInput: {
|
|
@@ -100,16 +121,23 @@ export declare const getFormat: <T extends "fileInput" | "toolbarItem">(locale:
|
|
|
100
121
|
readonly code: "Code Block";
|
|
101
122
|
readonly delete: "Strikethrough";
|
|
102
123
|
readonly emphasis: "Italic";
|
|
124
|
+
readonly enterFullscreen: "Enter Fullscreen";
|
|
125
|
+
readonly exitFullscreen: "Exit Fullscreen";
|
|
103
126
|
readonly heading: "Heading";
|
|
104
127
|
readonly image: "Image";
|
|
105
128
|
readonly inlineCode: "Inline Code";
|
|
106
129
|
readonly inlineMath: "Inline Formula";
|
|
107
130
|
readonly link: "Link";
|
|
108
131
|
readonly math: "Formula Block";
|
|
132
|
+
readonly orderedList: "Ordered List";
|
|
109
133
|
readonly redo: "Redo";
|
|
110
134
|
readonly strong: "Bold";
|
|
135
|
+
readonly table: "Table";
|
|
111
136
|
readonly thematicBreak: "Thematic Break";
|
|
137
|
+
readonly toHTML: "To HTML";
|
|
138
|
+
readonly toMarkdown: "To Markdown";
|
|
112
139
|
readonly undo: "Undo";
|
|
140
|
+
readonly unorderedList: "Unordered List";
|
|
113
141
|
};
|
|
114
142
|
})[T][U];
|
|
115
143
|
export {};
|
package/dist/locales/zh_CN.d.ts
CHANGED
|
@@ -12,16 +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: "分隔线";
|
|
28
|
+
readonly toHTML: "转成 HTML";
|
|
29
|
+
readonly toMarkdown: "转成 Markdown";
|
|
24
30
|
readonly undo: "撤销";
|
|
31
|
+
readonly unorderedList: "无序列表";
|
|
25
32
|
};
|
|
26
33
|
};
|
|
27
34
|
export default _default;
|
package/dist/locales/zh_CN.js
CHANGED
|
@@ -12,15 +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',
|
|
29
|
+
toMarkdown: '转成 Markdown',
|
|
30
|
+
undo: '撤销',
|
|
31
|
+
unorderedList: '无序列表'
|
|
25
32
|
}
|
|
26
33
|
};
|
package/dist/styles/index.css
CHANGED
|
@@ -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,51 +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
|
-
|
|
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-heading {
|
|
126
|
-
background-image: url(icons/heading.svg);
|
|
127
|
-
}
|
|
128
|
-
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-image {
|
|
129
|
-
background-image: url(icons/image.svg);
|
|
130
|
-
}
|
|
131
|
-
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-inline-code {
|
|
132
|
-
background-image: url(icons/inline-code.svg);
|
|
133
|
-
}
|
|
134
|
-
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-inline-math {
|
|
135
|
-
background-image: url(icons/inline-math.svg);
|
|
136
|
-
}
|
|
137
|
-
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-link {
|
|
138
|
-
background-image: url(icons/link.svg);
|
|
139
|
-
}
|
|
140
|
-
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-math {
|
|
141
|
-
background-image: url(icons/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-redo {
|
|
144
|
-
background-image: url(icons/redo.svg);
|
|
145
|
-
}
|
|
146
|
-
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-strong {
|
|
147
|
-
background-image: url(icons/strong.svg);
|
|
148
|
-
}
|
|
149
|
-
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-thematic-break {
|
|
150
|
-
background-image: url(icons/thematic-break.svg);
|
|
151
|
-
}
|
|
152
|
-
.x-star-editor-toolbar .x-star-editor-button-container > .x-star-editor-button .x-star-editor-icon.x-star-editor-icon-undo {
|
|
153
|
-
background-image: url(icons/undo.svg);
|
|
113
|
+
font-size: 1.75em;
|
|
154
114
|
}
|
|
155
115
|
.x-star-editor-toolbar .x-star-editor-button-container .x-star-editor-tooltip {
|
|
156
116
|
position: absolute;
|
|
@@ -232,11 +192,9 @@
|
|
|
232
192
|
}
|
|
233
193
|
|
|
234
194
|
.x-star-editor-md-editor {
|
|
235
|
-
position: relative;
|
|
236
195
|
padding: 0 1em;
|
|
237
196
|
line-height: 1.6em;
|
|
238
197
|
white-space: break-spaces;
|
|
239
|
-
color: rgba(0, 0, 0, 0.88);
|
|
240
198
|
background-color: #fff;
|
|
241
199
|
border: 1px solid #dedede;
|
|
242
200
|
border-top: none;
|
|
@@ -244,6 +202,8 @@
|
|
|
244
202
|
border-bottom-left-radius: 0.3em;
|
|
245
203
|
outline: none;
|
|
246
204
|
overflow: auto;
|
|
205
|
+
position: relative;
|
|
206
|
+
color: rgba(0, 0, 0, 0.88);
|
|
247
207
|
}
|
|
248
208
|
.x-star-editor-md-editor > :first-child {
|
|
249
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;
|
package/dist/utils/container.js
CHANGED
|
@@ -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,
|
package/dist/utils/markdown.d.ts
CHANGED
|
@@ -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)['
|
|
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
|
*/
|
|
@@ -35,7 +35,7 @@ export declare const getDefaultSchema: () => Schema;
|
|
|
35
35
|
* @param schema 过滤模式
|
|
36
36
|
* @returns 新的 Hast 树
|
|
37
37
|
*/
|
|
38
|
-
export declare const viewerRender: (root: HastRoot, schema: Schema) => import("hast").Root
|
|
38
|
+
export declare const viewerRender: (root: HastRoot, schema: Schema) => Promise<import("hast").Root>;
|
|
39
39
|
/**
|
|
40
40
|
* 将 Hast 树映射到 React 虚拟 DOM 树
|
|
41
41
|
*
|
|
@@ -50,19 +50,19 @@ export declare const postViewerRender: (root: HastRoot, options: ViewerOptions)
|
|
|
50
50
|
* @param sourceCode Markdown 文本
|
|
51
51
|
* @returns HTML 文本
|
|
52
52
|
*/
|
|
53
|
-
export declare const toHTML: (sourceCode: string) => string
|
|
53
|
+
export declare const toHTML: (sourceCode: string) => Promise<string>;
|
|
54
54
|
/**
|
|
55
55
|
* 将带有 HTML 的 Markdown 文本转成 Markdown 文本
|
|
56
56
|
*
|
|
57
57
|
* @param sourceCode 带有 HTML 的 Markdown 文本
|
|
58
58
|
* @returns Markdown 文本
|
|
59
59
|
*/
|
|
60
|
-
export declare const toMarkdown: (sourceCode: string) => string
|
|
60
|
+
export declare const toMarkdown: (sourceCode: string) => Promise<string>;
|
|
61
61
|
/**
|
|
62
62
|
* 将 Markdown 文本转成纯文本
|
|
63
63
|
*
|
|
64
64
|
* @param sourceCode Markdown 文本
|
|
65
65
|
* @returns 纯文本
|
|
66
66
|
*/
|
|
67
|
-
export declare const toText: (sourceCode: string) => string
|
|
67
|
+
export declare const toText: (sourceCode: string) => Promise<string>;
|
|
68
68
|
export {};
|