@harbour-enterprises/superdoc 0.28.3 → 0.29.0-next.2

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 (61) hide show
  1. package/dist/chunks/{PdfViewer-DUpLlOgk.es.js → PdfViewer-ByaA6tu-.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-QTV3RJM1.cjs → PdfViewer-POSV5DiN.cjs} +1 -1
  3. package/dist/chunks/{index-CuXB3dyN.cjs → index-3BBP_H1q.cjs} +3 -3
  4. package/dist/chunks/{index-DKtyoTAq.es.js → index-C3_BQlO-.es.js} +3 -3
  5. package/dist/chunks/{index-B3rVM2bJ-BgYPFhrh.cjs → index-F9UTAd9o-FTCIxXZV.cjs} +1 -1
  6. package/dist/chunks/{index-B3rVM2bJ-B62R9mgx.es.js → index-F9UTAd9o-O789Xvby.es.js} +1 -1
  7. package/dist/chunks/{super-editor.es-BKCxu5-_.cjs → super-editor.es-Ce1bKea8.cjs} +135 -36
  8. package/dist/chunks/{super-editor.es-BjTZa-cJ.es.js → super-editor.es-ZQFMn4Mx.es.js} +135 -36
  9. package/dist/core/types/index.d.ts.map +1 -1
  10. package/dist/images/altText_add.svg +3 -0
  11. package/dist/images/altText_disclaimer.svg +3 -0
  12. package/dist/images/altText_done.svg +3 -0
  13. package/dist/images/altText_spinner.svg +30 -0
  14. package/dist/images/altText_warning.svg +3 -0
  15. package/dist/images/annotation-check.svg +11 -0
  16. package/dist/images/annotation-comment.svg +16 -0
  17. package/dist/images/annotation-help.svg +26 -0
  18. package/dist/images/annotation-insert.svg +10 -0
  19. package/dist/images/annotation-key.svg +11 -0
  20. package/dist/images/annotation-newparagraph.svg +11 -0
  21. package/dist/images/annotation-noicon.svg +7 -0
  22. package/dist/images/annotation-note.svg +42 -0
  23. package/dist/images/annotation-paperclip.svg +6 -0
  24. package/dist/images/annotation-paragraph.svg +16 -0
  25. package/dist/images/annotation-pushpin.svg +7 -0
  26. package/dist/images/cursor-editorFreeHighlight.svg +6 -0
  27. package/dist/images/cursor-editorFreeText.svg +3 -0
  28. package/dist/images/cursor-editorInk.svg +4 -0
  29. package/dist/images/cursor-editorTextHighlight.svg +8 -0
  30. package/dist/images/editor-toolbar-delete.svg +5 -0
  31. package/dist/images/loading-icon.gif +0 -0
  32. package/dist/images/messageBar_closingButton.svg +3 -0
  33. package/dist/images/messageBar_warning.svg +3 -0
  34. package/dist/images/toolbarButton-editorHighlight.svg +6 -0
  35. package/dist/images/toolbarButton-menuArrow.svg +3 -0
  36. package/dist/style.css +10 -0
  37. package/dist/super-editor/ai-writer.es.js +2 -2
  38. package/dist/super-editor/chunks/{converter-CMtyH2w0.js → converter-C3c63BcJ.js} +95 -29
  39. package/dist/super-editor/chunks/{docx-zipper-Pgf9i5kI.js → docx-zipper-BYMN0YBQ.js} +1 -1
  40. package/dist/super-editor/chunks/{editor-C3KgN3zx.js → editor-CTJhnyzP.js} +42 -9
  41. package/dist/super-editor/chunks/{index-B3rVM2bJ.js → index-F9UTAd9o.js} +1 -1
  42. package/dist/super-editor/chunks/{toolbar-TXkIPPvk.js → toolbar-6Ayv3LAk.js} +2 -2
  43. package/dist/super-editor/converter.es.js +1 -1
  44. package/dist/super-editor/docx-zipper.es.js +2 -2
  45. package/dist/super-editor/editor.es.js +3 -3
  46. package/dist/super-editor/file-zipper.es.js +1 -1
  47. package/dist/super-editor/style.css +10 -0
  48. package/dist/super-editor/super-editor/src/core/super-converter/relationship-helpers.d.ts +2 -0
  49. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/listImporter.d.ts +1 -1
  50. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/numberingCache.d.ts +2 -2
  51. package/dist/super-editor/super-editor/src/utils/headless-helpers.d.ts +1 -0
  52. package/dist/super-editor/super-editor/src/utils/styleIsolation.d.ts +2 -0
  53. package/dist/super-editor/super-editor.es.js +6 -6
  54. package/dist/super-editor/toolbar.es.js +2 -2
  55. package/dist/super-editor.cjs +1 -1
  56. package/dist/super-editor.es.js +1 -1
  57. package/dist/superdoc.cjs +2 -2
  58. package/dist/superdoc.es.js +2 -2
  59. package/dist/superdoc.umd.js +137 -38
  60. package/dist/superdoc.umd.js.map +1 -1
  61. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-TXkIPPvk.js";
3
- import "./chunks/editor-C3KgN3zx.js";
2
+ import { T } from "./chunks/toolbar-6Ayv3LAk.js";
3
+ import "./chunks/editor-CTJhnyzP.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-BKCxu5-_.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-Ce1bKea8.cjs");
4
4
  require("./chunks/vue-DKMj1I9B.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, r, q } from "./chunks/super-editor.es-BjTZa-cJ.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, r, q } from "./chunks/super-editor.es-ZQFMn4Mx.es.js";
2
2
  import "./chunks/vue-ZWZLQtoU.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-BKCxu5-_.cjs");
4
- const superdoc = require("./chunks/index-CuXB3dyN.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-Ce1bKea8.cjs");
4
+ const superdoc = require("./chunks/index-3BBP_H1q.cjs");
5
5
  require("./chunks/vue-DKMj1I9B.cjs");
6
6
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
7
7
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-BjTZa-cJ.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-DKtyoTAq.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-ZQFMn4Mx.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-C3_BQlO-.es.js";
3
3
  import "./chunks/vue-ZWZLQtoU.es.js";
4
4
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
5
5
  export {
@@ -28333,7 +28333,23 @@
28333
28333
  ]
28334
28334
  };
28335
28335
  const docxNumberingCacheStore = /* @__PURE__ */ new WeakMap();
28336
+ const NUMBERING_CACHE_KEY = "numbering-cache";
28336
28337
  const LEVELS_MAP_KEY = Symbol("superdoc.numbering.levels");
28338
+ const NUMBERING_CACHE_DOCX_KEY = Symbol("superdoc.numbering.docx");
28339
+ const clearConverterCache = (converter) => {
28340
+ if (!converter) return;
28341
+ delete converter[NUMBERING_CACHE_KEY];
28342
+ delete converter[NUMBERING_CACHE_DOCX_KEY];
28343
+ };
28344
+ const setConverterCache = (converter, cache2, docx) => {
28345
+ if (!converter) return;
28346
+ converter[NUMBERING_CACHE_KEY] = cache2;
28347
+ if (docx && typeof docx === "object") {
28348
+ converter[NUMBERING_CACHE_DOCX_KEY] = docx;
28349
+ } else {
28350
+ delete converter[NUMBERING_CACHE_DOCX_KEY];
28351
+ }
28352
+ };
28337
28353
  const createEmptyCache = () => ({
28338
28354
  numToAbstractId: /* @__PURE__ */ new Map(),
28339
28355
  abstractById: /* @__PURE__ */ new Map(),
@@ -28405,12 +28421,27 @@
28405
28421
  }
28406
28422
  return { numToAbstractId, abstractById, templateById, numToDefinition, numNodesById };
28407
28423
  };
28408
- const ensureNumberingCache = (docx) => {
28424
+ const ensureNumberingCache = (docx, converter) => {
28425
+ if (converter?.[NUMBERING_CACHE_KEY]) {
28426
+ const cachedDocx = converter[NUMBERING_CACHE_DOCX_KEY];
28427
+ if (docx && cachedDocx && cachedDocx !== docx) {
28428
+ clearConverterCache(converter);
28429
+ } else {
28430
+ return converter[NUMBERING_CACHE_KEY];
28431
+ }
28432
+ }
28409
28433
  if (!docx || typeof docx !== "object") return createEmptyCache();
28410
28434
  const existingCache = docxNumberingCacheStore.get(docx);
28411
- if (existingCache) return existingCache;
28435
+ if (existingCache) {
28436
+ setConverterCache(converter, existingCache, docx);
28437
+ return existingCache;
28438
+ }
28412
28439
  const cache2 = buildNumberingCache(docx);
28413
- docxNumberingCacheStore.set(docx, cache2);
28440
+ if (converter) {
28441
+ setConverterCache(converter, cache2, docx);
28442
+ } else {
28443
+ docxNumberingCacheStore.set(docx, cache2);
28444
+ }
28414
28445
  return cache2;
28415
28446
  };
28416
28447
  const handleListNode = (params2) => {
@@ -28667,11 +28698,11 @@
28667
28698
  }
28668
28699
  return { numId, ilvl };
28669
28700
  };
28670
- const getAbstractDefinition = (numId, docx) => {
28701
+ const getAbstractDefinition = (numId, docx, converter) => {
28671
28702
  const numberingXml = docx["word/numbering.xml"];
28672
28703
  if (!numberingXml) return {};
28673
28704
  if (numId == null) return void 0;
28674
- const cache2 = ensureNumberingCache(docx);
28705
+ const cache2 = ensureNumberingCache(docx, converter);
28675
28706
  const numKey = String(numId);
28676
28707
  let listDefinitionForThisNumId = cache2.numToDefinition.get(numKey);
28677
28708
  if (!listDefinitionForThisNumId) {
@@ -32184,10 +32215,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32184
32215
  if (typeof numId === "string") numId = Number(numId);
32185
32216
  if (typeof level === "string") level = Number(level);
32186
32217
  const docx = editor?.converter?.convertedXml;
32187
- const numbering = editor?.converter?.numbering;
32218
+ const converter = editor?.converter;
32219
+ const numbering = converter?.numbering;
32188
32220
  const styleDefinition = docx ? getStyleTagFromStyleId(styleId, docx) : null;
32189
32221
  const stylePpr = styleDefinition?.elements.find((el) => el.name === "w:pPr");
32190
- let abstractDefinition = docx ? getAbstractDefinition(numId, docx) : null;
32222
+ let abstractDefinition = docx ? getAbstractDefinition(numId, docx, converter) : null;
32191
32223
  if (!abstractDefinition) {
32192
32224
  const listDef = numbering?.definitions?.[numId];
32193
32225
  const abstractId = listDef?.elements?.find((item) => item.name === "w:abstractNumId")?.attributes?.["w:val"];
@@ -36528,7 +36560,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36528
36560
  const { width: w2, height: h2 } = resizeKeepAspectRatio(size2.w, size2.h, maxWidthEmu);
36529
36561
  if (w2 && h2) size2 = { w: w2, h: h2 };
36530
36562
  }
36531
- if (params2.node.type === "image" && !imageId) {
36563
+ if (imageId) {
36564
+ const docx = params2.converter?.convertedXml || {};
36565
+ const rels = docx["word/_rels/document.xml.rels"];
36566
+ const relsTag = rels?.elements?.find((el) => el.name === "Relationships");
36567
+ const hasRelation = relsTag?.elements.find((el) => el.attributes.Id === imageId);
36568
+ const path2 = src?.split("word/")[1];
36569
+ if (!hasRelation) {
36570
+ addImageRelationshipForId(params2, imageId, path2);
36571
+ }
36572
+ } else if (params2.node.type === "image" && !imageId) {
36532
36573
  const path2 = src?.split("word/")[1];
36533
36574
  imageId = addNewImageRelationship(params2, path2);
36534
36575
  } else if (params2.node.type === "fieldAnnotation" && !imageId) {
@@ -36752,6 +36793,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36752
36793
  params2.relationships.push(newRel);
36753
36794
  return newId;
36754
36795
  }
36796
+ function addImageRelationshipForId(params2, id, imagePath) {
36797
+ const newRel = {
36798
+ type: "element",
36799
+ name: "Relationship",
36800
+ attributes: {
36801
+ Id: id,
36802
+ Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
36803
+ Target: imagePath
36804
+ }
36805
+ };
36806
+ params2.relationships.push(newRel);
36807
+ }
36755
36808
  function translateVectorShape(params2) {
36756
36809
  const { node: node2 } = params2;
36757
36810
  const { drawingContent } = node2.attrs;
@@ -41240,7 +41293,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
41240
41293
  comments,
41241
41294
  inlineDocumentFonts,
41242
41295
  linkedStyles: getStyleDefinitions(docx),
41243
- numbering: getNumberingDefinitions(docx)
41296
+ numbering: getNumberingDefinitions(docx, converter)
41244
41297
  };
41245
41298
  }
41246
41299
  return null;
@@ -41639,8 +41692,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
41639
41692
  ]);
41640
41693
  return content2.filter((node2) => node2 && typeof node2.type === "string" && !INLINE_TYPES.has(node2.type));
41641
41694
  }
41642
- function getNumberingDefinitions(docx) {
41643
- const cache2 = ensureNumberingCache(docx);
41695
+ function getNumberingDefinitions(docx, converter) {
41696
+ const cache2 = ensureNumberingCache(docx, converter);
41644
41697
  const abstractDefinitions = {};
41645
41698
  cache2.abstractById.forEach((value, key2) => {
41646
41699
  const numericKey = Number(key2);
@@ -43014,6 +43067,35 @@ Please report this to https://github.com/markedjs/marked.`, e) {
43014
43067
  };
43015
43068
  const HYPERLINK_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
43016
43069
  const HEADER_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";
43070
+ const FOOTER_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";
43071
+ const REL_ID_NUMERIC_PATTERN = /rId|mi/g;
43072
+ const getLargestRelationshipId = (relationships = []) => {
43073
+ const numericIds = relationships.map((rel) => Number(String(rel?.attributes?.Id ?? "").replace(REL_ID_NUMERIC_PATTERN, ""))).filter((value) => Number.isFinite(value));
43074
+ return numericIds.length ? Math.max(...numericIds) : 0;
43075
+ };
43076
+ const mergeRelationshipElements = (existingRelationships = [], newRelationships = []) => {
43077
+ if (!newRelationships?.length) return existingRelationships;
43078
+ let largestId = getLargestRelationshipId(existingRelationships);
43079
+ const seenIds = new Set(existingRelationships.map((rel) => rel?.attributes?.Id).filter(Boolean));
43080
+ const additions = [];
43081
+ newRelationships.forEach((rel) => {
43082
+ if (!rel?.attributes) return;
43083
+ const attributes = rel.attributes;
43084
+ const currentId = attributes.Id || "";
43085
+ attributes.Target = attributes?.Target?.replace(/&/g, "&");
43086
+ const existingTarget = existingRelationships.find((el) => el.attributes.Target === attributes.Target);
43087
+ const isMedia = attributes.Target?.startsWith("media/");
43088
+ const isNewHyperlink = attributes.Type === HYPERLINK_RELATIONSHIP_TYPE && currentId.length > 6;
43089
+ const isNewHeadFoot = (attributes.Type === HEADER_RELATIONSHIP_TYPE || attributes.Type === FOOTER_RELATIONSHIP_TYPE) && currentId.length > 6;
43090
+ const hasSeenId = currentId && seenIds.has(currentId);
43091
+ const shouldSkip2 = !isNewHyperlink && !isNewHeadFoot && (hasSeenId || existingTarget);
43092
+ if (shouldSkip2) return;
43093
+ attributes.Id = currentId.length > 6 || isMedia ? currentId : `rId${++largestId}`;
43094
+ seenIds.add(attributes.Id);
43095
+ additions.push(rel);
43096
+ });
43097
+ return additions.length ? [...existingRelationships, ...additions] : existingRelationships;
43098
+ };
43017
43099
  const FONT_FAMILY_FALLBACKS = Object.freeze({
43018
43100
  swiss: "Arial, sans-serif",
43019
43101
  roman: "Times New Roman, serif",
@@ -43222,7 +43304,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
43222
43304
  static getStoredSuperdocVersion(docx) {
43223
43305
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
43224
43306
  }
43225
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.28.2") {
43307
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.29.0-next.2") {
43226
43308
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
43227
43309
  }
43228
43310
  /**
@@ -43728,23 +43810,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
43728
43810
  exportProcessNewRelationships_fn = function(rels = []) {
43729
43811
  const relsData = this.convertedXml["word/_rels/document.xml.rels"];
43730
43812
  const relationships = relsData.elements.find((x) => x.name === "Relationships");
43731
- const newRels = [];
43732
- const regex = /rId|mi/g;
43733
- let largestId = Math.max(...relationships.elements.map((el) => Number(el.attributes.Id.replace(regex, ""))));
43734
- rels.forEach((rel) => {
43735
- const existingId = rel.attributes.Id;
43736
- const existingTarget = relationships.elements.find((el) => el.attributes.Target === rel.attributes.Target);
43737
- const isNewMedia = rel.attributes.Target?.startsWith("media/") && existingId.length > 6;
43738
- const isNewHyperlink = rel.attributes.Type === HYPERLINK_RELATIONSHIP_TYPE && existingId.length > 6;
43739
- const isNewHeadFoot = rel.attributes.Type === HEADER_RELATIONSHIP_TYPE && existingId.length > 6;
43740
- if (existingTarget && !isNewMedia && !isNewHyperlink && !isNewHeadFoot) {
43741
- return;
43742
- }
43743
- rel.attributes.Target = rel.attributes?.Target?.replace(/&/g, "&");
43744
- rel.attributes.Id = existingId.length > 6 ? existingId : `rId${++largestId}`;
43745
- newRels.push(rel);
43746
- });
43747
- relationships.elements = [...relationships.elements, ...newRels];
43813
+ relationships.elements = mergeRelationshipElements(relationships.elements, rels);
43748
43814
  };
43749
43815
  exportProcessMediaFiles_fn = async function(media2 = {}) {
43750
43816
  const processedData = {
@@ -57428,10 +57494,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57428
57494
  type: getNodeType(extension.name, this.schema)
57429
57495
  };
57430
57496
  const addNodeView = getExtensionConfigField(extension, "addNodeView", context);
57431
- if (!addNodeView) return [];
57497
+ if (!addNodeView) return null;
57498
+ const nodeViewFunction = addNodeView();
57499
+ if (!nodeViewFunction) return null;
57432
57500
  const nodeview = (node2, _view, getPos, decorations) => {
57433
57501
  const htmlAttributes = Attribute.getAttributesToRender(node2, extensionAttrs);
57434
- return addNodeView()({
57502
+ return nodeViewFunction({
57435
57503
  editor,
57436
57504
  node: node2,
57437
57505
  getPos,
@@ -57441,7 +57509,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57441
57509
  });
57442
57510
  };
57443
57511
  return [extension.name, nodeview];
57444
- });
57512
+ }).filter(Boolean);
57445
57513
  return Object.fromEntries(entries);
57446
57514
  }
57447
57515
  };
@@ -58064,6 +58132,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58064
58132
  const updateYdocDocxData = async (editor, ydoc) => {
58065
58133
  ydoc = ydoc || editor.options.ydoc;
58066
58134
  if (!ydoc) return;
58135
+ if (!editor || editor.isDestroyed) return;
58067
58136
  const metaMap = ydoc.getMap("meta");
58068
58137
  const docxValue = metaMap.get("docx");
58069
58138
  let docx = [];
@@ -58095,6 +58164,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58095
58164
  { event: "docx-update", user: editor.options.user }
58096
58165
  );
58097
58166
  };
58167
+ const STYLE_ISOLATION_CLASS = "sd-editor-scoped";
58168
+ const applyStyleIsolationClass = (target) => {
58169
+ if (!target || !target.classList) return;
58170
+ target.classList.add(STYLE_ISOLATION_CLASS);
58171
+ };
58098
58172
  const PaginationPluginKey = new PluginKey("paginationPlugin");
58099
58173
  const initPaginationData = async (editor) => {
58100
58174
  if (!editor.converter) return;
@@ -58130,6 +58204,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58130
58204
  return new Promise((resolve2) => {
58131
58205
  const editorContainer = document.createElement("div");
58132
58206
  editorContainer.className = "super-editor";
58207
+ applyStyleIsolationClass(editorContainer);
58133
58208
  editorContainer.style.padding = "0";
58134
58209
  editorContainer.style.margin = "0";
58135
58210
  const sectionEditor = createHeaderFooterEditor({ editor, data, editorContainer });
@@ -58157,6 +58232,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58157
58232
  const { fontSizePt, typeface, fontFamilyCss } = parentStyles;
58158
58233
  const fontSizeInPixles = fontSizePt * 1.3333;
58159
58234
  const lineHeight2 = fontSizeInPixles * 1.2;
58235
+ applyStyleIsolationClass(editorContainer);
58160
58236
  Object.assign(editorContainer.style, {
58161
58237
  padding: "0",
58162
58238
  margin: "0",
@@ -59555,6 +59631,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59555
59631
  });
59556
59632
  });
59557
59633
  return [syncPlugin];
59634
+ },
59635
+ addCommands() {
59636
+ return {
59637
+ addImageToCollaboration: ({ mediaPath, fileData }) => () => {
59638
+ if (!this.options.ydoc || !mediaPath || !fileData) return false;
59639
+ const mediaMap = this.options.ydoc.getMap("media");
59640
+ mediaMap.set(mediaPath, fileData);
59641
+ return true;
59642
+ }
59643
+ };
59558
59644
  }
59559
59645
  });
59560
59646
  const createSyncPlugin = (ydoc, editor) => {
@@ -61407,7 +61493,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61407
61493
  { default: remarkStringify2 },
61408
61494
  { default: remarkGfm2 }
61409
61495
  ] = await Promise.all([
61410
- Promise.resolve().then(() => indexB3rVM2bJ),
61496
+ Promise.resolve().then(() => indexF9UTAd9o),
61411
61497
  Promise.resolve().then(() => indexDRCvimau),
61412
61498
  Promise.resolve().then(() => indexC_x_N6Uh),
61413
61499
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -61625,7 +61711,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61625
61711
  * @returns {Object | void} Migration results
61626
61712
  */
61627
61713
  processCollaborationMigrations() {
61628
- console.debug("[checkVersionMigrations] Current editor version", "0.28.2");
61714
+ console.debug("[checkVersionMigrations] Current editor version", "0.29.0-next.2");
61629
61715
  if (!this.options.ydoc) return;
61630
61716
  const metaMap = this.options.ydoc.getMap("meta");
61631
61717
  let docVersion = metaMap.get("version");
@@ -61816,7 +61902,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61816
61902
  options.element.classList.add("sd-super-editor-html");
61817
61903
  }
61818
61904
  }
61819
- options.element = options.isHeadless ? null : options.element || document.createElement("div");
61905
+ if (options.isHeadless) {
61906
+ options.element = null;
61907
+ return;
61908
+ }
61909
+ options.element = options.element || document.createElement("div");
61910
+ applyStyleIsolationClass(options.element);
61820
61911
  };
61821
61912
  init_fn = function() {
61822
61913
  __privateMethod$1(this, _Editor_instances, createExtensionService_fn).call(this);
@@ -66699,6 +66790,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66699
66790
  }
66700
66791
  });
66701
66792
  }
66793
+ const shouldSkipNodeView = (editor) => {
66794
+ return editor.options.isHeadless;
66795
+ };
66702
66796
  const ListItem = Node$1.create({
66703
66797
  name: "listItem",
66704
66798
  content: "paragraph* block*",
@@ -66725,9 +66819,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66725
66819
  },
66726
66820
  /**
66727
66821
  * Important: The listItem node uses a custom node view.
66728
- * @returns {import('@core/NodeView.js').NodeView}
66822
+ * Skip node view in headless mode for performance.
66823
+ * @returns {import('@core/NodeView.js').NodeView|null}
66729
66824
  */
66730
66825
  addNodeView() {
66826
+ if (shouldSkipNodeView(this.editor)) return null;
66731
66827
  return ({ node: node2, editor, getPos, decorations }) => {
66732
66828
  return new ListItemNodeView(node2, getPos, decorations, editor);
66733
66829
  };
@@ -81839,6 +81935,7 @@ ${l}
81839
81935
  this.view = view;
81840
81936
  this.popover = document.createElement("div");
81841
81937
  this.popover.className = "sd-editor-popover";
81938
+ applyStyleIsolationClass(this.popover);
81842
81939
  document.body.appendChild(this.popover);
81843
81940
  this.tippyInstance = tippy(this.popover, {
81844
81941
  trigger: "manual",
@@ -83255,6 +83352,7 @@ ${l}
83255
83352
  const tempContainer = editor.options.element.cloneNode();
83256
83353
  if (!tempContainer) return [];
83257
83354
  tempContainer.className = "temp-container super-editor";
83355
+ applyStyleIsolationClass(tempContainer);
83258
83356
  const HIDDEN_EDITOR_OFFSET_TOP = 0;
83259
83357
  const HIDDEN_EDITOR_OFFSET_LEFT = 0;
83260
83358
  tempContainer.style.left = HIDDEN_EDITOR_OFFSET_TOP + "px";
@@ -84303,6 +84401,7 @@ ${l}
84303
84401
  handleEl.style.pointerEvents = "auto";
84304
84402
  resizeContainer.appendChild(handleEl);
84305
84403
  }
84404
+ applyStyleIsolationClass(resizeContainer);
84306
84405
  document.body.appendChild(resizeContainer);
84307
84406
  updateHandlePositions(wrapper.firstElementChild);
84308
84407
  }
@@ -117523,7 +117622,7 @@ ${style2}
117523
117622
  this.config.colors = shuffleArray(this.config.colors);
117524
117623
  this.userColorMap = /* @__PURE__ */ new Map();
117525
117624
  this.colorIndex = 0;
117526
- this.version = "0.28.2";
117625
+ this.version = "0.29.0-next.2";
117527
117626
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
117528
117627
  this.superdocId = config2.superdocId || v4();
117529
117628
  this.colors = this.config.colors;
@@ -119923,7 +120022,7 @@ ${style2}
119923
120022
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
119924
120023
  );
119925
120024
  }
119926
- const indexB3rVM2bJ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
120025
+ const indexF9UTAd9o = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
119927
120026
  __proto__: null,
119928
120027
  unified
119929
120028
  }, Symbol.toStringTag, { value: "Module" }));