x-star-editor 0.2.5 → 0.3.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.
@@ -59,7 +59,7 @@ var Button = function Button(_ref) {
59
59
  var popoverRef = useRef(null);
60
60
  useEffect(function () {
61
61
  if (popoverMount) {
62
- if (toolbarRef.current && popoverRef.current) {
62
+ if (toolbarRef.current && popoverRef.current && !popoverRef.current.style.left) {
63
63
  var left = toolbarRef.current.getBoundingClientRect().right - popoverRef.current.getBoundingClientRect().right;
64
64
  popoverRef.current.style.left = "".concat(left < 0 ? left : 0, "px");
65
65
  }
@@ -112,6 +112,78 @@ var Button = function Button(_ref) {
112
112
  className: classNames("".concat(prefix, "popover"))
113
113
  }, popover)));
114
114
  };
115
+ var codeOptions = [{
116
+ label: 'C++',
117
+ lang: 'cpp'
118
+ }, {
119
+ label: 'Java',
120
+ lang: 'java'
121
+ }, {
122
+ label: 'Python',
123
+ lang: 'py'
124
+ }, {
125
+ label: 'Text',
126
+ lang: 'txt'
127
+ }];
128
+ var headingOptions = [{
129
+ depth: 1,
130
+ fontSize: '1.6em'
131
+ }, {
132
+ depth: 2,
133
+ fontSize: '1.3em'
134
+ }, {
135
+ depth: 3,
136
+ fontSize: '1.2em'
137
+ }, {
138
+ depth: 4,
139
+ fontSize: '1.1em'
140
+ }, {
141
+ depth: 5,
142
+ fontSize: '1em'
143
+ }, {
144
+ depth: 6,
145
+ fontSize: '0.9em'
146
+ }];
147
+ var mermaidOptions = [{
148
+ label: 'Flowchart',
149
+ value: "flowchart TD\n A[Start] --> B{Is it?}\n B -- Yes --> C[OK]\n C --> D[Rethink]\n D --> B\n B -- No ----> E[End]"
150
+ }, {
151
+ label: 'Sequence Diagram',
152
+ value: "sequenceDiagram\n Alice->>John: Hello John, how are you?\n John-->>Alice: Great!\n Alice-)John: See you later!"
153
+ }, {
154
+ label: 'Class Diagram',
155
+ value: "classDiagram\n class BankAccount\n BankAccount : +String owner\n BankAccount : +Bigdecimal balance\n BankAccount : +deposit(amount)\n BankAccount : +withdrawal(amount)"
156
+ }, {
157
+ label: 'State Diagram',
158
+ value: "stateDiagram-v2\n [*] --> Still\n Still --> [*]\n\n Still --> Moving\n Moving --> Still\n Moving --> Crash\n Crash --> [*]"
159
+ }, {
160
+ label: 'Entity Relationship Diagram',
161
+ value: "erDiagram\n CUSTOMER ||--o{ ORDER : places\n ORDER ||--|{ LINE-ITEM : contains\n CUSTOMER }|..|{ DELIVERY-ADDRESS : uses"
162
+ }, {
163
+ label: 'User Journey',
164
+ value: "journey\n title My working day\n section Go to work\n Make tea: 5: Me\n Go upstairs: 3: Me\n Do work: 1: Me, Cat\n section Go home\n Go downstairs: 5: Me\n Sit down: 5: Me"
165
+ }, {
166
+ label: 'Gantt',
167
+ value: "gantt\n title A Gantt Diagram\n dateFormat YYYY-MM-DD\n section Section\n A task :a1, 2014-01-01, 30d\n Another task :after a1, 20d\n section Another\n Task in Another :2014-01-12, 12d\n another task :24d"
168
+ }, {
169
+ label: 'Pie Chart',
170
+ value: "pie title Pets adopted by volunteers\n \"Dogs\" : 386\n \"Cats\" : 85\n \"Rats\" : 15"
171
+ }, {
172
+ label: 'Quadrant Chart',
173
+ value: "quadrantChart\n title Reach and engagement of campaigns\n x-axis Low Reach --> High Reach\n y-axis Low Engagement --> High Engagement\n quadrant-1 We should expand\n quadrant-2 Need to promote\n quadrant-3 Re-evaluate\n quadrant-4 May be improved\n Campaign A: [0.3, 0.6]\n Campaign B: [0.45, 0.23]\n Campaign C: [0.57, 0.69]\n Campaign D: [0.78, 0.34]\n Campaign E: [0.40, 0.34]\n Campaign F: [0.35, 0.78]"
174
+ }, {
175
+ label: 'Requirement Diagram',
176
+ value: "requirementDiagram\n\n requirement test_req {\n id: 1\n text: the test text.\n risk: high\n verifymethod: test\n }\n\n element test_entity {\n type: simulation\n }\n\n test_entity - satisfies -> test_req"
177
+ }, {
178
+ label: 'Gitgraph (Git) Diagram',
179
+ value: "gitGraph\n commit\n commit\n branch develop\n checkout develop\n commit\n commit\n checkout main\n merge develop\n commit\n commit"
180
+ }, {
181
+ label: 'Mindmaps',
182
+ value: "mindmap\n root((mindmap))\n Origins\n Long history\n ::icon(fa fa-book)\n Popularisation\n British popular psychology author Tony Buzan\n Research\n On effectiveness<br/>and features\n On Automatic creation\n Uses\n Creative techniques\n Strategic planning\n Argument mapping\n Tools\n Pen and paper\n Mermaid"
183
+ }, {
184
+ label: 'Timeline',
185
+ value: "timeline\n title History of Social Media Platform\n 2002 : LinkedIn\n 2004 : Facebook\n : Google\n 2005 : Youtube\n 2006 : Twitter"
186
+ }];
115
187
  export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
116
188
  var _SvgEnterFullscreen, _t;
117
189
  var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
@@ -135,8 +207,11 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
135
207
  }),
136
208
  tooltip: t('code'),
137
209
  popoverRender: function popoverRender(exec, close) {
138
- var optionRender = function optionRender(label, lang) {
210
+ return codeOptions.map(function (_ref2) {
211
+ var label = _ref2.label,
212
+ lang = _ref2.lang;
139
213
  return /*#__PURE__*/React.createElement("div", {
214
+ key: label,
140
215
  className: classNames("".concat(prefix, "option")),
141
216
  onClick: function onClick() {
142
217
  exec(toggleHandler({
@@ -148,8 +223,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
148
223
  close();
149
224
  }
150
225
  }, label);
151
- };
152
- return /*#__PURE__*/React.createElement(React.Fragment, null, optionRender('C++', 'cpp'), optionRender('Java', 'java'), optionRender('Python', 'py'), optionRender('Text', 'txt'));
226
+ });
153
227
  }
154
228
  },
155
229
  delete: {
@@ -194,8 +268,11 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
194
268
  }),
195
269
  tooltip: t('heading'),
196
270
  popoverRender: function popoverRender(exec, close) {
197
- var optionRender = function optionRender(depth, fontSize) {
271
+ return headingOptions.map(function (_ref3) {
272
+ var depth = _ref3.depth,
273
+ fontSize = _ref3.fontSize;
198
274
  return /*#__PURE__*/React.createElement("div", {
275
+ key: depth,
199
276
  className: classNames("".concat(prefix, "option")),
200
277
  style: {
201
278
  fontSize: fontSize
@@ -208,8 +285,7 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
208
285
  close();
209
286
  }
210
287
  }, "H", depth, " ", t('heading'), " ", depth);
211
- };
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'));
288
+ });
213
289
  }
214
290
  },
215
291
  help: {
@@ -308,13 +384,24 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
308
384
  className: classNames("".concat(prefix, "icon"))
309
385
  }),
310
386
  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
- }));
387
+ popoverRender: function popoverRender(exec, close) {
388
+ return mermaidOptions.map(function (_ref4) {
389
+ var label = _ref4.label,
390
+ value = _ref4.value;
391
+ return /*#__PURE__*/React.createElement("div", {
392
+ key: label,
393
+ className: classNames("".concat(prefix, "option")),
394
+ onClick: function onClick() {
395
+ exec(toggleHandler({
396
+ type: 'code',
397
+ lang: 'mermaid',
398
+ value: value,
399
+ showLineNumbers: false
400
+ }));
401
+ close();
402
+ }
403
+ }, label);
404
+ });
318
405
  }
319
406
  },
320
407
  orderedList: {
@@ -323,8 +410,8 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
323
410
  }),
324
411
  tooltip: t('orderedList')
325
412
  },
326
- redo: function redo(_ref2) {
327
- var history = _ref2.history;
413
+ redo: function redo(_ref5) {
414
+ var history = _ref5.history;
328
415
  return {
329
416
  children: /*#__PURE__*/React.createElement(SvgRedo, {
330
417
  className: classNames("".concat(prefix, "icon"))
@@ -376,10 +463,10 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
376
463
  }),
377
464
  tooltip: t('toHTML'),
378
465
  onClick: function onClick(exec) {
379
- return exec(function (_ref3) {
380
- var sourceCode = _ref3.sourceCode,
381
- selection = _ref3.selection,
382
- dispatch = _ref3.dispatch;
466
+ return exec(function (_ref6) {
467
+ var sourceCode = _ref6.sourceCode,
468
+ selection = _ref6.selection,
469
+ dispatch = _ref6.dispatch;
383
470
  return dispatch({
384
471
  type: 'set',
385
472
  payload: {
@@ -397,10 +484,10 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
397
484
  }),
398
485
  tooltip: t('toMarkdown'),
399
486
  onClick: function onClick(exec) {
400
- return exec(function (_ref4) {
401
- var sourceCode = _ref4.sourceCode,
402
- selection = _ref4.selection,
403
- dispatch = _ref4.dispatch;
487
+ return exec(function (_ref7) {
488
+ var sourceCode = _ref7.sourceCode,
489
+ selection = _ref7.selection,
490
+ dispatch = _ref7.dispatch;
404
491
  return dispatch({
405
492
  type: 'set',
406
493
  payload: {
@@ -412,8 +499,8 @@ export var getDefaultToolbarItemMap = function getDefaultToolbarItemMap() {
412
499
  });
413
500
  }
414
501
  },
415
- undo: function undo(_ref5) {
416
- var history = _ref5.history;
502
+ undo: function undo(_ref8) {
503
+ var history = _ref8.history;
417
504
  return {
418
505
  children: /*#__PURE__*/React.createElement(SvgUndo, {
419
506
  className: classNames("".concat(prefix, "icon"))
@@ -447,12 +534,12 @@ export var getDefaultToolbarItems = function getDefaultToolbarItems() {
447
534
  ];
448
535
  };
449
536
 
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;
537
+ var Toolbar = function Toolbar(_ref9) {
538
+ var className = _ref9.className,
539
+ style = _ref9.style,
540
+ itemMap = _ref9.itemMap,
541
+ items = _ref9.items,
542
+ exec = _ref9.exec;
456
543
  var toolbarRef = useRef(null);
457
544
  var ctx = exec(function (ctx) {
458
545
  return ctx;
@@ -471,12 +558,12 @@ var Toolbar = function Toolbar(_ref6) {
471
558
  if (!toolbarItem) {
472
559
  return undefined;
473
560
  }
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;
561
+ var _ref10 = typeof toolbarItem === 'function' ? toolbarItem(ctx) : toolbarItem,
562
+ children = _ref10.children,
563
+ disabled = _ref10.disabled,
564
+ tooltip = _ref10.tooltip,
565
+ _popoverRender = _ref10.popoverRender,
566
+ _onClick2 = _ref10.onClick;
480
567
  return /*#__PURE__*/React.createElement(Button, {
481
568
  key: index,
482
569
  toolbarRef: toolbarRef,
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export type { ToolbarItem } from './components/Toolbar';
2
2
  export { createSelection, getRange } from './utils/container';
3
- export { deleteHandler, insertHandler, redoHandler, selectHandler, setHandler, toggleHandler, undoHandler, } from './utils/handler';
3
+ export { insertHandler, redoHandler, selectHandler, setHandler, toggleHandler, undoHandler, } from './utils/handler';
4
4
  export type { Executor, Handler, KeyboardEventHandler } from './utils/handler';
5
5
  export { toHTML, toMarkdown, toText } from './utils/markdown';
6
6
  export { default as XStarEditor, useEditorRef } from './x-star-editor';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { createSelection, getRange } from "./utils/container";
2
- export { deleteHandler, insertHandler, redoHandler, selectHandler, setHandler, toggleHandler, undoHandler } from "./utils/handler";
2
+ export { insertHandler, redoHandler, selectHandler, setHandler, toggleHandler, undoHandler } from "./utils/handler";
3
3
  export { toHTML, toMarkdown, toText } from "./utils/markdown";
4
4
  export { default as XStarEditor, useEditorRef } from "./x-star-editor";
5
5
  export { default as XStarMdEditor, useMdEditorRef } from "./x-star-md-editor";
@@ -0,0 +1,353 @@
1
+ @charset "UTF-8";
2
+ .x-star-editor-md-viewer.x-star-editor-theme-lark {
3
+ line-height: 1.68;
4
+ text-size-adjust: 100%;
5
+ font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, "Segoe UI", "PingFang SC", "Microsoft Yahei", "Hiragino Sans GB", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
6
+ font-size: 16px;
7
+ color: #1f2329;
8
+ }
9
+ .x-star-editor-md-viewer.x-star-editor-theme-lark * {
10
+ box-sizing: border-box;
11
+ -webkit-font-smoothing: antialiased;
12
+ text-rendering: optimizelegibility;
13
+ }
14
+ .x-star-editor-md-viewer.x-star-editor-theme-lark > *:first-child {
15
+ margin-top: 0;
16
+ }
17
+ .x-star-editor-md-viewer.x-star-editor-theme-lark > *:last-child {
18
+ margin-top: 0;
19
+ }
20
+ .x-star-editor-md-viewer.x-star-editor-theme-lark p,
21
+ .x-star-editor-md-viewer.x-star-editor-theme-lark details,
22
+ .x-star-editor-md-viewer.x-star-editor-theme-lark dl,
23
+ .x-star-editor-md-viewer.x-star-editor-theme-lark ol,
24
+ .x-star-editor-md-viewer.x-star-editor-theme-lark ul,
25
+ .x-star-editor-md-viewer.x-star-editor-theme-lark xmp,
26
+ .x-star-editor-md-viewer.x-star-editor-theme-lark plaintext,
27
+ .x-star-editor-md-viewer.x-star-editor-theme-lark listing,
28
+ .x-star-editor-md-viewer.x-star-editor-theme-lark blockquote,
29
+ .x-star-editor-md-viewer.x-star-editor-theme-lark table,
30
+ .x-star-editor-md-viewer.x-star-editor-theme-lark figure,
31
+ .x-star-editor-md-viewer.x-star-editor-theme-lark hr {
32
+ margin-top: 8px;
33
+ margin-bottom: 8px;
34
+ }
35
+ .x-star-editor-md-viewer.x-star-editor-theme-lark h1 {
36
+ font-size: 26px;
37
+ font-weight: bold;
38
+ margin: 26px 0 10px;
39
+ }
40
+ .x-star-editor-md-viewer.x-star-editor-theme-lark h2 {
41
+ font-size: 22px;
42
+ font-weight: bold;
43
+ margin: 22px 0 8px;
44
+ }
45
+ .x-star-editor-md-viewer.x-star-editor-theme-lark h3 {
46
+ font-size: 20px;
47
+ font-weight: bold;
48
+ margin: 20px 0 8px;
49
+ }
50
+ .x-star-editor-md-viewer.x-star-editor-theme-lark h4 {
51
+ font-size: 18px;
52
+ font-weight: bold;
53
+ margin: 18px 0 8px;
54
+ }
55
+ .x-star-editor-md-viewer.x-star-editor-theme-lark h5 {
56
+ font-size: 16px;
57
+ font-weight: bold;
58
+ margin: 16px 0 8px;
59
+ }
60
+ .x-star-editor-md-viewer.x-star-editor-theme-lark h6 {
61
+ font-size: 16px;
62
+ font-weight: bold;
63
+ margin: 16px 0 8px;
64
+ }
65
+ .x-star-editor-md-viewer.x-star-editor-theme-lark p {
66
+ margin-left: 0;
67
+ margin-right: 0;
68
+ }
69
+ .x-star-editor-md-viewer.x-star-editor-theme-lark pre,
70
+ .x-star-editor-md-viewer.x-star-editor-theme-lark xmp,
71
+ .x-star-editor-md-viewer.x-star-editor-theme-lark plaintext,
72
+ .x-star-editor-md-viewer.x-star-editor-theme-lark listing {
73
+ font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace;
74
+ }
75
+ .x-star-editor-md-viewer.x-star-editor-theme-lark blockquote > :first-child {
76
+ margin-top: 0;
77
+ }
78
+ .x-star-editor-md-viewer.x-star-editor-theme-lark blockquote > :last-child {
79
+ margin-bottom: 0;
80
+ }
81
+ .x-star-editor-md-viewer.x-star-editor-theme-lark hr {
82
+ border-style: inset;
83
+ border-width: 1px;
84
+ margin: 13px 0 12px;
85
+ border: 0;
86
+ height: 1px;
87
+ background-origin: content-box;
88
+ background-image: linear-gradient(90deg, #bbbfc4, #bbbfc4);
89
+ background-repeat: no-repeat;
90
+ }
91
+ .x-star-editor-md-viewer.x-star-editor-theme-lark img {
92
+ max-width: 100%;
93
+ height: auto;
94
+ }
95
+ .x-star-editor-md-viewer.x-star-editor-theme-lark li {
96
+ position: relative;
97
+ word-wrap: break-all;
98
+ }
99
+ .x-star-editor-md-viewer.x-star-editor-theme-lark li + li {
100
+ margin-top: 4px;
101
+ }
102
+ .x-star-editor-md-viewer.x-star-editor-theme-lark ul ul,
103
+ .x-star-editor-md-viewer.x-star-editor-theme-lark ol ul,
104
+ .x-star-editor-md-viewer.x-star-editor-theme-lark ul ol,
105
+ .x-star-editor-md-viewer.x-star-editor-theme-lark ol ol {
106
+ margin-top: 0;
107
+ margin-bottom: 0;
108
+ }
109
+ .x-star-editor-md-viewer.x-star-editor-theme-lark .task-list-item {
110
+ list-style-type: none;
111
+ padding-left: 0.3rem;
112
+ }
113
+ .x-star-editor-md-viewer.x-star-editor-theme-lark a {
114
+ color: #3370ff;
115
+ overflow-wrap: break-word;
116
+ word-wrap: break-word;
117
+ white-space: pre-wrap;
118
+ hyphens: auto;
119
+ word-break: break-word;
120
+ text-decoration: none;
121
+ }
122
+ .x-star-editor-md-viewer.x-star-editor-theme-lark a img {
123
+ border: none;
124
+ }
125
+ .x-star-editor-md-viewer.x-star-editor-theme-lark b,
126
+ .x-star-editor-md-viewer.x-star-editor-theme-lark strong {
127
+ font-weight: bold;
128
+ }
129
+ .x-star-editor-md-viewer.x-star-editor-theme-lark i,
130
+ .x-star-editor-md-viewer.x-star-editor-theme-lark cite,
131
+ .x-star-editor-md-viewer.x-star-editor-theme-lark em,
132
+ .x-star-editor-md-viewer.x-star-editor-theme-lark var,
133
+ .x-star-editor-md-viewer.x-star-editor-theme-lark address,
134
+ .x-star-editor-md-viewer.x-star-editor-theme-lark dfn {
135
+ font-style: italic;
136
+ }
137
+ .x-star-editor-md-viewer.x-star-editor-theme-lark code,
138
+ .x-star-editor-md-viewer.x-star-editor-theme-lark kbd,
139
+ .x-star-editor-md-viewer.x-star-editor-theme-lark tt,
140
+ .x-star-editor-md-viewer.x-star-editor-theme-lark samp {
141
+ font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace;
142
+ }
143
+ .x-star-editor-md-viewer.x-star-editor-theme-lark mark {
144
+ color: #1f2329;
145
+ padding: 0.2em 0;
146
+ background-color: rgba(255, 246, 122, 0.8);
147
+ }
148
+ .x-star-editor-md-viewer.x-star-editor-theme-lark del,
149
+ .x-star-editor-md-viewer.x-star-editor-theme-lark s {
150
+ color: inherit;
151
+ }
152
+ .x-star-editor-md-viewer.x-star-editor-theme-lark table {
153
+ color: black;
154
+ border-collapse: collapse;
155
+ background-color: white;
156
+ border-spacing: 2px;
157
+ font-size: 1em;
158
+ }
159
+ .x-star-editor-md-viewer.x-star-editor-theme-lark th,
160
+ .x-star-editor-md-viewer.x-star-editor-theme-lark td {
161
+ border-color: #dee0e3;
162
+ border-width: 1px;
163
+ border-style: solid;
164
+ }
165
+ .x-star-editor-md-viewer.x-star-editor-theme-lark th {
166
+ padding: 8px;
167
+ font-size: 1em;
168
+ }
169
+ .x-star-editor-md-viewer.x-star-editor-theme-lark td {
170
+ padding: 8px;
171
+ font-size: 1em;
172
+ font-weight: normal;
173
+ }
174
+ .x-star-editor-md-viewer.x-star-editor-theme-lark pre.md-fences,
175
+ .x-star-editor-md-viewer.x-star-editor-theme-lark pre.md-meta-block,
176
+ .x-star-editor-md-viewer.x-star-editor-theme-lark .md-rawblock-control:not(.md-rawblock-tooltip) .md-rawblock-input {
177
+ border-radius: 3px;
178
+ border: 1px solid #dee0e3;
179
+ padding: 10px;
180
+ background-color: #f5f6f7;
181
+ }
182
+ .x-star-editor-md-viewer.x-star-editor-theme-lark .md-math-block,
183
+ .x-star-editor-md-viewer.x-star-editor-theme-lark .md-rawblock {
184
+ margin-top: 1em;
185
+ margin-bottom: 1em;
186
+ }
187
+ .x-star-editor-md-viewer.x-star-editor-theme-lark .md-rawblock > .md-rawblock-tooltip {
188
+ background-color: #f5f6f7;
189
+ transition: 0.5s;
190
+ display: block;
191
+ visibility: hidden;
192
+ opacity: 0;
193
+ }
194
+ .x-star-editor-md-viewer.x-star-editor-theme-lark .md-rawblock:hover > .md-rawblock-tooltip {
195
+ transition: 0.5s;
196
+ visibility: visible;
197
+ opacity: 1;
198
+ animation: none;
199
+ }
200
+ .x-star-editor-md-viewer.x-star-editor-theme-lark .md-rawblock-control:not(.md-rawblock-tooltip) {
201
+ padding-left: 0;
202
+ padding-right: 0;
203
+ }
204
+ .x-star-editor-md-viewer.x-star-editor-theme-lark h1,
205
+ .x-star-editor-md-viewer.x-star-editor-theme-lark h2,
206
+ .x-star-editor-md-viewer.x-star-editor-theme-lark h3,
207
+ .x-star-editor-md-viewer.x-star-editor-theme-lark h4,
208
+ .x-star-editor-md-viewer.x-star-editor-theme-lark h5,
209
+ .x-star-editor-md-viewer.x-star-editor-theme-lark h6 {
210
+ line-height: 1.4;
211
+ margin-top: 1em;
212
+ margin-bottom: 0.37em;
213
+ }
214
+ .x-star-editor-md-viewer.x-star-editor-theme-lark blockquote {
215
+ display: block;
216
+ margin-left: 0;
217
+ padding-left: 14px;
218
+ border-left: 2px solid #3370ff;
219
+ color: rgba(31, 35, 41, 0.7);
220
+ }
221
+ .x-star-editor-md-viewer.x-star-editor-theme-lark :not(pre) > code {
222
+ border-radius: 4px;
223
+ margin-left: 2px;
224
+ margin-right: 2px;
225
+ border: 1px solid #dee0e3;
226
+ background-color: #f5f6f7;
227
+ word-spacing: normal;
228
+ line-height: 1.6;
229
+ padding: 0 2px;
230
+ }
231
+ .x-star-editor-md-viewer.x-star-editor-theme-lark a:hover {
232
+ text-decoration: underline;
233
+ }
234
+ .x-star-editor-md-viewer.x-star-editor-theme-lark ul {
235
+ margin-left: 0;
236
+ padding-left: 22px;
237
+ list-style: none;
238
+ }
239
+ .x-star-editor-md-viewer.x-star-editor-theme-lark ul > li:not([class*=task-list-item]) {
240
+ word-wrap: break-all;
241
+ padding-left: 0;
242
+ }
243
+ .x-star-editor-md-viewer.x-star-editor-theme-lark ul > li:not([class*=task-list-item])::before {
244
+ position: absolute;
245
+ top: 2px;
246
+ content: "•";
247
+ color: #3370ff;
248
+ display: inline-block;
249
+ margin-left: -20px;
250
+ margin-right: 20px;
251
+ width: 0;
252
+ font-size: 0.8em;
253
+ transform: scale(1.25);
254
+ font-family: PingFangSC-Regular, "PingFang SC", Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace;
255
+ }
256
+ .x-star-editor-md-viewer.x-star-editor-theme-lark ul > li:not([class*=task-list-item]) li:not([class*=task-list-item])::before {
257
+ content: "◦";
258
+ transform: scale(1);
259
+ font-weight: 700;
260
+ }
261
+ .x-star-editor-md-viewer.x-star-editor-theme-lark ul > li:not([class*=task-list-item]) li:not([class*=task-list-item]) li:not([class*=task-list-item])::before {
262
+ content: "▪";
263
+ transform: scale(1.25);
264
+ font-weight: normal;
265
+ }
266
+ .x-star-editor-md-viewer.x-star-editor-theme-lark ol {
267
+ counter-reset: ol_counter;
268
+ margin-left: 0;
269
+ padding-left: 22px;
270
+ list-style: none;
271
+ }
272
+ .x-star-editor-md-viewer.x-star-editor-theme-lark ol > li:not([class*=task-list-item]) {
273
+ word-wrap: break-all;
274
+ padding-left: 0;
275
+ position: relative;
276
+ }
277
+ .x-star-editor-md-viewer.x-star-editor-theme-lark ol > li:not([class*=task-list-item])::before {
278
+ content: counter(ol_counter) ".";
279
+ counter-increment: ol_counter;
280
+ color: #3370ff;
281
+ position: absolute;
282
+ margin-left: -22px;
283
+ margin-right: 4px;
284
+ padding-left: 2px;
285
+ padding-right: 2px;
286
+ text-align: left;
287
+ white-space: nowrap;
288
+ overflow: visible;
289
+ min-width: 18px;
290
+ border-radius: 2px;
291
+ transform: translateX(-2px);
292
+ font-family: "Helvetica Neue", Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace;
293
+ }
294
+ .x-star-editor-md-viewer.x-star-editor-theme-lark li + li,
295
+ .x-star-editor-md-viewer.x-star-editor-theme-lark ul ul,
296
+ .x-star-editor-md-viewer.x-star-editor-theme-lark ol ul,
297
+ .x-star-editor-md-viewer.x-star-editor-theme-lark ul ol,
298
+ .x-star-editor-md-viewer.x-star-editor-theme-lark ol ol,
299
+ .x-star-editor-md-viewer.x-star-editor-theme-lark li ul,
300
+ .x-star-editor-md-viewer.x-star-editor-theme-lark li ol {
301
+ margin-top: 4px;
302
+ }
303
+ .x-star-editor-md-viewer.x-star-editor-theme-lark .task-list-item > p {
304
+ transition: color 0.3s, opacity 0.3s;
305
+ }
306
+ .x-star-editor-md-viewer.x-star-editor-theme-lark .task-list-item.task-list-done > p {
307
+ color: #646a73;
308
+ text-decoration: line-through;
309
+ }
310
+ .x-star-editor-md-viewer.x-star-editor-theme-lark .task-list-item.task-list-done > p > .md-emoji {
311
+ opacity: 0.5;
312
+ }
313
+ .x-star-editor-md-viewer.x-star-editor-theme-lark .task-list-item.task-list-done > p > .md-link > a {
314
+ opacity: 0.6;
315
+ }
316
+ .x-star-editor-md-viewer.x-star-editor-theme-lark .task-list-item > input {
317
+ appearance: initial;
318
+ display: block;
319
+ position: absolute;
320
+ border: 1px solid #2b2f36;
321
+ border-radius: 0.25rem;
322
+ margin-left: -1.5rem;
323
+ height: 1.2rem;
324
+ width: 1.2rem;
325
+ transition: border-color 0.3s;
326
+ }
327
+ .x-star-editor-md-viewer.x-star-editor-theme-lark .task-list-item > input:focus {
328
+ outline: none;
329
+ box-shadow: none;
330
+ }
331
+ .x-star-editor-md-viewer.x-star-editor-theme-lark .task-list-item > input:hover {
332
+ border-color: #3370ff;
333
+ }
334
+ .x-star-editor-md-viewer.x-star-editor-theme-lark .task-list-item > input[checked]::before {
335
+ content: "";
336
+ position: absolute;
337
+ top: 20%;
338
+ left: 50%;
339
+ height: 60%;
340
+ width: 2px;
341
+ transform: rotate(40deg);
342
+ background: #3370ff;
343
+ }
344
+ .x-star-editor-md-viewer.x-star-editor-theme-lark .task-list-item > input[checked]::after {
345
+ content: "";
346
+ position: absolute;
347
+ top: 46%;
348
+ left: 25%;
349
+ height: 30%;
350
+ width: 2px;
351
+ transform: rotate(-40deg);
352
+ background: #3370ff;
353
+ }
@@ -36,9 +36,9 @@ export declare const getRange: ({ anchorOffset, focusOffset, }: ContainerSelecti
36
36
  * @returns 容器
37
37
  */
38
38
  export declare const useContainer: (ref: React.RefObject<HTMLDivElement>) => {
39
- normalize: () => void;
40
39
  getText: () => string;
41
40
  setText: (text: string) => void;
41
+ getOffset: (root: Node, targetNode: Node, targetOffset: number) => number;
42
42
  getSelection: () => ContainerSelection;
43
43
  setSelection: ({ anchorOffset, focusOffset }: ContainerSelection) => void;
44
44
  };