x-star-editor 0.2.3 → 0.2.5
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.d.ts +3 -3
- package/dist/components/Toolbar.js +91 -91
- package/dist/icons/EditOnly.d.ts +4 -0
- package/dist/icons/EditOnly.js +15 -0
- package/dist/icons/Help.d.ts +4 -0
- package/dist/icons/Help.js +26 -0
- package/dist/icons/Mermaid.d.ts +4 -0
- package/dist/icons/Mermaid.js +15 -0
- package/dist/icons/TaskList.d.ts +4 -0
- package/dist/icons/TaskList.js +24 -0
- package/dist/icons/ViewOnly.d.ts +4 -0
- package/dist/icons/ViewOnly.js +15 -0
- package/dist/index.d.ts +2 -1
- package/dist/locales/en_US.d.ts +5 -0
- package/dist/locales/en_US.js +6 -1
- package/dist/locales/index.d.ts +20 -0
- package/dist/locales/zh_CN.d.ts +5 -0
- package/dist/locales/zh_CN.js +6 -1
- package/dist/utils/container.js +14 -14
- package/dist/utils/history.d.ts +3 -1
- package/dist/utils/history.js +17 -13
- package/dist/utils/markdown.d.ts +6 -14
- package/dist/utils/markdown.js +72 -137
- package/dist/utils/rehype/rehype-line.d.ts +6 -0
- package/dist/utils/rehype/rehype-line.js +17 -0
- package/dist/utils/rehype/rehype-math.d.ts +13 -0
- package/dist/utils/rehype/rehype-math.js +167 -0
- package/dist/utils/rehype/rehype-raw-positions.d.ts +6 -0
- package/dist/utils/rehype/rehype-raw-positions.js +30 -0
- package/dist/x-star-md-editor/index.js +2 -5
- package/dist/x-star-md-viewer/index.js +8 -22
- package/package.json +4 -2
|
@@ -7,7 +7,7 @@ interface ToolbarItemProps {
|
|
|
7
7
|
popoverRender?: (exec: Executor, close: () => void) => React.ReactNode;
|
|
8
8
|
onClick?: (exec: Executor) => void;
|
|
9
9
|
}
|
|
10
|
-
type ToolbarItem = ToolbarItemProps | Handler<ToolbarItemProps>;
|
|
10
|
+
export type ToolbarItem = ToolbarItemProps | Handler<ToolbarItemProps>;
|
|
11
11
|
export type ToolbarItemMap = Partial<Record<string, ToolbarItem>>;
|
|
12
12
|
export declare const getDefaultToolbarItemMap: (locale?: string, onInsertFile?: ((file: File, options: {
|
|
13
13
|
description: string;
|
|
@@ -18,8 +18,8 @@ export declare const getDefaultToolbarItems: () => ToolbarItems;
|
|
|
18
18
|
interface ToolbarProps {
|
|
19
19
|
className?: string;
|
|
20
20
|
style?: React.CSSProperties;
|
|
21
|
-
itemMap:
|
|
22
|
-
items:
|
|
21
|
+
itemMap: ToolbarItemMap;
|
|
22
|
+
items: ToolbarItems;
|
|
23
23
|
exec: Executor;
|
|
24
24
|
}
|
|
25
25
|
declare const Toolbar: ({ className, style, itemMap, items, exec }: ToolbarProps) => React.JSX.Element;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
3
|
import classNames from 'classnames';
|
|
@@ -7,26 +5,30 @@ import React, { useEffect, useRef, useState } from 'react';
|
|
|
7
5
|
import SvgBlockquote from "../icons/Blockquote";
|
|
8
6
|
import SvgCode from "../icons/Code";
|
|
9
7
|
import SvgDelete from "../icons/Delete";
|
|
8
|
+
import SvgEditOnly from "../icons/EditOnly";
|
|
10
9
|
import SvgEmphasis from "../icons/Emphasis";
|
|
11
10
|
import SvgEnterFullscreen from "../icons/EnterFullscreen";
|
|
12
11
|
import SvgExitFullscreen from "../icons/ExitFullscreen";
|
|
13
12
|
import SvgHeading from "../icons/Heading";
|
|
13
|
+
import SvgHelp from "../icons/Help";
|
|
14
14
|
import SvgImage from "../icons/Image";
|
|
15
15
|
import SvgInlineCode from "../icons/InlineCode";
|
|
16
16
|
import SvgInlineMath from "../icons/InlineMath";
|
|
17
17
|
import SvgLink from "../icons/Link";
|
|
18
18
|
import SvgMath from "../icons/Math";
|
|
19
|
+
import SvgMermaid from "../icons/Mermaid";
|
|
19
20
|
import SvgOrderedList from "../icons/OrderedList";
|
|
20
21
|
import SvgRedo from "../icons/Redo";
|
|
21
22
|
import SvgStrong from "../icons/Strong";
|
|
22
23
|
import SvgTable from "../icons/Table";
|
|
24
|
+
import SvgTaskList from "../icons/TaskList";
|
|
23
25
|
import SvgThematicBreak from "../icons/ThematicBreak";
|
|
24
26
|
import SvgToHTML from "../icons/ToHtml";
|
|
25
27
|
import SvgToMarkdown from "../icons/ToMarkdown";
|
|
26
28
|
import SvgUndo from "../icons/Undo";
|
|
27
29
|
import SvgUnorderedList from "../icons/UnorderedList";
|
|
30
|
+
import SvgViewOnly from "../icons/ViewOnly";
|
|
28
31
|
import { getFormat } from "../locales";
|
|
29
|
-
import { createSelection } from "../utils/container";
|
|
30
32
|
import { prefix } from "../utils/global";
|
|
31
33
|
import { redoHandler, toggleHandler, undoHandler } from "../utils/handler";
|
|
32
34
|
import { toHTML, toMarkdown } from "../utils/markdown";
|
|
@@ -133,13 +135,15 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
|
|
|
133
135
|
}),
|
|
134
136
|
tooltip: t('code'),
|
|
135
137
|
popoverRender: function popoverRender(exec, close) {
|
|
136
|
-
var optionRender = function optionRender(label,
|
|
138
|
+
var optionRender = function optionRender(label, lang) {
|
|
137
139
|
return /*#__PURE__*/React.createElement("div", {
|
|
138
140
|
className: classNames("".concat(prefix, "option")),
|
|
139
141
|
onClick: function onClick() {
|
|
140
142
|
exec(toggleHandler({
|
|
141
143
|
type: 'code',
|
|
142
|
-
|
|
144
|
+
lang: lang,
|
|
145
|
+
value: '',
|
|
146
|
+
showLineNumbers: true
|
|
143
147
|
}));
|
|
144
148
|
close();
|
|
145
149
|
}
|
|
@@ -159,6 +163,12 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
|
|
|
159
163
|
}));
|
|
160
164
|
}
|
|
161
165
|
},
|
|
166
|
+
editOnly: {
|
|
167
|
+
children: /*#__PURE__*/React.createElement(SvgEditOnly, {
|
|
168
|
+
className: classNames("".concat(prefix, "icon"))
|
|
169
|
+
}),
|
|
170
|
+
tooltip: t('editOnly')
|
|
171
|
+
},
|
|
162
172
|
emphasis: {
|
|
163
173
|
children: /*#__PURE__*/React.createElement(SvgEmphasis, {
|
|
164
174
|
className: classNames("".concat(prefix, "icon"))
|
|
@@ -202,6 +212,12 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
|
|
|
202
212
|
return /*#__PURE__*/React.createElement(React.Fragment, null, optionRender(1, '1.6em'), optionRender(2, '1.3em'), optionRender(3, '1.2em'), optionRender(4, '1.1em'), optionRender(5, '1em'), optionRender(6, '0.9em'));
|
|
203
213
|
}
|
|
204
214
|
},
|
|
215
|
+
help: {
|
|
216
|
+
children: /*#__PURE__*/React.createElement(SvgHelp, {
|
|
217
|
+
className: classNames("".concat(prefix, "icon"))
|
|
218
|
+
}),
|
|
219
|
+
tooltip: t('help')
|
|
220
|
+
},
|
|
205
221
|
image: {
|
|
206
222
|
children: /*#__PURE__*/React.createElement(SvgImage, {
|
|
207
223
|
className: classNames("".concat(prefix, "icon"))
|
|
@@ -287,6 +303,20 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
|
|
|
287
303
|
}));
|
|
288
304
|
}
|
|
289
305
|
},
|
|
306
|
+
mermaid: {
|
|
307
|
+
children: /*#__PURE__*/React.createElement(SvgMermaid, {
|
|
308
|
+
className: classNames("".concat(prefix, "icon"))
|
|
309
|
+
}),
|
|
310
|
+
tooltip: t('mermaid'),
|
|
311
|
+
onClick: function onClick(exec) {
|
|
312
|
+
return exec(toggleHandler({
|
|
313
|
+
type: 'code',
|
|
314
|
+
lang: 'mermaid',
|
|
315
|
+
value: "flowchart TB\n A --> C\n A --> D\n B --> C\n B --> D",
|
|
316
|
+
showLineNumbers: false
|
|
317
|
+
}));
|
|
318
|
+
}
|
|
319
|
+
},
|
|
290
320
|
orderedList: {
|
|
291
321
|
children: /*#__PURE__*/React.createElement(SvgOrderedList, {
|
|
292
322
|
className: classNames("".concat(prefix, "icon"))
|
|
@@ -323,6 +353,12 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
|
|
|
323
353
|
}),
|
|
324
354
|
tooltip: t('table')
|
|
325
355
|
},
|
|
356
|
+
taskList: {
|
|
357
|
+
children: /*#__PURE__*/React.createElement(SvgTaskList, {
|
|
358
|
+
className: classNames("".concat(prefix, "icon"))
|
|
359
|
+
}),
|
|
360
|
+
tooltip: t('taskList')
|
|
361
|
+
},
|
|
326
362
|
thematicBreak: {
|
|
327
363
|
children: /*#__PURE__*/React.createElement(SvgThematicBreak, {
|
|
328
364
|
className: classNames("".concat(prefix, "icon"))
|
|
@@ -340,40 +376,19 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
|
|
|
340
376
|
}),
|
|
341
377
|
tooltip: t('toHTML'),
|
|
342
378
|
onClick: function onClick(exec) {
|
|
343
|
-
return exec(
|
|
344
|
-
var
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
_context.t3 = {
|
|
357
|
-
sourceCode: _context.t1,
|
|
358
|
-
selection: _context.t2
|
|
359
|
-
};
|
|
360
|
-
_context.t4 = selection;
|
|
361
|
-
_context.t5 = {
|
|
362
|
-
type: 'set',
|
|
363
|
-
payload: _context.t3,
|
|
364
|
-
selection: _context.t4
|
|
365
|
-
};
|
|
366
|
-
return _context.abrupt("return", (0, _context.t0)(_context.t5));
|
|
367
|
-
case 10:
|
|
368
|
-
case "end":
|
|
369
|
-
return _context.stop();
|
|
370
|
-
}
|
|
371
|
-
}, _callee);
|
|
372
|
-
}));
|
|
373
|
-
return function (_x) {
|
|
374
|
-
return _ref4.apply(this, arguments);
|
|
375
|
-
};
|
|
376
|
-
}());
|
|
379
|
+
return exec(function (_ref3) {
|
|
380
|
+
var sourceCode = _ref3.sourceCode,
|
|
381
|
+
selection = _ref3.selection,
|
|
382
|
+
dispatch = _ref3.dispatch;
|
|
383
|
+
return dispatch({
|
|
384
|
+
type: 'set',
|
|
385
|
+
payload: {
|
|
386
|
+
sourceCode: toHTML(sourceCode),
|
|
387
|
+
selection: selection
|
|
388
|
+
},
|
|
389
|
+
selection: selection
|
|
390
|
+
});
|
|
391
|
+
});
|
|
377
392
|
}
|
|
378
393
|
},
|
|
379
394
|
toMarkdown: {
|
|
@@ -382,44 +397,23 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
|
|
|
382
397
|
}),
|
|
383
398
|
tooltip: t('toMarkdown'),
|
|
384
399
|
onClick: function onClick(exec) {
|
|
385
|
-
return exec(
|
|
386
|
-
var
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
_context2.t3 = {
|
|
399
|
-
sourceCode: _context2.t1,
|
|
400
|
-
selection: _context2.t2
|
|
401
|
-
};
|
|
402
|
-
_context2.t4 = selection;
|
|
403
|
-
_context2.t5 = {
|
|
404
|
-
type: 'set',
|
|
405
|
-
payload: _context2.t3,
|
|
406
|
-
selection: _context2.t4
|
|
407
|
-
};
|
|
408
|
-
return _context2.abrupt("return", (0, _context2.t0)(_context2.t5));
|
|
409
|
-
case 10:
|
|
410
|
-
case "end":
|
|
411
|
-
return _context2.stop();
|
|
412
|
-
}
|
|
413
|
-
}, _callee2);
|
|
414
|
-
}));
|
|
415
|
-
return function (_x2) {
|
|
416
|
-
return _ref6.apply(this, arguments);
|
|
417
|
-
};
|
|
418
|
-
}());
|
|
400
|
+
return exec(function (_ref4) {
|
|
401
|
+
var sourceCode = _ref4.sourceCode,
|
|
402
|
+
selection = _ref4.selection,
|
|
403
|
+
dispatch = _ref4.dispatch;
|
|
404
|
+
return dispatch({
|
|
405
|
+
type: 'set',
|
|
406
|
+
payload: {
|
|
407
|
+
sourceCode: toMarkdown(sourceCode),
|
|
408
|
+
selection: selection
|
|
409
|
+
},
|
|
410
|
+
selection: selection
|
|
411
|
+
});
|
|
412
|
+
});
|
|
419
413
|
}
|
|
420
414
|
},
|
|
421
|
-
undo: function undo(
|
|
422
|
-
var history =
|
|
415
|
+
undo: function undo(_ref5) {
|
|
416
|
+
var history = _ref5.history;
|
|
423
417
|
return {
|
|
424
418
|
children: /*#__PURE__*/React.createElement(SvgUndo, {
|
|
425
419
|
className: classNames("".concat(prefix, "icon"))
|
|
@@ -436,23 +430,29 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
|
|
|
436
430
|
className: classNames("".concat(prefix, "icon"))
|
|
437
431
|
}),
|
|
438
432
|
tooltip: t('unorderedList')
|
|
433
|
+
},
|
|
434
|
+
viewOnly: {
|
|
435
|
+
children: /*#__PURE__*/React.createElement(SvgViewOnly, {
|
|
436
|
+
className: classNames("".concat(prefix, "icon"))
|
|
437
|
+
}),
|
|
438
|
+
tooltip: t('viewOnly')
|
|
439
439
|
}
|
|
440
440
|
};
|
|
441
441
|
};
|
|
442
442
|
export var getDefaultToolbarItems = function getDefaultToolbarItems() {
|
|
443
|
-
return [['heading', 'strong', 'emphasis', 'delete'], ['thematicBreak', 'blockquote'],
|
|
444
|
-
// ['
|
|
445
|
-
['
|
|
446
|
-
// ['fullscreen'],
|
|
443
|
+
return [['heading', 'strong', 'emphasis', 'delete'], ['thematicBreak', 'blockquote' /** 'table' */], ['link', 'image', 'mermaid'], ['inlineCode', 'code', 'inlineMath', 'math'], ['undo', 'redo'],
|
|
444
|
+
// ['orderedList', 'unorderedList', 'taskList'],
|
|
445
|
+
['toMarkdown', 'toHTML']
|
|
446
|
+
// ['help', 'editOnly', 'viewOnly', 'fullscreen'],
|
|
447
447
|
];
|
|
448
448
|
};
|
|
449
449
|
|
|
450
|
-
var Toolbar = function Toolbar(
|
|
451
|
-
var className =
|
|
452
|
-
style =
|
|
453
|
-
itemMap =
|
|
454
|
-
items =
|
|
455
|
-
exec =
|
|
450
|
+
var Toolbar = function Toolbar(_ref6) {
|
|
451
|
+
var className = _ref6.className,
|
|
452
|
+
style = _ref6.style,
|
|
453
|
+
itemMap = _ref6.itemMap,
|
|
454
|
+
items = _ref6.items,
|
|
455
|
+
exec = _ref6.exec;
|
|
456
456
|
var toolbarRef = useRef(null);
|
|
457
457
|
var ctx = exec(function (ctx) {
|
|
458
458
|
return ctx;
|
|
@@ -471,12 +471,12 @@ var Toolbar = function Toolbar(_ref8) {
|
|
|
471
471
|
if (!toolbarItem) {
|
|
472
472
|
return undefined;
|
|
473
473
|
}
|
|
474
|
-
var
|
|
475
|
-
children =
|
|
476
|
-
disabled =
|
|
477
|
-
tooltip =
|
|
478
|
-
_popoverRender =
|
|
479
|
-
_onClick2 =
|
|
474
|
+
var _ref7 = typeof toolbarItem === 'function' ? toolbarItem(ctx) : toolbarItem,
|
|
475
|
+
children = _ref7.children,
|
|
476
|
+
disabled = _ref7.disabled,
|
|
477
|
+
tooltip = _ref7.tooltip,
|
|
478
|
+
_popoverRender = _ref7.popoverRender,
|
|
479
|
+
_onClick2 = _ref7.onClick;
|
|
480
480
|
return /*#__PURE__*/React.createElement(Button, {
|
|
481
481
|
key: index,
|
|
482
482
|
toolbarRef: toolbarRef,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
var SvgEditOnly = function SvgEditOnly(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.992 6.531h.916c.05 0 .092.05.092.11v10.718c0 .06-.041.11-.092.11h-.916c-.05 0-.092-.05-.092-.11V6.641c0-.06.041-.11.092-.11Zm-1.859 0c.255 0 .46.204.46.456v10.025a.458.458 0 0 1-.46.455H7.454a.458.458 0 0 1-.46-.455V6.987c0-.252.206-.456.46-.456h6.68ZM7.998 16.49h5.6v-9h-5.6v9Z"
|
|
13
|
+
}));
|
|
14
|
+
};
|
|
15
|
+
export default SvgEditOnly;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
var SvgHelp = function SvgHelp(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("g", {
|
|
10
|
+
fill: "none",
|
|
11
|
+
fillRule: "evenodd",
|
|
12
|
+
transform: "translate(5 5)"
|
|
13
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
14
|
+
width: 10,
|
|
15
|
+
height: 10,
|
|
16
|
+
x: 2,
|
|
17
|
+
y: 2,
|
|
18
|
+
stroke: "currentColor",
|
|
19
|
+
rx: 1
|
|
20
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
21
|
+
fill: "currentColor",
|
|
22
|
+
fillRule: "nonzero",
|
|
23
|
+
d: "M8.526 4.33A2.305 2.305 0 0 0 7 3.773c-.574 0-1.116.199-1.526.557a1.864 1.864 0 0 0-.662 1.412v.104c0 .06.05.11.11.11h.656c.06 0 .11-.05.11-.11v-.104c0-.603.589-1.094 1.312-1.094.723 0 1.313.491 1.313 1.094 0 .425-.301.815-.767.994a1.528 1.528 0 0 0-.985 1.447v.294c0 .06.05.109.11.109h.656c.06 0 .11-.05.11-.11v-.31c0-.27.169-.515.422-.612.806-.31 1.327-1.022 1.327-1.812a1.858 1.858 0 0 0-.66-1.412Zm-2.073 5.678a.547.547 0 1 0 1.094 0 .547.547 0 0 0-1.094 0Z"
|
|
24
|
+
})));
|
|
25
|
+
};
|
|
26
|
+
export default SvgHelp;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
var SvgMermaid = function SvgMermaid(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.936 13.576h-1.295v-1.894a.1.1 0 0 0-.1-.1h-3.09v-1.195h1.346a.2.2 0 0 0 .2-.2V6.6a.2.2 0 0 0-.2-.199h-3.588a.2.2 0 0 0-.2.2v3.587c0 .11.09.2.2.2h1.345v1.196h-3.09a.1.1 0 0 0-.099.1v1.893H7.069a.2.2 0 0 0-.199.2v3.587c0 .11.09.2.2.2h3.587a.2.2 0 0 0 .2-.2v-3.588a.2.2 0 0 0-.2-.199H9.262V12.48h5.482v1.096h-1.396a.2.2 0 0 0-.199.2v3.587c0 .11.09.2.2.2h3.587a.2.2 0 0 0 .2-.2v-3.588a.2.2 0 0 0-.2-.199Zm-7.026.947v2.093H7.817v-2.093H9.91Zm1.046-5.083V7.347h2.093V9.44h-2.093Zm5.233 7.176h-2.093v-2.093h2.093v2.093Z"
|
|
13
|
+
}));
|
|
14
|
+
};
|
|
15
|
+
export default SvgMermaid;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
var SvgTaskList = function SvgTaskList(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("g", {
|
|
10
|
+
fill: "none",
|
|
11
|
+
fillRule: "evenodd"
|
|
12
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
13
|
+
fill: "currentColor",
|
|
14
|
+
fillRule: "nonzero",
|
|
15
|
+
d: "M17.869 7.625H9.884a.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-.109ZM17.869 11.508H9.884a.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-.11ZM17.869 15.39H9.884a.11.11 0 0 0-.109.11v.766c0 .06.05.109.11.109h7.984c.06 0 .11-.05.11-.11V15.5a.11.11 0 0 0-.11-.11Z"
|
|
16
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
17
|
+
stroke: "currentColor",
|
|
18
|
+
strokeLinecap: "square",
|
|
19
|
+
strokeLinejoin: "round",
|
|
20
|
+
strokeWidth: 0.75,
|
|
21
|
+
d: "m6.4 8.25.75.75 1.5-1.5M6.4 11.75l.75.75 1.5-1.5M6.4 15.75l.75.75 1.5-1.5"
|
|
22
|
+
})));
|
|
23
|
+
};
|
|
24
|
+
export default SvgTaskList;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
var SvgViewOnly = function SvgViewOnly(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.008 6.531h-.916c-.05 0-.092.05-.092.11v10.718c0 .06.041.11.092.11h.916c.05 0 .092-.05.092-.11V6.641c0-.06-.041-.11-.092-.11Zm1.859 0a.458.458 0 0 0-.46.456v10.025c0 .252.205.455.46.455h6.679c.254 0 .46-.203.46-.455V6.987a.458.458 0 0 0-.46-.456h-6.68Zm6.135 9.959h-5.6v-9h5.6v9Z"
|
|
13
|
+
}));
|
|
14
|
+
};
|
|
15
|
+
export default SvgViewOnly;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export type { ToolbarItem } from './components/Toolbar';
|
|
1
2
|
export { createSelection, getRange } from './utils/container';
|
|
2
3
|
export { deleteHandler, insertHandler, redoHandler, selectHandler, setHandler, toggleHandler, undoHandler, } from './utils/handler';
|
|
3
|
-
export type { Handler } from './utils/handler';
|
|
4
|
+
export type { Executor, Handler, KeyboardEventHandler } from './utils/handler';
|
|
4
5
|
export { toHTML, toMarkdown, toText } from './utils/markdown';
|
|
5
6
|
export { default as XStarEditor, useEditorRef } from './x-star-editor';
|
|
6
7
|
export type { XStarEditorHandle, XStarEditorProps } from './x-star-editor';
|
package/dist/locales/en_US.d.ts
CHANGED
|
@@ -11,24 +11,29 @@ declare const _default: {
|
|
|
11
11
|
readonly blockquote: "Blockquote";
|
|
12
12
|
readonly code: "Code Block";
|
|
13
13
|
readonly delete: "Strikethrough";
|
|
14
|
+
readonly editOnly: "Edit Only";
|
|
14
15
|
readonly emphasis: "Italic";
|
|
15
16
|
readonly enterFullscreen: "Enter Fullscreen";
|
|
16
17
|
readonly exitFullscreen: "Exit Fullscreen";
|
|
17
18
|
readonly heading: "Heading";
|
|
19
|
+
readonly help: "Help";
|
|
18
20
|
readonly image: "Image";
|
|
19
21
|
readonly inlineCode: "Inline Code";
|
|
20
22
|
readonly inlineMath: "Inline Formula";
|
|
21
23
|
readonly link: "Link";
|
|
22
24
|
readonly math: "Formula Block";
|
|
25
|
+
readonly mermaid: "Mermaid";
|
|
23
26
|
readonly orderedList: "Ordered List";
|
|
24
27
|
readonly redo: "Redo";
|
|
25
28
|
readonly strong: "Bold";
|
|
26
29
|
readonly table: "Table";
|
|
30
|
+
readonly taskList: "Task List";
|
|
27
31
|
readonly thematicBreak: "Thematic Break";
|
|
28
32
|
readonly toHTML: "To HTML";
|
|
29
33
|
readonly toMarkdown: "To Markdown";
|
|
30
34
|
readonly undo: "Undo";
|
|
31
35
|
readonly unorderedList: "Unordered List";
|
|
36
|
+
readonly viewOnly: "View Only";
|
|
32
37
|
};
|
|
33
38
|
};
|
|
34
39
|
export default _default;
|
package/dist/locales/en_US.js
CHANGED
|
@@ -11,23 +11,28 @@ export default {
|
|
|
11
11
|
blockquote: 'Blockquote',
|
|
12
12
|
code: 'Code Block',
|
|
13
13
|
delete: 'Strikethrough',
|
|
14
|
+
editOnly: 'Edit Only',
|
|
14
15
|
emphasis: 'Italic',
|
|
15
16
|
enterFullscreen: 'Enter Fullscreen',
|
|
16
17
|
exitFullscreen: 'Exit Fullscreen',
|
|
17
18
|
heading: 'Heading',
|
|
19
|
+
help: 'Help',
|
|
18
20
|
image: 'Image',
|
|
19
21
|
inlineCode: 'Inline Code',
|
|
20
22
|
inlineMath: 'Inline Formula',
|
|
21
23
|
link: 'Link',
|
|
22
24
|
math: 'Formula Block',
|
|
25
|
+
mermaid: 'Mermaid',
|
|
23
26
|
orderedList: 'Ordered List',
|
|
24
27
|
redo: 'Redo',
|
|
25
28
|
strong: 'Bold',
|
|
26
29
|
table: 'Table',
|
|
30
|
+
taskList: 'Task List',
|
|
27
31
|
thematicBreak: 'Thematic Break',
|
|
28
32
|
toHTML: 'To HTML',
|
|
29
33
|
toMarkdown: 'To Markdown',
|
|
30
34
|
undo: 'Undo',
|
|
31
|
-
unorderedList: 'Unordered List'
|
|
35
|
+
unorderedList: 'Unordered List',
|
|
36
|
+
viewOnly: 'View Only'
|
|
32
37
|
}
|
|
33
38
|
};
|
package/dist/locales/index.d.ts
CHANGED
|
@@ -22,24 +22,29 @@ export declare const useLocale: <T extends "fileInput" | "toolbarItem">(slice: T
|
|
|
22
22
|
readonly blockquote: "引用";
|
|
23
23
|
readonly code: "代码块";
|
|
24
24
|
readonly delete: "删除线";
|
|
25
|
+
readonly editOnly: "仅编辑";
|
|
25
26
|
readonly emphasis: "斜体";
|
|
26
27
|
readonly enterFullscreen: "进入全屏";
|
|
27
28
|
readonly exitFullscreen: "退出全屏";
|
|
28
29
|
readonly heading: "标题";
|
|
30
|
+
readonly help: "帮助";
|
|
29
31
|
readonly image: "图片";
|
|
30
32
|
readonly inlineCode: "行内代码";
|
|
31
33
|
readonly inlineMath: "行内公式";
|
|
32
34
|
readonly link: "链接";
|
|
33
35
|
readonly math: "公式块";
|
|
36
|
+
readonly mermaid: "Mermaid";
|
|
34
37
|
readonly orderedList: "有序列表";
|
|
35
38
|
readonly redo: "恢复";
|
|
36
39
|
readonly strong: "粗体";
|
|
37
40
|
readonly table: "表格";
|
|
41
|
+
readonly taskList: "任务列表";
|
|
38
42
|
readonly thematicBreak: "分隔线";
|
|
39
43
|
readonly toHTML: "转成 HTML";
|
|
40
44
|
readonly toMarkdown: "转成 Markdown";
|
|
41
45
|
readonly undo: "撤销";
|
|
42
46
|
readonly unorderedList: "无序列表";
|
|
47
|
+
readonly viewOnly: "仅查看";
|
|
43
48
|
};
|
|
44
49
|
} | {
|
|
45
50
|
readonly fileInput: {
|
|
@@ -54,24 +59,29 @@ export declare const useLocale: <T extends "fileInput" | "toolbarItem">(slice: T
|
|
|
54
59
|
readonly blockquote: "Blockquote";
|
|
55
60
|
readonly code: "Code Block";
|
|
56
61
|
readonly delete: "Strikethrough";
|
|
62
|
+
readonly editOnly: "Edit Only";
|
|
57
63
|
readonly emphasis: "Italic";
|
|
58
64
|
readonly enterFullscreen: "Enter Fullscreen";
|
|
59
65
|
readonly exitFullscreen: "Exit Fullscreen";
|
|
60
66
|
readonly heading: "Heading";
|
|
67
|
+
readonly help: "Help";
|
|
61
68
|
readonly image: "Image";
|
|
62
69
|
readonly inlineCode: "Inline Code";
|
|
63
70
|
readonly inlineMath: "Inline Formula";
|
|
64
71
|
readonly link: "Link";
|
|
65
72
|
readonly math: "Formula Block";
|
|
73
|
+
readonly mermaid: "Mermaid";
|
|
66
74
|
readonly orderedList: "Ordered List";
|
|
67
75
|
readonly redo: "Redo";
|
|
68
76
|
readonly strong: "Bold";
|
|
69
77
|
readonly table: "Table";
|
|
78
|
+
readonly taskList: "Task List";
|
|
70
79
|
readonly thematicBreak: "Thematic Break";
|
|
71
80
|
readonly toHTML: "To HTML";
|
|
72
81
|
readonly toMarkdown: "To Markdown";
|
|
73
82
|
readonly undo: "Undo";
|
|
74
83
|
readonly unorderedList: "Unordered List";
|
|
84
|
+
readonly viewOnly: "View Only";
|
|
75
85
|
};
|
|
76
86
|
})[T][U];
|
|
77
87
|
};
|
|
@@ -88,24 +98,29 @@ export declare const getFormat: <T extends "fileInput" | "toolbarItem">(locale:
|
|
|
88
98
|
readonly blockquote: "引用";
|
|
89
99
|
readonly code: "代码块";
|
|
90
100
|
readonly delete: "删除线";
|
|
101
|
+
readonly editOnly: "仅编辑";
|
|
91
102
|
readonly emphasis: "斜体";
|
|
92
103
|
readonly enterFullscreen: "进入全屏";
|
|
93
104
|
readonly exitFullscreen: "退出全屏";
|
|
94
105
|
readonly heading: "标题";
|
|
106
|
+
readonly help: "帮助";
|
|
95
107
|
readonly image: "图片";
|
|
96
108
|
readonly inlineCode: "行内代码";
|
|
97
109
|
readonly inlineMath: "行内公式";
|
|
98
110
|
readonly link: "链接";
|
|
99
111
|
readonly math: "公式块";
|
|
112
|
+
readonly mermaid: "Mermaid";
|
|
100
113
|
readonly orderedList: "有序列表";
|
|
101
114
|
readonly redo: "恢复";
|
|
102
115
|
readonly strong: "粗体";
|
|
103
116
|
readonly table: "表格";
|
|
117
|
+
readonly taskList: "任务列表";
|
|
104
118
|
readonly thematicBreak: "分隔线";
|
|
105
119
|
readonly toHTML: "转成 HTML";
|
|
106
120
|
readonly toMarkdown: "转成 Markdown";
|
|
107
121
|
readonly undo: "撤销";
|
|
108
122
|
readonly unorderedList: "无序列表";
|
|
123
|
+
readonly viewOnly: "仅查看";
|
|
109
124
|
};
|
|
110
125
|
} | {
|
|
111
126
|
readonly fileInput: {
|
|
@@ -120,24 +135,29 @@ export declare const getFormat: <T extends "fileInput" | "toolbarItem">(locale:
|
|
|
120
135
|
readonly blockquote: "Blockquote";
|
|
121
136
|
readonly code: "Code Block";
|
|
122
137
|
readonly delete: "Strikethrough";
|
|
138
|
+
readonly editOnly: "Edit Only";
|
|
123
139
|
readonly emphasis: "Italic";
|
|
124
140
|
readonly enterFullscreen: "Enter Fullscreen";
|
|
125
141
|
readonly exitFullscreen: "Exit Fullscreen";
|
|
126
142
|
readonly heading: "Heading";
|
|
143
|
+
readonly help: "Help";
|
|
127
144
|
readonly image: "Image";
|
|
128
145
|
readonly inlineCode: "Inline Code";
|
|
129
146
|
readonly inlineMath: "Inline Formula";
|
|
130
147
|
readonly link: "Link";
|
|
131
148
|
readonly math: "Formula Block";
|
|
149
|
+
readonly mermaid: "Mermaid";
|
|
132
150
|
readonly orderedList: "Ordered List";
|
|
133
151
|
readonly redo: "Redo";
|
|
134
152
|
readonly strong: "Bold";
|
|
135
153
|
readonly table: "Table";
|
|
154
|
+
readonly taskList: "Task List";
|
|
136
155
|
readonly thematicBreak: "Thematic Break";
|
|
137
156
|
readonly toHTML: "To HTML";
|
|
138
157
|
readonly toMarkdown: "To Markdown";
|
|
139
158
|
readonly undo: "Undo";
|
|
140
159
|
readonly unorderedList: "Unordered List";
|
|
160
|
+
readonly viewOnly: "View Only";
|
|
141
161
|
};
|
|
142
162
|
})[T][U];
|
|
143
163
|
export {};
|