@harbour-enterprises/superdoc 0.16.1 → 0.16.3

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 (27) hide show
  1. package/dist/chunks/{PdfViewer-Bov51NJk.cjs → PdfViewer-BF9znEuU.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-CGOPmqZL.es.js → PdfViewer-DZ7nYZ_7.es.js} +1 -1
  3. package/dist/chunks/{index-C9t8QM3H.es.js → index-B5SFvLE3.es.js} +3 -3
  4. package/dist/chunks/{index-H2DnqbsC.cjs → index-ix5rRPuN.cjs} +3 -3
  5. package/dist/chunks/{super-editor.es-Bd5ul_QJ.cjs → super-editor.es-CUUY0Y9b.cjs} +76 -72
  6. package/dist/chunks/{super-editor.es-BhpCczpb.es.js → super-editor.es-CcHzk5fr.es.js} +76 -72
  7. package/dist/core/SuperDoc.d.ts.map +1 -1
  8. package/dist/super-editor/ai-writer.es.js +2 -2
  9. package/dist/super-editor/chunks/{converter-T_2xCPrJ.js → converter-daTWQDSX.js} +2 -2
  10. package/dist/super-editor/chunks/{docx-zipper-D22Q5mQ5.js → docx-zipper-D6pIqvek.js} +1 -1
  11. package/dist/super-editor/chunks/{editor-CCZEU0o3.js → editor-DlwltKCg.js} +76 -72
  12. package/dist/super-editor/chunks/{toolbar-7j6S3kWZ.js → toolbar-BUKbd0tf.js} +2 -2
  13. package/dist/super-editor/converter.es.js +1 -1
  14. package/dist/super-editor/docx-zipper.es.js +2 -2
  15. package/dist/super-editor/editor.es.js +3 -3
  16. package/dist/super-editor/file-zipper.es.js +1 -1
  17. package/dist/super-editor/src/core/commands/insertContentAt.d.ts +6 -5
  18. package/dist/super-editor/src/extensions/block-node/block-node.d.ts +2 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +77 -73
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -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, 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, _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, c as callOrGet, g as getExtensionConfigField, b as getMarkType, d as getMarksFromSelection, e as getNodeType, f as getSchemaTypeNameByName, S as Schema$1, h as cleanSchemaItem, T as TextSelection, N as NodeSelection, i as canSplit, j as defaultBlockAt$1, l as liftTarget, A as AllSelection, k as canJoin, m as joinPoint, n as Selection, r as replaceStep$1, F as Fragment, R as ReplaceAroundStep$1, o as Slice, p as isTextSelection, q as getMarkRange, s as isMarkActive, t as isNodeActive, u as deleteProps, D as DOMParser$1, v as ReplaceStep, w as NodeRange, x as findWrapping, L as ListHelpers, y as findParentNode, z as isMacOS, B as isIOS, C as DOMSerializer, E as Mark$1, G as dropPoint, H as process$1, I as Buffer2, J as getSchemaTypeByName, K as inputRulesPlugin, O as TrackDeleteMarkName, Q as TrackInsertMarkName, U as v4, V as TrackFormatMarkName, W as comments_module_events, X as findMark, Y as objectIncludes, Z as AddMarkStep, _ as RemoveMarkStep, $ as twipsToLines, a0 as pixelsToTwips, a1 as helpers, a2 as posToDOMRect, a3 as CommandService, a4 as SuperConverter, a5 as createDocument, a6 as createDocFromMarkdown, a7 as createDocFromHTML, a8 as EditorState, a9 as hasSomeParentWithClass, aa as isActive, ab as unflattenListsInHtml, ac as parseSizeUnit, ad as minMax, ae as getLineHeightValueString, af as InputRule, ag as kebabCase, ah as getListItemStyleDefinitions, ai as docxNumberigHelpers, aj as parseIndentElement, ak as combineIndents, al as StepMap, am as getColStyleDeclaration, an as SelectionRange, ao as Transform, ap as findParentNodeClosestToPos, aq as isInTable$1, ar as createColGroup, as as generateDocxRandomId, at as insertNewRelationship, au as htmlHandler } from "./converter-T_2xCPrJ.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, c as callOrGet, g as getExtensionConfigField, b as getMarkType, d as getMarksFromSelection, e as getNodeType, f as getSchemaTypeNameByName, S as Schema$1, h as cleanSchemaItem, T as TextSelection, N as NodeSelection, i as canSplit, j as defaultBlockAt$1, l as liftTarget, A as AllSelection, k as canJoin, m as joinPoint, n as Selection, r as replaceStep$1, F as Fragment, R as ReplaceAroundStep$1, o as Slice, p as isTextSelection, q as getMarkRange, s as isMarkActive, t as isNodeActive, u as deleteProps, D as DOMParser$1, v as ReplaceStep, w as NodeRange, x as findWrapping, L as ListHelpers, y as findParentNode, z as isMacOS, B as isIOS, C as DOMSerializer, E as Mark$1, G as dropPoint, H as process$1, I as Buffer2, J as getSchemaTypeByName, K as inputRulesPlugin, O as TrackDeleteMarkName, Q as TrackInsertMarkName, U as v4, V as TrackFormatMarkName, W as comments_module_events, X as findMark, Y as objectIncludes, Z as AddMarkStep, _ as RemoveMarkStep, $ as twipsToLines, a0 as pixelsToTwips, a1 as helpers, a2 as posToDOMRect, a3 as CommandService, a4 as SuperConverter, a5 as createDocument, a6 as createDocFromMarkdown, a7 as createDocFromHTML, a8 as EditorState, a9 as hasSomeParentWithClass, aa as isActive, ab as unflattenListsInHtml, ac as parseSizeUnit, ad as minMax, ae as getLineHeightValueString, af as InputRule, ag as kebabCase, ah as getListItemStyleDefinitions, ai as docxNumberigHelpers, aj as parseIndentElement, ak as combineIndents, al as StepMap, am as getColStyleDeclaration, an as SelectionRange, ao as Transform, ap as findParentNodeClosestToPos, aq as isInTable$1, ar as createColGroup, as as generateDocxRandomId, at as insertNewRelationship, au as htmlHandler } from "./converter-daTWQDSX.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-D22Q5mQ5.js";
17
+ import { D as DocxZipper } from "./docx-zipper-D6pIqvek.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -1990,76 +1990,78 @@ const isFragment = (nodeOrFragment) => {
1990
1990
  return !("type" in nodeOrFragment);
1991
1991
  };
1992
1992
  const insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {
1993
- if (dispatch) {
1994
- options = {
1995
- parseOptions: {},
1996
- updateSelection: true,
1997
- applyInputRules: false,
1998
- applyPasteRules: false,
1999
- ...options
2000
- };
2001
- let content;
2002
- try {
2003
- content = createNodeFromContent(value, editor.schema, {
2004
- parseOptions: {
2005
- preserveWhitespace: "full",
2006
- ...options.parseOptions
2007
- },
2008
- errorOnInvalidContent: options.errorOnInvalidContent ?? editor.options.enableContentCheck
2009
- });
2010
- } catch (e) {
2011
- editor.emit("contentError", {
2012
- editor,
2013
- error: e,
2014
- disableCollaboration: () => {
2015
- console.error("[super-editor error]: Unable to disable collaboration at this point in time");
2016
- }
2017
- });
2018
- return false;
2019
- }
2020
- let { from: from2, to } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
2021
- const forceTextInsert = typeof value === "string" || Array.isArray(value) && value.every((v) => typeof v === "string" || v && typeof v.text === "string") || value && typeof value === "object" && typeof value.text === "string";
2022
- let isOnlyTextContent = forceTextInsert;
2023
- let isOnlyBlockContent = true;
2024
- const nodes = isFragment(content) ? content : [content];
2025
- nodes.forEach((node) => {
2026
- node.check();
2027
- if (!forceTextInsert) {
2028
- isOnlyTextContent = isOnlyTextContent ? node.isText && node.marks.length === 0 : false;
2029
- }
2030
- isOnlyBlockContent = isOnlyBlockContent ? node.isBlock : false;
1993
+ if (!dispatch) return true;
1994
+ options = {
1995
+ parseOptions: {},
1996
+ updateSelection: true,
1997
+ applyInputRules: false,
1998
+ applyPasteRules: false,
1999
+ // optional escape hatch to force literal text insertion
2000
+ asText: false,
2001
+ ...options
2002
+ };
2003
+ let content;
2004
+ try {
2005
+ content = createNodeFromContent(value, editor.schema, {
2006
+ parseOptions: {
2007
+ preserveWhitespace: "full",
2008
+ ...options.parseOptions
2009
+ },
2010
+ errorOnInvalidContent: options.errorOnInvalidContent ?? editor.options.enableContentCheck
2031
2011
  });
2032
- if (from2 === to && isOnlyBlockContent) {
2033
- const { parent } = tr.doc.resolve(from2);
2034
- const isEmptyTextBlock = parent.isTextblock && !parent.type.spec.code && !parent.childCount;
2035
- if (isEmptyTextBlock) {
2036
- from2 -= 1;
2037
- to += 1;
2038
- }
2039
- }
2040
- let newContent;
2041
- if (isOnlyTextContent) {
2042
- if (Array.isArray(value)) {
2043
- newContent = value.map((v) => typeof v === "string" ? v : v && v.text || "").join("");
2044
- } else if (typeof value === "object" && !!value && !!value.text) {
2045
- newContent = value.text;
2046
- } else {
2047
- newContent = value;
2012
+ } catch (e) {
2013
+ editor.emit("contentError", {
2014
+ editor,
2015
+ error: e,
2016
+ disableCollaboration: () => {
2017
+ console.error("[super-editor error]: Unable to disable collaboration at this point in time");
2048
2018
  }
2049
- tr.insertText(newContent, from2, to);
2019
+ });
2020
+ return false;
2021
+ }
2022
+ let { from: from2, to } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
2023
+ const isBareString = typeof value === "string";
2024
+ const looksLikeHTML = isBareString && /^\s*<[a-zA-Z][^>]*>.*<\/[a-zA-Z][^>]*>\s*$/s.test(value);
2025
+ const hasNewline = isBareString && /[\r\n]/.test(value);
2026
+ const forceTextInsert = !!options.asText || hasNewline && !looksLikeHTML || Array.isArray(value) && value.every((v) => typeof v === "string" || v && typeof v.text === "string") || !!value && typeof value === "object" && typeof value.text === "string";
2027
+ let isOnlyTextContent = true;
2028
+ let isOnlyBlockContent = true;
2029
+ const nodes = isFragment(content) ? content : [content];
2030
+ nodes.forEach((node) => {
2031
+ node.check();
2032
+ isOnlyTextContent = isOnlyTextContent ? node.isText && node.marks.length === 0 : false;
2033
+ isOnlyBlockContent = isOnlyBlockContent ? node.isBlock : false;
2034
+ });
2035
+ if (from2 === to && isOnlyBlockContent) {
2036
+ const { parent } = tr.doc.resolve(from2);
2037
+ const isEmptyTextBlock = parent.isTextblock && !parent.type.spec.code && !parent.childCount;
2038
+ if (isEmptyTextBlock) {
2039
+ from2 -= 1;
2040
+ to += 1;
2041
+ }
2042
+ }
2043
+ let newContent;
2044
+ if (isOnlyTextContent || forceTextInsert) {
2045
+ if (Array.isArray(value)) {
2046
+ newContent = value.map((v) => typeof v === "string" ? v : v && v.text || "").join("");
2047
+ } else if (typeof value === "object" && !!value && !!value.text) {
2048
+ newContent = value.text;
2050
2049
  } else {
2051
- newContent = content;
2052
- tr.replaceWith(from2, to, newContent);
2053
- }
2054
- if (options.updateSelection) {
2055
- selectionToInsertionEnd(tr, tr.steps.length - 1, -1);
2056
- }
2057
- if (options.applyInputRules) {
2058
- tr.setMeta("applyInputRules", { from: from2, text: newContent });
2059
- }
2060
- if (options.applyPasteRules) {
2061
- tr.setMeta("applyPasteRules", { from: from2, text: newContent });
2050
+ newContent = typeof value === "string" ? value : "";
2062
2051
  }
2052
+ tr.insertText(newContent, from2, to);
2053
+ } else {
2054
+ newContent = content;
2055
+ tr.replaceWith(from2, to, newContent);
2056
+ }
2057
+ if (options.updateSelection) {
2058
+ selectionToInsertionEnd(tr, tr.steps.length - 1, -1);
2059
+ }
2060
+ if (options.applyInputRules) {
2061
+ tr.setMeta("applyInputRules", { from: from2, text: newContent });
2062
+ }
2063
+ if (options.applyPasteRules) {
2064
+ tr.setMeta("applyPasteRules", { from: from2, text: newContent });
2063
2065
  }
2064
2066
  return true;
2065
2067
  };
@@ -14254,7 +14256,7 @@ const _Editor = class _Editor extends EventEmitter {
14254
14256
  * @returns {Object | void} Migration results
14255
14257
  */
14256
14258
  processCollaborationMigrations() {
14257
- console.debug("[checkVersionMigrations] Current editor version", "0.16.0");
14259
+ console.debug("[checkVersionMigrations] Current editor version", "0.16.2");
14258
14260
  if (!this.options.ydoc) return;
14259
14261
  const metaMap = this.options.ydoc.getMap("meta");
14260
14262
  let docVersion = metaMap.get("version");
@@ -25048,11 +25050,10 @@ const BlockNode = Extension.create({
25048
25050
  appendTransaction: (transactions, _oldState, newState) => {
25049
25051
  if (hasInitialized && !transactions.some((tr2) => tr2.docChanged)) return null;
25050
25052
  if (hasInitialized && !checkForNewBlockNodesInTrs(transactions)) return null;
25051
- let tr = null;
25053
+ const { tr } = newState;
25052
25054
  let changed = false;
25053
25055
  newState.doc.descendants((node, pos) => {
25054
25056
  if (!nodeAllowsSdBlockIdAttr(node) || !nodeNeedsSdBlockId(node)) return null;
25055
- tr = tr ?? newState.tr;
25056
25057
  tr.setNodeMarkup(
25057
25058
  pos,
25058
25059
  void 0,
@@ -25064,7 +25065,10 @@ const BlockNode = Extension.create({
25064
25065
  );
25065
25066
  changed = true;
25066
25067
  });
25067
- if (changed && !hasInitialized) hasInitialized = true;
25068
+ if (changed && !hasInitialized) {
25069
+ hasInitialized = true;
25070
+ }
25071
+ tr.setStoredMarks(newState.tr.storedMarks);
25068
25072
  return changed ? tr : null;
25069
25073
  }
25070
25074
  })
@@ -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 { H as process$1 } from "./converter-T_2xCPrJ.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-CCZEU0o3.js";
2
+ import { H as process$1 } from "./converter-daTWQDSX.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-DlwltKCg.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -1,4 +1,4 @@
1
- import { a4 } from "./chunks/converter-T_2xCPrJ.js";
1
+ import { a4 } from "./chunks/converter-daTWQDSX.js";
2
2
  export {
3
3
  a4 as SuperConverter
4
4
  };
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-T_2xCPrJ.js";
2
- import { D } from "./chunks/docx-zipper-D22Q5mQ5.js";
1
+ import "./chunks/converter-daTWQDSX.js";
2
+ import { D } from "./chunks/docx-zipper-D6pIqvek.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-CCZEU0o3.js";
2
- import "./chunks/converter-T_2xCPrJ.js";
3
- import "./chunks/docx-zipper-D22Q5mQ5.js";
1
+ import { E } from "./chunks/editor-DlwltKCg.js";
2
+ import "./chunks/converter-daTWQDSX.js";
3
+ import "./chunks/docx-zipper-D6pIqvek.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-D22Q5mQ5.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-D6pIqvek.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -1,7 +1,8 @@
1
- export function insertContentAt(position: import("prosemirror-model").ResolvedPos, value: string | Array<string | ProseMirrorNode>, options: any): ({ tr, dispatch, editor }: {
2
- tr: any;
3
- dispatch: any;
4
- editor: any;
5
- }) => boolean;
1
+ export function insertContentAt(position: import("prosemirror-model").ResolvedPos | number | {
2
+ from: number;
3
+ to: number;
4
+ }, value: string | Array<string | {
5
+ text?: string;
6
+ }> | ProseMirrorNode | ProseMirrorFragment, options: any): boolean;
6
7
  export type ProseMirrorNode = import("prosemirror-model").Node;
7
8
  export type ProseMirrorFragment = import("prosemirror-model").Fragment;
@@ -2,6 +2,7 @@ export const BlockNodePluginKey: PluginKey<any>;
2
2
  export const BlockNode: Extension;
3
3
  export function nodeAllowsSdBlockIdAttr(node: import("prosemirror-model").Node): boolean;
4
4
  export function nodeNeedsSdBlockId(node: import("prosemirror-model").Node): boolean;
5
- export function checkForNewBlockNodesInTrs(transactions: Array<Transaction>): boolean;
5
+ export function checkForNewBlockNodesInTrs(transactions: readonly Transaction[]): boolean;
6
6
  import { PluginKey } from 'prosemirror-state';
7
7
  import { Extension } from '@core/Extension.js';
8
+ import { Transaction } from 'prosemirror-state';
@@ -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 { aw as getDefaultExportFromCjs, U as v4, T as TextSelection$1, q as getMarkRange, az as vClickOutside, y as findParentNode, aA as getActiveFormatting, aq as isInTable, aB as readFromClipboard, aC as handleClipboardPaste, aD as getFileObject, a as Plugin } from "./chunks/converter-T_2xCPrJ.js";
13
- import { aE, a4, d, a1 } from "./chunks/converter-T_2xCPrJ.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, s as startImageUpload, y as yUndoPluginKey, d as undoDepth, r as redoDepth, S as SlashMenuPluginKey, E as Editor, e as getStarterExtensions, P as Placeholder, f as getRichTextExtensions, M as Mark, h as Extension, A as Attribute, N as Node } from "./chunks/editor-CCZEU0o3.js";
15
- import { k, C, l, T, i, m, j } from "./chunks/editor-CCZEU0o3.js";
12
+ import { aw as getDefaultExportFromCjs, U as v4, T as TextSelection$1, q as getMarkRange, az as vClickOutside, y as findParentNode, aA as getActiveFormatting, aq as isInTable, aB as readFromClipboard, aC as handleClipboardPaste, aD as getFileObject, a as Plugin } from "./chunks/converter-daTWQDSX.js";
13
+ import { aE, a4, d, a1 } from "./chunks/converter-daTWQDSX.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, s as startImageUpload, y as yUndoPluginKey, d as undoDepth, r as redoDepth, S as SlashMenuPluginKey, E as Editor, e as getStarterExtensions, P as Placeholder, f as getRichTextExtensions, M as Mark, h as Extension, A as Attribute, N as Node } from "./chunks/editor-DlwltKCg.js";
15
+ import { k, C, l, T, i, m, j } from "./chunks/editor-DlwltKCg.js";
16
16
  import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, reactive, onUnmounted, renderSlot, shallowRef, createBlock, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-7j6S3kWZ.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-BUKbd0tf.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-D22Q5mQ5.js";
19
+ import { D } from "./chunks/docx-zipper-D6pIqvek.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  var hasRequiredEventemitter3;
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-7j6S3kWZ.js";
3
- import "./chunks/editor-CCZEU0o3.js";
2
+ import { T } from "./chunks/toolbar-BUKbd0tf.js";
3
+ import "./chunks/editor-DlwltKCg.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-Bd5ul_QJ.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-CUUY0Y9b.cjs");
4
4
  require("./chunks/vue-B6WOnFdF.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,4 +1,4 @@
1
- import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, q } from "./chunks/super-editor.es-BhpCczpb.es.js";
1
+ import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, q } from "./chunks/super-editor.es-CcHzk5fr.es.js";
2
2
  import "./chunks/vue-xvq3uP6K.es.js";
3
3
  export {
4
4
  A as AIWriter,
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-Bd5ul_QJ.cjs");
4
- const superdoc = require("./chunks/index-H2DnqbsC.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-CUUY0Y9b.cjs");
4
+ const superdoc = require("./chunks/index-ix5rRPuN.cjs");
5
5
  require("./chunks/vue-B6WOnFdF.cjs");
6
6
  require("./chunks/jszip-DmmUnPkH.cjs");
7
7
  const blankDocx = require("./chunks/blank-docx-CPqX9RF5.cjs");
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, p, q } from "./chunks/super-editor.es-BhpCczpb.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-C9t8QM3H.es.js";
1
+ import { a, E, b, S, d, i, j, n, p, q } from "./chunks/super-editor.es-CcHzk5fr.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-B5SFvLE3.es.js";
3
3
  import "./chunks/vue-xvq3uP6K.es.js";
4
4
  import "./chunks/jszip-DXHu60h9.es.js";
5
5
  import { B } from "./chunks/blank-docx-iwdyG9RH.es.js";
@@ -37720,7 +37720,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37720
37720
  return;
37721
37721
  }
37722
37722
  }
37723
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.16.0") {
37723
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.16.2") {
37724
37724
  const customLocation = "docProps/custom.xml";
37725
37725
  if (!docx[customLocation]) {
37726
37726
  docx[customLocation] = generateCustomXml();
@@ -38202,7 +38202,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38202
38202
  function generateCustomXml() {
38203
38203
  return DEFAULT_CUSTOM_XML;
38204
38204
  }
38205
- function generateSuperdocVersion(pid = 2, version2 = "0.16.0") {
38205
+ function generateSuperdocVersion(pid = 2, version2 = "0.16.2") {
38206
38206
  return {
38207
38207
  type: "element",
38208
38208
  name: "property",
@@ -42759,76 +42759,78 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42759
42759
  return !("type" in nodeOrFragment);
42760
42760
  };
42761
42761
  const insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {
42762
- if (dispatch) {
42763
- options = {
42764
- parseOptions: {},
42765
- updateSelection: true,
42766
- applyInputRules: false,
42767
- applyPasteRules: false,
42768
- ...options
42769
- };
42770
- let content;
42771
- try {
42772
- content = createNodeFromContent(value, editor.schema, {
42773
- parseOptions: {
42774
- preserveWhitespace: "full",
42775
- ...options.parseOptions
42776
- },
42777
- errorOnInvalidContent: options.errorOnInvalidContent ?? editor.options.enableContentCheck
42778
- });
42779
- } catch (e) {
42780
- editor.emit("contentError", {
42781
- editor,
42782
- error: e,
42783
- disableCollaboration: () => {
42784
- console.error("[super-editor error]: Unable to disable collaboration at this point in time");
42785
- }
42786
- });
42787
- return false;
42788
- }
42789
- let { from: from2, to } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
42790
- const forceTextInsert = typeof value === "string" || Array.isArray(value) && value.every((v2) => typeof v2 === "string" || v2 && typeof v2.text === "string") || value && typeof value === "object" && typeof value.text === "string";
42791
- let isOnlyTextContent = forceTextInsert;
42792
- let isOnlyBlockContent = true;
42793
- const nodes = isFragment(content) ? content : [content];
42794
- nodes.forEach((node2) => {
42795
- node2.check();
42796
- if (!forceTextInsert) {
42797
- isOnlyTextContent = isOnlyTextContent ? node2.isText && node2.marks.length === 0 : false;
42798
- }
42799
- isOnlyBlockContent = isOnlyBlockContent ? node2.isBlock : false;
42762
+ if (!dispatch) return true;
42763
+ options = {
42764
+ parseOptions: {},
42765
+ updateSelection: true,
42766
+ applyInputRules: false,
42767
+ applyPasteRules: false,
42768
+ // optional escape hatch to force literal text insertion
42769
+ asText: false,
42770
+ ...options
42771
+ };
42772
+ let content;
42773
+ try {
42774
+ content = createNodeFromContent(value, editor.schema, {
42775
+ parseOptions: {
42776
+ preserveWhitespace: "full",
42777
+ ...options.parseOptions
42778
+ },
42779
+ errorOnInvalidContent: options.errorOnInvalidContent ?? editor.options.enableContentCheck
42800
42780
  });
42801
- if (from2 === to && isOnlyBlockContent) {
42802
- const { parent } = tr.doc.resolve(from2);
42803
- const isEmptyTextBlock = parent.isTextblock && !parent.type.spec.code && !parent.childCount;
42804
- if (isEmptyTextBlock) {
42805
- from2 -= 1;
42806
- to += 1;
42807
- }
42808
- }
42809
- let newContent;
42810
- if (isOnlyTextContent) {
42811
- if (Array.isArray(value)) {
42812
- newContent = value.map((v2) => typeof v2 === "string" ? v2 : v2 && v2.text || "").join("");
42813
- } else if (typeof value === "object" && !!value && !!value.text) {
42814
- newContent = value.text;
42815
- } else {
42816
- newContent = value;
42781
+ } catch (e) {
42782
+ editor.emit("contentError", {
42783
+ editor,
42784
+ error: e,
42785
+ disableCollaboration: () => {
42786
+ console.error("[super-editor error]: Unable to disable collaboration at this point in time");
42817
42787
  }
42818
- tr.insertText(newContent, from2, to);
42788
+ });
42789
+ return false;
42790
+ }
42791
+ let { from: from2, to } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
42792
+ const isBareString = typeof value === "string";
42793
+ const looksLikeHTML = isBareString && /^\s*<[a-zA-Z][^>]*>.*<\/[a-zA-Z][^>]*>\s*$/s.test(value);
42794
+ const hasNewline = isBareString && /[\r\n]/.test(value);
42795
+ const forceTextInsert = !!options.asText || hasNewline && !looksLikeHTML || Array.isArray(value) && value.every((v2) => typeof v2 === "string" || v2 && typeof v2.text === "string") || !!value && typeof value === "object" && typeof value.text === "string";
42796
+ let isOnlyTextContent = true;
42797
+ let isOnlyBlockContent = true;
42798
+ const nodes = isFragment(content) ? content : [content];
42799
+ nodes.forEach((node2) => {
42800
+ node2.check();
42801
+ isOnlyTextContent = isOnlyTextContent ? node2.isText && node2.marks.length === 0 : false;
42802
+ isOnlyBlockContent = isOnlyBlockContent ? node2.isBlock : false;
42803
+ });
42804
+ if (from2 === to && isOnlyBlockContent) {
42805
+ const { parent } = tr.doc.resolve(from2);
42806
+ const isEmptyTextBlock = parent.isTextblock && !parent.type.spec.code && !parent.childCount;
42807
+ if (isEmptyTextBlock) {
42808
+ from2 -= 1;
42809
+ to += 1;
42810
+ }
42811
+ }
42812
+ let newContent;
42813
+ if (isOnlyTextContent || forceTextInsert) {
42814
+ if (Array.isArray(value)) {
42815
+ newContent = value.map((v2) => typeof v2 === "string" ? v2 : v2 && v2.text || "").join("");
42816
+ } else if (typeof value === "object" && !!value && !!value.text) {
42817
+ newContent = value.text;
42819
42818
  } else {
42820
- newContent = content;
42821
- tr.replaceWith(from2, to, newContent);
42822
- }
42823
- if (options.updateSelection) {
42824
- selectionToInsertionEnd(tr, tr.steps.length - 1, -1);
42825
- }
42826
- if (options.applyInputRules) {
42827
- tr.setMeta("applyInputRules", { from: from2, text: newContent });
42828
- }
42829
- if (options.applyPasteRules) {
42830
- tr.setMeta("applyPasteRules", { from: from2, text: newContent });
42819
+ newContent = typeof value === "string" ? value : "";
42831
42820
  }
42821
+ tr.insertText(newContent, from2, to);
42822
+ } else {
42823
+ newContent = content;
42824
+ tr.replaceWith(from2, to, newContent);
42825
+ }
42826
+ if (options.updateSelection) {
42827
+ selectionToInsertionEnd(tr, tr.steps.length - 1, -1);
42828
+ }
42829
+ if (options.applyInputRules) {
42830
+ tr.setMeta("applyInputRules", { from: from2, text: newContent });
42831
+ }
42832
+ if (options.applyPasteRules) {
42833
+ tr.setMeta("applyPasteRules", { from: from2, text: newContent });
42832
42834
  }
42833
42835
  return true;
42834
42836
  };
@@ -54971,7 +54973,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
54971
54973
  * @returns {Object | void} Migration results
54972
54974
  */
54973
54975
  processCollaborationMigrations() {
54974
- console.debug("[checkVersionMigrations] Current editor version", "0.16.0");
54976
+ console.debug("[checkVersionMigrations] Current editor version", "0.16.2");
54975
54977
  if (!this.options.ydoc) return;
54976
54978
  const metaMap = this.options.ydoc.getMap("meta");
54977
54979
  let docVersion = metaMap.get("version");
@@ -65648,11 +65650,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65648
65650
  appendTransaction: (transactions, _oldState, newState) => {
65649
65651
  if (hasInitialized && !transactions.some((tr2) => tr2.docChanged)) return null;
65650
65652
  if (hasInitialized && !checkForNewBlockNodesInTrs(transactions)) return null;
65651
- let tr = null;
65653
+ const { tr } = newState;
65652
65654
  let changed = false;
65653
65655
  newState.doc.descendants((node2, pos) => {
65654
65656
  if (!nodeAllowsSdBlockIdAttr(node2) || !nodeNeedsSdBlockId(node2)) return null;
65655
- tr = tr ?? newState.tr;
65656
65657
  tr.setNodeMarkup(
65657
65658
  pos,
65658
65659
  void 0,
@@ -65664,7 +65665,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65664
65665
  );
65665
65666
  changed = true;
65666
65667
  });
65667
- if (changed && !hasInitialized) hasInitialized = true;
65668
+ if (changed && !hasInitialized) {
65669
+ hasInitialized = true;
65670
+ }
65671
+ tr.setStoredMarks(newState.tr.storedMarks);
65668
65672
  return changed ? tr : null;
65669
65673
  }
65670
65674
  })
@@ -104484,7 +104488,7 @@ ${style2}
104484
104488
  this.config.colors = shuffleArray(this.config.colors);
104485
104489
  this.userColorMap = /* @__PURE__ */ new Map();
104486
104490
  this.colorIndex = 0;
104487
- this.version = "0.16.0";
104491
+ this.version = "0.16.2";
104488
104492
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
104489
104493
  this.superdocId = config.superdocId || v4();
104490
104494
  this.colors = this.config.colors;