@harbour-enterprises/superdoc 0.13.0-RC3 → 0.13.0-next.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 (96) hide show
  1. package/dist/chunks/{eventemitter3-Dq2TEegt.es.js → eventemitter3-BrspJk8q.es.js} +1 -1
  2. package/dist/chunks/{eventemitter3-DuScojUH.cjs → eventemitter3-DfVviFzP.cjs} +1 -1
  3. package/dist/chunks/{index-DiSsZq2e.cjs → index-B4J7wgs6.cjs} +2 -2
  4. package/dist/chunks/{index-DRXYX6Gk.cjs → index-Cdsq63Xq.cjs} +4 -4
  5. package/dist/chunks/{index-CIbdIyV7.es.js → index-Diu6UKHt.es.js} +4 -4
  6. package/dist/chunks/{index-xoeJtm87.es.js → index-Hr3Um-Bg.es.js} +2 -2
  7. package/dist/chunks/{jszip-Bwu_om3F.cjs → jszip-BTAcmbVg.cjs} +1 -1
  8. package/dist/chunks/{jszip-BmWWPxfF.es.js → jszip-DckFs3A7.es.js} +1 -1
  9. package/dist/chunks/{super-editor.es-CzkFh6x_.cjs → super-editor.es-B4lFJKTF.cjs} +3771 -1630
  10. package/dist/chunks/{super-editor.es-BNfBtek_.es.js → super-editor.es-C-QroPG4.es.js} +3771 -1630
  11. package/dist/chunks/{url-DCj-FtDL.cjs → url-BIzg4y2i.cjs} +2 -2
  12. package/dist/chunks/{url-BYg6oUon.es.js → url-CHayXMZH.es.js} +2 -2
  13. package/dist/chunks/{vue-IIIZMHTg.es.js → vue-Bi1uWinj.es.js} +17 -11
  14. package/dist/chunks/{vue-DPZkajuO.cjs → vue-HIY1g7dm.cjs} +17 -11
  15. package/dist/chunks/{xml-js-DJKwJc1u.cjs → xml-js-BjqmFOSP.cjs} +102 -81
  16. package/dist/chunks/{xml-js-Dua_oPCO.es.js → xml-js-CfClL-1b.es.js} +102 -81
  17. package/dist/core/SuperDoc.d.ts +0 -6
  18. package/dist/core/SuperDoc.d.ts.map +1 -1
  19. package/dist/core/collaboration/collaboration.d.ts +0 -9
  20. package/dist/core/collaboration/collaboration.d.ts.map +1 -1
  21. package/dist/core/collaboration/helpers.d.ts.map +1 -1
  22. package/dist/style.css +246 -147
  23. package/dist/super-editor/ai-writer.es.js +2 -2
  24. package/dist/super-editor/chunks/{converter-BbSSdo_p.js → converter-Bwa99qcs.js} +577 -337
  25. package/dist/super-editor/chunks/{docx-zipper-8FbwdMJc.js → docx-zipper-CVKlI3mU.js} +1 -1
  26. package/dist/super-editor/chunks/{editor-CnYTUN7K.js → editor-BdaZqkkS.js} +3590 -1911
  27. package/dist/super-editor/chunks/{toolbar-DtAngH6V.js → toolbar-BNg5l9RP.js} +130 -37
  28. package/dist/super-editor/components/pagination-helpers.d.ts.map +1 -1
  29. package/dist/super-editor/converter.es.js +1 -1
  30. package/dist/super-editor/core/Editor.d.ts +1 -8
  31. package/dist/super-editor/core/Editor.d.ts.map +1 -1
  32. package/dist/super-editor/core/InputRule.d.ts +7 -0
  33. package/dist/super-editor/core/InputRule.d.ts.map +1 -1
  34. package/dist/super-editor/core/commands/splitListItem.d.ts +1 -1
  35. package/dist/super-editor/core/commands/splitListItem.d.ts.map +1 -1
  36. package/dist/super-editor/core/helpers/annotator.d.ts +2 -0
  37. package/dist/super-editor/core/helpers/annotator.d.ts.map +1 -1
  38. package/dist/super-editor/core/helpers/findWordBounds.d.ts +5 -0
  39. package/dist/super-editor/core/helpers/findWordBounds.d.ts.map +1 -0
  40. package/dist/super-editor/core/helpers/setWordSelection.d.ts +2 -0
  41. package/dist/super-editor/core/helpers/setWordSelection.d.ts.map +1 -0
  42. package/dist/super-editor/core/inputRules/docx-paste/docx-paste.d.ts.map +1 -1
  43. package/dist/super-editor/core/super-converter/SuperConverter.d.ts +4 -1
  44. package/dist/super-editor/core/super-converter/SuperConverter.d.ts.map +1 -1
  45. package/dist/super-editor/core/super-converter/exporter.d.ts.map +1 -1
  46. package/dist/super-editor/core/super-converter/helpers.d.ts.map +1 -1
  47. package/dist/super-editor/core/super-converter/v2/importer/autoPageNumberImporter.d.ts.map +1 -1
  48. package/dist/super-editor/core/super-converter/v2/importer/listImporter.d.ts +5 -32
  49. package/dist/super-editor/core/super-converter/v2/importer/listImporter.d.ts.map +1 -1
  50. package/dist/super-editor/core/super-converter/v2/importer/paragraphNodeImporter.d.ts +3 -3
  51. package/dist/super-editor/core/super-converter/v2/importer/paragraphNodeImporter.d.ts.map +1 -1
  52. package/dist/super-editor/docx-zipper.es.js +2 -2
  53. package/dist/super-editor/editor.es.js +3 -3
  54. package/dist/super-editor/extensions/field-annotation/FieldAnnotationView.d.ts.map +1 -1
  55. package/dist/super-editor/extensions/field-annotation/field-annotation.d.ts.map +1 -1
  56. package/dist/super-editor/extensions/image/imageHelpers/imagePositionPlugin.d.ts.map +1 -1
  57. package/dist/super-editor/extensions/image/imageHelpers/index.d.ts +1 -0
  58. package/dist/super-editor/extensions/image/imageHelpers/processUploadedImage.d.ts.map +1 -1
  59. package/dist/super-editor/extensions/image/index.d.ts +1 -0
  60. package/dist/super-editor/extensions/index.d.ts +2 -1
  61. package/dist/super-editor/extensions/index.d.ts.map +1 -1
  62. package/dist/super-editor/extensions/line-height/line-height.d.ts.map +1 -1
  63. package/dist/super-editor/extensions/linked-styles/linked-styles.d.ts.map +1 -1
  64. package/dist/super-editor/extensions/list-item/list-item.d.ts.map +1 -1
  65. package/dist/super-editor/extensions/noderesizer/index.d.ts +2 -0
  66. package/dist/super-editor/extensions/noderesizer/index.d.ts.map +1 -0
  67. package/dist/super-editor/extensions/noderesizer/noderesizer.d.ts +7 -0
  68. package/dist/super-editor/extensions/noderesizer/noderesizer.d.ts.map +1 -0
  69. package/dist/super-editor/extensions/ordered-list/ordered-list.d.ts.map +1 -1
  70. package/dist/super-editor/extensions/page-number/page-number.d.ts +10 -0
  71. package/dist/super-editor/extensions/page-number/page-number.d.ts.map +1 -1
  72. package/dist/super-editor/extensions/pagination/pagination-helpers.d.ts +2 -1
  73. package/dist/super-editor/extensions/pagination/pagination-helpers.d.ts.map +1 -1
  74. package/dist/super-editor/extensions/pagination/pagination.d.ts.map +1 -1
  75. package/dist/super-editor/extensions/paragraph/paragraph.d.ts.map +1 -1
  76. package/dist/super-editor/file-zipper.es.js +1 -1
  77. package/dist/super-editor/style.css +219 -120
  78. package/dist/super-editor/super-editor.es.js +325 -200
  79. package/dist/super-editor/tests/e2e/test-app/vite.config.d.ts +1 -1
  80. package/dist/super-editor/tests/export/export-helpers/export-helpers.d.ts.map +1 -1
  81. package/dist/super-editor/toolbar.es.js +2 -2
  82. package/dist/super-editor.cjs +2 -2
  83. package/dist/super-editor.es.js +2 -2
  84. package/dist/superdoc.cjs +1590 -367
  85. package/dist/superdoc.es.js +1575 -368
  86. package/dist/superdoc.umd.js +5254 -1905
  87. package/dist/superdoc.umd.js.map +1 -1
  88. package/package.json +3 -2
  89. package/dist/super-editor/core/helpers/list-numbering-helpers.d.ts +0 -235
  90. package/dist/super-editor/core/helpers/list-numbering-helpers.d.ts.map +0 -1
  91. package/dist/super-editor/extensions/list-item/ListItemNodeView.d.ts +0 -56
  92. package/dist/super-editor/extensions/list-item/ListItemNodeView.d.ts.map +0 -1
  93. package/dist/super-editor/tests/e2e/test-app/dist/assets/index-BTMvkUyI.d.ts +0 -3
  94. package/dist/super-editor/tests/e2e/test-app/dist/assets/index-BTMvkUyI.d.ts.map +0 -1
  95. package/dist/super-editor/tests/editor/listItemHelpers.test.d.ts +0 -2
  96. package/dist/super-editor/tests/editor/listItemHelpers.test.d.ts.map +0 -1
@@ -9,14 +9,14 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, runCommandWithArgumentOnly_fn;
12
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, I as ImagePlaceholderPluginKey, f as findPlaceholder, c as findParentNode, d as getActiveFormatting, i as isInTable, e as undoDepth, r as redoDepth, E as Editor, h as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-CnYTUN7K.js";
13
- import { o, C, T, m, p, l, n } from "./chunks/editor-CnYTUN7K.js";
14
- import { a7 as getDefaultExportFromCjs, E as v4, aa as vClickOutside, T as TextSelection, a as Plugin } from "./chunks/converter-BbSSdo_p.js";
15
- import { O } from "./chunks/converter-BbSSdo_p.js";
16
- import { ref, createElementBlock, openBlock, normalizeClass, unref, createElementVNode, getCurrentInstance, computed, watch, onMounted, createCommentVNode, withDirectives, withKeys, withModifiers, vModelText, createTextVNode, toDisplayString, Fragment, renderList, normalizeStyle, createVNode, h, createApp, reactive, onUnmounted, shallowRef, onBeforeUnmount, createBlock } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, N as NSkeleton } from "./chunks/toolbar-DtAngH6V.js";
12
+ import { a2 as getDefaultExportFromCjs, E as v4, a5 as vClickOutside, T as TextSelection, a as Plugin } from "./chunks/converter-Bwa99qcs.js";
13
+ import { O } from "./chunks/converter-Bwa99qcs.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, f as findParentNode, c as getFileOpener, s as startImageUpload, d as getActiveFormatting, i as isInTable, e as undoDepth, r as redoDepth, E as Editor, h as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-BdaZqkkS.js";
15
+ import { o, C, T, m, q, p, l, n } from "./chunks/editor-BdaZqkkS.js";
16
+ import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, getCurrentInstance, computed, watch, createCommentVNode, withDirectives, withKeys, vModelText, createTextVNode, toDisplayString, normalizeStyle, createVNode, h, createApp, reactive, onUnmounted, shallowRef, onBeforeUnmount, createBlock } from "vue";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, N as NSkeleton } from "./chunks/toolbar-BNg5l9RP.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-8FbwdMJc.js";
19
+ import { D } from "./chunks/docx-zipper-CVKlI3mU.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  (function(module) {
@@ -327,60 +327,99 @@ const useToolbarItem = (options) => {
327
327
  onDeactivate
328
328
  };
329
329
  };
330
- const _hoisted_1$b = ["innerHTML"];
331
- const _hoisted_2$9 = ["innerHTML"];
332
- const _hoisted_3$7 = ["innerHTML"];
333
- const _hoisted_4$3 = ["innerHTML"];
330
+ const _hoisted_1$b = ["onClick", "innerHTML", "aria-label", "onKeydown"];
334
331
  const _sfc_main$c = {
335
332
  __name: "AlignmentButtons",
336
333
  emits: ["select"],
337
334
  setup(__props, { emit: __emit }) {
338
335
  const { isHighContrastMode } = useHighContrastMode();
339
336
  const emit = __emit;
337
+ const alignmentButtonsRefs = ref([]);
338
+ const alignmentButtons = [
339
+ {
340
+ key: "left",
341
+ ariaLabel: "Align left",
342
+ icon: toolbarIcons.alignLeft
343
+ },
344
+ {
345
+ key: "center",
346
+ ariaLabel: "Align center",
347
+ icon: toolbarIcons.alignCenter
348
+ },
349
+ {
350
+ key: "right",
351
+ ariaLabel: "Align right",
352
+ icon: toolbarIcons.alignRight
353
+ },
354
+ {
355
+ key: "justify",
356
+ ariaLabel: "Justify",
357
+ icon: toolbarIcons.alignJustify
358
+ }
359
+ ];
340
360
  const select = (alignment2) => {
341
361
  emit("select", alignment2);
342
362
  };
363
+ const moveToNextButton = (index) => {
364
+ if (index === alignmentButtonsRefs.value.length - 1) return;
365
+ const nextButton = alignmentButtonsRefs.value[index + 1];
366
+ if (nextButton) {
367
+ nextButton.setAttribute("tabindex", "0");
368
+ nextButton.focus();
369
+ }
370
+ };
371
+ const moveToPreviousButton = (index) => {
372
+ if (index === 0) return;
373
+ const previousButton = alignmentButtonsRefs.value[index - 1];
374
+ if (previousButton) {
375
+ previousButton.setAttribute("tabindex", "0");
376
+ previousButton.focus();
377
+ }
378
+ };
379
+ const handleKeyDown = (e, index) => {
380
+ switch (e.key) {
381
+ case "ArrowLeft":
382
+ moveToPreviousButton(index);
383
+ break;
384
+ case "ArrowRight":
385
+ moveToNextButton(index);
386
+ break;
387
+ case "Enter":
388
+ select(alignmentButtons[index].key);
389
+ break;
390
+ }
391
+ };
392
+ onMounted(() => {
393
+ const firstButton = alignmentButtonsRefs.value[0];
394
+ if (firstButton) {
395
+ firstButton.setAttribute("tabindex", "0");
396
+ firstButton.focus();
397
+ }
398
+ });
343
399
  return (_ctx, _cache) => {
344
400
  return openBlock(), createElementBlock("div", {
345
401
  class: normalizeClass(["alignment-buttons", { "high-contrast": unref(isHighContrastMode) }])
346
402
  }, [
347
- createElementVNode("div", {
348
- class: "button-icon",
349
- onClick: _cache[0] || (_cache[0] = ($event) => select("left")),
350
- innerHTML: unref(toolbarIcons).alignLeft,
351
- "data-item": "btn-textAlign-option",
352
- role: "menuitem",
353
- "aria-label": "Align left"
354
- }, null, 8, _hoisted_1$b),
355
- createElementVNode("div", {
356
- class: "button-icon",
357
- onClick: _cache[1] || (_cache[1] = ($event) => select("center")),
358
- innerHTML: unref(toolbarIcons).alignCenter,
359
- "data-item": "btn-textAlign-option",
360
- role: "menuitem",
361
- "aria-label": "Align center"
362
- }, null, 8, _hoisted_2$9),
363
- createElementVNode("div", {
364
- class: "button-icon",
365
- onClick: _cache[2] || (_cache[2] = ($event) => select("right")),
366
- innerHTML: unref(toolbarIcons).alignRight,
367
- "data-item": "btn-textAlign-option",
368
- role: "menuitem",
369
- "aria-label": "Align right"
370
- }, null, 8, _hoisted_3$7),
371
- createElementVNode("div", {
372
- class: "button-icon",
373
- onClick: _cache[3] || (_cache[3] = ($event) => select("justify")),
374
- innerHTML: unref(toolbarIcons).alignJustify,
375
- "data-item": "btn-textAlign-option",
376
- role: "menuitem",
377
- "aria-label": "Justify"
378
- }, null, 8, _hoisted_4$3)
403
+ (openBlock(), createElementBlock(Fragment, null, renderList(alignmentButtons, (button, index) => {
404
+ return createElementVNode("div", {
405
+ key: button.key,
406
+ class: "button-icon",
407
+ onClick: ($event) => select(button.key),
408
+ innerHTML: button.icon,
409
+ "data-item": "btn-textAlign-option",
410
+ role: "menuitem",
411
+ "aria-label": button.ariaLabel,
412
+ ref_for: true,
413
+ ref_key: "alignmentButtonsRefs",
414
+ ref: alignmentButtonsRefs,
415
+ onKeydown: withModifiers((event) => handleKeyDown(event, index), ["prevent"])
416
+ }, null, 40, _hoisted_1$b);
417
+ }), 64))
379
418
  ], 2);
380
419
  };
381
420
  }
382
421
  };
383
- const AlignmentButtons = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-58d8a9bb"]]);
422
+ const AlignmentButtons = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-3f28435a"]]);
384
423
  const _hoisted_1$a = {
385
424
  key: 0,
386
425
  class: "link-title"
@@ -544,7 +583,7 @@ const _sfc_main$b = {
544
583
  }
545
584
  };
546
585
  const LinkInput = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-64aa14bc"]]);
547
- const _hoisted_1$9 = ["onClick"];
586
+ const _hoisted_1$9 = ["onClick", "onKeydown"];
548
587
  const _hoisted_2$7 = { class: "document-mode-column icon-column" };
549
588
  const _hoisted_3$5 = ["innerHTML"];
550
589
  const _hoisted_4$1 = { class: "document-mode-column text-column" };
@@ -560,20 +599,59 @@ const _sfc_main$a = {
560
599
  emits: ["select"],
561
600
  setup(__props, { emit: __emit }) {
562
601
  const emit = __emit;
602
+ const documentModeRefs = ref([]);
563
603
  const { isHighContrastMode } = useHighContrastMode();
604
+ const props = __props;
564
605
  const handleClick = (item) => {
565
606
  emit("select", item);
566
607
  };
608
+ const moveToNextOption = (index) => {
609
+ if (index === documentModeRefs.value.length - 1) return;
610
+ const nextOption = documentModeRefs.value[index + 1];
611
+ if (nextOption) {
612
+ nextOption.setAttribute("tabindex", "0");
613
+ nextOption.focus();
614
+ }
615
+ };
616
+ const moveToPreviousOption = (index) => {
617
+ if (index === 0) return;
618
+ const previousOption = documentModeRefs.value[index - 1];
619
+ if (previousOption) {
620
+ previousOption.setAttribute("tabindex", "0");
621
+ previousOption.focus();
622
+ }
623
+ };
624
+ const handleKeyDown = (e, index) => {
625
+ switch (e.key) {
626
+ case "ArrowDown":
627
+ moveToNextOption(index);
628
+ break;
629
+ case "ArrowUp":
630
+ moveToPreviousOption(index);
631
+ break;
632
+ case "Enter":
633
+ handleClick(props.options[index]);
634
+ break;
635
+ }
636
+ };
637
+ onMounted(() => {
638
+ documentModeRefs.value[0].setAttribute("tabindex", "0");
639
+ documentModeRefs.value[0].focus();
640
+ });
567
641
  return (_ctx, _cache) => {
568
642
  return openBlock(), createElementBlock("div", {
569
643
  class: normalizeClass(["document-mode", { "high-contrast": unref(isHighContrastMode) }])
570
644
  }, [
571
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
645
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, index) => {
572
646
  return openBlock(), createElementBlock("div", {
573
647
  class: normalizeClass(["option-item", { disabled: option.disabled }]),
574
648
  onClick: ($event) => handleClick(option),
575
649
  "data-item": "btn-documentMode-option",
576
- role: "menuitem"
650
+ role: "menuitem",
651
+ ref_for: true,
652
+ ref_key: "documentModeRefs",
653
+ ref: documentModeRefs,
654
+ onKeydown: withModifiers((event) => handleKeyDown(event, index), ["prevent"])
577
655
  }, [
578
656
  createElementVNode("div", _hoisted_2$7, [
579
657
  createElementVNode("div", {
@@ -585,18 +663,18 @@ const _sfc_main$a = {
585
663
  createElementVNode("div", _hoisted_5$1, toDisplayString(option.label), 1),
586
664
  createElementVNode("div", _hoisted_6, toDisplayString(option.description), 1)
587
665
  ])
588
- ], 10, _hoisted_1$9);
666
+ ], 42, _hoisted_1$9);
589
667
  }), 256))
590
668
  ], 2);
591
669
  };
592
670
  }
593
671
  };
594
- const DocumentMode = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-050d9d49"]]);
672
+ const DocumentMode = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-7febe4d9"]]);
595
673
  const _hoisted_1$8 = {
596
674
  key: 0,
597
675
  class: "linked-style-buttons"
598
676
  };
599
- const _hoisted_2$6 = ["onClick"];
677
+ const _hoisted_2$6 = ["onClick", "onKeydown"];
600
678
  const _sfc_main$9 = {
601
679
  __name: "LinkedStyle",
602
680
  props: {
@@ -611,32 +689,72 @@ const _sfc_main$9 = {
611
689
  emits: ["select"],
612
690
  setup(__props, { emit: __emit }) {
613
691
  const emit = __emit;
692
+ const styleRefs = ref([]);
614
693
  const props = __props;
615
694
  const select = (style) => {
616
695
  emit("select", style);
617
696
  };
697
+ const moveToNextStyle = (index) => {
698
+ if (index === styleRefs.value.length - 1) {
699
+ return;
700
+ }
701
+ const nextItem = styleRefs.value[index + 1];
702
+ nextItem.setAttribute("tabindex", "0");
703
+ nextItem.focus();
704
+ };
705
+ const moveToPreviousStyle = (index) => {
706
+ if (index === 0) {
707
+ return;
708
+ }
709
+ const previousItem = styleRefs.value[index - 1];
710
+ previousItem.setAttribute("tabindex", "0");
711
+ previousItem.focus();
712
+ };
713
+ const handleKeyDown = (event, index, style) => {
714
+ switch (event.key) {
715
+ case "ArrowDown":
716
+ moveToNextStyle(index);
717
+ break;
718
+ case "ArrowUp":
719
+ moveToPreviousStyle(index);
720
+ break;
721
+ case "Enter":
722
+ console.log("style", style);
723
+ select(style);
724
+ break;
725
+ }
726
+ };
727
+ onMounted(() => {
728
+ styleRefs.value[0].setAttribute("tabindex", "0");
729
+ styleRefs.value[0].focus();
730
+ });
618
731
  return (_ctx, _cache) => {
619
732
  return props.editor ? (openBlock(), createElementBlock("div", _hoisted_1$8, [
620
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getQuickFormatList)(__props.editor), (style) => {
733
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getQuickFormatList)(__props.editor), (style, index) => {
621
734
  return openBlock(), createElementBlock("div", {
622
735
  class: normalizeClass(["style-item", { "selected": __props.selectedOption === style.id }]),
623
- onClick: ($event) => select(style)
736
+ onClick: ($event) => select(style),
737
+ onKeydown: (event) => handleKeyDown(event, index, style),
738
+ ref_for: true,
739
+ ref_key: "styleRefs",
740
+ ref: styleRefs
624
741
  }, [
625
742
  createElementVNode("div", {
626
743
  class: "style-name",
627
744
  style: normalizeStyle(unref(generateLinkedStyleString)(style, null, false)),
628
745
  "data-item": "btn-linkedStyles-option"
629
746
  }, toDisplayString(style.definition.attrs.name), 5)
630
- ], 10, _hoisted_2$6);
747
+ ], 42, _hoisted_2$6);
631
748
  }), 256))
632
749
  ])) : createCommentVNode("", true);
633
750
  };
634
751
  }
635
752
  };
636
- const LinkedStyle = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-bf5a8c1e"]]);
637
- const _hoisted_1$7 = ["aria-label", "onClick"];
753
+ const LinkedStyle = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-2cf079a2"]]);
754
+ const _hoisted_1$7 = ["aria-label", "onClick", "onKeydown"];
638
755
  const _hoisted_2$5 = ["innerHTML"];
639
756
  const _hoisted_3$4 = ["innerHTML"];
757
+ const ROW_SIZE$1 = 7;
640
758
  const _sfc_main$8 = {
641
759
  __name: "IconGridRow",
642
760
  props: {
@@ -649,7 +767,7 @@ const _sfc_main$8 = {
649
767
  required: false
650
768
  }
651
769
  },
652
- emits: ["select"],
770
+ emits: ["select", "clickoutside"],
653
771
  setup(__props, { emit: __emit }) {
654
772
  const emit = __emit;
655
773
  const props = __props;
@@ -665,16 +783,80 @@ const _sfc_main$8 = {
665
783
  const handleClick = (option) => {
666
784
  emit("select", option.value);
667
785
  };
786
+ const rowRefs = ref([]);
787
+ const iconRefs = ref([]);
668
788
  onMounted(() => {
669
789
  const isMatrix = props.icons.every((row) => Array.isArray(row));
670
790
  if (!isMatrix) throw new Error("icon props must be 2d array");
791
+ const firstIcon = iconRefs.value[0];
792
+ if (firstIcon) {
793
+ firstIcon.setAttribute("tabindex", "0");
794
+ firstIcon.focus();
795
+ }
671
796
  });
797
+ const moveToNextIcon = (rowIndex, optionIndex) => {
798
+ const iconIndex = ROW_SIZE$1 * rowIndex + optionIndex + 1;
799
+ const nextIcon = iconRefs.value[iconIndex];
800
+ if (nextIcon) {
801
+ nextIcon.setAttribute("tabindex", "0");
802
+ nextIcon.focus();
803
+ }
804
+ };
805
+ const moveToPreviousIcon = (rowIndex, optionIndex) => {
806
+ const iconIndex = ROW_SIZE$1 * rowIndex + optionIndex - 1;
807
+ const previousIcon = iconRefs.value[iconIndex];
808
+ if (previousIcon) {
809
+ previousIcon.setAttribute("tabindex", "0");
810
+ previousIcon.focus();
811
+ }
812
+ };
813
+ const moveToNextRow = (rowIndex, optionIndex) => {
814
+ const iconIndex = optionIndex + ROW_SIZE$1 * (rowIndex + 1);
815
+ const nextIcon = iconRefs.value[iconIndex];
816
+ if (nextIcon) {
817
+ nextIcon.setAttribute("tabindex", "0");
818
+ nextIcon.focus();
819
+ }
820
+ };
821
+ const moveToPreviousRow = (rowIndex, optionIndex) => {
822
+ const iconIndex = optionIndex + ROW_SIZE$1 * (rowIndex - 1);
823
+ const previousIcon = iconRefs.value[iconIndex];
824
+ if (previousIcon) {
825
+ previousIcon.setAttribute("tabindex", "0");
826
+ previousIcon.focus();
827
+ }
828
+ };
829
+ const handleKeyDown = (event, rowIndex, optionIndex, option) => {
830
+ switch (event.key) {
831
+ case "ArrowRight":
832
+ moveToNextIcon(rowIndex, optionIndex);
833
+ break;
834
+ case "ArrowLeft":
835
+ moveToPreviousIcon(rowIndex, optionIndex);
836
+ break;
837
+ case "ArrowDown":
838
+ moveToNextRow(rowIndex, optionIndex);
839
+ break;
840
+ case "ArrowUp":
841
+ moveToPreviousRow(rowIndex, optionIndex);
842
+ break;
843
+ case "Enter":
844
+ handleClick(option);
845
+ break;
846
+ case "Escape":
847
+ emit("clickoutside");
848
+ break;
849
+ }
850
+ };
672
851
  return (_ctx, _cache) => {
673
852
  return openBlock(true), createElementBlock(Fragment, null, renderList(__props.icons, (row, rowIndex) => {
674
853
  return openBlock(), createElementBlock("div", {
675
854
  class: "option-row",
676
855
  key: rowIndex,
677
- role: "group"
856
+ role: "group",
857
+ ref_for: true,
858
+ ref_key: "rowRefs",
859
+ ref: rowRefs
678
860
  }, [
679
861
  (openBlock(true), createElementBlock(Fragment, null, renderList(row, (option, optionIndex) => {
680
862
  return openBlock(), createElementBlock("div", {
@@ -682,7 +864,11 @@ const _sfc_main$8 = {
682
864
  key: optionIndex,
683
865
  "aria-label": option.label,
684
866
  role: "menuitem",
685
- onClick: withModifiers(($event) => handleClick(option), ["stop", "prevent"])
867
+ ref_for: true,
868
+ ref_key: "iconRefs",
869
+ ref: iconRefs,
870
+ onClick: withModifiers(($event) => handleClick(option), ["stop", "prevent"]),
871
+ onKeydown: withModifiers((event) => handleKeyDown(event, rowIndex, optionIndex, option), ["prevent"])
686
872
  }, [
687
873
  createElementVNode("div", {
688
874
  class: "option__icon",
@@ -695,14 +881,14 @@ const _sfc_main$8 = {
695
881
  innerHTML: unref(toolbarIcons).colorOptionCheck,
696
882
  style: normalizeStyle(getCheckStyle(option.value, optionIndex))
697
883
  }, null, 12, _hoisted_3$4)) : createCommentVNode("", true)
698
- ], 8, _hoisted_1$7);
884
+ ], 40, _hoisted_1$7);
699
885
  }), 128))
700
886
  ]);
701
887
  }), 128);
702
888
  };
703
889
  }
704
890
  };
705
- const IconGridRow = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-d96a82fa"]]);
891
+ const IconGridRow = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-e89b7f5f"]]);
706
892
  const DropIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M320 512c53.2 0 101.4-21.6 136.1-56.6l-298.3-235C140 257.1 128 292.3 128 320c0 106 86 192 192 192zM505.2 370.7c4.4-16.2 6.8-33.1 6.8-50.7c0-91.2-130.2-262.3-166.6-308.3C339.4 4.2 330.5 0 320.9 0l-1.8 0c-9.6 0-18.5 4.2-24.5 11.7C277.8 33 240.7 81.3 205.8 136L38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L505.2 370.7zM224 336c0 44.2 35.8 80 80 80c8.8 0 16 7.2 16 16s-7.2 16-16 16c-61.9 0-112-50.1-112-112c0-8.8 7.2-16 16-16s16 7.2 16 16z"/></svg>\n';
707
893
  const _hoisted_1$6 = { class: "options-grid-wrap" };
708
894
  const _hoisted_2$4 = ["innerHTML"];
@@ -767,7 +953,7 @@ const _sfc_main$7 = {
767
953
  };
768
954
  }
769
955
  };
770
- const IconGrid = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-9246bdef"]]);
956
+ const IconGrid = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-a00a9a3e"]]);
771
957
  const closeDropdown$1 = (dropdown) => {
772
958
  dropdown.expand.value = false;
773
959
  };
@@ -876,8 +1062,9 @@ const icons = [
876
1062
  const getAvailableColorOptions = () => {
877
1063
  return icons.flat().map((item) => item.value);
878
1064
  };
879
- const _hoisted_1$5 = ["data-cols", "data-rows", "onClick"];
1065
+ const _hoisted_1$5 = ["data-cols", "data-rows", "onKeydown", "onClick"];
880
1066
  const _hoisted_2$3 = ["aria-valuetext"];
1067
+ const ROW_SIZE = 5;
881
1068
  const _sfc_main$6 = {
882
1069
  __name: "TableGrid",
883
1070
  emits: ["select", "clickoutside"],
@@ -886,6 +1073,7 @@ const _sfc_main$6 = {
886
1073
  const selectedRows = ref(0);
887
1074
  const selectedCols = ref(0);
888
1075
  const { isHighContrastMode } = useHighContrastMode();
1076
+ const tableGridItems = ref([]);
889
1077
  const onTableGridMouseOver = (event) => {
890
1078
  let target = event.target;
891
1079
  let isGrid = !!target.dataset.grid;
@@ -896,6 +1084,9 @@ const _sfc_main$6 = {
896
1084
  let allItems = [...grid.querySelectorAll("[data-item]")];
897
1085
  let cols = parseInt(target.dataset.cols, 10);
898
1086
  let rows = parseInt(target.dataset.rows, 10);
1087
+ selectGridItems(allItems, cols, rows);
1088
+ };
1089
+ const selectGridItems = (allItems, cols, rows) => {
899
1090
  selectedCols.value = cols;
900
1091
  selectedRows.value = rows;
901
1092
  for (let i = 0; i < allItems.length; i++) {
@@ -912,6 +1103,61 @@ const _sfc_main$6 = {
912
1103
  const handleClick = ({ cols, rows }) => {
913
1104
  emit("select", { cols, rows });
914
1105
  };
1106
+ const handleKeyDown = (event, cols, rows) => {
1107
+ let normalizedCols = cols - 1;
1108
+ let normalizedRows = rows - 1;
1109
+ switch (event.key) {
1110
+ case "ArrowRight": {
1111
+ if (normalizedCols >= 4) {
1112
+ return;
1113
+ }
1114
+ const currentRow = normalizedRows * ROW_SIZE;
1115
+ tableGridItems.value[currentRow + normalizedCols + 1].setAttribute("tabindex", "0");
1116
+ tableGridItems.value[currentRow + normalizedCols + 1].focus();
1117
+ selectGridItems(tableGridItems.value, cols + 1, rows);
1118
+ break;
1119
+ }
1120
+ case "ArrowLeft": {
1121
+ if (normalizedCols <= 0) {
1122
+ return;
1123
+ }
1124
+ const currentRow = normalizedRows * ROW_SIZE;
1125
+ tableGridItems.value[currentRow + normalizedCols - 1].setAttribute("tabindex", "0");
1126
+ tableGridItems.value[currentRow + normalizedCols - 1].focus();
1127
+ selectGridItems(tableGridItems.value, cols - 1, rows);
1128
+ break;
1129
+ }
1130
+ case "ArrowDown": {
1131
+ if (normalizedRows >= 4) {
1132
+ return;
1133
+ }
1134
+ const nextRow = (normalizedRows + 1) * ROW_SIZE;
1135
+ tableGridItems.value[nextRow + normalizedCols].setAttribute("tabindex", "0");
1136
+ tableGridItems.value[nextRow + normalizedCols].focus();
1137
+ selectGridItems(tableGridItems.value, cols, rows + 1);
1138
+ break;
1139
+ }
1140
+ case "ArrowUp": {
1141
+ if (normalizedRows <= 0) {
1142
+ return;
1143
+ }
1144
+ const previousRow = (normalizedRows - 1) * ROW_SIZE;
1145
+ tableGridItems.value[previousRow + normalizedCols].setAttribute("tabindex", "0");
1146
+ tableGridItems.value[previousRow + normalizedCols].focus();
1147
+ selectGridItems(tableGridItems.value, cols, rows - 1);
1148
+ break;
1149
+ }
1150
+ case "Enter": {
1151
+ handleClick({ cols, rows });
1152
+ break;
1153
+ }
1154
+ }
1155
+ };
1156
+ onMounted(() => {
1157
+ tableGridItems.value[0].setAttribute("tabindex", "0");
1158
+ tableGridItems.value[0].focus();
1159
+ selectGridItems(tableGridItems.value, 1, 1);
1160
+ });
915
1161
  return (_ctx, _cache) => {
916
1162
  return openBlock(), createElementBlock("div", {
917
1163
  class: normalizeClass(["toolbar-table-grid-wrapper", { "high-contrast": unref(isHighContrastMode) }])
@@ -930,8 +1176,12 @@ const _sfc_main$6 = {
930
1176
  "data-cols": n2,
931
1177
  "data-rows": i,
932
1178
  "data-item": "true",
1179
+ ref_for: true,
1180
+ ref_key: "tableGridItems",
1181
+ ref: tableGridItems,
1182
+ onKeydown: withModifiers((event) => handleKeyDown(event, n2, i), ["prevent"]),
933
1183
  onClick: withModifiers(($event) => handleClick({ cols: n2, rows: i }), ["stop", "prevent"])
934
- }, null, 8, _hoisted_1$5);
1184
+ }, null, 40, _hoisted_1$5);
935
1185
  }), 64))
936
1186
  ], 64);
937
1187
  }), 64))
@@ -944,7 +1194,7 @@ const _sfc_main$6 = {
944
1194
  };
945
1195
  }
946
1196
  };
947
- const TableGrid = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-617bf152"]]);
1197
+ const TableGrid = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-3e1154b8"]]);
948
1198
  const _hoisted_1$4 = { class: "toolbar-table-actions" };
949
1199
  const _hoisted_2$2 = ["onClick", "data-item", "ariaLabel"];
950
1200
  const _hoisted_3$2 = { class: "toolbar-table-actions__icon" };
@@ -2075,140 +2325,6 @@ const makeDefaultItems = ({
2075
2325
  overflowItems: overflowItems.filter((item) => item.type !== "separator")
2076
2326
  };
2077
2327
  };
2078
- const ACCEPT_IMAGE_TYPES = [".jpg", ".jpeg", ".png", "image/jpeg", "image/png"];
2079
- const getFileOpener = () => {
2080
- let fileInput = document.createElement("input");
2081
- fileInput.type = "file";
2082
- let acceptTypes = ACCEPT_IMAGE_TYPES;
2083
- fileInput.accept = acceptTypes.join(",");
2084
- const openFile = () => {
2085
- return new Promise((resolve, reject) => {
2086
- fileInput.onchange = async () => {
2087
- const files = fileInput.files;
2088
- if (!files) return resolve(null);
2089
- const file = files.item(0);
2090
- if (!file) return resolve(null);
2091
- return resolve({ file });
2092
- };
2093
- fileInput.oncancel = () => resolve(null);
2094
- fileInput.onerror = reject;
2095
- fileInput.click();
2096
- });
2097
- };
2098
- return openFile;
2099
- };
2100
- const handleImageUpload = (file) => {
2101
- return new Promise((resolve, reject) => {
2102
- let reader = new FileReader();
2103
- reader.onload = (event) => resolve(event.target.result);
2104
- reader.onerror = reject;
2105
- setTimeout(() => reader.readAsDataURL(file), 250);
2106
- });
2107
- };
2108
- const processUploadedImage = (fileData, editor) => {
2109
- return new Promise((resolve, reject) => {
2110
- const img = new window.Image();
2111
- img.onload = () => {
2112
- const canvas = document.createElement("canvas");
2113
- const { width, height } = getAllowedImageDimensions(
2114
- img.width,
2115
- img.height,
2116
- editor
2117
- );
2118
- canvas.width = width;
2119
- canvas.height = height;
2120
- const ctx = canvas.getContext("2d");
2121
- ctx.drawImage(img, 0, 0, width, height);
2122
- if (typeof fileData === "string") {
2123
- const resizedBase64 = canvas.toDataURL();
2124
- resolve(resizedBase64);
2125
- } else {
2126
- canvas.toBlob((blob) => {
2127
- const updatedFile = new File([blob], fileData.name, {
2128
- type: fileData.type,
2129
- lastModified: Date.now()
2130
- });
2131
- resolve({ file: updatedFile, width, height });
2132
- });
2133
- }
2134
- };
2135
- img.onerror = (error) => reject(error);
2136
- img.src = typeof fileData === "string" ? fileData : URL.createObjectURL(fileData);
2137
- });
2138
- };
2139
- const getAllowedImageDimensions = (width, height, editor) => {
2140
- const { width: maxWidth, height: maxHeight } = editor.getMaxContentSize();
2141
- if (!maxWidth || !maxHeight) return { width, height };
2142
- let adjustedWidth = width;
2143
- let adjustedHeight = height;
2144
- const aspectRatio = width / height;
2145
- if (height > maxHeight) {
2146
- adjustedHeight = maxHeight;
2147
- adjustedWidth = Math.round(maxHeight * aspectRatio);
2148
- }
2149
- if (adjustedWidth > maxWidth) {
2150
- adjustedWidth = maxWidth;
2151
- adjustedHeight = Math.round(maxWidth / aspectRatio);
2152
- }
2153
- return { width: adjustedWidth, height: adjustedHeight };
2154
- };
2155
- const startImageUpload = async ({ editor, view, file }) => {
2156
- let imageUploadHandler = typeof editor.options.handleImageUpload === "function" ? editor.options.handleImageUpload : handleImageUpload;
2157
- let fileSizeMb = (file.size / (1024 * 1024)).toFixed(4);
2158
- if (fileSizeMb > 5) {
2159
- window.alert("Image size must be less than 5MB");
2160
- return;
2161
- }
2162
- let width;
2163
- let height;
2164
- try {
2165
- const processedImageResult = await processUploadedImage(file, editor);
2166
- width = processedImageResult.width;
2167
- height = processedImageResult.height;
2168
- file = processedImageResult.file;
2169
- } catch (err) {
2170
- console.warn("Error processing image:", err);
2171
- return;
2172
- }
2173
- let id = {};
2174
- let { tr, schema } = view.state;
2175
- if (!tr.selection.empty) {
2176
- tr.deleteSelection();
2177
- }
2178
- let imageMeta = {
2179
- type: "add",
2180
- pos: tr.selection.from,
2181
- id
2182
- };
2183
- tr.setMeta(ImagePlaceholderPluginKey, imageMeta);
2184
- view.dispatch(tr);
2185
- imageUploadHandler(file).then(
2186
- (url) => {
2187
- let fileName = file.name.replace(" ", "_");
2188
- let placeholderPos = findPlaceholder(view.state, id);
2189
- if (placeholderPos == null) {
2190
- return;
2191
- }
2192
- let removeMeta = { type: "remove", id };
2193
- let mediaPath = `word/media/${fileName}`;
2194
- let imageNode = schema.nodes.image.create({
2195
- src: mediaPath,
2196
- size: { width, height }
2197
- });
2198
- editor.storage.image.media = Object.assign(editor.storage.image.media, { [mediaPath]: url });
2199
- if (editor.options.ydoc) {
2200
- editor.commands.addImageToCollaboration({ mediaPath, fileData: url });
2201
- }
2202
- view.dispatch(
2203
- view.state.tr.replaceWith(placeholderPos, placeholderPos, imageNode).setMeta(ImagePlaceholderPluginKey, removeMeta)
2204
- );
2205
- },
2206
- () => {
2207
- let removeMeta = { type: "remove", id };
2208
- view.dispatch(tr.setMeta(ImagePlaceholderPluginKey, removeMeta));
2209
- }
2210
- );
2211
- };
2212
2328
  const toolbarTexts = {
2213
2329
  bold: "Bold",
2214
2330
  fontFamily: "Font",
@@ -3280,6 +3396,15 @@ const _sfc_main$2 = {
3280
3396
  });
3281
3397
  };
3282
3398
  const handleSuperEditorKeydown = (event) => {
3399
+ if ((event.metaKey || event.ctrlKey) && event.altKey && event.shiftKey) {
3400
+ if (event.code === "KeyM") {
3401
+ const toolbar = document.querySelector(".superdoc-toolbar");
3402
+ if (toolbar) {
3403
+ toolbar.setAttribute("tabindex", "0");
3404
+ toolbar.focus();
3405
+ }
3406
+ }
3407
+ }
3283
3408
  emit("editor-keydown", { editor: editor.value });
3284
3409
  };
3285
3410
  const handleSuperEditorClick = (event) => {
@@ -3385,7 +3510,7 @@ const _sfc_main$2 = {
3385
3510
  };
3386
3511
  }
3387
3512
  };
3388
- const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-f27b7c30"]]);
3513
+ const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-4b700df1"]]);
3389
3514
  const _sfc_main$1 = {
3390
3515
  __name: "BasicUpload",
3391
3516
  emits: ["file-change"],
@@ -3521,7 +3646,7 @@ export {
3521
3646
  createZip,
3522
3647
  m as fieldAnnotationHelpers,
3523
3648
  getActiveFormatting,
3524
- getAllowedImageDimensions,
3649
+ q as getAllowedImageDimensions,
3525
3650
  p as getMarksFromSelection,
3526
3651
  getRichTextExtensions,
3527
3652
  getStarterExtensions,