@textbus/xnote 0.1.1 → 0.2.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.
Files changed (53) hide show
  1. package/bundles/components/dropdown/dropdown-menu.d.ts +2 -1
  2. package/bundles/components/dropdown/dropdown.d.ts +1 -0
  3. package/bundles/fonts/textbus.svg +4 -3
  4. package/bundles/fonts/textbus.ttf +0 -0
  5. package/bundles/fonts/textbus.woff +0 -0
  6. package/bundles/index.css +2 -2
  7. package/bundles/index.esm.css +2 -2
  8. package/bundles/index.esm.js +1243 -717
  9. package/bundles/index.js +1257 -715
  10. package/bundles/plugins/_api.d.ts +8 -4
  11. package/bundles/plugins/inline-toolbar/inline-toolbar.d.ts +4 -0
  12. package/bundles/plugins/inline-toolbar/inline-toolbar.plugin.d.ts +12 -0
  13. package/bundles/plugins/static-toolbar/static-toolbar.d.ts +4 -0
  14. package/bundles/plugins/static-toolbar/static-toolbar.plugin.d.ts +14 -0
  15. package/bundles/plugins/suspension-toolbar/suspension-toolbar.d.ts +4 -0
  16. package/bundles/plugins/suspension-toolbar/suspension-toolbar.plugin.d.ts +13 -0
  17. package/bundles/plugins/{_common → tools}/_api.d.ts +8 -0
  18. package/bundles/plugins/tools/_common/common-state.d.ts +1 -0
  19. package/bundles/plugins/tools/_common/split-line.d.ts +1 -0
  20. package/bundles/plugins/tools/_common/tool.service.d.ts +14 -0
  21. package/bundles/plugins/tools/clean-formats.tool.d.ts +1 -0
  22. package/bundles/plugins/{left-toolbar/insert-tool.d.ts → tools/insert-menu.d.ts} +1 -1
  23. package/bundles/plugins/tools/insert.tool.d.ts +1 -0
  24. package/bundles/plugins/tools/redo.tool.d.ts +1 -0
  25. package/bundles/plugins/tools/subscript.tool.d.ts +1 -0
  26. package/bundles/plugins/tools/superscript.tool.d.ts +1 -0
  27. package/bundles/plugins/tools/table/help.d.ts +5 -0
  28. package/bundles/plugins/tools/undo.tool.d.ts +1 -0
  29. package/bundles/textbus/components/step/step.component.d.ts +1 -0
  30. package/bundles/textbus/components/table/table.component.d.ts +1 -0
  31. package/bundles/textbus/components/timeline/timeline.component.d.ts +1 -0
  32. package/bundles/textbus/formatters/_api.d.ts +2 -0
  33. package/bundles/textbus/formatters/subscript.d.ts +4 -0
  34. package/bundles/textbus/formatters/superscript.d.ts +4 -0
  35. package/package.json +10 -10
  36. package/bundles/plugins/toolbar/toolbar.d.ts +0 -1
  37. package/bundles/plugins/toolbar/toolbar.plugin.d.ts +0 -7
  38. /package/bundles/plugins/{_common → tools}/attr.tool.d.ts +0 -0
  39. /package/bundles/plugins/{_common → tools}/block.tool.d.ts +0 -0
  40. /package/bundles/plugins/{_common → tools}/bold.tool.d.ts +0 -0
  41. /package/bundles/plugins/{_common → tools}/code.tool.d.ts +0 -0
  42. /package/bundles/plugins/{_common → tools}/color.tool.d.ts +0 -0
  43. /package/bundles/plugins/{_common → tools}/font-family.tool.d.ts +0 -0
  44. /package/bundles/plugins/{_common → tools}/font-size.tool.d.ts +0 -0
  45. /package/bundles/plugins/{_common → tools}/italic.tool.d.ts +0 -0
  46. /package/bundles/plugins/{_common → tools}/link.tool.d.ts +0 -0
  47. /package/bundles/plugins/{_common → tools}/strike-through.tool.d.ts +0 -0
  48. /package/bundles/plugins/{_common → tools}/table/_api.d.ts +0 -0
  49. /package/bundles/plugins/{_common → tools}/table/cell-align.tool.d.ts +0 -0
  50. /package/bundles/plugins/{_common → tools}/table/cell-background.tool.d.ts +0 -0
  51. /package/bundles/plugins/{_common → tools}/table/merge-cells.tool.d.ts +0 -0
  52. /package/bundles/plugins/{_common → tools}/table/split-cells.tool.d.ts +0 -0
  53. /package/bundles/plugins/{_common → tools}/underline.tool.d.ts +0 -0
package/bundles/index.js CHANGED
@@ -14,7 +14,7 @@ var Katex = require('katex');
14
14
  var adapterViewfly = require('@textbus/adapter-viewfly');
15
15
  var collaborate = require('@textbus/collaborate');
16
16
 
17
- var scopedId$o = "vf-d94b56";
17
+ var scopedId$r = "vf-7d288d";
18
18
 
19
19
  /******************************************************************************
20
20
  Copyright (c) Microsoft Corporation.
@@ -147,7 +147,7 @@ function Button(props) {
147
147
  subscription.unsubscribe();
148
148
  });
149
149
  }
150
- return scopedCss.withScopedCSS(scopedId$o, () => {
150
+ return scopedCss.withScopedCSS(scopedId$r, () => {
151
151
  return (jsxRuntime.jsxs("button", Object.assign({ type: "button" }, props, { class: [
152
152
  'btn',
153
153
  {
@@ -159,7 +159,7 @@ function Button(props) {
159
159
  });
160
160
  }
161
161
 
162
- var scopedId$n = "vf-d552b9";
162
+ var scopedId$q = "vf-d552b9";
163
163
 
164
164
  class Picker {
165
165
  set hex(color$1) {
@@ -448,7 +448,7 @@ function ColorPicker(props) {
448
448
  props.onSelected(picker);
449
449
  addRecentColor();
450
450
  }
451
- return scopedCss.withScopedCSS(scopedId$n, () => {
451
+ return scopedCss.withScopedCSS(scopedId$q, () => {
452
452
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
453
453
  return (jsxRuntime.jsxs("div", { onMousedown: ev => {
454
454
  ev.stopPropagation();
@@ -499,10 +499,10 @@ function ColorPicker(props) {
499
499
  });
500
500
  }
501
501
 
502
- var scopedId$m = "vf-ac7e8d";
502
+ var scopedId$p = "vf-ac7e8d";
503
503
 
504
504
  function ComponentToolbar(props) {
505
- return scopedCss.withScopedCSS(scopedId$m, () => {
505
+ return scopedCss.withScopedCSS(scopedId$p, () => {
506
506
  return (jsxRuntime.jsx("div", { class: "component-toolbar", style: props.style, children: jsxRuntime.jsx("div", { class: [
507
507
  'toolbar',
508
508
  {
@@ -512,15 +512,15 @@ function ComponentToolbar(props) {
512
512
  });
513
513
  }
514
514
 
515
- var scopedId$l = "vf-ede279";
515
+ var scopedId$o = "vf-ede279";
516
516
 
517
517
  function Divider() {
518
- return scopedCss.withScopedCSS(scopedId$l, () => {
518
+ return scopedCss.withScopedCSS(scopedId$o, () => {
519
519
  return jsxRuntime.jsx("div", { class: "divider" });
520
520
  });
521
521
  }
522
522
 
523
- var scopedId$k = "vf-d91ad6";
523
+ var scopedId$n = "vf-d91ad6";
524
524
 
525
525
  function DragResize(props) {
526
526
  const isShow = core.createSignal(false);
@@ -629,24 +629,25 @@ function DragResize(props) {
629
629
  });
630
630
  }
631
631
  const sizeText = core.createSignal(`${component.state.width}*${component.state.height}`);
632
- return scopedCss.withScopedCSS(scopedId$k, () => {
632
+ return scopedCss.withScopedCSS(scopedId$n, () => {
633
633
  return (jsxRuntime.jsxs("div", { class: "drag-resize", onClick: selectComponent, children: [jsxRuntime.jsx("div", { class: "container", ref: ref, children: props.children }), jsxRuntime.jsxs("div", { class: ['resize-tool', {
634
634
  active: isShow()
635
635
  }], children: [jsxRuntime.jsx("div", { class: "mask", ref: mask, children: sizeText() }), jsxRuntime.jsxs("div", { class: "btn-group", ref: btnGroup, onMousedown: drag, children: [jsxRuntime.jsx("button", { type: "button" }), jsxRuntime.jsx("button", { type: "button" }), jsxRuntime.jsx("button", { type: "button" }), jsxRuntime.jsx("button", { type: "button" }), jsxRuntime.jsx("button", { type: "button" }), jsxRuntime.jsx("button", { type: "button" }), jsxRuntime.jsx("button", { type: "button" }), jsxRuntime.jsx("button", { type: "button" })] })] })] }));
636
636
  });
637
637
  }
638
638
 
639
- var scopedId$j = "vf-a99c5e";
639
+ var scopedId$m = "vf-a99c5e";
640
640
 
641
- var scopedId$i = "vf-8a05e9";
641
+ var scopedId$l = "vf-8a05e9";
642
642
 
643
+ const DropdownMenuContainer = new core.InjectionToken('DropdownMenuContainer');
643
644
  const DropdownMenuPortal = core.withAnnotation({
644
645
  providers: [
645
646
  exports.DropdownService
646
647
  ]
647
648
  }, function DropdownMenuPortal(props) {
648
649
  const dropdownContextService = core.inject(exports.DropdownContextService);
649
- const container = core.inject(platformBrowser.VIEW_CONTAINER);
650
+ const container = core.inject(DropdownMenuContainer, core.inject(platformBrowser.VIEW_CONTAINER));
650
651
  const menuRef = core.createRef();
651
652
  let timer = null;
652
653
  const delay = 10;
@@ -733,8 +734,11 @@ const DropdownMenuPortal = core.withAnnotation({
733
734
  dropdownContextService.canHide = true;
734
735
  dropdownContextService.hide();
735
736
  }
736
- return platformBrowser$1.createPortal(scopedCss.withScopedCSS(scopedId$i, () => {
737
- return (jsxRuntime.jsx("div", { onMouseenter: onEnter, onMouseleave: onLeave, ref: menuRef, style: {
737
+ function stopPropagation(ev) {
738
+ ev.stopPropagation();
739
+ }
740
+ return platformBrowser$1.createPortal(scopedCss.withScopedCSS(scopedId$l, () => {
741
+ return (jsxRuntime.jsx("div", { onMouseenter: onEnter, onMousedown: stopPropagation, onMouseleave: onLeave, ref: menuRef, style: {
738
742
  width: props.width
739
743
  }, class: "dropdown-menu", children: jsxRuntime.jsx("div", { class: "dropdown-menu-content", style: {
740
744
  padding: props.padding
@@ -748,6 +752,9 @@ const Dropdown = core.withAnnotation({
748
752
  const isShow = core.createSignal(false);
749
753
  const dropdownContextService = core.inject(exports.DropdownContextService);
750
754
  const toggle = () => {
755
+ if (props.disabled) {
756
+ return;
757
+ }
751
758
  if (dropdownContextService.isOpen) {
752
759
  dropdownContextService.hide(false);
753
760
  }
@@ -777,11 +784,17 @@ const Dropdown = core.withAnnotation({
777
784
  let leaveSub;
778
785
  const bindLeave = function () {
779
786
  leaveSub = core$1.fromEvent(dropdownRef.current, 'mouseleave').subscribe(() => {
787
+ if (props.disabled) {
788
+ return;
789
+ }
780
790
  dropdownContextService.hide();
781
791
  });
782
792
  };
783
793
  bindLeave();
784
794
  subscription.add(core$1.fromEvent(dropdownRef.current, 'mouseenter').subscribe(() => {
795
+ if (props.disabled) {
796
+ return;
797
+ }
785
798
  if (leaveSub) {
786
799
  leaveSub.unsubscribe();
787
800
  }
@@ -801,7 +814,7 @@ const Dropdown = core.withAnnotation({
801
814
  dropdownContextService.hide(false);
802
815
  }
803
816
  },
804
- $render: scopedCss.withScopedCSS(scopedId$j, () => {
817
+ $render: scopedCss.withScopedCSS(scopedId$m, () => {
805
818
  return (jsxRuntime.jsxs("div", { class: ['dropdown', props.class], style: props.style, ref: dropdownRef, children: [jsxRuntime.jsxs("div", { class: "dropdown-btn", ref: triggerRef, children: [jsxRuntime.jsx("div", { class: "dropdown-btn-inner", children: props.children }), jsxRuntime.jsx("div", { class: "dropdown-btn-arrow" })] }), isShow() &&
806
819
  jsxRuntime.jsx(DropdownMenuPortal, { toLeft: props.toLeft, padding: props.padding, noTrigger: props.trigger === 'none', width: props.width, abreast: props.abreast, triggerRef: triggerRef, children: Array.isArray(props.menu) ?
807
820
  props.menu.map(menu => {
@@ -818,7 +831,7 @@ const Dropdown = core.withAnnotation({
818
831
  };
819
832
  });
820
833
 
821
- var scopedId$h = "vf-c32a7b";
834
+ var scopedId$k = "vf-c32a7b";
822
835
 
823
836
  function Keymap(props) {
824
837
  const arr = [];
@@ -852,20 +865,20 @@ function Keymap(props) {
852
865
  arr.push(jsxRuntime.jsx("span", { children: keymap.key }));
853
866
  }
854
867
  }
855
- return scopedCss.withScopedCSS(scopedId$h, () => {
868
+ return scopedCss.withScopedCSS(scopedId$k, () => {
856
869
  return (jsxRuntime.jsx("span", { class: "keymap", children: arr }));
857
870
  });
858
871
  }
859
872
 
860
- var scopedId$g = "vf-acaa5f";
873
+ var scopedId$j = "vf-acaa5f";
861
874
 
862
875
  function MenuHeading(props) {
863
- return scopedCss.withScopedCSS(scopedId$g, () => {
876
+ return scopedCss.withScopedCSS(scopedId$j, () => {
864
877
  return (jsxRuntime.jsx("div", { class: "menu-heading", children: props.children }));
865
878
  });
866
879
  }
867
880
 
868
- var scopedId$f = "vf-c3b9dc";
881
+ var scopedId$i = "vf-c3b9dc";
869
882
 
870
883
  function MenuItem(props) {
871
884
  const dropdownContextService = core.inject(exports.DropdownContextService, null);
@@ -885,7 +898,7 @@ function MenuItem(props) {
885
898
  }
886
899
  (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, props.value);
887
900
  }
888
- return scopedCss.withScopedCSS(scopedId$f, () => {
901
+ return scopedCss.withScopedCSS(scopedId$i, () => {
889
902
  return (jsxRuntime.jsxs("div", { class: ['menu-item', { disabled: props.disabled, active: props.arrow && isActive() }], onClick: click, children: [jsxRuntime.jsxs("div", { class: "menu-item-content", children: [jsxRuntime.jsxs("div", { children: [props.icon && jsxRuntime.jsx("span", { class: "menu-icon", children: props.icon }), props.children] }), jsxRuntime.jsx("div", { children: props.desc })] }), props.arrow ?
890
903
  jsxRuntime.jsx("div", { class: "arrow", children: jsxRuntime.jsx("span", { class: "xnote-icon-arrow-right" }) }) :
891
904
  jsxRuntime.jsx("div", { class: [
@@ -895,11 +908,11 @@ function MenuItem(props) {
895
908
  });
896
909
  }
897
910
 
898
- var scopedId$e = "vf-a23c47";
911
+ var scopedId$h = "vf-a23c47";
899
912
 
900
913
  function Popup(props) {
901
914
  const host = core.inject(platformBrowser.VIEW_CONTAINER);
902
- return platformBrowser$1.createPortal(scopedCss.withScopedCSS(scopedId$e, () => {
915
+ return platformBrowser$1.createPortal(scopedCss.withScopedCSS(scopedId$h, () => {
903
916
  return (jsxRuntime.jsx("div", { class: "popup", style: {
904
917
  left: props.left + 'px',
905
918
  top: props.top + 'px'
@@ -907,15 +920,15 @@ function Popup(props) {
907
920
  }), host);
908
921
  }
909
922
 
910
- var scopedId$d = "vf-216815";
923
+ var scopedId$g = "vf-cd4d99";
911
924
 
912
925
  function ToolbarItem(props) {
913
- return scopedCss.withScopedCSS(scopedId$d, () => {
926
+ return scopedCss.withScopedCSS(scopedId$g, () => {
914
927
  return (jsxRuntime.jsx("div", { class: "toolbar-item", children: props.children }));
915
928
  });
916
929
  }
917
930
 
918
- var scopedId$c = "vf-2a8a65";
931
+ var scopedId$f = "vf-2a8a65";
919
932
 
920
933
  exports.RefreshService = class RefreshService {
921
934
  constructor() {
@@ -1401,6 +1414,14 @@ class TimelineComponent extends core$1.Component {
1401
1414
  getSlots() {
1402
1415
  return this.state.items.map(i => i.slot);
1403
1416
  }
1417
+ removeSlot(slot) {
1418
+ const index = this.state.items.findIndex(i => i.slot === slot);
1419
+ if (index >= 0) {
1420
+ this.state.items.splice(index, 1);
1421
+ return true;
1422
+ }
1423
+ return false;
1424
+ }
1404
1425
  }
1405
1426
  TimelineComponent.componentName = 'TimelineComponent';
1406
1427
  TimelineComponent.type = core$1.ContentType.BlockComponent;
@@ -1435,6 +1456,17 @@ class StepComponent extends core$1.Component {
1435
1456
  getSlots() {
1436
1457
  return this.state.items.map(i => i.slot);
1437
1458
  }
1459
+ removeSlot(slot) {
1460
+ const index = this.state.items.findIndex(i => i.slot === slot);
1461
+ if (index >= 0) {
1462
+ if (index === this.state.step) {
1463
+ this.state.step--;
1464
+ }
1465
+ this.state.items.splice(index, 1);
1466
+ return true;
1467
+ }
1468
+ return false;
1469
+ }
1438
1470
  }
1439
1471
  StepComponent.componentName = 'StepComponent';
1440
1472
  StepComponent.type = core$1.ContentType.BlockComponent;
@@ -2197,6 +2229,37 @@ function registerTextIndentShortcut(textbus) {
2197
2229
  });
2198
2230
  }
2199
2231
 
2232
+ let ToolService = class ToolService {
2233
+ constructor(selection, controller) {
2234
+ this.selection = selection;
2235
+ this.controller = controller;
2236
+ const [state, updateState] = hooks.useProduce({
2237
+ inSourceCode: false,
2238
+ readonly: controller.readonly
2239
+ });
2240
+ this.state = state;
2241
+ this.sub = core$1.merge(selection.onChange, controller.onReadonlyStateChange).subscribe(() => {
2242
+ updateState(draft => {
2243
+ draft.readonly = controller.readonly;
2244
+ draft.inSourceCode = selection.commonAncestorComponent instanceof SourceCodeComponent;
2245
+ });
2246
+ });
2247
+ }
2248
+ destroy() {
2249
+ this.sub.unsubscribe();
2250
+ }
2251
+ };
2252
+ ToolService = __decorate([
2253
+ core.Injectable(),
2254
+ __metadata("design:paramtypes", [core$1.Selection,
2255
+ core$1.Controller])
2256
+ ], ToolService);
2257
+
2258
+ function useCommonState() {
2259
+ const toolService = core.inject(ToolService);
2260
+ return toolService.state;
2261
+ }
2262
+
2200
2263
  function AttrTool(props) {
2201
2264
  const commander = core.inject(core$1.Commander);
2202
2265
  const selection = core.inject(core$1.Selection);
@@ -2273,9 +2336,11 @@ function AttrTool(props) {
2273
2336
  break;
2274
2337
  }
2275
2338
  }
2276
- return scopedCss.withScopedCSS(scopedId$c, () => {
2339
+ const commonState = useCommonState();
2340
+ return scopedCss.withScopedCSS(scopedId$f, () => {
2277
2341
  const states = checkStates();
2278
- return (jsxRuntime.jsx(Dropdown, { width: 'auto', style: props.style, abreast: props.abreast, onCheck: updateAttr, trigger: 'hover', menu: [
2342
+ const b = commonState().inSourceCode || commonState().readonly;
2343
+ return (jsxRuntime.jsx(Dropdown, { disabled: b, width: 'auto', style: props.style, abreast: props.abreast, onCheck: updateAttr, trigger: 'hover', menu: [
2279
2344
  {
2280
2345
  label: jsxRuntime.jsx(MenuItem, { icon: jsxRuntime.jsx("span", { class: "xnote-icon-paragraph-left" }), desc: jsxRuntime.jsx(Keymap, { keymap: { key: 'L', modKey: true } }), checked: states.textAlign === 'left', children: "\u5DE6\u5BF9\u9F50" }),
2281
2346
  value: 't-l'
@@ -2298,7 +2363,7 @@ function AttrTool(props) {
2298
2363
  label: jsxRuntime.jsx(MenuItem, { desc: jsxRuntime.jsx(Keymap, { keymap: { key: 'Tab', shiftKey: true } }), icon: jsxRuntime.jsx("span", { class: "xnote-icon-indent-decrease" }), children: "\u51CF\u5C11\u7F29\u8FDB" }),
2299
2364
  value: 'i-'
2300
2365
  }
2301
- ], children: props.children || jsxRuntime.jsx(Button, { arrow: true, highlight: false, children: jsxRuntime.jsx("span", { class: `xnote-icon-paragraph-${states.textAlign || 'left'} icon` }) }) }));
2366
+ ], children: props.children || jsxRuntime.jsx(Button, { disabled: b, arrow: true, highlight: false, children: jsxRuntime.jsx("span", { class: `xnote-icon-paragraph-${states.textAlign || 'left'} icon` }) }) }));
2302
2367
  });
2303
2368
  }
2304
2369
 
@@ -2480,6 +2545,17 @@ class TableComponent extends core$1.Component {
2480
2545
  }
2481
2546
  }
2482
2547
  }
2548
+ splitCellBySlot(slot) {
2549
+ const slots = this.getNormalizedData();
2550
+ for (const item of slots) {
2551
+ for (const cell of item.cells) {
2552
+ if (cell.raw.slot === slot) {
2553
+ Reflect.deleteProperty(this.state.mergeConfig, cell.raw.id);
2554
+ return;
2555
+ }
2556
+ }
2557
+ }
2558
+ }
2483
2559
  getMaxRectangle(startSlot, endSlot) {
2484
2560
  let index1 = -1;
2485
2561
  let index2 = -1;
@@ -3551,7 +3627,8 @@ function useBlockTransform() {
3551
3627
  function BlockTool() {
3552
3628
  const checkStates = useActiveBlock();
3553
3629
  const transform = useBlockTransform();
3554
- return scopedCss.withScopedCSS(scopedId$c, () => {
3630
+ const commonState = useCommonState();
3631
+ return scopedCss.withScopedCSS(scopedId$f, () => {
3555
3632
  const states = checkStates();
3556
3633
  const types = [
3557
3634
  [states.paragraph, 'xnote-icon-pilcrow'],
@@ -3575,7 +3652,8 @@ function BlockTool() {
3575
3652
  break;
3576
3653
  }
3577
3654
  }
3578
- return (jsxRuntime.jsx(Dropdown, { width: 'auto', onCheck: transform, trigger: 'hover', menu: [
3655
+ const b = commonState().inSourceCode || commonState().readonly;
3656
+ return (jsxRuntime.jsx(Dropdown, { disabled: b, width: 'auto', onCheck: transform, trigger: 'hover', menu: [
3579
3657
  {
3580
3658
  label: jsxRuntime.jsx(MenuItem, { icon: jsxRuntime.jsx("span", { class: "xnote-icon-pilcrow" }), desc: jsxRuntime.jsx(Keymap, { keymap: {
3581
3659
  modKey: true,
@@ -3640,7 +3718,7 @@ function BlockTool() {
3640
3718
  label: jsxRuntime.jsx(MenuItem, { icon: jsxRuntime.jsx("span", { class: "xnote-icon-hightlight-box" }), checked: states.highlightBox, children: "\u9AD8\u4EAE\u5757" }),
3641
3719
  value: 'highlightBox'
3642
3720
  }
3643
- ], children: jsxRuntime.jsx(Button, { arrow: true, highlight: false, children: jsxRuntime.jsx("span", { class: currentType }) }) }));
3721
+ ], children: jsxRuntime.jsx(Button, { disabled: b, arrow: true, highlight: false, children: jsxRuntime.jsx("span", { class: currentType }) }) }));
3644
3722
  });
3645
3723
  }
3646
3724
 
@@ -3818,6 +3896,40 @@ const linkFormatLoader = {
3818
3896
  }
3819
3897
  };
3820
3898
 
3899
+ const subscriptFormatter = new core$1.Formatter('sub', {
3900
+ render(children) {
3901
+ return core$1.createVNode('sub', null, children);
3902
+ }
3903
+ });
3904
+ const subscriptFormatLoader = {
3905
+ match(element) {
3906
+ return element.tagName === 'SUB';
3907
+ },
3908
+ read() {
3909
+ return {
3910
+ formatter: subscriptFormatter,
3911
+ value: true
3912
+ };
3913
+ }
3914
+ };
3915
+
3916
+ const superscriptFormatter = new core$1.Formatter('super', {
3917
+ render(children) {
3918
+ return core$1.createVNode('sup', null, children);
3919
+ }
3920
+ });
3921
+ const superscriptFormatLoader = {
3922
+ match(element) {
3923
+ return element.tagName === 'SUP';
3924
+ },
3925
+ read() {
3926
+ return {
3927
+ formatter: superscriptFormatter,
3928
+ value: true
3929
+ };
3930
+ }
3931
+ };
3932
+
3821
3933
  const underlineFormatter = new core$1.Formatter('underline', {
3822
3934
  columned: true,
3823
3935
  render(children) {
@@ -3867,9 +3979,9 @@ function BoldTool() {
3867
3979
  const query = core.inject(core$1.Query);
3868
3980
  const textbus = core.inject(core$1.Textbus);
3869
3981
  const refreshService = core.inject(exports.RefreshService);
3982
+ const commonState = useCommonState();
3870
3983
  const [viewModel, update] = hooks.useProduce({
3871
3984
  highlight: false,
3872
- disabled: false,
3873
3985
  });
3874
3986
  function toggle() {
3875
3987
  toggleBold(textbus);
@@ -3885,7 +3997,20 @@ function BoldTool() {
3885
3997
  });
3886
3998
  return () => {
3887
3999
  const vm = viewModel();
3888
- return jsxRuntime.jsx(Button, { highlight: vm.highlight, disabled: vm.disabled, onClick: toggle, children: jsxRuntime.jsx("span", { class: "xnote-icon-bold" }) });
4000
+ return jsxRuntime.jsx(Button, { highlight: vm.highlight, disabled: commonState().inSourceCode || commonState().readonly, onClick: toggle, children: jsxRuntime.jsx("span", { class: "xnote-icon-bold" }) });
4001
+ };
4002
+ }
4003
+
4004
+ function CleanFormatsTool() {
4005
+ const commonState = useCommonState();
4006
+ const commander = core.inject(core$1.Commander);
4007
+ function clean() {
4008
+ commander.cleanFormats([
4009
+ linkFormatter
4010
+ ]);
4011
+ }
4012
+ return () => {
4013
+ return (jsxRuntime.jsx(Button, { disabled: commonState().inSourceCode || commonState().readonly, onClick: clean, children: jsxRuntime.jsx("span", { class: "xnote-icon-clear-formatting" }) }));
3889
4014
  };
3890
4015
  }
3891
4016
 
@@ -3893,9 +4018,9 @@ function CodeTool() {
3893
4018
  const query = core.inject(core$1.Query);
3894
4019
  const refreshService = core.inject(exports.RefreshService);
3895
4020
  const textbus = core.inject(core$1.Textbus);
4021
+ const commonState = useCommonState();
3896
4022
  const [viewModel, update] = hooks.useProduce({
3897
4023
  highlight: false,
3898
- disabled: false,
3899
4024
  });
3900
4025
  function toggle() {
3901
4026
  toggleCode(textbus);
@@ -3911,11 +4036,11 @@ function CodeTool() {
3911
4036
  });
3912
4037
  return () => {
3913
4038
  const vm = viewModel();
3914
- return jsxRuntime.jsx(Button, { highlight: vm.highlight, disabled: vm.disabled, onClick: toggle, children: jsxRuntime.jsx("span", { class: "xnote-icon-code" }) });
4039
+ return jsxRuntime.jsx(Button, { highlight: vm.highlight, disabled: commonState().inSourceCode || commonState().readonly, onClick: toggle, children: jsxRuntime.jsx("span", { class: "xnote-icon-code" }) });
3915
4040
  };
3916
4041
  }
3917
4042
 
3918
- var scopedId$b = "vf-accb31";
4043
+ var scopedId$e = "vf-accb31";
3919
4044
 
3920
4045
  function ColorTool(props) {
3921
4046
  const query = core.inject(core$1.Query);
@@ -3926,7 +4051,6 @@ function ColorTool(props) {
3926
4051
  const backgroundColor = core.createSignal('');
3927
4052
  const [viewModel] = hooks.useProduce({
3928
4053
  highlight: false,
3929
- disabled: false,
3930
4054
  });
3931
4055
  function updateCheckState() {
3932
4056
  if (!props.slot && !selection.isSelected) {
@@ -3978,9 +4102,10 @@ function ColorTool(props) {
3978
4102
  '#90a0e5',
3979
4103
  '#c596e0',
3980
4104
  ];
3981
- return scopedCss.withScopedCSS(scopedId$b, () => {
4105
+ const commonState = useCommonState();
4106
+ return scopedCss.withScopedCSS(scopedId$e, () => {
3982
4107
  const vm = viewModel();
3983
- return (jsxRuntime.jsx(Dropdown, { style: props.style, width: '180px', abreast: props.abreast, trigger: 'hover', menu: jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { class: "color-type", children: "\u6587\u5B57\u989C\u8272" }), jsxRuntime.jsxs("div", { class: "text-colors", children: [jsxRuntime.jsx("div", { class: {
4108
+ return (jsxRuntime.jsx(Dropdown, { disabled: commonState().readonly || commonState().inSourceCode, style: props.style, width: '180px', abreast: props.abreast, trigger: 'hover', menu: jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { class: "color-type", children: "\u6587\u5B57\u989C\u8272" }), jsxRuntime.jsxs("div", { class: "text-colors", children: [jsxRuntime.jsx("div", { class: {
3984
4109
  'no-background': true,
3985
4110
  active: textColor() === ''
3986
4111
  }, onClick: () => {
@@ -4010,7 +4135,7 @@ function ColorTool(props) {
4010
4135
  (_a = props.applyBefore) === null || _a === void 0 ? void 0 : _a.call(props);
4011
4136
  commander.applyFormat(backgroundColorFormatter, c);
4012
4137
  }, style: { backgroundColor: c }, children: "A" });
4013
- })] })] }), children: props.children || jsxRuntime.jsx(Button, { highlight: vm.highlight, arrow: true, disabled: vm.disabled, children: jsxRuntime.jsx("span", { class: "background", children: jsxRuntime.jsx("span", { style: {
4138
+ })] })] }), children: props.children || jsxRuntime.jsx(Button, { highlight: vm.highlight, arrow: true, disabled: commonState().readonly || commonState().inSourceCode, children: jsxRuntime.jsx("span", { class: "background", children: jsxRuntime.jsx("span", { style: {
4014
4139
  backgroundColor: backgroundColor(),
4015
4140
  color: textColor()
4016
4141
  }, children: jsxRuntime.jsx("span", { class: "xnote-icon-color" }) }) }) }) }));
@@ -4110,16 +4235,18 @@ function FontFamilyTool() {
4110
4235
  core.onUnmounted(() => {
4111
4236
  subscription.unsubscribe();
4112
4237
  });
4238
+ const commonState = useCommonState();
4113
4239
  return () => {
4114
4240
  var _a;
4115
- return (jsxRuntime.jsx(Dropdown, { onCheck: check, menu: fontFamilyOptions.map(i => {
4241
+ const b = commonState().inSourceCode || commonState().readonly;
4242
+ return (jsxRuntime.jsx(Dropdown, { disabled: b, onCheck: check, menu: fontFamilyOptions.map(i => {
4116
4243
  const disabled = i.value ? !i.value.split(',').map(i => isSupportFont(i.trim())).some(v => v) : false;
4117
4244
  return {
4118
4245
  label: jsxRuntime.jsx(MenuItem, { disabled: disabled, checked: currentFontFamily() === i.value, children: i.label }),
4119
4246
  disabled,
4120
4247
  value: i.value,
4121
4248
  };
4122
- }), children: jsxRuntime.jsx(Button, { arrow: true, highlight: highlight(), children: ((_a = fontFamilyOptions.find(v => {
4249
+ }), children: jsxRuntime.jsx(Button, { disabled: b, arrow: true, highlight: highlight(), children: ((_a = fontFamilyOptions.find(v => {
4123
4250
  return v.value === currentFontFamily();
4124
4251
  })) === null || _a === void 0 ? void 0 : _a.label) || '默认' }) }));
4125
4252
  };
@@ -4164,776 +4291,1027 @@ function FontSizeTool() {
4164
4291
  core.onUnmounted(() => {
4165
4292
  subscription.unsubscribe();
4166
4293
  });
4294
+ const commonState = useCommonState();
4167
4295
  return () => {
4168
- return (jsxRuntime.jsx(Dropdown, { onCheck: check, menu: fontSizeOptions.map(i => {
4296
+ const b = commonState().inSourceCode || commonState().readonly;
4297
+ return (jsxRuntime.jsx(Dropdown, { disabled: b, onCheck: check, menu: fontSizeOptions.map(i => {
4169
4298
  return {
4170
4299
  label: jsxRuntime.jsx(MenuItem, { checked: currentFontSize() === i, children: i || '默认' }),
4171
4300
  value: i
4172
4301
  };
4173
- }), children: jsxRuntime.jsxs(Button, { arrow: true, highlight: highlight(), children: [jsxRuntime.jsx("span", { class: "xnote-icon-font-size" }), jsxRuntime.jsx("span", { children: currentFontSize() || '默认' })] }) }));
4302
+ }), children: jsxRuntime.jsxs(Button, { disabled: b, arrow: true, highlight: highlight(), children: [jsxRuntime.jsx("span", { class: "xnote-icon-font-size" }), jsxRuntime.jsx("span", { children: currentFontSize() || '默认' })] }) }));
4174
4303
  };
4175
4304
  }
4176
4305
 
4177
- function ItalicTool() {
4178
- const query = core.inject(core$1.Query);
4179
- const refreshService = core.inject(exports.RefreshService);
4180
- const textbus = core.inject(core$1.Textbus);
4181
- const [viewModel, update] = hooks.useProduce({
4182
- highlight: false,
4183
- disabled: false,
4184
- });
4185
- function toggle() {
4186
- toggleItalic(textbus);
4306
+ var scopedId$d = "vf-cf8e1c";
4307
+
4308
+ class FileUploader {
4309
+ }
4310
+
4311
+ class ImageComponent extends core$1.Component {
4312
+ static fromJSON(textbus, json) {
4313
+ return new ImageComponent(textbus, Object.assign({}, json));
4187
4314
  }
4188
- const sub = refreshService.onRefresh.subscribe(() => {
4189
- const state = query.queryFormat(italicFormatter);
4190
- update(draft => {
4191
- draft.highlight = state.state === core$1.QueryStateType.Enabled;
4192
- });
4193
- });
4194
- core.onUnmounted(() => {
4195
- sub.unsubscribe();
4196
- });
4315
+ getSlots() {
4316
+ return [];
4317
+ }
4318
+ }
4319
+ ImageComponent.type = core$1.ContentType.InlineComponent;
4320
+ ImageComponent.componentName = 'ImageComponent';
4321
+ function ImageView(props) {
4322
+ const { name, state } = props.component;
4323
+ const imageRef = core.createRef();
4324
+ const readonly = useReadonly();
4325
+ const output = useOutput();
4197
4326
  return () => {
4198
- const vm = viewModel();
4199
- return jsxRuntime.jsx(Button, { highlight: vm.highlight, disabled: vm.disabled, onClick: toggle, children: jsxRuntime.jsx("span", { class: "xnote-icon-italic" }) });
4327
+ if (readonly() || output()) {
4328
+ return (jsxRuntime.jsx("div", { class: "xnote-image", ref: props.rootRef, "data-component": name, children: jsxRuntime.jsx("img", { alt: "", src: state.src, style: {
4329
+ width: state.width,
4330
+ height: state.height
4331
+ } }) }));
4332
+ }
4333
+ return (jsxRuntime.jsx("div", { class: "xnote-image", ref: props.rootRef, "data-component": name, children: jsxRuntime.jsx(DragResize, { source: imageRef, component: props.component, children: jsxRuntime.jsx("img", { alt: "", ref: imageRef, src: state.src, style: {
4334
+ width: state.width,
4335
+ height: state.height
4336
+ } }) }) }));
4200
4337
  };
4201
4338
  }
4202
-
4203
- var scopedId$a = "vf-e74208";
4204
-
4205
- exports.EditorService = class EditorService {
4206
- constructor() {
4207
- this.hideInlineToolbar = false;
4208
- this.canShowLeftToolbar = true;
4209
- this.onLeftToolbarCanVisibleChange = new core$1.Subject();
4210
- }
4211
- changeLeftToolbarVisible(b) {
4212
- this.canShowLeftToolbar = b;
4213
- this.onLeftToolbarCanVisibleChange.next();
4339
+ const imageComponentLoader = {
4340
+ match(element) {
4341
+ return element.tagName === 'IMG' || element.dataset.component === ImageComponent.componentName;
4342
+ },
4343
+ read(element, textbus) {
4344
+ const img = element instanceof HTMLImageElement ? element : (element.querySelector('img') || document.createElement('img'));
4345
+ return new ImageComponent(textbus, {
4346
+ src: img.src,
4347
+ width: img.style.width || 'auto',
4348
+ height: img.style.height || 'auto'
4349
+ });
4214
4350
  }
4215
4351
  };
4216
- exports.EditorService = __decorate([
4217
- core.Injectable({
4218
- provideIn: 'root'
4219
- })
4220
- ], exports.EditorService);
4221
4352
 
4222
- function LinkTool(props) {
4223
- const selectionBridge = core.inject(platformBrowser.SelectionBridge);
4224
- const selection = core.inject(core$1.Selection);
4225
- const commander = core.inject(core$1.Commander);
4226
- const editorService = core.inject(exports.EditorService);
4227
- const container = core.inject(platformBrowser.VIEW_CONTAINER);
4228
- const isShow = core.createSignal(false);
4229
- const value = core.createSignal('');
4230
- function setLink(ev) {
4231
- ev.preventDefault();
4232
- commander.applyFormat(linkFormatter, {
4233
- href: value(),
4234
- target: '_blanK'
4235
- });
4236
- isShow.set(false);
4353
+ class VideoComponent extends core$1.Component {
4354
+ static fromJSON(textbus, json) {
4355
+ return new VideoComponent(textbus, Object.assign({}, json));
4237
4356
  }
4238
- let isClickFromSelf = false;
4239
- const sub = core$1.fromEvent(document, 'click').subscribe(() => {
4240
- if (isClickFromSelf) {
4241
- isClickFromSelf = false;
4242
- return;
4243
- }
4244
- editorService.hideInlineToolbar = false;
4245
- isShow.set(false);
4246
- });
4247
- core.onUnmounted(() => {
4248
- sub.unsubscribe();
4249
- });
4250
- return scopedCss.withScopedCSS(scopedId$a, () => {
4251
- const containerRect = container.getBoundingClientRect();
4252
- const rect = isShow() ? selectionBridge.getRect({
4253
- slot: selection.focusSlot,
4254
- offset: selection.focusOffset
4255
- }) : {};
4256
- return (jsxRuntime.jsxs("span", { children: [jsxRuntime.jsx(Button, { onClick: () => {
4257
- var _a;
4258
- isShow.set(true);
4259
- isClickFromSelf = true;
4260
- (_a = props.hideToolbar) === null || _a === void 0 ? void 0 : _a.call(props);
4261
- }, children: jsxRuntime.jsx("span", { class: "xnote-icon-link" }) }), isShow() &&
4262
- jsxRuntime.jsx(Popup, { left: rect.left - containerRect.left, top: rect.top + rect.height - containerRect.top, children: jsxRuntime.jsxs("form", { onSubmit: setLink, onClick: () => {
4263
- isClickFromSelf = true;
4264
- }, class: "input-group", children: [jsxRuntime.jsx("input", { onChange: ev => {
4265
- value.set(ev.target.value);
4266
- }, placeholder: "\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740", type: "text" }), jsxRuntime.jsx(Button, { type: "submit", children: "\u786E\u5B9A" })] }) })] }));
4267
- });
4268
- }
4269
-
4270
- function StrikeThroughTool() {
4271
- const query = core.inject(core$1.Query);
4272
- const refreshService = core.inject(exports.RefreshService);
4273
- const textbus = core.inject(core$1.Textbus);
4274
- const [viewModel, update] = hooks.useProduce({
4275
- highlight: false,
4276
- disabled: false,
4277
- });
4278
- function toggle() {
4279
- toggleStrikeThrough(textbus);
4357
+ getSlots() {
4358
+ return [];
4280
4359
  }
4281
- const sub = refreshService.onRefresh.subscribe(() => {
4282
- const state = query.queryFormat(strikeThroughFormatter);
4283
- update(draft => {
4284
- draft.highlight = state.state === core$1.QueryStateType.Enabled;
4285
- });
4286
- });
4287
- core.onUnmounted(() => {
4288
- sub.unsubscribe();
4289
- });
4360
+ }
4361
+ VideoComponent.type = core$1.ContentType.InlineComponent;
4362
+ VideoComponent.componentName = 'VideoComponent';
4363
+ function VideoView(props) {
4364
+ const { name, state } = props.component;
4365
+ const videoRef = core.createRef();
4366
+ const readonly = useReadonly();
4367
+ const output = useOutput();
4290
4368
  return () => {
4291
- const vm = viewModel();
4292
- return jsxRuntime.jsx(Button, { highlight: vm.highlight, disabled: vm.disabled, onClick: toggle, children: jsxRuntime.jsx("span", { class: "xnote-icon-strikethrough" }) });
4369
+ if (readonly() || output()) {
4370
+ return (jsxRuntime.jsx("div", { class: "xnote-video", ref: props.rootRef, "data-component": name, children: jsxRuntime.jsx("video", { ref: videoRef, src: state.src, style: {
4371
+ width: state.width,
4372
+ height: state.height
4373
+ } }) }));
4374
+ }
4375
+ return (jsxRuntime.jsx("div", { ref: props.rootRef, class: "xnote-video", "data-component": name, children: jsxRuntime.jsx(DragResize, { source: videoRef, component: props.component, children: jsxRuntime.jsx("video", { ref: videoRef, src: state.src, style: {
4376
+ width: state.width,
4377
+ height: state.height
4378
+ } }) }) }));
4293
4379
  };
4294
4380
  }
4295
-
4296
- function UnderlineTool() {
4297
- const query = core.inject(core$1.Query);
4298
- const refreshService = core.inject(exports.RefreshService);
4299
- const textbus = core.inject(core$1.Textbus);
4300
- const [viewModel, update] = hooks.useProduce({
4301
- highlight: false,
4302
- disabled: false,
4303
- });
4304
- function toggle() {
4305
- toggleUnderline(textbus);
4381
+ const videoComponentLoader = {
4382
+ match(element) {
4383
+ return element.tagName === 'VIDEO' || element.dataset.component === VideoComponent.componentName;
4384
+ },
4385
+ read(element, textbus) {
4386
+ const video = element instanceof HTMLVideoElement ? element : (element.querySelector('video') || document.createElement('video'));
4387
+ return new VideoComponent(textbus, {
4388
+ src: video.src,
4389
+ width: video.style.width || 'auto',
4390
+ height: video.style.height || 'auto'
4391
+ });
4306
4392
  }
4307
- const sub = refreshService.onRefresh.subscribe(() => {
4308
- const state = query.queryFormat(underlineFormatter);
4309
- update(draft => {
4310
- draft.highlight = state.state === core$1.QueryStateType.Enabled;
4393
+ };
4394
+
4395
+ class KatexEditor extends core$1.Textbus {
4396
+ constructor() {
4397
+ const adapter = new adapterViewfly.ViewflyAdapter({
4398
+ [SourceCodeComponent.componentName]: SourceCodeView
4399
+ }, (host, root, injector) => {
4400
+ const appInjector = new core.ReflectiveInjector(injector, [{
4401
+ provide: OutputInjectionToken,
4402
+ useValue: true
4403
+ }]);
4404
+ const app = platformBrowser$1.createApp(root, {
4405
+ context: appInjector
4406
+ }).mount(host);
4407
+ return () => {
4408
+ app.destroy();
4409
+ };
4311
4410
  });
4312
- });
4313
- core.onUnmounted(() => {
4314
- sub.unsubscribe();
4315
- });
4316
- return () => {
4317
- const vm = viewModel();
4318
- return jsxRuntime.jsx(Button, { highlight: vm.highlight, disabled: vm.disabled, onClick: toggle, children: jsxRuntime.jsx("span", { class: "xnote-icon-underline" }) });
4319
- };
4411
+ const browserModule = new platformBrowser.BrowserModule({
4412
+ adapter,
4413
+ renderTo: () => {
4414
+ return this.host;
4415
+ }
4416
+ });
4417
+ super({
4418
+ components: [
4419
+ SourceCodeComponent
4420
+ ],
4421
+ imports: [browserModule]
4422
+ });
4423
+ this.onValueChange = new core$1.Subject();
4424
+ }
4425
+ mount(host, code) {
4426
+ this.host = host;
4427
+ const model = new SourceCodeComponent(this, {
4428
+ lineNumber: true,
4429
+ autoBreak: true,
4430
+ lang: 'latex',
4431
+ theme: 'github',
4432
+ slots: code.split('\n').map(i => {
4433
+ const slot = new core$1.Slot([core$1.ContentType.Text]);
4434
+ slot.insert(i);
4435
+ return {
4436
+ slot,
4437
+ emphasize: false
4438
+ };
4439
+ })
4440
+ });
4441
+ this.onChange.subscribe(() => {
4442
+ const str = model.state.slots.map(i => {
4443
+ if (i.slot.isEmpty) {
4444
+ return '';
4445
+ }
4446
+ return i.slot.toString();
4447
+ }).join('\n');
4448
+ this.onValueChange.next(str);
4449
+ });
4450
+ return this.render(model);
4451
+ }
4320
4452
  }
4321
4453
 
4322
- const cellAlignAttr = new core$1.Attribute('cellAlign', {
4323
- render(node, formatValue) {
4324
- node.styles.set('verticalAlign', formatValue);
4454
+ class KatexComponent extends core$1.Component {
4455
+ static fromJSON(textbus, state) {
4456
+ return new KatexComponent(textbus, state);
4325
4457
  }
4326
- });
4327
- const cellAlignAttrLoader = {
4328
- match(element) {
4329
- return element instanceof HTMLTableCellElement && !!element.style.verticalAlign;
4330
- },
4331
- read(element) {
4332
- return {
4333
- attribute: cellAlignAttr,
4334
- value: element.style.verticalAlign
4335
- };
4458
+ constructor(textbus, state = {
4459
+ text: '% \\f is defined as #1f(#2) using the macro\n' +
4460
+ '\\f\\relax{x} = \\int_{-\\infty}^\\infty\n' +
4461
+ '\\f\\hat\\xi\\,e^{2 \\pi i \\xi x}\n' +
4462
+ '\\,d\\xi'
4463
+ }) {
4464
+ super(textbus, state);
4336
4465
  }
4337
- };
4338
-
4339
- function CellAlignTool() {
4340
- const currentValue = core.createSignal('');
4341
- const selection = core.inject(core$1.Selection);
4342
- function check(v) {
4343
- const commonAncestorComponent = selection.commonAncestorComponent;
4344
- if (commonAncestorComponent instanceof TableComponent) {
4345
- const slots = commonAncestorComponent.getSelectedNormalizedSlots();
4346
- slots.forEach(item => {
4347
- item.cells.forEach(cell => {
4348
- if (cell.visible) {
4349
- cell.raw.slot.setAttribute(cellAlignAttr, v);
4350
- }
4351
- });
4466
+ getSlots() {
4467
+ return [];
4468
+ }
4469
+ }
4470
+ KatexComponent.componentName = 'KatexComponent';
4471
+ KatexComponent.type = core$1.ContentType.InlineComponent;
4472
+ function domToVDom(el) {
4473
+ const attrs = {};
4474
+ el.getAttributeNames().forEach(key => {
4475
+ attrs[key] = el.getAttribute(key);
4476
+ });
4477
+ attrs.children = Array.from(el.childNodes).map(child => {
4478
+ if (child.nodeType === Node.ELEMENT_NODE) {
4479
+ return domToVDom(child);
4480
+ }
4481
+ return child.textContent || '';
4482
+ });
4483
+ return core.jsx(el.tagName.toLowerCase(), attrs);
4484
+ }
4485
+ function KatexComponentView(props) {
4486
+ function toDOM(value) {
4487
+ let htmlString;
4488
+ try {
4489
+ htmlString = Katex.renderToString(value, {
4490
+ displayMode: true,
4491
+ leqno: false,
4492
+ fleqn: false,
4493
+ throwOnError: true,
4494
+ errorColor: '#cc0000',
4495
+ strict: 'warn',
4496
+ output: 'html',
4497
+ trust: false,
4498
+ macros: { '\\f': '#1f(#2)' }
4352
4499
  });
4353
4500
  }
4501
+ catch (e) {
4502
+ htmlString = '<span style="color: red">公式错误</span>';
4503
+ }
4504
+ return new DOMParser().parseFromString(htmlString, 'text/html').body.children[0];
4354
4505
  }
4355
- const refreshService = core.inject(exports.RefreshService);
4356
- const query = core.inject(core$1.Query);
4357
- const highlight = core.createSignal(false);
4358
- const subscription = refreshService.onRefresh.subscribe(() => {
4359
- const result = query.queryAttribute(cellAlignAttr);
4360
- const isHighlight = result.state === core$1.QueryStateType.Enabled;
4361
- highlight.set(isHighlight);
4362
- currentValue.set(isHighlight ? result.value : 'middle');
4363
- });
4364
- core.onUnmounted(() => {
4365
- subscription.unsubscribe();
4506
+ const selection = core.inject(core$1.Textbus);
4507
+ const editorRef = core.createDynamicRef(node => {
4508
+ const editor = new KatexEditor();
4509
+ editor.mount(node, props.component.state.text).then(() => {
4510
+ editor.focus();
4511
+ });
4512
+ selection.blur();
4513
+ const subscription = editor.onValueChange.subscribe((value) => {
4514
+ props.component.state.text = value;
4515
+ }).add(core$1.fromEvent(node, 'mousedown').subscribe(ev => ev.stopPropagation()), core$1.fromEvent(document, 'mousedown').subscribe(() => {
4516
+ var _a;
4517
+ (_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.isShow(false);
4518
+ }));
4519
+ return () => {
4520
+ subscription.unsubscribe();
4521
+ editor.destroy();
4522
+ };
4366
4523
  });
4524
+ const dropdownRef = core.createRef();
4525
+ const output = useOutput();
4526
+ const readonly = useReadonly();
4367
4527
  return () => {
4368
- return (jsxRuntime.jsx(Dropdown, { onCheck: check, menu: [
4369
- {
4370
- label: jsxRuntime.jsx(MenuItem, { checked: currentValue() === 'top', icon: jsxRuntime.jsx("span", { class: "xnote-icon-align-top" }), children: "\u9876\u90E8\u5BF9\u9F50" }),
4371
- value: 'top'
4372
- },
4373
- {
4374
- label: jsxRuntime.jsx(MenuItem, { checked: currentValue() === 'middle', icon: jsxRuntime.jsx("span", { class: "xnote-icon-align-middle" }), children: "\u5782\u76F4\u5C45\u4E2D" }),
4375
- value: 'middle'
4376
- },
4377
- {
4378
- label: jsxRuntime.jsx(MenuItem, { checked: currentValue() === 'bottom', icon: jsxRuntime.jsx("span", { class: "xnote-icon-align-bottom" }), children: "\u5E95\u90E8\u5BF9\u9F50" }),
4379
- value: 'bottom'
4380
- }
4381
- ], children: jsxRuntime.jsx(Button, { arrow: true, highlight: highlight(), children: jsxRuntime.jsx("span", { class: 'xnote-icon-align-' + (currentValue() || 'middle') }) }) }));
4528
+ const text = props.component.state.text;
4529
+ return (jsxRuntime.jsx("span", { onClick: () => {
4530
+ var _a;
4531
+ (_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.isShow(true);
4532
+ }, ref: props.rootRef, "data-component": KatexComponent.componentName, "data-katex": encodeURIComponent(text), class: "xnote-katex", children: (output() || readonly()) ?
4533
+ domToVDom(toDOM(text))
4534
+ :
4535
+ jsxRuntime.jsx(Dropdown, { padding: '0', ref: dropdownRef, trigger: 'none', width: '600px', menu: jsxRuntime.jsx("div", { class: "xnote-katex-input", ref: editorRef }), children: domToVDom(toDOM(text)) }) }));
4382
4536
  };
4383
4537
  }
4384
-
4385
- const cellBackgroundAttr = new core$1.Attribute('cellBackground', {
4386
- render(node, formatValue) {
4387
- const rgba = color.parseCss(formatValue);
4388
- if (rgba) {
4389
- const hsl = color.rgb2Hsl(rgba);
4390
- if (hsl.l > 50) {
4391
- hsl.l -= 10;
4392
- }
4393
- else {
4394
- hsl.l += Math.max((50 - hsl.l) * 0.55, 10);
4395
- }
4396
- hsl.s *= 0.7;
4397
- const newRgba = color.hsl2Rgb(hsl);
4398
- node.styles.set('borderColor', `rgba(${newRgba.r}, ${newRgba.g}, ${newRgba.b}, ${rgba.a || 1})`);
4399
- }
4400
- node.styles.set('backgroundColor', formatValue);
4401
- }
4402
- });
4403
- const cellBackgroundAttrLoader = {
4538
+ const katexComponentLoader = {
4404
4539
  match(element) {
4405
- return (element.tagName === 'TD' || element.tagName === 'TH') && !!element.style.backgroundColor;
4540
+ return element.dataset.component === KatexComponent.componentName;
4406
4541
  },
4407
- read(element) {
4408
- return {
4409
- attribute: cellBackgroundAttr,
4410
- value: element.style.backgroundColor
4411
- };
4542
+ read(element, textbus) {
4543
+ const value = element.dataset.katex || '';
4544
+ return new KatexComponent(textbus, {
4545
+ text: decodeURIComponent(value)
4546
+ });
4412
4547
  }
4413
4548
  };
4414
4549
 
4415
- function CellBackgroundTool() {
4416
- const refreshService = core.inject(exports.RefreshService);
4550
+ function InsertMenu(props) {
4551
+ const commander = core.inject(core$1.Commander);
4417
4552
  const selection = core.inject(core$1.Selection);
4418
- const [viewModel, update] = hooks.useProduce({
4419
- highlight: false,
4420
- disabled: false,
4421
- });
4422
- function setColor(picker) {
4423
- const commonAncestorComponent = selection.commonAncestorComponent;
4424
- if (commonAncestorComponent instanceof TableComponent) {
4425
- const slots = commonAncestorComponent.getSelectedNormalizedSlots();
4426
- if (slots) {
4427
- slots.map(i => {
4428
- return i.cells.filter(t => t.visible).map(i => i.raw.slot);
4429
- }).flat().forEach(slot => {
4430
- const rgba = picker.rgba;
4431
- if (rgba) {
4432
- slot.setAttribute(cellBackgroundAttr, `rgba(${rgba.r}, ${rgba.g}, ${rgba.b}, ${rgba.a})`);
4433
- }
4434
- else {
4435
- slot.removeAttribute(cellBackgroundAttr);
4553
+ const textbus = core.inject(core$1.Textbus);
4554
+ const fileUploader = core.inject(FileUploader, null);
4555
+ const dropdownContextService = core.inject(exports.DropdownContextService);
4556
+ function insert(type) {
4557
+ var _a;
4558
+ const component = (_a = props.slot) === null || _a === void 0 ? void 0 : _a.parent;
4559
+ if (!component) {
4560
+ return;
4561
+ }
4562
+ function insertComponent(comp) {
4563
+ if (props.replace) {
4564
+ commander.replaceComponent(component, comp);
4565
+ }
4566
+ else {
4567
+ commander.insertAfter(comp, component);
4568
+ }
4569
+ dropdownContextService.canHide = true;
4570
+ dropdownContextService.hide(false);
4571
+ }
4572
+ switch (type) {
4573
+ case 'h1':
4574
+ case 'h2':
4575
+ case 'h3':
4576
+ case 'h4':
4577
+ case 'h5':
4578
+ case 'h6':
4579
+ case 'paragraph':
4580
+ {
4581
+ const slot = new core$1.Slot([
4582
+ core$1.ContentType.InlineComponent,
4583
+ core$1.ContentType.Text
4584
+ ]);
4585
+ if (/h[1-6]/.test(type)) {
4586
+ slot.setAttribute(headingAttr, type);
4436
4587
  }
4588
+ const p = new ParagraphComponent(textbus, {
4589
+ slot
4590
+ });
4591
+ insertComponent(p);
4592
+ selection.setPosition(slot, 0);
4593
+ }
4594
+ break;
4595
+ case 'ol':
4596
+ case 'ul':
4597
+ {
4598
+ const slot = new core$1.Slot([
4599
+ core$1.ContentType.InlineComponent,
4600
+ core$1.ContentType.Text
4601
+ ]);
4602
+ const list = new ListComponent(textbus, {
4603
+ slot,
4604
+ reorder: true,
4605
+ type: type === 'ol' ? 'OrderedList' : 'UnorderedList'
4606
+ });
4607
+ insertComponent(list);
4608
+ selection.setPosition(slot, 0);
4609
+ }
4610
+ break;
4611
+ case 'sourceCode':
4612
+ {
4613
+ const slot = new core$1.Slot([
4614
+ core$1.ContentType.Text
4615
+ ]);
4616
+ const comp = new SourceCodeComponent(textbus, {
4617
+ lang: '',
4618
+ lineNumber: true,
4619
+ slots: [{
4620
+ slot,
4621
+ emphasize: false
4622
+ }]
4623
+ });
4624
+ insertComponent(comp);
4625
+ selection.setPosition(slot, 0);
4626
+ }
4627
+ break;
4628
+ case 'table':
4629
+ {
4630
+ const table = new TableComponent(textbus);
4631
+ insertComponent(table);
4632
+ textbus.nextTick(() => {
4633
+ selection.selectFirstPosition(table, true, true);
4634
+ });
4635
+ }
4636
+ break;
4637
+ case 'todolist':
4638
+ {
4639
+ const slot = new core$1.Slot([
4640
+ core$1.ContentType.Text,
4641
+ core$1.ContentType.InlineComponent
4642
+ ]);
4643
+ const comp = new TodolistComponent(textbus, {
4644
+ slot,
4645
+ checked: false
4646
+ });
4647
+ insertComponent(comp);
4648
+ selection.setPosition(slot, 0);
4649
+ }
4650
+ break;
4651
+ case 'image':
4652
+ if (fileUploader) {
4653
+ Promise.resolve().then(() => fileUploader.uploadFile('image')).then(url => {
4654
+ const img = new ImageComponent(textbus, {
4655
+ src: url
4656
+ });
4657
+ commander.insert(img);
4658
+ });
4659
+ }
4660
+ break;
4661
+ case 'video':
4662
+ if (fileUploader) {
4663
+ Promise.resolve().then(() => fileUploader.uploadFile('video')).then(url => {
4664
+ const img = new VideoComponent(textbus, {
4665
+ src: url
4666
+ });
4667
+ commander.insert(img);
4668
+ });
4669
+ }
4670
+ break;
4671
+ case 'highlightBox':
4672
+ {
4673
+ const p = new ParagraphComponent(textbus);
4674
+ const comp = new HighlightBoxComponent(textbus);
4675
+ comp.state.slot.insert(p);
4676
+ insertComponent(comp);
4677
+ selection.setPosition(p.state.slot, 0);
4678
+ }
4679
+ break;
4680
+ case 'katex':
4681
+ {
4682
+ const p = new ParagraphComponent(textbus);
4683
+ const comp = new KatexComponent(textbus);
4684
+ p.state.slot.insert(comp);
4685
+ insertComponent(p);
4686
+ selection.selectComponent(comp);
4687
+ }
4688
+ break;
4689
+ case 'step':
4690
+ {
4691
+ const step = new StepComponent(textbus, {
4692
+ step: 0,
4693
+ items: [createStepItem(textbus)]
4694
+ });
4695
+ insertComponent(step);
4696
+ selection.selectFirstPosition(step, false, true);
4697
+ }
4698
+ break;
4699
+ case 'timeline': {
4700
+ const timeline = new TimelineComponent(textbus, {
4701
+ items: [createTimelineItem(textbus, '#296eff')]
4437
4702
  });
4703
+ insertComponent(timeline);
4704
+ selection.selectFirstPosition(timeline, false, true);
4705
+ break;
4438
4706
  }
4439
4707
  }
4440
4708
  }
4441
- const sub = refreshService.onRefresh.subscribe(() => {
4442
- const commonAncestorComponent = selection.commonAncestorComponent;
4443
- update(draft => {
4444
- draft.disabled = !(commonAncestorComponent instanceof TableComponent);
4445
- });
4446
- });
4447
- core.onUnmounted(() => {
4448
- sub.unsubscribe();
4709
+ return scopedCss.withScopedCSS(scopedId$d, () => {
4710
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [props.hideTitle ? null : jsxRuntime.jsx(MenuHeading, { children: props.replace ? '替换为' : '在下面添加' }), jsxRuntime.jsxs("div", { class: "btn-group", children: [jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('paragraph'), children: jsxRuntime.jsx("span", { class: "xnote-icon-pilcrow" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('h1'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h1" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('h2'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h2" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('h3'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h3" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('h4'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h4" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('h5'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h5" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('h6'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h6" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('ol'), children: jsxRuntime.jsx("span", { class: "xnote-icon-list-numbered" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('ul'), children: jsxRuntime.jsx("span", { class: "xnote-icon-list" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('sourceCode'), children: jsxRuntime.jsx("span", { class: "xnote-icon-source-code" }) })] }), jsxRuntime.jsx(Divider, {}), jsxRuntime.jsx(MenuItem, { onClick: () => insert('table'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-table" }), children: "\u8868\u683C" }), jsxRuntime.jsx(MenuItem, { onClick: () => insert('todolist'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-checkbox-checked" }), children: "\u5F85\u529E\u5217\u8868" }), jsxRuntime.jsx(MenuItem, { onClick: () => insert('image'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-image" }), children: "\u56FE\u7247" }), jsxRuntime.jsx(MenuItem, { onClick: () => insert('video'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-video" }), children: "\u89C6\u9891" }), jsxRuntime.jsx(MenuItem, { onClick: () => insert('highlightBox'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-hightlight-box" }), children: "\u9AD8\u4EAE\u5757" }), jsxRuntime.jsx(MenuItem, { onClick: () => insert('katex'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-function" }), children: "\u6570\u5B66\u516C\u5F0F" }), jsxRuntime.jsx(MenuItem, { onClick: () => insert('step'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-step" }), children: "\u6B65\u9AA4\u6761" }), jsxRuntime.jsx(MenuItem, { onClick: () => insert('timeline'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-timeline" }), children: "\u65F6\u95F4\u8F74" })] });
4449
4711
  });
4450
- return () => {
4451
- const vm = viewModel();
4452
- return (jsxRuntime.jsx(Dropdown, { width: '177px', menu: jsxRuntime.jsx(ColorPicker, { onSelected: setColor }), trigger: 'hover', children: jsxRuntime.jsx(Button, { highlight: vm.highlight, disabled: vm.disabled, children: jsxRuntime.jsx("span", { class: "xnote-icon-palette" }) }) }));
4453
- };
4454
4712
  }
4455
4713
 
4456
- function MergeCellsTool() {
4457
- const refreshService = core.inject(exports.RefreshService);
4714
+ function InsertTool() {
4458
4715
  const selection = core.inject(core$1.Selection);
4459
- const [viewModel, update] = hooks.useProduce({
4460
- highlight: false,
4461
- disabled: false,
4462
- });
4463
- function merge() {
4464
- const commonAncestorComponent = selection.commonAncestorComponent;
4465
- if (commonAncestorComponent instanceof TableComponent) {
4466
- commonAncestorComponent.mergeCellBySelection();
4467
- }
4468
- }
4469
- const sub = refreshService.onRefresh.subscribe(() => {
4470
- const commonAncestorComponent = selection.commonAncestorComponent;
4471
- update(draft => {
4472
- draft.disabled = !(commonAncestorComponent instanceof TableComponent);
4473
- });
4716
+ const instance = core.getCurrentInstance();
4717
+ const sub = selection.onChange.subscribe(() => {
4718
+ instance.markAsDirtied();
4474
4719
  });
4475
4720
  core.onUnmounted(() => {
4476
4721
  sub.unsubscribe();
4477
4722
  });
4723
+ const commonState = useCommonState();
4478
4724
  return () => {
4479
- const vm = viewModel();
4480
- return jsxRuntime.jsx(Button, { highlight: vm.highlight, disabled: vm.disabled, onClick: merge, children: jsxRuntime.jsx("span", { class: "xnote-icon-merge-cells" }) });
4725
+ const b = commonState().readonly;
4726
+ return (jsxRuntime.jsx(Dropdown, { disabled: b, menu: jsxRuntime.jsx(InsertMenu, { replace: false, hideTitle: true, slot: selection.focusSlot }), children: jsxRuntime.jsx(Button, { disabled: b, arrow: true, children: "\u63D2\u5165" }) }));
4481
4727
  };
4482
4728
  }
4483
4729
 
4484
- function SplitCellsTool() {
4730
+ function ItalicTool() {
4731
+ const query = core.inject(core$1.Query);
4485
4732
  const refreshService = core.inject(exports.RefreshService);
4486
- const selection = core.inject(core$1.Selection);
4733
+ const textbus = core.inject(core$1.Textbus);
4487
4734
  const [viewModel, update] = hooks.useProduce({
4488
4735
  highlight: false,
4489
- disabled: false,
4490
4736
  });
4491
- function split() {
4492
- const commonAncestorComponent = selection.commonAncestorComponent;
4493
- if (commonAncestorComponent instanceof TableComponent) {
4494
- commonAncestorComponent.splitCellsBySelection();
4495
- }
4737
+ function toggle() {
4738
+ toggleItalic(textbus);
4496
4739
  }
4497
4740
  const sub = refreshService.onRefresh.subscribe(() => {
4498
- const commonAncestorComponent = selection.commonAncestorComponent;
4741
+ const state = query.queryFormat(italicFormatter);
4499
4742
  update(draft => {
4500
- if (commonAncestorComponent instanceof TableComponent) {
4501
- const slots = commonAncestorComponent.getSelectedNormalizedSlots();
4502
- if (slots) {
4503
- for (const item of slots) {
4504
- for (const cell of item.cells) {
4505
- if (cell.visible && cell.colspan > 1 || cell.colspan > 1) {
4506
- draft.disabled = false;
4507
- return;
4508
- }
4509
- }
4510
- }
4511
- }
4512
- }
4513
- draft.disabled = true;
4743
+ draft.highlight = state.state === core$1.QueryStateType.Enabled;
4514
4744
  });
4515
4745
  });
4516
4746
  core.onUnmounted(() => {
4517
4747
  sub.unsubscribe();
4518
4748
  });
4749
+ const commonState = useCommonState();
4519
4750
  return () => {
4520
4751
  const vm = viewModel();
4521
- return jsxRuntime.jsx(Button, { highlight: vm.highlight, disabled: vm.disabled, onClick: split, children: jsxRuntime.jsx("span", { class: "xnote-icon-split-cells" }) });
4752
+ return jsxRuntime.jsx(Button, { highlight: vm.highlight, disabled: commonState().inSourceCode || commonState().readonly, onClick: toggle, children: jsxRuntime.jsx("span", { class: "xnote-icon-italic" }) });
4522
4753
  };
4523
4754
  }
4524
4755
 
4525
- var scopedId$9 = "vf-cf8e1c";
4526
-
4527
- class FileUploader {
4528
- }
4756
+ var scopedId$c = "vf-e74208";
4529
4757
 
4530
- class ImageComponent extends core$1.Component {
4531
- static fromJSON(textbus, json) {
4532
- return new ImageComponent(textbus, Object.assign({}, json));
4758
+ exports.EditorService = class EditorService {
4759
+ constructor() {
4760
+ this.hideInlineToolbar = false;
4761
+ this.canShowLeftToolbar = true;
4762
+ this.onLeftToolbarCanVisibleChange = new core$1.Subject();
4533
4763
  }
4534
- getSlots() {
4535
- return [];
4536
- }
4537
- }
4538
- ImageComponent.type = core$1.ContentType.InlineComponent;
4539
- ImageComponent.componentName = 'ImageComponent';
4540
- function ImageView(props) {
4541
- const { name, state } = props.component;
4542
- const imageRef = core.createRef();
4543
- const readonly = useReadonly();
4544
- const output = useOutput();
4545
- return () => {
4546
- if (readonly() || output()) {
4547
- return (jsxRuntime.jsx("div", { class: "xnote-image", ref: props.rootRef, "data-component": name, children: jsxRuntime.jsx("img", { alt: "", src: state.src, style: {
4548
- width: state.width,
4549
- height: state.height
4550
- } }) }));
4551
- }
4552
- return (jsxRuntime.jsx("div", { class: "xnote-image", ref: props.rootRef, "data-component": name, children: jsxRuntime.jsx(DragResize, { source: imageRef, component: props.component, children: jsxRuntime.jsx("img", { alt: "", ref: imageRef, src: state.src, style: {
4553
- width: state.width,
4554
- height: state.height
4555
- } }) }) }));
4556
- };
4557
- }
4558
- const imageComponentLoader = {
4559
- match(element) {
4560
- return element.tagName === 'IMG' || element.dataset.component === ImageComponent.componentName;
4561
- },
4562
- read(element, textbus) {
4563
- const img = element instanceof HTMLImageElement ? element : (element.querySelector('img') || document.createElement('img'));
4564
- return new ImageComponent(textbus, {
4565
- src: img.src,
4566
- width: img.style.width || 'auto',
4567
- height: img.style.height || 'auto'
4568
- });
4764
+ changeLeftToolbarVisible(b) {
4765
+ this.canShowLeftToolbar = b;
4766
+ this.onLeftToolbarCanVisibleChange.next();
4569
4767
  }
4570
4768
  };
4769
+ exports.EditorService = __decorate([
4770
+ core.Injectable({
4771
+ provideIn: 'root'
4772
+ })
4773
+ ], exports.EditorService);
4571
4774
 
4572
- class VideoComponent extends core$1.Component {
4573
- static fromJSON(textbus, json) {
4574
- return new VideoComponent(textbus, Object.assign({}, json));
4575
- }
4576
- getSlots() {
4577
- return [];
4775
+ function LinkTool(props) {
4776
+ const selectionBridge = core.inject(platformBrowser.SelectionBridge);
4777
+ const selection = core.inject(core$1.Selection);
4778
+ const commander = core.inject(core$1.Commander);
4779
+ const editorService = core.inject(exports.EditorService);
4780
+ const container = core.inject(platformBrowser.VIEW_CONTAINER);
4781
+ const isShow = core.createSignal(false);
4782
+ const value = core.createSignal('');
4783
+ function setLink(ev) {
4784
+ ev.preventDefault();
4785
+ commander.applyFormat(linkFormatter, {
4786
+ href: value(),
4787
+ target: '_blanK'
4788
+ });
4789
+ isShow.set(false);
4578
4790
  }
4791
+ let isClickFromSelf = false;
4792
+ const sub = core$1.fromEvent(document, 'click').subscribe(() => {
4793
+ if (isClickFromSelf) {
4794
+ isClickFromSelf = false;
4795
+ return;
4796
+ }
4797
+ editorService.hideInlineToolbar = false;
4798
+ isShow.set(false);
4799
+ });
4800
+ core.onUnmounted(() => {
4801
+ sub.unsubscribe();
4802
+ });
4803
+ const commonState = useCommonState();
4804
+ return scopedCss.withScopedCSS(scopedId$c, () => {
4805
+ const containerRect = container.getBoundingClientRect();
4806
+ const rect = isShow() ? selectionBridge.getRect({
4807
+ slot: selection.focusSlot,
4808
+ offset: selection.focusOffset
4809
+ }) : {};
4810
+ return (jsxRuntime.jsxs("span", { children: [jsxRuntime.jsx(Button, { disabled: commonState().inSourceCode || commonState().readonly, onClick: () => {
4811
+ var _a;
4812
+ isShow.set(true);
4813
+ isClickFromSelf = true;
4814
+ (_a = props.hideToolbar) === null || _a === void 0 ? void 0 : _a.call(props);
4815
+ }, children: jsxRuntime.jsx("span", { class: "xnote-icon-link" }) }), isShow() &&
4816
+ jsxRuntime.jsx(Popup, { left: rect.left - containerRect.left, top: rect.top + rect.height - containerRect.top, children: jsxRuntime.jsxs("form", { onSubmit: setLink, onClick: () => {
4817
+ isClickFromSelf = true;
4818
+ }, class: "input-group", children: [jsxRuntime.jsx("input", { onChange: ev => {
4819
+ value.set(ev.target.value);
4820
+ }, placeholder: "\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740", type: "text" }), jsxRuntime.jsx(Button, { type: "submit", children: "\u786E\u5B9A" })] }) })] }));
4821
+ });
4579
4822
  }
4580
- VideoComponent.type = core$1.ContentType.InlineComponent;
4581
- VideoComponent.componentName = 'VideoComponent';
4582
- function VideoView(props) {
4583
- const { name, state } = props.component;
4584
- const videoRef = core.createRef();
4585
- const readonly = useReadonly();
4586
- const output = useOutput();
4823
+
4824
+ function RedoTool() {
4825
+ const history = core.inject(core$1.History);
4826
+ const instance = core.getCurrentInstance();
4827
+ function redo() {
4828
+ history.forward();
4829
+ }
4830
+ const sub = history.onChange.subscribe(() => {
4831
+ instance.markAsDirtied();
4832
+ });
4833
+ core.onUnmounted(() => {
4834
+ sub.unsubscribe();
4835
+ });
4836
+ const commonState = useCommonState();
4587
4837
  return () => {
4588
- if (readonly() || output()) {
4589
- return (jsxRuntime.jsx("div", { class: "xnote-video", ref: props.rootRef, "data-component": name, children: jsxRuntime.jsx("video", { ref: videoRef, src: state.src, style: {
4590
- width: state.width,
4591
- height: state.height
4592
- } }) }));
4593
- }
4594
- return (jsxRuntime.jsx("div", { ref: props.rootRef, class: "xnote-video", "data-component": name, children: jsxRuntime.jsx(DragResize, { source: videoRef, component: props.component, children: jsxRuntime.jsx("video", { ref: videoRef, src: state.src, style: {
4595
- width: state.width,
4596
- height: state.height
4597
- } }) }) }));
4838
+ return jsxRuntime.jsx(Button, { disabled: !history.canForward || commonState().readonly, onClick: redo, children: jsxRuntime.jsx("span", { class: "xnote-icon-history-forward" }) });
4598
4839
  };
4599
4840
  }
4600
- const videoComponentLoader = {
4601
- match(element) {
4602
- return element.tagName === 'VIDEO' || element.dataset.component === VideoComponent.componentName;
4603
- },
4604
- read(element, textbus) {
4605
- const video = element instanceof HTMLVideoElement ? element : (element.querySelector('video') || document.createElement('video'));
4606
- return new VideoComponent(textbus, {
4607
- src: video.src,
4608
- width: video.style.width || 'auto',
4609
- height: video.style.height || 'auto'
4610
- });
4611
- }
4612
- };
4613
4841
 
4614
- class KatexEditor extends core$1.Textbus {
4615
- constructor() {
4616
- const adapter = new adapterViewfly.ViewflyAdapter({
4617
- [SourceCodeComponent.componentName]: SourceCodeView
4618
- }, (host, root, injector) => {
4619
- const appInjector = new core.ReflectiveInjector(injector, [{
4620
- provide: OutputInjectionToken,
4621
- useValue: true
4622
- }]);
4623
- const app = platformBrowser$1.createApp(root, {
4624
- context: appInjector
4625
- }).mount(host);
4626
- return () => {
4627
- app.destroy();
4628
- };
4629
- });
4630
- const browserModule = new platformBrowser.BrowserModule({
4631
- adapter,
4632
- renderTo: () => {
4633
- return this.host;
4634
- }
4635
- });
4636
- super({
4637
- components: [
4638
- SourceCodeComponent
4639
- ],
4640
- imports: [browserModule]
4641
- });
4642
- this.onValueChange = new core$1.Subject();
4842
+ function StrikeThroughTool() {
4843
+ const query = core.inject(core$1.Query);
4844
+ const refreshService = core.inject(exports.RefreshService);
4845
+ const textbus = core.inject(core$1.Textbus);
4846
+ const [viewModel, update] = hooks.useProduce({
4847
+ highlight: false,
4848
+ });
4849
+ function toggle() {
4850
+ toggleStrikeThrough(textbus);
4643
4851
  }
4644
- mount(host, code) {
4645
- this.host = host;
4646
- const model = new SourceCodeComponent(this, {
4647
- lineNumber: true,
4648
- autoBreak: true,
4649
- lang: 'latex',
4650
- theme: 'github',
4651
- slots: code.split('\n').map(i => {
4652
- const slot = new core$1.Slot([core$1.ContentType.Text]);
4653
- slot.insert(i);
4654
- return {
4655
- slot,
4656
- emphasize: false
4657
- };
4658
- })
4659
- });
4660
- this.onChange.subscribe(() => {
4661
- const str = model.state.slots.map(i => {
4662
- if (i.slot.isEmpty) {
4663
- return '';
4664
- }
4665
- return i.slot.toString();
4666
- }).join('\n');
4667
- this.onValueChange.next(str);
4852
+ const sub = refreshService.onRefresh.subscribe(() => {
4853
+ const state = query.queryFormat(strikeThroughFormatter);
4854
+ update(draft => {
4855
+ draft.highlight = state.state === core$1.QueryStateType.Enabled;
4668
4856
  });
4669
- return this.render(model);
4670
- }
4857
+ });
4858
+ core.onUnmounted(() => {
4859
+ sub.unsubscribe();
4860
+ });
4861
+ const commonState = useCommonState();
4862
+ return () => {
4863
+ const vm = viewModel();
4864
+ return jsxRuntime.jsx(Button, { highlight: vm.highlight, disabled: commonState().inSourceCode || commonState().readonly, onClick: toggle, children: jsxRuntime.jsx("span", { class: "xnote-icon-strikethrough" }) });
4865
+ };
4671
4866
  }
4672
4867
 
4673
- class KatexComponent extends core$1.Component {
4674
- static fromJSON(textbus, state) {
4675
- return new KatexComponent(textbus, state);
4676
- }
4677
- constructor(textbus, state = {
4678
- text: '% \\f is defined as #1f(#2) using the macro\n' +
4679
- '\\f\\relax{x} = \\int_{-\\infty}^\\infty\n' +
4680
- '\\f\\hat\\xi\\,e^{2 \\pi i \\xi x}\n' +
4681
- '\\,d\\xi'
4682
- }) {
4683
- super(textbus, state);
4868
+ function SubscriptTool() {
4869
+ const query = core.inject(core$1.Query);
4870
+ const selection = core.inject(core$1.Selection);
4871
+ const commander = core.inject(core$1.Commander);
4872
+ const [state, updateState] = hooks.useProduce({
4873
+ highlight: false
4874
+ });
4875
+ const sub = selection.onChange.subscribe(() => {
4876
+ updateState(draft => {
4877
+ draft.highlight = getState();
4878
+ });
4879
+ });
4880
+ function getState() {
4881
+ const s = query.queryFormat(subscriptFormatter);
4882
+ return s.state === core$1.QueryStateType.Enabled;
4684
4883
  }
4685
- getSlots() {
4686
- return [];
4884
+ core.onUnmounted(() => {
4885
+ sub.unsubscribe();
4886
+ });
4887
+ function apply() {
4888
+ const is = getState();
4889
+ if (is) {
4890
+ commander.unApplyFormat(subscriptFormatter);
4891
+ }
4892
+ else {
4893
+ commander.unApplyFormat(superscriptFormatter);
4894
+ commander.applyFormat(subscriptFormatter, true);
4895
+ }
4687
4896
  }
4897
+ const commonState = useCommonState();
4898
+ return () => {
4899
+ return (jsxRuntime.jsx(Button, { disabled: commonState().inSourceCode || commonState().readonly, highlight: state().highlight, onClick: apply, children: jsxRuntime.jsx("span", { class: "xnote-icon-subscript" }) }));
4900
+ };
4688
4901
  }
4689
- KatexComponent.componentName = 'KatexComponent';
4690
- KatexComponent.type = core$1.ContentType.InlineComponent;
4691
- function domToVDom(el) {
4692
- const attrs = {};
4693
- el.getAttributeNames().forEach(key => {
4694
- attrs[key] = el.getAttribute(key);
4902
+
4903
+ function SuperscriptTool() {
4904
+ const query = core.inject(core$1.Query);
4905
+ const selection = core.inject(core$1.Selection);
4906
+ const commander = core.inject(core$1.Commander);
4907
+ const [state, updateState] = hooks.useProduce({
4908
+ highlight: false
4695
4909
  });
4696
- attrs.children = Array.from(el.childNodes).map(child => {
4697
- if (child.nodeType === Node.ELEMENT_NODE) {
4698
- return domToVDom(child);
4699
- }
4700
- return child.textContent || '';
4910
+ const sub = selection.onChange.subscribe(() => {
4911
+ updateState(draft => {
4912
+ draft.highlight = getState();
4913
+ });
4701
4914
  });
4702
- return core.jsx(el.tagName.toLowerCase(), attrs);
4703
- }
4704
- function KatexComponentView(props) {
4705
- function toDOM(value) {
4706
- let htmlString;
4707
- try {
4708
- htmlString = Katex.renderToString(value, {
4709
- displayMode: true,
4710
- leqno: false,
4711
- fleqn: false,
4712
- throwOnError: true,
4713
- errorColor: '#cc0000',
4714
- strict: 'warn',
4715
- output: 'html',
4716
- trust: false,
4717
- macros: { '\\f': '#1f(#2)' }
4718
- });
4915
+ function getState() {
4916
+ const s = query.queryFormat(superscriptFormatter);
4917
+ return s.state === core$1.QueryStateType.Enabled;
4918
+ }
4919
+ core.onUnmounted(() => {
4920
+ sub.unsubscribe();
4921
+ });
4922
+ function apply() {
4923
+ const is = getState();
4924
+ if (is) {
4925
+ commander.unApplyFormat(superscriptFormatter);
4719
4926
  }
4720
- catch (e) {
4721
- htmlString = '<span style="color: red">公式错误</span>';
4927
+ else {
4928
+ commander.unApplyFormat(subscriptFormatter);
4929
+ commander.applyFormat(superscriptFormatter, true);
4722
4930
  }
4723
- return new DOMParser().parseFromString(htmlString, 'text/html').body.children[0];
4724
4931
  }
4725
- const selection = core.inject(core$1.Textbus);
4726
- const editorRef = core.createDynamicRef(node => {
4727
- const editor = new KatexEditor();
4728
- editor.mount(node, props.component.state.text).then(() => {
4729
- editor.focus();
4932
+ const commonState = useCommonState();
4933
+ return () => {
4934
+ return (jsxRuntime.jsx(Button, { disabled: commonState().inSourceCode || commonState().readonly, highlight: state().highlight, onClick: apply, children: jsxRuntime.jsx("span", { class: "xnote-icon-superscript" }) }));
4935
+ };
4936
+ }
4937
+
4938
+ function UnderlineTool() {
4939
+ const query = core.inject(core$1.Query);
4940
+ const refreshService = core.inject(exports.RefreshService);
4941
+ const textbus = core.inject(core$1.Textbus);
4942
+ const [viewModel, update] = hooks.useProduce({
4943
+ highlight: false,
4944
+ });
4945
+ function toggle() {
4946
+ toggleUnderline(textbus);
4947
+ }
4948
+ const sub = refreshService.onRefresh.subscribe(() => {
4949
+ const state = query.queryFormat(underlineFormatter);
4950
+ update(draft => {
4951
+ draft.highlight = state.state === core$1.QueryStateType.Enabled;
4730
4952
  });
4731
- selection.blur();
4732
- const subscription = editor.onValueChange.subscribe((value) => {
4733
- props.component.state.text = value;
4734
- }).add(core$1.fromEvent(node, 'mousedown').subscribe(ev => ev.stopPropagation()), core$1.fromEvent(document, 'mousedown').subscribe(() => {
4735
- var _a;
4736
- (_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.isShow(false);
4737
- }));
4738
- return () => {
4739
- subscription.unsubscribe();
4740
- editor.destroy();
4741
- };
4742
4953
  });
4743
- const dropdownRef = core.createRef();
4744
- const output = useOutput();
4745
- const readonly = useReadonly();
4954
+ core.onUnmounted(() => {
4955
+ sub.unsubscribe();
4956
+ });
4957
+ const commonState = useCommonState();
4746
4958
  return () => {
4747
- const text = props.component.state.text;
4748
- return (jsxRuntime.jsx("span", { onClick: () => {
4749
- var _a;
4750
- (_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.isShow(true);
4751
- }, ref: props.rootRef, "data-component": KatexComponent.componentName, "data-katex": encodeURIComponent(text), class: "xnote-katex", children: (output() || readonly()) ?
4752
- domToVDom(toDOM(text))
4753
- :
4754
- jsxRuntime.jsx(Dropdown, { padding: '0', ref: dropdownRef, trigger: 'none', width: '600px', menu: jsxRuntime.jsx("div", { class: "xnote-katex-input", ref: editorRef }), children: domToVDom(toDOM(text)) }) }));
4959
+ const vm = viewModel();
4960
+ return jsxRuntime.jsx(Button, { highlight: vm.highlight, disabled: commonState().inSourceCode || commonState().readonly, onClick: toggle, children: jsxRuntime.jsx("span", { class: "xnote-icon-underline" }) });
4755
4961
  };
4756
4962
  }
4757
- const katexComponentLoader = {
4963
+
4964
+ function UndoTool() {
4965
+ const history = core.inject(core$1.History);
4966
+ const instance = core.getCurrentInstance();
4967
+ function undo() {
4968
+ history.back();
4969
+ }
4970
+ const sub = history.onChange.subscribe(() => {
4971
+ instance.markAsDirtied();
4972
+ });
4973
+ core.onUnmounted(() => {
4974
+ sub.unsubscribe();
4975
+ });
4976
+ const commonState = useCommonState();
4977
+ return () => {
4978
+ return jsxRuntime.jsx(Button, { disabled: !history.canBack || commonState().readonly, onClick: undo, children: jsxRuntime.jsx("span", { class: "xnote-icon-history-back" }) });
4979
+ };
4980
+ }
4981
+
4982
+ const cellAlignAttr = new core$1.Attribute('cellAlign', {
4983
+ render(node, formatValue) {
4984
+ node.styles.set('verticalAlign', formatValue);
4985
+ }
4986
+ });
4987
+ const cellAlignAttrLoader = {
4758
4988
  match(element) {
4759
- return element.dataset.component === KatexComponent.componentName;
4989
+ return element instanceof HTMLTableCellElement && !!element.style.verticalAlign;
4760
4990
  },
4761
- read(element, textbus) {
4762
- const value = element.dataset.katex || '';
4763
- return new KatexComponent(textbus, {
4764
- text: decodeURIComponent(value)
4765
- });
4991
+ read(element) {
4992
+ return {
4993
+ attribute: cellAlignAttr,
4994
+ value: element.style.verticalAlign
4995
+ };
4766
4996
  }
4767
4997
  };
4768
4998
 
4769
- function InsertTool(props) {
4770
- const commander = core.inject(core$1.Commander);
4771
- const selection = core.inject(core$1.Selection);
4772
- const textbus = core.inject(core$1.Textbus);
4773
- const fileUploader = core.inject(FileUploader, null);
4774
- const dropdownContextService = core.inject(exports.DropdownContextService);
4775
- function insert(type) {
4776
- var _a;
4777
- const component = (_a = props.slot) === null || _a === void 0 ? void 0 : _a.parent;
4778
- if (!component) {
4779
- return;
4780
- }
4781
- function insertComponent(comp) {
4782
- if (props.replace) {
4783
- commander.replaceComponent(component, comp);
4784
- }
4785
- else {
4786
- commander.insertAfter(comp, component);
4999
+ function isInTable(selection) {
5000
+ if (selection.commonAncestorComponent instanceof TableComponent) {
5001
+ return true;
5002
+ }
5003
+ if (selection.isCollapsed) {
5004
+ let slot = selection.commonAncestorSlot;
5005
+ while (slot) {
5006
+ if (slot.parent instanceof TableComponent) {
5007
+ return true;
4787
5008
  }
4788
- dropdownContextService.canHide = true;
4789
- dropdownContextService.hide(false);
5009
+ slot = slot.parentSlot;
4790
5010
  }
4791
- switch (type) {
4792
- case 'h1':
4793
- case 'h2':
4794
- case 'h3':
4795
- case 'h4':
4796
- case 'h5':
4797
- case 'h6':
4798
- case 'paragraph':
4799
- {
4800
- const slot = new core$1.Slot([
4801
- core$1.ContentType.InlineComponent,
4802
- core$1.ContentType.Text
4803
- ]);
4804
- if (/h[1-6]/.test(type)) {
4805
- slot.setAttribute(headingAttr, type);
5011
+ return false;
5012
+ }
5013
+ const startTable = getParentTable(selection.startSlot);
5014
+ const endTable = getParentTable(selection.endSlot);
5015
+ if (startTable && endTable) {
5016
+ return startTable === endTable;
5017
+ }
5018
+ return false;
5019
+ }
5020
+ function getParentTable(slot) {
5021
+ while (slot) {
5022
+ if (slot.parent instanceof TableComponent) {
5023
+ return slot.parent;
5024
+ }
5025
+ slot = slot.parentSlot;
5026
+ }
5027
+ return null;
5028
+ }
5029
+ function getTableSlotBySlot(slot) {
5030
+ while (slot) {
5031
+ if (slot.parent instanceof TableComponent) {
5032
+ return slot;
5033
+ }
5034
+ slot = slot.parentSlot;
5035
+ }
5036
+ return null;
5037
+ }
5038
+
5039
+ function CellAlignTool() {
5040
+ const currentValue = core.createSignal('');
5041
+ const selection = core.inject(core$1.Selection);
5042
+ function check(v) {
5043
+ const commonAncestorComponent = selection.commonAncestorComponent;
5044
+ if (commonAncestorComponent instanceof TableComponent) {
5045
+ const slots = commonAncestorComponent.getSelectedNormalizedSlots();
5046
+ slots.forEach(item => {
5047
+ item.cells.forEach(cell => {
5048
+ if (cell.visible) {
5049
+ cell.raw.slot.setAttribute(cellAlignAttr, v);
4806
5050
  }
4807
- const p = new ParagraphComponent(textbus, {
4808
- slot
4809
- });
4810
- insertComponent(p);
4811
- selection.setPosition(slot, 0);
4812
- }
4813
- break;
4814
- case 'ol':
4815
- case 'ul':
4816
- {
4817
- const slot = new core$1.Slot([
4818
- core$1.ContentType.InlineComponent,
4819
- core$1.ContentType.Text
4820
- ]);
4821
- const list = new ListComponent(textbus, {
4822
- slot,
4823
- reorder: true,
4824
- type: type === 'ol' ? 'OrderedList' : 'UnorderedList'
4825
- });
4826
- insertComponent(list);
4827
- selection.setPosition(slot, 0);
5051
+ });
5052
+ });
5053
+ }
5054
+ else {
5055
+ const is = isInTable(selection);
5056
+ if (is) {
5057
+ let parentSlot = selection.commonAncestorSlot;
5058
+ while (parentSlot) {
5059
+ if (parentSlot.parent instanceof TableComponent) {
5060
+ const slots = parentSlot.parent.getNormalizedData();
5061
+ for (const item of slots) {
5062
+ for (const cell of item.cells) {
5063
+ if (cell.visible && cell.raw.slot === parentSlot) {
5064
+ cell.raw.slot.setAttribute(cellAlignAttr, v);
5065
+ return;
5066
+ }
5067
+ }
5068
+ }
5069
+ }
5070
+ parentSlot = parentSlot.parentSlot;
4828
5071
  }
4829
- break;
4830
- case 'sourceCode':
5072
+ }
5073
+ }
5074
+ }
5075
+ const refreshService = core.inject(exports.RefreshService);
5076
+ const query = core.inject(core$1.Query);
5077
+ const highlight = core.createSignal(false);
5078
+ const subscription = refreshService.onRefresh.subscribe(() => {
5079
+ if (!isInTable(selection)) {
5080
+ highlight.set(false);
5081
+ currentValue.set('middle');
5082
+ return;
5083
+ }
5084
+ const result = query.queryAttribute(cellAlignAttr);
5085
+ const isHighlight = result.state === core$1.QueryStateType.Enabled;
5086
+ highlight.set(isHighlight);
5087
+ currentValue.set(isHighlight ? result.value : 'middle');
5088
+ });
5089
+ core.onUnmounted(() => {
5090
+ subscription.unsubscribe();
5091
+ });
5092
+ return () => {
5093
+ return (jsxRuntime.jsx(Dropdown, { onCheck: check, menu: [
4831
5094
  {
4832
- const slot = new core$1.Slot([
4833
- core$1.ContentType.Text
4834
- ]);
4835
- const comp = new SourceCodeComponent(textbus, {
4836
- lang: '',
4837
- lineNumber: true,
4838
- slots: [{
4839
- slot,
4840
- emphasize: false
4841
- }]
4842
- });
4843
- insertComponent(comp);
4844
- selection.setPosition(slot, 0);
4845
- }
4846
- break;
4847
- case 'table':
5095
+ label: jsxRuntime.jsx(MenuItem, { checked: currentValue() === 'top', icon: jsxRuntime.jsx("span", { class: "xnote-icon-align-top" }), children: "\u9876\u90E8\u5BF9\u9F50" }),
5096
+ value: 'top'
5097
+ },
4848
5098
  {
4849
- const table = new TableComponent(textbus);
4850
- insertComponent(table);
4851
- textbus.nextTick(() => {
4852
- selection.selectFirstPosition(table, true, true);
4853
- });
4854
- }
4855
- break;
4856
- case 'todolist':
5099
+ label: jsxRuntime.jsx(MenuItem, { checked: currentValue() === 'middle', icon: jsxRuntime.jsx("span", { class: "xnote-icon-align-middle" }), children: "\u5782\u76F4\u5C45\u4E2D" }),
5100
+ value: 'middle'
5101
+ },
4857
5102
  {
4858
- const slot = new core$1.Slot([
4859
- core$1.ContentType.Text,
4860
- core$1.ContentType.InlineComponent
4861
- ]);
4862
- const comp = new TodolistComponent(textbus, {
4863
- slot,
4864
- checked: false
4865
- });
4866
- insertComponent(comp);
4867
- selection.setPosition(slot, 0);
4868
- }
4869
- break;
4870
- case 'image':
4871
- if (fileUploader) {
4872
- Promise.resolve().then(() => fileUploader.uploadFile('image')).then(url => {
4873
- const img = new ImageComponent(textbus, {
4874
- src: url
4875
- });
4876
- commander.insert(img);
4877
- });
4878
- }
4879
- break;
4880
- case 'video':
4881
- if (fileUploader) {
4882
- Promise.resolve().then(() => fileUploader.uploadFile('video')).then(url => {
4883
- const img = new VideoComponent(textbus, {
4884
- src: url
4885
- });
4886
- commander.insert(img);
4887
- });
5103
+ label: jsxRuntime.jsx(MenuItem, { checked: currentValue() === 'bottom', icon: jsxRuntime.jsx("span", { class: "xnote-icon-align-bottom" }), children: "\u5E95\u90E8\u5BF9\u9F50" }),
5104
+ value: 'bottom'
4888
5105
  }
4889
- break;
4890
- case 'highlightBox':
4891
- {
4892
- const p = new ParagraphComponent(textbus);
4893
- const comp = new HighlightBoxComponent(textbus);
4894
- comp.state.slot.insert(p);
4895
- insertComponent(comp);
4896
- selection.setPosition(p.state.slot, 0);
5106
+ ], children: jsxRuntime.jsx(Button, { arrow: true, highlight: highlight(), children: jsxRuntime.jsx("span", { class: 'xnote-icon-align-' + (currentValue() || 'middle') }) }) }));
5107
+ };
5108
+ }
5109
+
5110
+ const cellBackgroundAttr = new core$1.Attribute('cellBackground', {
5111
+ render(node, formatValue) {
5112
+ const rgba = color.parseCss(formatValue);
5113
+ if (rgba) {
5114
+ const hsl = color.rgb2Hsl(rgba);
5115
+ if (hsl.l > 50) {
5116
+ hsl.l -= 10;
5117
+ }
5118
+ else {
5119
+ hsl.l += Math.max((50 - hsl.l) * 0.55, 10);
5120
+ }
5121
+ hsl.s *= 0.7;
5122
+ const newRgba = color.hsl2Rgb(hsl);
5123
+ node.styles.set('borderColor', `rgba(${newRgba.r}, ${newRgba.g}, ${newRgba.b}, ${rgba.a || 1})`);
5124
+ }
5125
+ node.styles.set('backgroundColor', formatValue);
5126
+ }
5127
+ });
5128
+ const cellBackgroundAttrLoader = {
5129
+ match(element) {
5130
+ return (element.tagName === 'TD' || element.tagName === 'TH') && !!element.style.backgroundColor;
5131
+ },
5132
+ read(element) {
5133
+ return {
5134
+ attribute: cellBackgroundAttr,
5135
+ value: element.style.backgroundColor
5136
+ };
5137
+ }
5138
+ };
5139
+
5140
+ function CellBackgroundTool() {
5141
+ const refreshService = core.inject(exports.RefreshService);
5142
+ const selection = core.inject(core$1.Selection);
5143
+ const [viewModel, update] = hooks.useProduce({
5144
+ highlight: false,
5145
+ disabled: false,
5146
+ });
5147
+ function setColor(picker) {
5148
+ const commonAncestorComponent = selection.commonAncestorComponent;
5149
+ if (commonAncestorComponent instanceof TableComponent) {
5150
+ const slots = commonAncestorComponent.getSelectedNormalizedSlots();
5151
+ if (slots) {
5152
+ slots.map(i => {
5153
+ return i.cells.filter(t => t.visible).map(i => i.raw.slot);
5154
+ }).flat().forEach(slot => {
5155
+ const rgba = picker.rgba;
5156
+ if (rgba) {
5157
+ slot.setAttribute(cellBackgroundAttr, `rgba(${rgba.r}, ${rgba.g}, ${rgba.b}, ${rgba.a})`);
5158
+ }
5159
+ else {
5160
+ slot.removeAttribute(cellBackgroundAttr);
5161
+ }
5162
+ });
5163
+ }
5164
+ }
5165
+ else {
5166
+ let parentSlot = selection.commonAncestorSlot;
5167
+ while (parentSlot) {
5168
+ if (parentSlot.parent instanceof TableComponent) {
5169
+ const rgba = picker.rgba;
5170
+ if (rgba) {
5171
+ parentSlot.setAttribute(cellBackgroundAttr, `rgba(${rgba.r}, ${rgba.g}, ${rgba.b}, ${rgba.a})`);
5172
+ }
5173
+ else {
5174
+ parentSlot.removeAttribute(cellBackgroundAttr);
5175
+ }
5176
+ return;
4897
5177
  }
4898
- break;
4899
- case 'katex':
4900
- {
4901
- const p = new ParagraphComponent(textbus);
4902
- const comp = new KatexComponent(textbus);
4903
- p.state.slot.insert(comp);
4904
- insertComponent(p);
4905
- selection.selectComponent(comp);
5178
+ parentSlot = parentSlot.parentSlot;
5179
+ }
5180
+ }
5181
+ }
5182
+ const sub = refreshService.onRefresh.subscribe(() => {
5183
+ update(draft => {
5184
+ draft.disabled = !isInTable(selection);
5185
+ });
5186
+ });
5187
+ core.onUnmounted(() => {
5188
+ sub.unsubscribe();
5189
+ });
5190
+ return () => {
5191
+ const vm = viewModel();
5192
+ return (jsxRuntime.jsx(Dropdown, { width: '177px', menu: jsxRuntime.jsx(ColorPicker, { onSelected: setColor }), trigger: 'hover', children: jsxRuntime.jsx(Button, { highlight: vm.highlight, disabled: vm.disabled, children: jsxRuntime.jsx("span", { class: "xnote-icon-palette" }) }) }));
5193
+ };
5194
+ }
5195
+
5196
+ function MergeCellsTool() {
5197
+ const refreshService = core.inject(exports.RefreshService);
5198
+ const selection = core.inject(core$1.Selection);
5199
+ const [viewModel, update] = hooks.useProduce({
5200
+ highlight: false,
5201
+ disabled: false,
5202
+ });
5203
+ function merge() {
5204
+ const commonAncestorComponent = selection.commonAncestorComponent;
5205
+ if (commonAncestorComponent instanceof TableComponent) {
5206
+ commonAncestorComponent.mergeCellBySelection();
5207
+ }
5208
+ }
5209
+ const sub = refreshService.onRefresh.subscribe(() => {
5210
+ update(draft => {
5211
+ const is = isInTable(selection);
5212
+ if (is) {
5213
+ const p1 = getTableSlotBySlot(selection.startSlot);
5214
+ const p2 = getTableSlotBySlot(selection.endSlot);
5215
+ if (p1 && p2) {
5216
+ draft.disabled = p1 === p2;
5217
+ return;
4906
5218
  }
4907
- break;
4908
- case 'step':
4909
- {
4910
- const step = new StepComponent(textbus, {
4911
- step: 0,
4912
- items: [createStepItem(textbus)]
4913
- });
4914
- insertComponent(step);
4915
- selection.selectFirstPosition(step, false, true);
5219
+ }
5220
+ draft.disabled = true;
5221
+ });
5222
+ });
5223
+ core.onUnmounted(() => {
5224
+ sub.unsubscribe();
5225
+ });
5226
+ return () => {
5227
+ const vm = viewModel();
5228
+ return jsxRuntime.jsx(Button, { highlight: vm.highlight, disabled: vm.disabled, onClick: merge, children: jsxRuntime.jsx("span", { class: "xnote-icon-merge-cells" }) });
5229
+ };
5230
+ }
5231
+
5232
+ function SplitCellsTool() {
5233
+ const refreshService = core.inject(exports.RefreshService);
5234
+ const selection = core.inject(core$1.Selection);
5235
+ const [viewModel, update] = hooks.useProduce({
5236
+ highlight: false,
5237
+ disabled: false,
5238
+ });
5239
+ function split() {
5240
+ const commonAncestorComponent = selection.commonAncestorComponent;
5241
+ if (commonAncestorComponent instanceof TableComponent) {
5242
+ commonAncestorComponent.splitCellsBySelection();
5243
+ return;
5244
+ }
5245
+ let parentSlot = selection.commonAncestorSlot;
5246
+ while (parentSlot) {
5247
+ if (parentSlot.parent instanceof TableComponent) {
5248
+ if (parentSlot.parent === commonAncestorComponent) {
5249
+ parentSlot.parent.splitCellsBySelection();
5250
+ return;
4916
5251
  }
4917
- break;
4918
- case 'timeline': {
4919
- const timeline = new TimelineComponent(textbus, {
4920
- items: [createTimelineItem(textbus, '#296eff')]
4921
- });
4922
- insertComponent(timeline);
4923
- selection.selectFirstPosition(timeline, false, true);
4924
- break;
5252
+ parentSlot.parent.splitCellBySlot(parentSlot);
5253
+ return;
4925
5254
  }
5255
+ parentSlot = parentSlot.parentSlot;
4926
5256
  }
4927
5257
  }
4928
- return scopedCss.withScopedCSS(scopedId$9, () => {
4929
- return jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [props.hideTitle ? null : jsxRuntime.jsx(MenuHeading, { children: props.replace ? '替换为' : '在下面添加' }), jsxRuntime.jsxs("div", { class: "btn-group", children: [jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('paragraph'), children: jsxRuntime.jsx("span", { class: "xnote-icon-pilcrow" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('h1'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h1" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('h2'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h2" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('h3'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h3" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('h4'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h4" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('h5'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h5" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('h6'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h6" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('ol'), children: jsxRuntime.jsx("span", { class: "xnote-icon-list-numbered" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('ul'), children: jsxRuntime.jsx("span", { class: "xnote-icon-list" }) }), jsxRuntime.jsx(Button, { ordinary: true, onClick: () => insert('sourceCode'), children: jsxRuntime.jsx("span", { class: "xnote-icon-source-code" }) })] }), jsxRuntime.jsx(Divider, {}), jsxRuntime.jsx(MenuItem, { onClick: () => insert('table'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-table" }), children: "\u8868\u683C" }), jsxRuntime.jsx(MenuItem, { onClick: () => insert('todolist'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-checkbox-checked" }), children: "\u5F85\u529E\u5217\u8868" }), jsxRuntime.jsx(MenuItem, { onClick: () => insert('image'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-image" }), children: "\u56FE\u7247" }), jsxRuntime.jsx(MenuItem, { onClick: () => insert('video'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-video" }), children: "\u89C6\u9891" }), jsxRuntime.jsx(MenuItem, { onClick: () => insert('highlightBox'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-hightlight-box" }), children: "\u9AD8\u4EAE\u5757" }), jsxRuntime.jsx(MenuItem, { onClick: () => insert('katex'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-function" }), children: "\u6570\u5B66\u516C\u5F0F" }), jsxRuntime.jsx(MenuItem, { onClick: () => insert('step'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-step" }), children: "\u6B65\u9AA4\u6761" }), jsxRuntime.jsx(MenuItem, { onClick: () => insert('timeline'), icon: jsxRuntime.jsx("span", { class: "xnote-icon-timeline" }), children: "\u65F6\u95F4\u8F74" })] });
5258
+ const sub = refreshService.onRefresh.subscribe(() => {
5259
+ const commonAncestorComponent = selection.commonAncestorComponent;
5260
+ update(draft => {
5261
+ if (commonAncestorComponent instanceof TableComponent) {
5262
+ const slots = commonAncestorComponent.getSelectedNormalizedSlots();
5263
+ if (slots) {
5264
+ for (const item of slots) {
5265
+ for (const cell of item.cells) {
5266
+ if (cell.visible && cell.colspan > 1 || cell.colspan > 1) {
5267
+ draft.disabled = false;
5268
+ return;
5269
+ }
5270
+ }
5271
+ }
5272
+ }
5273
+ }
5274
+ else {
5275
+ let parentSlot = selection.commonAncestorSlot;
5276
+ while (parentSlot) {
5277
+ if (parentSlot.parent instanceof TableComponent) {
5278
+ const slots = parentSlot.parent.getNormalizedData();
5279
+ for (const item of slots) {
5280
+ for (const cell of item.cells) {
5281
+ if (cell.raw.slot === parentSlot) {
5282
+ draft.disabled = !(cell.colspan > 1 || cell.colspan > 1);
5283
+ return;
5284
+ }
5285
+ }
5286
+ }
5287
+ }
5288
+ parentSlot = parentSlot.parentSlot;
5289
+ }
5290
+ }
5291
+ draft.disabled = true;
5292
+ });
5293
+ });
5294
+ core.onUnmounted(() => {
5295
+ sub.unsubscribe();
5296
+ });
5297
+ return () => {
5298
+ const vm = viewModel();
5299
+ return jsxRuntime.jsx(Button, { highlight: vm.highlight, disabled: vm.disabled, onClick: split, children: jsxRuntime.jsx("span", { class: "xnote-icon-split-cells" }) });
5300
+ };
5301
+ }
5302
+
5303
+ var scopedId$b = "vf-669084";
5304
+
5305
+ function SplitLine() {
5306
+ return scopedCss.withScopedCSS(scopedId$b, () => {
5307
+ return jsxRuntime.jsx("div", { class: "split-line" });
4930
5308
  });
4931
5309
  }
4932
5310
 
4933
- var scopedId$8 = "vf-b05292";
5311
+ var scopedId$a = "vf-b05292";
4934
5312
 
4935
5313
  const LeftToolbar = core.withAnnotation({
4936
- providers: [exports.RefreshService]
5314
+ providers: [exports.RefreshService, ToolService]
4937
5315
  }, function LeftToolbar() {
4938
5316
  const adapter = core.inject(platformBrowser.DomAdapter);
4939
5317
  const textbus = core.inject(core$1.Textbus);
@@ -5094,7 +5472,7 @@ const LeftToolbar = core.withAnnotation({
5094
5472
  function changeIgnoreMove(b) {
5095
5473
  isIgnoreMove = b;
5096
5474
  }
5097
- return scopedCss.withScopedCSS(scopedId$8, () => {
5475
+ return scopedCss.withScopedCSS(scopedId$a, () => {
5098
5476
  var _a;
5099
5477
  const position = positionSignal();
5100
5478
  const slot = activeSlot();
@@ -5134,9 +5512,9 @@ const LeftToolbar = core.withAnnotation({
5134
5512
  right: 0,
5135
5513
  top: 0
5136
5514
  }, menu: isEmptyBlock() ?
5137
- jsxRuntime.jsx(InsertTool, { replace: !needInsert, slot: activeSlot() })
5515
+ jsxRuntime.jsx(InsertMenu, { replace: !needInsert, slot: activeSlot() })
5138
5516
  :
5139
- jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { class: "btn-group", children: [jsxRuntime.jsx(Button, { ordinary: true, highlight: states.paragraph, onClick: () => transform('paragraph'), children: jsxRuntime.jsx("span", { class: "xnote-icon-pilcrow" }) }), jsxRuntime.jsx(Button, { ordinary: true, highlight: states.h1, onClick: () => transform('h1'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h1" }) }), jsxRuntime.jsx(Button, { ordinary: true, highlight: states.h2, onClick: () => transform('h2'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h2" }) }), jsxRuntime.jsx(Button, { ordinary: true, highlight: states.h3, onClick: () => transform('h3'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h3" }) }), jsxRuntime.jsx(Button, { ordinary: true, highlight: states.h4, onClick: () => transform('h4'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h4" }) }), jsxRuntime.jsx(Button, { ordinary: true, highlight: states.todolist, onClick: () => transform('todolist'), children: jsxRuntime.jsx("span", { class: "xnote-icon-checkbox-checked" }) }), jsxRuntime.jsx(Button, { ordinary: true, highlight: states.orderedList, onClick: () => transform('ol'), children: jsxRuntime.jsx("span", { class: "xnote-icon-list-numbered" }) }), jsxRuntime.jsx(Button, { ordinary: true, highlight: states.unorderedList, onClick: () => transform('ul'), children: jsxRuntime.jsx("span", { class: "xnote-icon-list" }) }), jsxRuntime.jsx(Button, { ordinary: true, highlight: states.blockquote, onClick: () => transform('blockquote'), children: jsxRuntime.jsx("span", { class: "xnote-icon-quotes-right" }) }), jsxRuntime.jsx(Button, { ordinary: true, highlight: states.sourceCode, onClick: () => transform('sourceCode'), children: jsxRuntime.jsx("span", { class: "xnote-icon-source-code" }) })] }), jsxRuntime.jsx(Divider, {}), jsxRuntime.jsx(AttrTool, { style: { display: 'block' }, abreast: true, slot: slot, applyBefore: applyBefore, children: jsxRuntime.jsx(MenuItem, { arrow: true, icon: jsxRuntime.jsx("span", { class: "xnote-icon-indent-decrease" }), children: "\u7F29\u8FDB\u548C\u5BF9\u9F50" }) }), jsxRuntime.jsx(ColorTool, { style: { display: 'block' }, abreast: true, applyBefore: applyBefore, children: jsxRuntime.jsx(MenuItem, { arrow: true, icon: jsxRuntime.jsx("span", { class: "xnote-icon-color" }), children: "\u989C\u8272" }) }), jsxRuntime.jsx(Divider, {}), jsxRuntime.jsx(MenuItem, { onClick: copy, icon: jsxRuntime.jsx("span", { class: "xnote-icon-copy" }), children: "\u590D\u5236" }), jsxRuntime.jsx(MenuItem, { onClick: remove, icon: jsxRuntime.jsx("span", { class: "xnote-icon-bin" }), children: "\u5220\u9664" }), jsxRuntime.jsx(MenuItem, { onClick: cut, icon: jsxRuntime.jsx("span", { class: "xnote-icon-cut" }), children: "\u526A\u5207" }), jsxRuntime.jsx(Divider, {}), jsxRuntime.jsx(Dropdown, { style: { display: 'block' }, abreast: true, menu: jsxRuntime.jsx(InsertTool, { hideTitle: true, slot: activeSlot() }), children: jsxRuntime.jsx(MenuItem, { arrow: true, icon: jsxRuntime.jsx("span", { class: "xnote-icon-plus" }), children: "\u5728\u4E0B\u9762\u6DFB\u52A0" }) })] }), children: jsxRuntime.jsx("button", { type: "button", class: "left-toolbar-btn", children: isEmptyBlock() ?
5517
+ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { class: "btn-group", children: [jsxRuntime.jsx(Button, { ordinary: true, highlight: states.paragraph, onClick: () => transform('paragraph'), children: jsxRuntime.jsx("span", { class: "xnote-icon-pilcrow" }) }), jsxRuntime.jsx(Button, { ordinary: true, highlight: states.h1, onClick: () => transform('h1'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h1" }) }), jsxRuntime.jsx(Button, { ordinary: true, highlight: states.h2, onClick: () => transform('h2'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h2" }) }), jsxRuntime.jsx(Button, { ordinary: true, highlight: states.h3, onClick: () => transform('h3'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h3" }) }), jsxRuntime.jsx(Button, { ordinary: true, highlight: states.h4, onClick: () => transform('h4'), children: jsxRuntime.jsx("span", { class: "xnote-icon-heading-h4" }) }), jsxRuntime.jsx(Button, { ordinary: true, highlight: states.todolist, onClick: () => transform('todolist'), children: jsxRuntime.jsx("span", { class: "xnote-icon-checkbox-checked" }) }), jsxRuntime.jsx(Button, { ordinary: true, highlight: states.orderedList, onClick: () => transform('ol'), children: jsxRuntime.jsx("span", { class: "xnote-icon-list-numbered" }) }), jsxRuntime.jsx(Button, { ordinary: true, highlight: states.unorderedList, onClick: () => transform('ul'), children: jsxRuntime.jsx("span", { class: "xnote-icon-list" }) }), jsxRuntime.jsx(Button, { ordinary: true, highlight: states.blockquote, onClick: () => transform('blockquote'), children: jsxRuntime.jsx("span", { class: "xnote-icon-quotes-right" }) }), jsxRuntime.jsx(Button, { ordinary: true, highlight: states.sourceCode, onClick: () => transform('sourceCode'), children: jsxRuntime.jsx("span", { class: "xnote-icon-source-code" }) })] }), jsxRuntime.jsx(Divider, {}), jsxRuntime.jsx(AttrTool, { style: { display: 'block' }, abreast: true, slot: slot, applyBefore: applyBefore, children: jsxRuntime.jsx(MenuItem, { arrow: true, icon: jsxRuntime.jsx("span", { class: "xnote-icon-indent-decrease" }), children: "\u7F29\u8FDB\u548C\u5BF9\u9F50" }) }), jsxRuntime.jsx(ColorTool, { style: { display: 'block' }, abreast: true, applyBefore: applyBefore, children: jsxRuntime.jsx(MenuItem, { arrow: true, icon: jsxRuntime.jsx("span", { class: "xnote-icon-color" }), children: "\u989C\u8272" }) }), jsxRuntime.jsx(Divider, {}), jsxRuntime.jsx(MenuItem, { onClick: copy, icon: jsxRuntime.jsx("span", { class: "xnote-icon-copy" }), children: "\u590D\u5236" }), jsxRuntime.jsx(MenuItem, { onClick: remove, icon: jsxRuntime.jsx("span", { class: "xnote-icon-bin" }), children: "\u5220\u9664" }), jsxRuntime.jsx(MenuItem, { onClick: cut, icon: jsxRuntime.jsx("span", { class: "xnote-icon-cut" }), children: "\u526A\u5207" }), jsxRuntime.jsx(Divider, {}), jsxRuntime.jsx(Dropdown, { style: { display: 'block' }, abreast: true, menu: jsxRuntime.jsx(InsertMenu, { hideTitle: true, slot: activeSlot() }), children: jsxRuntime.jsx(MenuItem, { arrow: true, icon: jsxRuntime.jsx("span", { class: "xnote-icon-plus" }), children: "\u5728\u4E0B\u9762\u6DFB\u52A0" }) })] }), children: jsxRuntime.jsx("button", { type: "button", class: "left-toolbar-btn", children: isEmptyBlock() ?
5140
5518
  jsxRuntime.jsx("span", { children: jsxRuntime.jsx("i", { class: "xnote-icon-plus" }) })
5141
5519
  :
5142
5520
  jsxRuntime.jsxs("span", { children: [activeNode, jsxRuntime.jsx("i", { style: "font-size: 12px", class: "xnote-icon-more" })] }) }) }) }) }));
@@ -5171,7 +5549,7 @@ class LeftToolbarPlugin {
5171
5549
  }
5172
5550
  }
5173
5551
 
5174
- var scopedId$7 = "vf-3073ba";
5552
+ var scopedId$9 = "vf-3073ba";
5175
5553
 
5176
5554
  function LinkJump() {
5177
5555
  const selection = core.inject(core$1.Selection);
@@ -5225,25 +5603,26 @@ function LinkJump() {
5225
5603
  }
5226
5604
  });
5227
5605
  }
5228
- return platformBrowser$1.createPortal(scopedCss.withScopedCSS(scopedId$7, () => {
5606
+ return platformBrowser$1.createPortal(scopedCss.withScopedCSS(scopedId$9, () => {
5229
5607
  return (jsxRuntime.jsxs("div", { ref: ref, class: "link-jump-plugin", style: { display: isShow() ? '' : 'none' }, children: [jsxRuntime.jsx("span", { onClick: cleanLink, children: "\u6E05\u9664" }), jsxRuntime.jsx("a", { target: "_blank", href: href(), children: "\u8DF3\u8F6C" })] }));
5230
5608
  }), container);
5231
5609
  }
5232
5610
 
5233
- var scopedId$6 = "vf-fee98b";
5611
+ var scopedId$8 = "vf-33b3ca";
5234
5612
 
5235
5613
  function sum(numbers) {
5236
5614
  return numbers.reduce((a, b) => a + b, 0);
5237
5615
  }
5238
5616
 
5239
- const Toolbar = core.withAnnotation({
5240
- providers: [exports.RefreshService]
5241
- }, function Toolbar() {
5617
+ const InlineToolbar = core.withAnnotation({
5618
+ providers: [exports.RefreshService, ToolService]
5619
+ }, function Toolbar(props) {
5242
5620
  const selection = core.inject(core$1.Selection);
5243
5621
  const viewDocument = core.inject(platformBrowser.VIEW_CONTAINER);
5244
5622
  const rootComponentRef = core.inject(core$1.RootComponentRef);
5245
5623
  const adapter = core.inject(platformBrowser.DomAdapter);
5246
5624
  const bridge = core.inject(platformBrowser.SelectionBridge);
5625
+ const query = core.inject(core$1.Query);
5247
5626
  const textbus = core.inject(core$1.Textbus);
5248
5627
  const editorService = core.inject(exports.EditorService);
5249
5628
  const refreshService = core.inject(exports.RefreshService);
@@ -5366,28 +5745,29 @@ const Toolbar = core.withAnnotation({
5366
5745
  mousedownSubscription.unsubscribe();
5367
5746
  mouseupSubscription.unsubscribe();
5368
5747
  });
5369
- return scopedCss.withScopedCSS(scopedId$6, () => {
5748
+ return scopedCss.withScopedCSS(scopedId$8, () => {
5370
5749
  const p = viewPosition();
5371
- return (jsxRuntime.jsxs("div", { class: "toolbar", ref: toolbarRef, style: {
5750
+ return (jsxRuntime.jsxs("div", { class: ['toolbar', props.theme], ref: toolbarRef, style: {
5372
5751
  left: p.left + 'px',
5373
5752
  top: p.top + 'px',
5374
5753
  pointerEvents: p.isHide ? 'none' : 'initial',
5375
5754
  opacity: p.opacity,
5376
5755
  display: editorService.hideInlineToolbar ? 'none' : '',
5377
5756
  transitionDuration: p.transitionDuration + 's'
5378
- }, children: [selection.commonAncestorComponent instanceof TableComponent && jsxRuntime.jsxs(core.Fragment, { children: [jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(MergeCellsTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(SplitCellsTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CellBackgroundTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CellAlignTool, {}) })] }, "table"), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(BlockTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(AttrTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(BoldTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(ItalicTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(StrikeThroughTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(UnderlineTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(FontSizeTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(FontFamilyTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(LinkTool, { hideToolbar: hideToolbar }) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CodeTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(ColorTool, {}) })] }));
5757
+ }, children: [jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(BlockTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(AttrTool, {}) }), jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(BoldTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(ItalicTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(StrikeThroughTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(UnderlineTool, {}) }), jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(FontSizeTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(FontFamilyTool, {}) }), jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(LinkTool, { hideToolbar: hideToolbar }) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CodeTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(ColorTool, {}) }), jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(SubscriptTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(SuperscriptTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CleanFormatsTool, {}) }), query.queryComponent(TableComponent).state === core$1.QueryStateType.Enabled && jsxRuntime.jsxs(core.Fragment, { children: [jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(MergeCellsTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(SplitCellsTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CellBackgroundTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CellAlignTool, {}) })] }, "table")] }));
5379
5758
  });
5380
5759
  });
5381
5760
 
5382
- class ToolbarPlugin {
5383
- constructor() {
5761
+ class InlineToolbarPlugin {
5762
+ constructor(config = {}) {
5763
+ this.config = config;
5384
5764
  this.app = null;
5385
5765
  }
5386
5766
  setup(injector) {
5387
- const App = function () {
5767
+ const App = () => {
5388
5768
  const readonly = useReadonly();
5389
5769
  return () => {
5390
- return readonly() ? null : jsxRuntime.jsx(Toolbar, {});
5770
+ return readonly() ? null : jsxRuntime.jsx(InlineToolbar, { theme: this.config.theme });
5391
5771
  };
5392
5772
  };
5393
5773
  this.app = platformBrowser$1.createApp(jsxRuntime.jsx(App, {}), {
@@ -5404,6 +5784,133 @@ class ToolbarPlugin {
5404
5784
  }
5405
5785
  }
5406
5786
 
5787
+ var scopedId$7 = "vf-42c12d";
5788
+
5789
+ const StaticToolbar = core.withAnnotation({
5790
+ providers: [exports.RefreshService, ToolService]
5791
+ }, function Toolbar(props) {
5792
+ const selection = core.inject(core$1.Selection);
5793
+ const textbus = core.inject(core$1.Textbus);
5794
+ const query = core.inject(core$1.Query);
5795
+ const refreshService = core.inject(exports.RefreshService);
5796
+ const instance = core.getCurrentInstance();
5797
+ const subscription = core$1.merge(textbus.onChange, selection.onChange).pipe(core$1.debounceTime(20)).subscribe(() => {
5798
+ refreshService.onRefresh.next();
5799
+ instance.markAsDirtied();
5800
+ });
5801
+ core.onUnmounted(() => {
5802
+ subscription.unsubscribe();
5803
+ });
5804
+ return scopedCss.withScopedCSS(scopedId$7, () => {
5805
+ return (jsxRuntime.jsxs("div", { class: ['toolbar', props.theme], children: [jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(UndoTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(RedoTool, {}) }), jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(InsertTool, {}) }), jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(BlockTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(AttrTool, {}) }), jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(BoldTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(ItalicTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(StrikeThroughTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(UnderlineTool, {}) }), jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(FontSizeTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(FontFamilyTool, {}) }), jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(LinkTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CodeTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(ColorTool, {}) }), jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(SubscriptTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(SuperscriptTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CleanFormatsTool, {}) }), query.queryComponent(TableComponent).state === core$1.QueryStateType.Enabled && jsxRuntime.jsxs(core.Fragment, { children: [jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(MergeCellsTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(SplitCellsTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CellBackgroundTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CellAlignTool, {}) })] }, "table")] }));
5806
+ });
5807
+ });
5808
+
5809
+ class StaticToolbarPlugin {
5810
+ constructor(options) {
5811
+ this.options = options;
5812
+ this.app = null;
5813
+ this.container = null;
5814
+ }
5815
+ setup(injector) {
5816
+ const container = document.createElement('div');
5817
+ container.style.position = 'relative';
5818
+ container.style.borderRadius = 'inherit';
5819
+ this.app = platformBrowser$1.createApp(jsxRuntime.jsx(core.Context, { providers: [{
5820
+ provide: DropdownMenuContainer,
5821
+ useValue: container
5822
+ }], children: jsxRuntime.jsx(StaticToolbar, { theme: this.options.theme }) }), {
5823
+ context: injector
5824
+ });
5825
+ this.options.host.appendChild(container);
5826
+ this.container = container;
5827
+ this.app.mount(container);
5828
+ }
5829
+ onDestroy() {
5830
+ var _a, _b;
5831
+ (_a = this.container) === null || _a === void 0 ? void 0 : _a.remove();
5832
+ (_b = this.app) === null || _b === void 0 ? void 0 : _b.destroy();
5833
+ }
5834
+ }
5835
+
5836
+ var scopedId$6 = "vf-25fd9c";
5837
+
5838
+ const SuspensionToolbar = core.withAnnotation({
5839
+ providers: [exports.RefreshService, ToolService]
5840
+ }, function Toolbar(props) {
5841
+ const selection = core.inject(core$1.Selection);
5842
+ const textbus = core.inject(core$1.Textbus);
5843
+ const query = core.inject(core$1.Query);
5844
+ const refreshService = core.inject(exports.RefreshService);
5845
+ const viewDocument = core.inject(platformBrowser.VIEW_CONTAINER);
5846
+ const instance = core.getCurrentInstance();
5847
+ const subscription = core$1.merge(textbus.onChange, selection.onChange).pipe(core$1.debounceTime(20)).subscribe(() => {
5848
+ refreshService.onRefresh.next();
5849
+ instance.markAsDirtied();
5850
+ });
5851
+ core.onUnmounted(() => {
5852
+ subscription.unsubscribe();
5853
+ });
5854
+ const [styles, updateStyles] = hooks.useProduce({
5855
+ top: 0,
5856
+ opacity: 1,
5857
+ });
5858
+ subscription.add(core$1.fromEvent(document, 'scroll').pipe(core$1.tap(() => {
5859
+ updateStyles(draft => {
5860
+ draft.opacity = 0;
5861
+ });
5862
+ }), core$1.debounceTime(100), core$1.tap(() => {
5863
+ const rect = viewDocument.getBoundingClientRect();
5864
+ if (rect.top < 10) {
5865
+ updateStyles(draft => {
5866
+ draft.top = Math.min(-rect.top + 10, rect.height - 100);
5867
+ });
5868
+ }
5869
+ else {
5870
+ updateStyles(draft => {
5871
+ draft.top = 0;
5872
+ });
5873
+ }
5874
+ }), core$1.delay(100)).subscribe(() => {
5875
+ updateStyles(draft => {
5876
+ draft.opacity = 1;
5877
+ });
5878
+ }));
5879
+ return scopedCss.withScopedCSS(scopedId$6, () => {
5880
+ const s = styles();
5881
+ return (jsxRuntime.jsxs("div", { class: ['toolbar', props.theme, {
5882
+ suspension: s.top === 0 ? '' : 'suspension'
5883
+ }], style: {
5884
+ top: s.top + 'px',
5885
+ opacity: s.opacity,
5886
+ pointerEvents: s.opacity === 0 ? 'none' : 'initial',
5887
+ }, children: [jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(UndoTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(RedoTool, {}) }), jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(InsertTool, {}) }), jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(BlockTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(AttrTool, {}) }), jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(BoldTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(ItalicTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(StrikeThroughTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(UnderlineTool, {}) }), jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(FontSizeTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(FontFamilyTool, {}) }), jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(LinkTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CodeTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(ColorTool, {}) }), jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(SubscriptTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(SuperscriptTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CleanFormatsTool, {}) }), query.queryComponent(TableComponent).state === core$1.QueryStateType.Enabled && jsxRuntime.jsxs(core.Fragment, { children: [jsxRuntime.jsx(SplitLine, {}), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(MergeCellsTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(SplitCellsTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CellBackgroundTool, {}) }), jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(CellAlignTool, {}) })] }, "table")] }));
5888
+ });
5889
+ });
5890
+
5891
+ class SuspensionToolbarPlugin {
5892
+ constructor(options = {}) {
5893
+ this.options = options;
5894
+ this.app = null;
5895
+ this.container = null;
5896
+ }
5897
+ setup(injector) {
5898
+ const host = injector.get(platformBrowser.VIEW_CONTAINER);
5899
+ const container = document.createElement('div');
5900
+ this.app = platformBrowser$1.createApp(jsxRuntime.jsx(SuspensionToolbar, { theme: this.options.theme }), {
5901
+ context: injector
5902
+ });
5903
+ host.prepend(container);
5904
+ this.container = container;
5905
+ this.app.mount(container);
5906
+ }
5907
+ onDestroy() {
5908
+ var _a, _b;
5909
+ (_a = this.container) === null || _a === void 0 ? void 0 : _a.remove();
5910
+ (_b = this.app) === null || _b === void 0 ? void 0 : _b.destroy();
5911
+ }
5912
+ }
5913
+
5407
5914
  class Matcher {
5408
5915
  constructor(target, rule) {
5409
5916
  this.target = target;
@@ -5504,6 +6011,10 @@ class Matcher {
5504
6011
  class Organization {
5505
6012
  }
5506
6013
  function registerAtShortcut(textbus) {
6014
+ const organization = textbus.get(Organization, null);
6015
+ if (!organization) {
6016
+ return;
6017
+ }
5507
6018
  const keyboard = textbus.get(core$1.Keyboard);
5508
6019
  const selection = textbus.get(core$1.Selection);
5509
6020
  const commander = textbus.get(core$1.Commander);
@@ -5754,8 +6265,11 @@ class RootComponent extends core$1.Component {
5754
6265
  lastContent instanceof TodolistComponent) {
5755
6266
  return;
5756
6267
  }
6268
+ const selection = this.textbus.get(core$1.Selection);
5757
6269
  content.retain(content.length);
5758
- content.insert(new ParagraphComponent(this.textbus));
6270
+ const newParagraph = new ParagraphComponent(this.textbus);
6271
+ content.insert(newParagraph);
6272
+ selection.setPosition(newParagraph.state.slot, 0);
5759
6273
  }
5760
6274
  }
5761
6275
  RootComponent.componentName = 'RootComponent';
@@ -5770,14 +6284,22 @@ function RootView(props) {
5770
6284
  sub.unsubscribe();
5771
6285
  };
5772
6286
  });
5773
- core.onUpdated(() => {
5774
- props.component.afterCheck();
5775
- });
6287
+ const containerRef = core.createRef();
5776
6288
  const readonly = useReadonly();
5777
6289
  const output = useOutput();
6290
+ function checkContent(ev) {
6291
+ if (ev.target === containerRef.current) {
6292
+ const rect = containerRef.current.getBoundingClientRect();
6293
+ if (rect.bottom - ev.clientY < 40) {
6294
+ props.component.afterCheck();
6295
+ }
6296
+ }
6297
+ }
5778
6298
  return () => {
5779
6299
  const { rootRef } = props;
5780
- return (jsxRuntime.jsx("div", { class: "xnote-root", dir: "auto", ref: [rootRef, ref], "data-component": props.component.name, children: jsxRuntime.jsx(SlotRender, { slot: content, tag: "div", class: "xnote-content", "data-placeholder": content.isEmpty ? '请输入内容' : '', renderEnv: readonly() || output() }) }));
6300
+ return (jsxRuntime.jsx("div", { class: "xnote-root", onClick: checkContent, style: !readonly() ? {
6301
+ paddingBottom: '40px'
6302
+ } : {}, dir: "auto", ref: [rootRef, containerRef, ref], "data-component": props.component.name, children: jsxRuntime.jsx(SlotRender, { slot: content, tag: "div", class: "xnote-content", "data-placeholder": content.isEmpty ? '请输入内容' : '', renderEnv: readonly() || output() }) }));
5781
6303
  };
5782
6304
  }
5783
6305
  const rootComponentLoader = {
@@ -6827,7 +7349,9 @@ class Editor extends core$1.Textbus {
6827
7349
  italicFormatLoader,
6828
7350
  linkFormatLoader,
6829
7351
  strikeThroughFormatLoader,
6830
- underlineFormatLoader
7352
+ underlineFormatLoader,
7353
+ subscriptFormatLoader,
7354
+ superscriptFormatLoader
6831
7355
  ], attributeLoaders: [
6832
7356
  cellBackgroundAttrLoader,
6833
7357
  cellAlignAttrLoader,
@@ -6915,7 +7439,9 @@ class Editor extends core$1.Textbus {
6915
7439
  italicFormatter,
6916
7440
  linkFormatter,
6917
7441
  strikeThroughFormatter,
6918
- underlineFormatter
7442
+ underlineFormatter,
7443
+ subscriptFormatter,
7444
+ superscriptFormatter
6919
7445
  ], attributes: [
6920
7446
  cellBackgroundAttr,
6921
7447
  cellAlignAttr,
@@ -6924,7 +7450,7 @@ class Editor extends core$1.Textbus {
6924
7450
  textIndentAttr
6925
7451
  ], plugins: [
6926
7452
  new LeftToolbarPlugin(),
6927
- new ToolbarPlugin(),
7453
+ new InlineToolbarPlugin()
6928
7454
  ], onAfterStartup(textbus) {
6929
7455
  registerBoldShortcut(textbus);
6930
7456
  registerCodeShortcut(textbus);
@@ -6988,6 +7514,7 @@ exports.BoldTool = BoldTool;
6988
7514
  exports.Button = Button;
6989
7515
  exports.CellAlignTool = CellAlignTool;
6990
7516
  exports.CellBackgroundTool = CellBackgroundTool;
7517
+ exports.CleanFormatsTool = CleanFormatsTool;
6991
7518
  exports.CodeTool = CodeTool;
6992
7519
  exports.ColorPicker = ColorPicker;
6993
7520
  exports.ColorTool = ColorTool;
@@ -6995,6 +7522,7 @@ exports.ComponentToolbar = ComponentToolbar;
6995
7522
  exports.Divider = Divider;
6996
7523
  exports.DragResize = DragResize;
6997
7524
  exports.Dropdown = Dropdown;
7525
+ exports.DropdownMenuContainer = DropdownMenuContainer;
6998
7526
  exports.DropdownMenuPortal = DropdownMenuPortal;
6999
7527
  exports.Editor = Editor;
7000
7528
  exports.FileUploader = FileUploader;
@@ -7004,6 +7532,9 @@ exports.HighlightBoxComponent = HighlightBoxComponent;
7004
7532
  exports.HighlightBoxView = HighlightBoxView;
7005
7533
  exports.ImageComponent = ImageComponent;
7006
7534
  exports.ImageView = ImageView;
7535
+ exports.InlineToolbar = InlineToolbar;
7536
+ exports.InlineToolbarPlugin = InlineToolbarPlugin;
7537
+ exports.InsertMenu = InsertMenu;
7007
7538
  exports.InsertTool = InsertTool;
7008
7539
  exports.ItalicTool = ItalicTool;
7009
7540
  exports.KatexComponent = KatexComponent;
@@ -7025,20 +7556,27 @@ exports.ParagraphComponent = ParagraphComponent;
7025
7556
  exports.ParagraphView = ParagraphView;
7026
7557
  exports.Picker = Picker;
7027
7558
  exports.Popup = Popup;
7559
+ exports.RedoTool = RedoTool;
7028
7560
  exports.RootComponent = RootComponent;
7029
7561
  exports.RootView = RootView;
7030
7562
  exports.SourceCodeComponent = SourceCodeComponent;
7031
7563
  exports.SourceCodeView = SourceCodeView;
7032
7564
  exports.SplitCellsTool = SplitCellsTool;
7565
+ exports.SplitLine = SplitLine;
7566
+ exports.StaticToolbar = StaticToolbar;
7567
+ exports.StaticToolbarPlugin = StaticToolbarPlugin;
7033
7568
  exports.StrikeThroughTool = StrikeThroughTool;
7569
+ exports.SubscriptTool = SubscriptTool;
7570
+ exports.SuperscriptTool = SuperscriptTool;
7571
+ exports.SuspensionToolbar = SuspensionToolbar;
7572
+ exports.SuspensionToolbarPlugin = SuspensionToolbarPlugin;
7034
7573
  exports.TableComponent = TableComponent;
7035
7574
  exports.TableComponentView = TableComponentView;
7036
7575
  exports.TodolistComponent = TodolistComponent;
7037
7576
  exports.TodolistView = TodolistView;
7038
- exports.Toolbar = Toolbar;
7039
7577
  exports.ToolbarItem = ToolbarItem;
7040
- exports.ToolbarPlugin = ToolbarPlugin;
7041
7578
  exports.UnderlineTool = UnderlineTool;
7579
+ exports.UndoTool = UndoTool;
7042
7580
  exports.VideoComponent = VideoComponent;
7043
7581
  exports.VideoView = VideoView;
7044
7582
  exports.XNoteMessageBug = XNoteMessageBug;
@@ -7090,6 +7628,10 @@ exports.sourceCodeComponentLoader = sourceCodeComponentLoader;
7090
7628
  exports.sourceCodeThemes = sourceCodeThemes;
7091
7629
  exports.strikeThroughFormatLoader = strikeThroughFormatLoader;
7092
7630
  exports.strikeThroughFormatter = strikeThroughFormatter;
7631
+ exports.subscriptFormatLoader = subscriptFormatLoader;
7632
+ exports.subscriptFormatter = subscriptFormatter;
7633
+ exports.superscriptFormatLoader = superscriptFormatLoader;
7634
+ exports.superscriptFormatter = superscriptFormatter;
7093
7635
  exports.tableComponentLoader = tableComponentLoader;
7094
7636
  exports.textAlignAttr = textAlignAttr;
7095
7637
  exports.textAlignAttrLoader = textAlignAttrLoader;