@harbour-enterprises/superdoc 0.21.0-next.4 → 0.21.0-next.6

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 (36) hide show
  1. package/dist/chunks/{PdfViewer-OZDJ7gwT.cjs → PdfViewer-BrJSIJjF.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-D3zo7tPo.es.js → PdfViewer-CJAEtjUD.es.js} +1 -1
  3. package/dist/chunks/{index-MzW5BVNd.es.js → index-BDfKQQiO.es.js} +4 -3
  4. package/dist/chunks/{index-CfYf4T_z.cjs → index-NiOytIlp.cjs} +4 -3
  5. package/dist/chunks/{super-editor.es-U-GVCd_F.cjs → super-editor.es-DmkkMNKU.cjs} +2015 -787
  6. package/dist/chunks/{super-editor.es-Bntob7Wd.es.js → super-editor.es-iVTtEcot.es.js} +2015 -787
  7. package/dist/core/types/index.d.ts +8 -0
  8. package/dist/core/types/index.d.ts.map +1 -1
  9. package/dist/style.css +43 -38
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-3xnF_NHq.js → converter-CYC0HBJe.js} +733 -642
  12. package/dist/super-editor/chunks/{docx-zipper-CZdELYi-.js → docx-zipper-DlwteneT.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-BqYH4kDD.js → editor-BzT9rpXb.js} +59 -13
  14. package/dist/super-editor/chunks/{toolbar-TkaE2kKM.js → toolbar-BnTHDmlP.js} +6 -7
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/src/components/slash-menu/menuItems.d.ts +5 -1
  20. package/dist/super-editor/src/components/slash-menu/tests/testHelpers.d.ts +466 -0
  21. package/dist/super-editor/src/components/slash-menu/utils.d.ts +9 -2
  22. package/dist/super-editor/src/core/super-converter/v3/handlers/mc/altermateContent/alternate-content-translator.d.ts +6 -0
  23. package/dist/super-editor/src/core/super-converter/v3/handlers/mc/altermateContent/index.d.ts +1 -0
  24. package/dist/super-editor/src/extensions/noderesizer/helpers.d.ts +2 -0
  25. package/dist/super-editor/src/tests/helpers/helpers.d.ts +1 -0
  26. package/dist/super-editor/src/utils/shadow-root.d.ts +12 -0
  27. package/dist/super-editor/style.css +16 -11
  28. package/dist/super-editor/super-editor.es.js +1226 -134
  29. package/dist/super-editor/toolbar.es.js +2 -2
  30. package/dist/super-editor.cjs +1 -1
  31. package/dist/super-editor.es.js +1 -1
  32. package/dist/superdoc.cjs +2 -2
  33. package/dist/superdoc.es.js +2 -2
  34. package/dist/superdoc.umd.js +2017 -788
  35. package/dist/superdoc.umd.js.map +1 -1
  36. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { p as process$1, au as commonjsGlobal, B as Buffer, av as getDefaultExportFromCjs, aw as getContentTypesFromXml, ax as xmljs } from "./converter-3xnF_NHq.js";
1
+ import { p as process$1, au as commonjsGlobal, B as Buffer, av as getDefaultExportFromCjs, aw as getContentTypesFromXml, ax as xmljs } from "./converter-CYC0HBJe.js";
2
2
  function commonjsRequire(path) {
3
3
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
4
4
  }
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12
12
  var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _ListItemNodeView_instances, init_fn2, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _DocumentSectionView_instances, init_fn3, addToolTip_fn;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as SelectionRange, ao as Transform, ap as isInTable$1, aq as generateDocxRandomId, ar as insertNewRelationship, as as updateDOMAttributes, at as htmlHandler } from "./converter-3xnF_NHq.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as SelectionRange, ao as Transform, ap as isInTable$1, aq as generateDocxRandomId, ar as insertNewRelationship, as as updateDOMAttributes, at as htmlHandler } from "./converter-CYC0HBJe.js";
16
16
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
17
- import { D as DocxZipper } from "./docx-zipper-CZdELYi-.js";
17
+ import { D as DocxZipper } from "./docx-zipper-DlwteneT.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -11675,9 +11675,11 @@ const toggleHeaderFooterEditMode = ({ editor, focusedSectionEditor, isEditMode,
11675
11675
  item.editor.view.dom.setAttribute("documentmode", documentMode);
11676
11676
  });
11677
11677
  if (isEditMode) {
11678
- const pm = document.querySelector(".ProseMirror");
11679
- pm.classList.add("header-footer-edit");
11680
- pm.setAttribute("aria-readonly", true);
11678
+ const pm = editor.view?.dom;
11679
+ if (pm) {
11680
+ pm.classList.add("header-footer-edit");
11681
+ pm.setAttribute("aria-readonly", true);
11682
+ }
11681
11683
  }
11682
11684
  if (focusedSectionEditor) {
11683
11685
  focusedSectionEditor.view.focus();
@@ -14332,7 +14334,7 @@ const _Editor = class _Editor extends EventEmitter {
14332
14334
  setDocumentMode(documentMode) {
14333
14335
  let cleanedMode = documentMode?.toLowerCase() || "editing";
14334
14336
  if (!this.extensionService || !this.state) return;
14335
- const pm = document.querySelector(".ProseMirror");
14337
+ const pm = this.view?.dom;
14336
14338
  if (this.options.role === "viewer") cleanedMode = "viewing";
14337
14339
  if (this.options.role === "suggester" && cleanedMode === "editing") cleanedMode = "suggesting";
14338
14340
  if (cleanedMode === "viewing") {
@@ -15378,9 +15380,11 @@ createView_fn = function(element) {
15378
15380
  isEditMode: false,
15379
15381
  documentMode: this.options.documentMode
15380
15382
  });
15381
- const pm = document.querySelector(".ProseMirror");
15382
- pm.classList.remove("header-footer-edit");
15383
- pm.setAttribute("aria-readonly", false);
15383
+ const pm = this.view?.dom;
15384
+ if (pm) {
15385
+ pm.classList.remove("header-footer-edit");
15386
+ pm.setAttribute("aria-readonly", false);
15387
+ }
15384
15388
  }
15385
15389
  setWordSelection(view, pos);
15386
15390
  }
@@ -33358,6 +33362,45 @@ const Search = Extension.create({
33358
33362
  };
33359
33363
  }
33360
33364
  });
33365
+ let cachedShadowRootCtor;
33366
+ const getShadowRootCtor = () => {
33367
+ if (cachedShadowRootCtor === void 0) {
33368
+ const ctor = globalThis.ShadowRoot;
33369
+ cachedShadowRootCtor = typeof ctor === "function" ? ctor : null;
33370
+ }
33371
+ return cachedShadowRootCtor;
33372
+ };
33373
+ let cachedElementCtor;
33374
+ const getElementCtor = () => {
33375
+ if (cachedElementCtor === void 0) {
33376
+ const ctor = globalThis.Element;
33377
+ cachedElementCtor = typeof ctor === "function" ? ctor : null;
33378
+ }
33379
+ return cachedElementCtor;
33380
+ };
33381
+ const queryWithinRoot = (domNode, selector) => {
33382
+ const shadowRoot = domNode?.shadowRoot;
33383
+ if (shadowRoot && typeof shadowRoot.querySelector === "function") {
33384
+ return shadowRoot.querySelector(selector);
33385
+ }
33386
+ const rawRoot = domNode?.getRootNode?.();
33387
+ const ShadowRootCtor = getShadowRootCtor();
33388
+ const isShadowRoot2 = !!ShadowRootCtor && rawRoot instanceof ShadowRootCtor;
33389
+ if (isShadowRoot2 && typeof rawRoot.querySelector === "function") {
33390
+ return rawRoot.querySelector(selector);
33391
+ }
33392
+ if (domNode && typeof domNode.querySelector === "function") {
33393
+ const localMatch = domNode.querySelector(selector);
33394
+ if (localMatch) return localMatch;
33395
+ }
33396
+ return typeof document !== "undefined" ? document.querySelector(selector) : null;
33397
+ };
33398
+ const findInEventPath = (event, selector) => {
33399
+ if (!event || !selector) return void 0;
33400
+ const path = typeof event.composedPath === "function" ? event.composedPath() : [];
33401
+ const ElementCtor = getElementCtor();
33402
+ return path.find((node) => ElementCtor && node instanceof ElementCtor && node.matches(selector));
33403
+ };
33361
33404
  const NodeResizerKey = new PluginKey("node-resizer");
33362
33405
  const nodeResizer = (nodeNames = ["image"], editor) => {
33363
33406
  let resizeState = {
@@ -33412,16 +33455,19 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
33412
33455
  view(view) {
33413
33456
  editorView = view;
33414
33457
  globalClickHandler = (event) => {
33415
- if (!event.target.closest(".sd-editor-resizable-wrapper") && !event.target.closest(".sd-editor-resize-container")) {
33458
+ const wrapperInPath = findInEventPath(event, ".sd-editor-resizable-wrapper");
33459
+ const containerInPath = findInEventPath(event, ".sd-editor-resize-container");
33460
+ if (!wrapperInPath && !containerInPath) {
33416
33461
  hideResizeHandles();
33417
33462
  }
33418
33463
  };
33419
33464
  document.addEventListener("click", globalClickHandler);
33420
33465
  globalMousedownHandler = (event) => {
33421
- if (event.target.closest(".sd-editor-resize-handle")) {
33466
+ const handle = findInEventPath(event, ".sd-editor-resize-handle");
33467
+ if (handle) {
33422
33468
  event.preventDefault();
33423
33469
  event.stopPropagation();
33424
- startResize(editorView, event, event.target);
33470
+ startResize(editorView, event, handle);
33425
33471
  return true;
33426
33472
  }
33427
33473
  };
@@ -33438,7 +33484,7 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
33438
33484
  const prevSelection = prevState.selection;
33439
33485
  if (selection.from !== prevSelection.from || selection.to !== prevSelection.to) {
33440
33486
  setTimeout(() => {
33441
- const selectedResizableWrapper = document.querySelector(".sd-editor-resizable-wrapper");
33487
+ const selectedResizableWrapper = queryWithinRoot(editorView?.dom, ".sd-editor-resizable-wrapper");
33442
33488
  if (selectedResizableWrapper) {
33443
33489
  showResizeHandles(view2, selectedResizableWrapper);
33444
33490
  } else {
@@ -1,6 +1,6 @@
1
1
  import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
2
- import { p as process$1 } from "./converter-3xnF_NHq.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-BqYH4kDD.js";
2
+ import { p as process$1 } from "./converter-CYC0HBJe.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-BzT9rpXb.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -9827,6 +9827,7 @@ const _sfc_main$1 = {
9827
9827
  const toolbarItemRefs = ref([]);
9828
9828
  const props = __props;
9829
9829
  const currentItem = ref(null);
9830
+ const { proxy } = getCurrentInstance();
9830
9831
  const { isHighContrastMode } = useHighContrastMode();
9831
9832
  const isMobile = window.matchMedia("(max-width: 768px)").matches;
9832
9833
  const styleMap = {
@@ -9925,10 +9926,8 @@ const _sfc_main$1 = {
9925
9926
  nextButtonGroup.setAttribute("tabindex", "0");
9926
9927
  nextButtonGroup.focus();
9927
9928
  } else {
9928
- const editor = document.querySelector(".ProseMirror");
9929
- if (editor) {
9930
- editor.focus();
9931
- }
9929
+ const editorDom = proxy?.$toolbar?.activeEditor?.view?.dom;
9930
+ editorDom?.focus();
9932
9931
  }
9933
9932
  };
9934
9933
  const moveToPreviousButtonGroup = (e) => {
@@ -10074,7 +10073,7 @@ const _sfc_main$1 = {
10074
10073
  };
10075
10074
  }
10076
10075
  };
10077
- const ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-f42ec7e6"]]);
10076
+ const ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-c1b3551b"]]);
10078
10077
  const _sfc_main = {
10079
10078
  __name: "Toolbar",
10080
10079
  emits: ["command", "toggle", "select"],
@@ -1,4 +1,4 @@
1
- import { a5 } from "./chunks/converter-3xnF_NHq.js";
1
+ import { a5 } from "./chunks/converter-CYC0HBJe.js";
2
2
  import "vue";
3
3
  export {
4
4
  a5 as SuperConverter
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-3xnF_NHq.js";
2
- import { D } from "./chunks/docx-zipper-CZdELYi-.js";
1
+ import "./chunks/converter-CYC0HBJe.js";
2
+ import { D } from "./chunks/docx-zipper-DlwteneT.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-BqYH4kDD.js";
2
- import "./chunks/converter-3xnF_NHq.js";
3
- import "./chunks/docx-zipper-CZdELYi-.js";
1
+ import { E } from "./chunks/editor-BzT9rpXb.js";
2
+ import "./chunks/converter-CYC0HBJe.js";
3
+ import "./chunks/docx-zipper-DlwteneT.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-CZdELYi-.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-DlwteneT.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -14,7 +14,9 @@
14
14
  * requiresClipboard?: boolean
15
15
  * requiresTableParent?: boolean
16
16
  * requiredSectionParent?: boolean,
17
- * requiresModule?: string
17
+ * requiresModule?: string,
18
+ * render?: (context: Object) => HTMLElement,
19
+ * showWhen?: (context: Object) => boolean
18
20
  * }>
19
21
  * }>} Array of menu sections
20
22
  */
@@ -32,5 +34,7 @@ export function getItems(context: any): Array<{
32
34
  requiresTableParent?: boolean;
33
35
  requiredSectionParent?: boolean;
34
36
  requiresModule?: string;
37
+ render?: (context: any) => HTMLElement;
38
+ showWhen?: (context: any) => boolean;
35
39
  }>;
36
40
  }>;