@harbour-enterprises/superdoc 0.25.0-next.2 → 0.25.0-next.4

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 (30) hide show
  1. package/dist/chunks/{PdfViewer-CEc5ST9t.cjs → PdfViewer-BETK3Bs4.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-CoEXViCu.es.js → PdfViewer-D4F3H-Ay.es.js} +1 -1
  3. package/dist/chunks/{index-ChgYIPZ8.cjs → index-BHS2aLqo.cjs} +5 -7
  4. package/dist/chunks/{index-DtXgSPMT.es.js → index-D9KYAvvg.es.js} +5 -7
  5. package/dist/chunks/{super-editor.es-B-E_YaLO.cjs → super-editor.es-BJzqCihw.cjs} +126 -125
  6. package/dist/chunks/{super-editor.es-BePxEtE8.es.js → super-editor.es-Beeng5kU.es.js} +126 -125
  7. package/dist/core/types/index.d.ts.map +1 -1
  8. package/dist/style.css +57 -54
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-gSy6s2VK.js → converter-DOkexB95.js} +89 -72
  11. package/dist/super-editor/chunks/{docx-zipper-CceGxV02.js → docx-zipper-Ci5JbfjE.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-yaef8OIs.js → editor-DC9ZOqdt.js} +25 -59
  13. package/dist/super-editor/chunks/{toolbar-Dc5uyyIp.js → toolbar-SPGEoEi0.js} +4 -4
  14. package/dist/super-editor/converter.es.js +1 -1
  15. package/dist/super-editor/docx-zipper.es.js +2 -2
  16. package/dist/super-editor/editor.es.js +3 -3
  17. package/dist/super-editor/file-zipper.es.js +1 -1
  18. package/dist/super-editor/style.css +30 -27
  19. package/dist/super-editor/super-editor/src/components/toolbar/use-toolbar-item.d.ts +1 -1
  20. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/mc/altermateContent/alternate-content-translator.d.ts +11 -0
  21. package/dist/super-editor/super-editor/src/index.d.ts +8 -2
  22. package/dist/super-editor/super-editor.es.js +31 -18
  23. package/dist/super-editor/toolbar.es.js +2 -2
  24. package/dist/super-editor.cjs +1 -1
  25. package/dist/super-editor.es.js +1 -1
  26. package/dist/superdoc.cjs +2 -2
  27. package/dist/superdoc.es.js +2 -2
  28. package/dist/superdoc.umd.js +129 -130
  29. package/dist/superdoc.umd.js.map +1 -1
  30. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-DKMj1I9B.cjs");
4
- const superdoc = require("./index-ChgYIPZ8.cjs");
4
+ const superdoc = require("./index-BHS2aLqo.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,5 +1,5 @@
1
1
  import { m as defineComponent, B as h, O as Transition, $ as process$1, I as watchEffect, d as computed, r as ref, j as onMounted, W as onUnmounted, c as createElementBlock, o as openBlock, a as createBaseVNode, f as createCommentVNode, v as createVNode, x as unref } from "./vue-ZWZLQtoU.es.js";
2
- import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-DtXgSPMT.es.js";
2
+ import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-D9KYAvvg.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-B-E_YaLO.cjs");
2
+ const superEditor_es = require("./super-editor.es-BJzqCihw.cjs");
3
3
  const vue = require("./vue-DKMj1I9B.cjs");
4
4
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
5
5
  const eventemitter3 = require("./eventemitter3-DkXkH2rT.cjs");
@@ -17164,7 +17164,7 @@ const _sfc_main = {
17164
17164
  __name: "SuperDoc",
17165
17165
  emits: ["selection-update"],
17166
17166
  setup(__props, { emit: __emit }) {
17167
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-CEc5ST9t.cjs")));
17167
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-BETK3Bs4.cjs")));
17168
17168
  const superdocStore = useSuperdocStore();
17169
17169
  const commentsStore = useCommentsStore();
17170
17170
  const {
@@ -17341,10 +17341,8 @@ const _sfc_main = {
17341
17341
  const onEditorListdefinitionsChange = (params2) => {
17342
17342
  proxy.$superdoc.emit("list-definitions-change", params2);
17343
17343
  };
17344
- const onFontsResolved = (params2) => {
17345
- proxy.$superdoc.emit("fonts-resolved", params2);
17346
- };
17347
17344
  const editorOptions = (doc) => {
17345
+ const onFontsResolvedFn = proxy.$superdoc.listeners?.("fonts-resolved")?.length > 0 ? proxy.$superdoc.listeners("fonts-resolved")[0] : null;
17348
17346
  const options = {
17349
17347
  isDebug: proxy.$superdoc.config.isDebug || false,
17350
17348
  pagination: proxy.$superdoc.config.pagination,
@@ -17376,7 +17374,7 @@ const _sfc_main = {
17376
17374
  onCommentsUpdate: onEditorCommentsUpdate,
17377
17375
  onCommentLocationsUpdate: onEditorCommentLocationsUpdate,
17378
17376
  onListDefinitionsChange: onEditorListdefinitionsChange,
17379
- onFontsResolved: proxy?.$superdoc?.config?.onFontsResolved ? onFontsResolved : null,
17377
+ onFontsResolved: onFontsResolvedFn,
17380
17378
  onTransaction: onEditorTransaction,
17381
17379
  ydoc: doc.ydoc,
17382
17380
  collaborationProvider: doc.provider || null,
@@ -17760,7 +17758,7 @@ const _sfc_main = {
17760
17758
  };
17761
17759
  }
17762
17760
  };
17763
- const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ac4ea6eb"]]);
17761
+ const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-715d68b1"]]);
17764
17762
  const createSuperdocVueApp = () => {
17765
17763
  const app = vue.createApp(App);
17766
17764
  const pinia = createPinia();
@@ -1,4 +1,4 @@
1
- import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-BePxEtE8.es.js";
1
+ import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-Beeng5kU.es.js";
2
2
  import { a0 as effectScope, r as ref, _ as markRaw, $ as process$1, a1 as toRaw, d as computed, a2 as isRef, a3 as isReactive, C as toRef, i as inject, p as getCurrentInstance, l as watch, x as unref, a4 as hasInjectionContext, M as reactive, s as nextTick, a5 as getCurrentScope, a6 as onScopeDispose, a7 as toRefs, g as global$1, J as shallowRef, N as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, S as onActivated, q as onDeactivated, z as createTextVNode, F as Fragment, Q as Comment, m as defineComponent, D as provide, H as withDirectives, B as h, U as Teleport, R as renderSlot, V as isVNode, I as watchEffect, O as Transition, a8 as TransitionGroup, E as mergeProps, P as vShow, G as cloneVNode, T as Text, c as createElementBlock, o as openBlock, t as toDisplayString, v as createVNode, y as withCtx, a as createBaseVNode, A as normalizeStyle, f as createCommentVNode, u as createBlock, w as withModifiers, n as normalizeClass, a9 as resolveDirective, e as renderList, b as createApp, X as resolveDynamicComponent, aa as defineAsyncComponent } from "./vue-ZWZLQtoU.es.js";
3
3
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
4
4
  import { E as EventEmitter } from "./eventemitter3-BWEnUdTY.es.js";
@@ -17147,7 +17147,7 @@ const _sfc_main = {
17147
17147
  __name: "SuperDoc",
17148
17148
  emits: ["selection-update"],
17149
17149
  setup(__props, { emit: __emit }) {
17150
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CoEXViCu.es.js"));
17150
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-D4F3H-Ay.es.js"));
17151
17151
  const superdocStore = useSuperdocStore();
17152
17152
  const commentsStore = useCommentsStore();
17153
17153
  const {
@@ -17324,10 +17324,8 @@ const _sfc_main = {
17324
17324
  const onEditorListdefinitionsChange = (params2) => {
17325
17325
  proxy.$superdoc.emit("list-definitions-change", params2);
17326
17326
  };
17327
- const onFontsResolved = (params2) => {
17328
- proxy.$superdoc.emit("fonts-resolved", params2);
17329
- };
17330
17327
  const editorOptions = (doc) => {
17328
+ const onFontsResolvedFn = proxy.$superdoc.listeners?.("fonts-resolved")?.length > 0 ? proxy.$superdoc.listeners("fonts-resolved")[0] : null;
17331
17329
  const options = {
17332
17330
  isDebug: proxy.$superdoc.config.isDebug || false,
17333
17331
  pagination: proxy.$superdoc.config.pagination,
@@ -17359,7 +17357,7 @@ const _sfc_main = {
17359
17357
  onCommentsUpdate: onEditorCommentsUpdate,
17360
17358
  onCommentLocationsUpdate: onEditorCommentLocationsUpdate,
17361
17359
  onListDefinitionsChange: onEditorListdefinitionsChange,
17362
- onFontsResolved: proxy?.$superdoc?.config?.onFontsResolved ? onFontsResolved : null,
17360
+ onFontsResolved: onFontsResolvedFn,
17363
17361
  onTransaction: onEditorTransaction,
17364
17362
  ydoc: doc.ydoc,
17365
17363
  collaborationProvider: doc.provider || null,
@@ -17743,7 +17741,7 @@ const _sfc_main = {
17743
17741
  };
17744
17742
  }
17745
17743
  };
17746
- const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ac4ea6eb"]]);
17744
+ const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-715d68b1"]]);
17747
17745
  const createSuperdocVueApp = () => {
17748
17746
  const app = createApp(App);
17749
17747
  const pinia = createPinia();
@@ -32332,8 +32332,7 @@ const bookmarkEndNodeHandlerEntity = {
32332
32332
  handlerName: "w:bookmarkEndTranslator",
32333
32333
  handler: handleBookmarkEndNode
32334
32334
  };
32335
- const ALTERNATE_CONTENT_NODE = "mc:AlternateContent";
32336
- const SUPPORTED_REQUIRES = /* @__PURE__ */ new Set([
32335
+ const SUPPORTED_ALTERNATE_CONTENT_REQUIRES = /* @__PURE__ */ new Set([
32337
32336
  "wps",
32338
32337
  "wp14",
32339
32338
  "w14",
@@ -32346,22 +32345,85 @@ const SUPPORTED_REQUIRES = /* @__PURE__ */ new Set([
32346
32345
  "w16sdtfl",
32347
32346
  "w16se"
32348
32347
  ]);
32348
+ const XML_NODE_NAME$1 = "mc:AlternateContent";
32349
+ const SD_NODE_NAME$1 = [];
32350
+ const validXmlAttributes$1 = [];
32351
+ function encode$1(params2) {
32352
+ const { nodeListHandler } = params2;
32353
+ const { node } = params2.extraParams;
32354
+ if (!node || !node.type) {
32355
+ return null;
32356
+ }
32357
+ const { branch, elements } = selectAlternateContentElements(node);
32358
+ if (!elements) {
32359
+ return null;
32360
+ }
32361
+ return nodeListHandler.handler({
32362
+ ...params2,
32363
+ nodes: elements,
32364
+ path: buildPath(params2.path, node, branch)
32365
+ });
32366
+ }
32367
+ function decode$1(params2) {
32368
+ const { node } = params2;
32369
+ const { drawingContent } = node.attrs;
32370
+ const drawing = {
32371
+ name: "w:drawing",
32372
+ elements: [...drawingContent ? [...drawingContent.elements || []] : []]
32373
+ };
32374
+ const choice = {
32375
+ name: "mc:Choice",
32376
+ attributes: { Requires: "wps" },
32377
+ elements: [drawing]
32378
+ };
32379
+ return {
32380
+ name: "mc:AlternateContent",
32381
+ elements: [choice]
32382
+ };
32383
+ }
32384
+ const config$1 = {
32385
+ xmlName: XML_NODE_NAME$1,
32386
+ sdNodeOrKeyName: SD_NODE_NAME$1,
32387
+ type: NodeTranslator.translatorTypes.NODE,
32388
+ encode: encode$1,
32389
+ decode: decode$1,
32390
+ attributes: validXmlAttributes$1
32391
+ };
32392
+ function selectAlternateContentElements(node) {
32393
+ if (!node?.elements?.length) {
32394
+ return { branch: null, elements: null };
32395
+ }
32396
+ const choices = node.elements.filter((el) => el?.name === "mc:Choice");
32397
+ const fallback = node.elements.find((el) => el?.name === "mc:Fallback");
32398
+ const supportedChoice = choices.find((choice) => {
32399
+ const requiresAttr = choice?.attributes?.Requires || choice?.attributes?.requires;
32400
+ if (!requiresAttr) return false;
32401
+ return requiresAttr.split(/\s+/).filter(Boolean).some((namespace2) => SUPPORTED_ALTERNATE_CONTENT_REQUIRES.has(namespace2));
32402
+ });
32403
+ const branch = supportedChoice || fallback || choices[0] || null;
32404
+ const selectedElements = branch?.elements;
32405
+ if (!selectedElements) {
32406
+ return { branch, elements: null };
32407
+ }
32408
+ return {
32409
+ branch,
32410
+ elements: carbonCopy(selectedElements)
32411
+ };
32412
+ }
32413
+ const translator$1 = NodeTranslator.from(config$1);
32414
+ function buildPath(existingPath = [], node, branch) {
32415
+ const path = [...existingPath];
32416
+ if (node) path.push(node);
32417
+ if (branch) path.push(branch);
32418
+ return path;
32419
+ }
32420
+ const ALTERNATE_CONTENT_NODE = "mc:AlternateContent";
32349
32421
  const skipHandlerResponse = { nodes: [], consumed: 0 };
32350
32422
  const isAlternateContentNode = (node) => node?.name === ALTERNATE_CONTENT_NODE;
32351
- const isSupportedChoice = (choice) => {
32352
- if (!choice?.attributes) return false;
32353
- const requires = choice.attributes.Requires || choice.attributes.requires;
32354
- if (!requires) return false;
32355
- return requires.split(/\s+/).filter(Boolean).some((namespace2) => SUPPORTED_REQUIRES.has(namespace2));
32356
- };
32357
32423
  const resolveAlternateContentElements = (alternateContent) => {
32358
- if (!alternateContent?.elements?.length) return null;
32359
- const choices = alternateContent.elements.filter((el) => el.name === "mc:Choice");
32360
- const fallback = alternateContent.elements.find((el) => el.name === "mc:Fallback");
32361
- const supportedChoice = choices.find(isSupportedChoice);
32362
- const selectedElements = supportedChoice?.elements || fallback?.elements || choices[0]?.elements;
32363
- if (!selectedElements) return null;
32364
- return carbonCopy(selectedElements);
32424
+ const { elements } = selectAlternateContentElements(alternateContent);
32425
+ if (!elements) return null;
32426
+ return elements;
32365
32427
  };
32366
32428
  const buildNodeWithoutAlternateContent = (node) => {
32367
32429
  const { elements } = node || {};
@@ -32393,16 +32455,20 @@ const handleAlternateChoice = (params2) => {
32393
32455
  }
32394
32456
  const [currentNode] = nodes;
32395
32457
  if (isAlternateContentNode(currentNode)) {
32396
- const resolvedElements = resolveAlternateContentElements(currentNode);
32397
- if (!resolvedElements) {
32398
- return skipHandlerResponse;
32399
- }
32400
- const result2 = nodeListHandler.handler({
32458
+ const nodeForTranslator = currentNode?.type ? currentNode : {
32459
+ ...currentNode,
32460
+ type: "element"
32461
+ };
32462
+ const translated = translator$1.encode({
32401
32463
  ...params2,
32402
- nodes: resolvedElements,
32403
- path: [...params2.path || [], currentNode]
32464
+ nodes: [nodeForTranslator],
32465
+ extraParams: { ...params2.extraParams || {}, node: nodeForTranslator }
32404
32466
  });
32405
- return { nodes: result2, consumed: 1 };
32467
+ if (!translated) {
32468
+ return skipHandlerResponse;
32469
+ }
32470
+ const nodesArray = Array.isArray(translated) ? translated : [translated];
32471
+ return { nodes: nodesArray, consumed: 1 };
32406
32472
  }
32407
32473
  const sanitizedNode = buildNodeWithoutAlternateContent(currentNode);
32408
32474
  if (!sanitizedNode) {
@@ -33700,55 +33766,6 @@ function translateShapeTextbox(params2) {
33700
33766
  };
33701
33767
  return textbox;
33702
33768
  }
33703
- const XML_NODE_NAME$1 = "mc:AlternateContent";
33704
- const SD_NODE_NAME$1 = [];
33705
- const validXmlAttributes$1 = [];
33706
- function encode$1(params2) {
33707
- const { nodeListHandler } = params2;
33708
- const { node } = params2.extraParams;
33709
- if (!node || !node.type) {
33710
- return null;
33711
- }
33712
- const allowedNamespaces = ["wps", "wp14", "w14", "w15"];
33713
- const wpsNode = node.elements.find(
33714
- (el) => el.name === "mc:Choice" && allowedNamespaces.includes(el.attributes["Requires"])
33715
- );
33716
- if (!wpsNode) {
33717
- return null;
33718
- }
33719
- const contents = wpsNode.elements;
33720
- return nodeListHandler.handler({
33721
- ...params2,
33722
- nodes: contents,
33723
- path: [...params2.path || [], wpsNode]
33724
- });
33725
- }
33726
- function decode$1(params2) {
33727
- const { node } = params2;
33728
- const { drawingContent } = node.attrs;
33729
- const drawing = {
33730
- name: "w:drawing",
33731
- elements: [...drawingContent ? [...drawingContent.elements || []] : []]
33732
- };
33733
- const choice = {
33734
- name: "mc:Choice",
33735
- attributes: { Requires: "wps" },
33736
- elements: [drawing]
33737
- };
33738
- return {
33739
- name: "mc:AlternateContent",
33740
- elements: [choice]
33741
- };
33742
- }
33743
- const config$1 = {
33744
- xmlName: XML_NODE_NAME$1,
33745
- sdNodeOrKeyName: SD_NODE_NAME$1,
33746
- type: NodeTranslator.translatorTypes.NODE,
33747
- encode: encode$1,
33748
- decode: decode$1,
33749
- attributes: validXmlAttributes$1
33750
- };
33751
- const translator$1 = NodeTranslator.from(config$1);
33752
33769
  function translateContentBlock(params2) {
33753
33770
  const { node } = params2;
33754
33771
  const { vmlAttributes, horizontalRule } = node.attrs;
@@ -38352,7 +38369,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
38352
38369
  var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
38353
38370
  var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
38354
38371
  var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
38355
- 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, checkFonts_fn, determineUnsupportedFontsWithLocalFonts_fn, determineUnsupportedFontsWithCanvas_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, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ListItemNodeView_instances, init_fn3, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
38372
+ 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, checkFonts_fn, determineUnsupportedFonts_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, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ListItemNodeView_instances, init_fn3, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
38356
38373
  var GOOD_LEAF_SIZE = 200;
38357
38374
  var RopeSequence = function RopeSequence2() {
38358
38375
  };
@@ -53535,9 +53552,6 @@ init_fn = function() {
53535
53552
  this.emit("beforeCreate", { editor: this });
53536
53553
  this.on("contentError", this.options.onContentError);
53537
53554
  this.mount(this.options.element);
53538
- if (!this.options.isHeadless) {
53539
- __privateMethod$1(this, _Editor_instances, checkFonts_fn).call(this);
53540
- }
53541
53555
  this.on("create", this.options.onCreate);
53542
53556
  this.on("update", this.options.onUpdate);
53543
53557
  this.on("selectionUpdate", this.options.onSelectionUpdate);
@@ -53554,12 +53568,17 @@ init_fn = function() {
53554
53568
  this.on("paginationUpdate", this.options.onPaginationUpdate);
53555
53569
  this.on("comment-positions", this.options.onCommentLocationsUpdate);
53556
53570
  this.on("list-definitions-change", this.options.onListDefinitionsChange);
53571
+ this.on("fonts-resolved", this.options.onFontsResolved);
53557
53572
  this.on("exception", this.options.onException);
53558
53573
  if (!this.options.isHeadless) {
53559
53574
  this.initializeCollaborationData();
53560
53575
  this.initDefaultStyles();
53576
+ __privateMethod$1(this, _Editor_instances, checkFonts_fn).call(this);
53561
53577
  }
53562
- if (!this.options.ydoc || this.options.markdown || this.options.html) {
53578
+ const shouldMigrateListsOnInit = Boolean(
53579
+ this.options.markdown || this.options.html || this.options.loadFromSchema || this.options.jsonOverride || this.options.mode === "html" || this.options.mode === "text"
53580
+ );
53581
+ if (shouldMigrateListsOnInit) {
53563
53582
  this.migrateListsToV2();
53564
53583
  }
53565
53584
  this.setDocumentMode(this.options.documentMode);
@@ -53700,52 +53719,18 @@ checkFonts_fn = async function() {
53700
53719
  if (this.options.isHeadless) {
53701
53720
  return;
53702
53721
  }
53703
- const fontsUsedInDocument = this.converter.getDocumentFonts();
53704
- if (!("queryLocalFonts" in window)) {
53705
- console.warn("[SuperDoc] Could not get access to local fonts. Using fallback solution.");
53706
- const unsupportedFonts = __privateMethod$1(this, _Editor_instances, determineUnsupportedFontsWithCanvas_fn).call(this, fontsUsedInDocument);
53707
- this.options.onFontsResolved({
53708
- documentFonts: fontsUsedInDocument,
53709
- unsupportedFonts
53710
- });
53711
- return;
53712
- }
53713
- const localFontAccess = await navigator.permissions.query({ name: "local-fonts" });
53714
- if (localFontAccess.state === "denied") {
53715
- console.warn("[SuperDoc] Could not get access to local fonts. Using fallback solution.");
53716
- const unsupportedFonts = __privateMethod$1(this, _Editor_instances, determineUnsupportedFontsWithCanvas_fn).call(this, fontsUsedInDocument);
53717
- this.options.onFontsResolved({
53718
- documentFonts: fontsUsedInDocument,
53719
- unsupportedFonts
53720
- });
53721
- return;
53722
- }
53723
53722
  try {
53724
- const localFonts = await window.queryLocalFonts();
53725
- const uniqueLocalFonts = [...new Set(localFonts.map((font) => font.family))];
53726
- const unsupportedFonts = __privateMethod$1(this, _Editor_instances, determineUnsupportedFontsWithLocalFonts_fn).call(this, fontsUsedInDocument, uniqueLocalFonts);
53727
- this.options.onFontsResolved({
53723
+ const fontsUsedInDocument = this.converter.getDocumentFonts();
53724
+ const unsupportedFonts = __privateMethod$1(this, _Editor_instances, determineUnsupportedFonts_fn).call(this, fontsUsedInDocument);
53725
+ this.emit("fonts-resolved", {
53728
53726
  documentFonts: fontsUsedInDocument,
53729
53727
  unsupportedFonts
53730
53728
  });
53731
53729
  } catch {
53732
- console.warn("[SuperDoc] Could not get access to local fonts. Using fallback solution.");
53733
- const unsupportedFonts = __privateMethod$1(this, _Editor_instances, determineUnsupportedFontsWithCanvas_fn).call(this, fontsUsedInDocument);
53734
- this.options.onFontsResolved({
53735
- documentFonts: fontsUsedInDocument,
53736
- unsupportedFonts
53737
- });
53730
+ console.warn("[SuperDoc] Could not determine document fonts and unsupported fonts");
53738
53731
  }
53739
53732
  };
53740
- determineUnsupportedFontsWithLocalFonts_fn = function(fonts, localFonts) {
53741
- const unsupportedFonts = fonts.filter((font) => {
53742
- const isLocalFont = localFonts.includes(font);
53743
- const isFontImported = this.fontsImported.includes(font);
53744
- return !isLocalFont && !isFontImported;
53745
- });
53746
- return unsupportedFonts;
53747
- };
53748
- determineUnsupportedFontsWithCanvas_fn = function(fonts) {
53733
+ determineUnsupportedFonts_fn = function(fonts) {
53749
53734
  const unsupportedFonts = fonts.filter((font) => {
53750
53735
  const canRender = canRenderFont(font);
53751
53736
  const isFontImported = this.fontsImported.includes(font);
@@ -53833,6 +53818,9 @@ onCollaborationReady_fn = function({ editor, ydoc }) {
53833
53818
  if (this.options.collaborationIsReady) return;
53834
53819
  console.debug("🔗 [super-editor] Collaboration ready");
53835
53820
  __privateMethod$1(this, _Editor_instances, validateDocumentInit_fn).call(this);
53821
+ if (this.options.ydoc) {
53822
+ this.migrateListsToV2();
53823
+ }
53836
53824
  this.options.onCollaborationReady({ editor, ydoc });
53837
53825
  this.options.collaborationIsReady = true;
53838
53826
  this.options.initialState = this.state;
@@ -73520,7 +73508,7 @@ const _sfc_main$4$1 = {
73520
73508
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inlineTextInput.value = $event),
73521
73509
  onKeydown: vue.withKeys(vue.withModifiers(handleInputSubmit, ["prevent"]), ["enter"]),
73522
73510
  type: "text",
73523
- class: vue.normalizeClass(["button-text-input", { "high-contrast": vue.unref(isHighContrastMode2) }]),
73511
+ class: vue.normalizeClass(["button-text-input button-text-input--font-size", { "high-contrast": vue.unref(isHighContrastMode2) }]),
73524
73512
  id: "inlineTextInput-" + vue.unref(name),
73525
73513
  autocomplete: "off",
73526
73514
  ref_key: "inlineInput",
@@ -73554,7 +73542,7 @@ const _sfc_main$4$1 = {
73554
73542
  };
73555
73543
  }
73556
73544
  };
73557
- const ToolbarButton = /* @__PURE__ */ _export_sfc(_sfc_main$4$1, [["__scopeId", "data-v-cea02a58"]]);
73545
+ const ToolbarButton = /* @__PURE__ */ _export_sfc(_sfc_main$4$1, [["__scopeId", "data-v-ea93b080"]]);
73558
73546
  const _hoisted_1$2$1 = {
73559
73547
  class: "toolbar-separator",
73560
73548
  role: "separator",
@@ -84105,8 +84093,8 @@ const useToolbarItem = (options) => {
84105
84093
  if (!Array.isArray(options.options)) throw new Error("Invalid toolbar item options - " + options.options);
84106
84094
  nestedOptions.value?.push(...options.options);
84107
84095
  }
84108
- const activate = (attrs) => {
84109
- onActivate(attrs);
84096
+ const activate = (attrs, ...args) => {
84097
+ onActivate(attrs, ...args);
84110
84098
  if (suppressActiveHighlight.value) return;
84111
84099
  active.value = true;
84112
84100
  };
@@ -85407,7 +85395,12 @@ const makeDefaultItems = ({
85407
85395
  ariaLabel: "Font size"
85408
85396
  },
85409
85397
  options: fontSizeOptions,
85410
- onActivate: ({ fontSize: size2 }) => {
85398
+ onActivate: ({ fontSize: size2 }, isMultiple = false) => {
85399
+ if (isMultiple) {
85400
+ fontSize2.label.value = "";
85401
+ fontSize2.selectedValue.value = "";
85402
+ return;
85403
+ }
85411
85404
  const defaultSize = fontSizeOptions.find((i2) => i2.label === String(fontSize2.defaultLabel.value));
85412
85405
  if (!size2) {
85413
85406
  fontSize2.label.value = fontSize2.defaultLabel.value;
@@ -85424,8 +85417,6 @@ const makeDefaultItems = ({
85424
85417
  });
85425
85418
  if (foundSize) {
85426
85419
  fontSize2.selectedValue.value = foundSize.key;
85427
- } else if (defaultSize) {
85428
- fontSize2.selectedValue.value = defaultSize.key;
85429
85420
  } else {
85430
85421
  fontSize2.selectedValue.value = "";
85431
85422
  }
@@ -86876,7 +86867,13 @@ class SuperToolbar extends EventEmitter2 {
86876
86867
  const markNegated = rawActiveMark ? isNegatedMark(rawActiveMark.name, rawActiveMark.attrs) : false;
86877
86868
  const activeMark = markNegated ? null : rawActiveMark;
86878
86869
  if (activeMark) {
86879
- item.activate(activeMark.attrs);
86870
+ if (activeMark.name === "fontSize") {
86871
+ const fontSizes = marks.filter((i2) => i2.name === "fontSize").map((i2) => i2.attrs.fontSize);
86872
+ const isMultiple = [...new Set(fontSizes)].length > 1;
86873
+ item.activate(activeMark.attrs, isMultiple);
86874
+ } else {
86875
+ item.activate(activeMark.attrs);
86876
+ }
86880
86877
  } else {
86881
86878
  item.deactivate();
86882
86879
  }
@@ -88981,8 +88978,12 @@ const Extensions = {
88981
88978
  Node: Node$1,
88982
88979
  Attribute: Attribute2,
88983
88980
  Extension,
88981
+ Mark: Mark2,
88982
+ //
88984
88983
  Plugin,
88985
- Mark: Mark2
88984
+ PluginKey,
88985
+ Decoration,
88986
+ DecorationSet
88986
88987
  };
88987
88988
  exports.AIWriter = AIWriter;
88988
88989
  exports.AnnotatorHelpers = AnnotatorHelpers;