@harbour-enterprises/superdoc 0.28.1 → 0.29.0-next.1

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 (67) hide show
  1. package/dist/chunks/{PdfViewer-Can0yoW4.cjs → PdfViewer-D-eZ2Yov.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-DJkdA-8o.es.js → PdfViewer-DkZrQk4g.es.js} +1 -1
  3. package/dist/chunks/{index-DidXsI6u.es.js → index-DJQlES_f.es.js} +3 -3
  4. package/dist/chunks/{index-njnq8umX-DU2xcaHZ.es.js → index-DQ6dCde6-BZTSGgXX.es.js} +1 -1
  5. package/dist/chunks/{index-njnq8umX-_TfP84XP.cjs → index-DQ6dCde6-BnMDi7G1.cjs} +1 -1
  6. package/dist/chunks/{index-BY-vlgKe.cjs → index-zeAsCB89.cjs} +3 -3
  7. package/dist/chunks/{super-editor.es-ksiTgGLm.cjs → super-editor.es-BV85aAFJ.cjs} +1739 -1156
  8. package/dist/chunks/{super-editor.es-Br566URP.es.js → super-editor.es-CLErM40t.es.js} +1739 -1156
  9. package/dist/core/types/index.d.ts.map +1 -1
  10. package/dist/style.css +10 -0
  11. package/dist/super-editor/ai-writer.es.js +2 -2
  12. package/dist/super-editor/chunks/{converter-D6Z6OmA3.js → converter-iD03MYzC.js} +748 -672
  13. package/dist/super-editor/chunks/{docx-zipper-Dni97kMT.js → docx-zipper-nrZgxvR8.js} +1 -1
  14. package/dist/super-editor/chunks/{editor-D3TKfdXs.js → editor-C7iHgXnE.js} +644 -137
  15. package/dist/super-editor/chunks/{index-njnq8umX.js → index-DQ6dCde6.js} +1 -1
  16. package/dist/super-editor/chunks/{toolbar-fNE3luLB.js → toolbar-DKrq-G-q.js} +2 -2
  17. package/dist/super-editor/converter.es.js +1 -1
  18. package/dist/super-editor/docx-zipper.es.js +2 -2
  19. package/dist/super-editor/editor.es.js +3 -3
  20. package/dist/super-editor/file-zipper.es.js +1 -1
  21. package/dist/super-editor/style.css +10 -0
  22. package/dist/super-editor/super-editor/src/core/helpers/rangeUtils.d.ts +2 -0
  23. package/dist/super-editor/super-editor/src/core/super-converter/relationship-helpers.d.ts +2 -0
  24. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/listImporter.d.ts +1 -1
  25. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/numberingCache.d.ts +2 -2
  26. package/dist/super-editor/super-editor/src/extensions/field-annotation/FieldAnnotationPlugin.d.ts +5 -1
  27. package/dist/super-editor/super-editor/src/extensions/image/imageHelpers/imagePositionPlugin.d.ts +2 -0
  28. package/dist/super-editor/super-editor/src/extensions/list-item/helpers/listItemTypography.d.ts +5 -0
  29. package/dist/super-editor/super-editor/src/extensions/list-item/helpers/styledListMarkerPlugin.d.ts +11 -2
  30. package/dist/super-editor/super-editor/src/extensions/tab/helpers/tabDecorations.d.ts +4 -1
  31. package/dist/super-editor/super-editor/src/utils/headless-helpers.d.ts +1 -0
  32. package/dist/super-editor/super-editor/src/utils/styleIsolation.d.ts +2 -0
  33. package/dist/super-editor/super-editor.es.js +6 -6
  34. package/dist/super-editor/toolbar.es.js +2 -2
  35. package/dist/super-editor.cjs +1 -1
  36. package/dist/super-editor.es.js +1 -1
  37. package/dist/superdoc.cjs +2 -2
  38. package/dist/superdoc.es.js +2 -2
  39. package/dist/superdoc.umd.js +1503 -920
  40. package/dist/superdoc.umd.js.map +1 -1
  41. package/package.json +1 -1
  42. package/dist/images/altText_add.svg +0 -3
  43. package/dist/images/altText_disclaimer.svg +0 -3
  44. package/dist/images/altText_done.svg +0 -3
  45. package/dist/images/altText_spinner.svg +0 -30
  46. package/dist/images/altText_warning.svg +0 -3
  47. package/dist/images/annotation-check.svg +0 -11
  48. package/dist/images/annotation-comment.svg +0 -16
  49. package/dist/images/annotation-help.svg +0 -26
  50. package/dist/images/annotation-insert.svg +0 -10
  51. package/dist/images/annotation-key.svg +0 -11
  52. package/dist/images/annotation-newparagraph.svg +0 -11
  53. package/dist/images/annotation-noicon.svg +0 -7
  54. package/dist/images/annotation-note.svg +0 -42
  55. package/dist/images/annotation-paperclip.svg +0 -6
  56. package/dist/images/annotation-paragraph.svg +0 -16
  57. package/dist/images/annotation-pushpin.svg +0 -7
  58. package/dist/images/cursor-editorFreeHighlight.svg +0 -6
  59. package/dist/images/cursor-editorFreeText.svg +0 -3
  60. package/dist/images/cursor-editorInk.svg +0 -4
  61. package/dist/images/cursor-editorTextHighlight.svg +0 -8
  62. package/dist/images/editor-toolbar-delete.svg +0 -5
  63. package/dist/images/loading-icon.gif +0 -0
  64. package/dist/images/messageBar_closingButton.svg +0 -3
  65. package/dist/images/messageBar_warning.svg +0 -3
  66. package/dist/images/toolbarButton-editorHighlight.svg +0 -6
  67. package/dist/images/toolbarButton-menuArrow.svg +0 -3
@@ -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, 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, applyIndentStyling_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_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 updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberingHelpers, ap as parseIndentElement, aq as combineIndents, ar as twipsToPixels, as as PIXELS_PER_INCH, at as SelectionRange, au as Transform, av as isInTable$1, aw as generateDocxRandomId, ax as insertNewRelationship, ay as inchesToPixels } from "./converter-D6Z6OmA3.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 updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberingHelpers, ap as parseIndentElement, aq as combineIndents, ar as twipsToPixels, as as PIXELS_PER_INCH, at as SelectionRange, au as Transform, av as isInTable$1, aw as generateDocxRandomId, ax as insertNewRelationship, ay as inchesToPixels } from "./converter-iD03MYzC.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-Dni97kMT.js";
17
+ import { D as DocxZipper } from "./docx-zipper-nrZgxvR8.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -11017,10 +11017,12 @@ const _ExtensionService = class _ExtensionService {
11017
11017
  type: getNodeType(extension.name, this.schema)
11018
11018
  };
11019
11019
  const addNodeView = getExtensionConfigField(extension, "addNodeView", context);
11020
- if (!addNodeView) return [];
11020
+ if (!addNodeView) return null;
11021
+ const nodeViewFunction = addNodeView();
11022
+ if (!nodeViewFunction) return null;
11021
11023
  const nodeview = (node, _view, getPos, decorations) => {
11022
11024
  const htmlAttributes = Attribute.getAttributesToRender(node, extensionAttrs);
11023
- return addNodeView()({
11025
+ return nodeViewFunction({
11024
11026
  editor,
11025
11027
  node,
11026
11028
  getPos,
@@ -11030,7 +11032,7 @@ const _ExtensionService = class _ExtensionService {
11030
11032
  });
11031
11033
  };
11032
11034
  return [extension.name, nodeview];
11033
- });
11035
+ }).filter(Boolean);
11034
11036
  return Object.fromEntries(entries);
11035
11037
  }
11036
11038
  };
@@ -11302,17 +11304,7 @@ const TrackChangesBasePlugin = () => {
11302
11304
  },
11303
11305
  apply(tr, oldState, prevEditorState, newEditorState) {
11304
11306
  const meta = tr.getMeta(TrackChangesBasePluginKey);
11305
- if (!meta) {
11306
- return {
11307
- ...oldState,
11308
- decorations: getTrackChangesDecorations(
11309
- newEditorState,
11310
- oldState.onlyOriginalShown,
11311
- oldState.onlyModifiedShown
11312
- )
11313
- };
11314
- }
11315
- if (meta.type === "TRACK_CHANGES_ENABLE") {
11307
+ if (meta && meta.type === "TRACK_CHANGES_ENABLE") {
11316
11308
  return {
11317
11309
  ...oldState,
11318
11310
  isTrackChangesActive: meta.value === true,
@@ -11323,7 +11315,7 @@ const TrackChangesBasePlugin = () => {
11323
11315
  )
11324
11316
  };
11325
11317
  }
11326
- if (meta.type === "SHOW_ONLY_ORIGINAL") {
11318
+ if (meta && meta.type === "SHOW_ONLY_ORIGINAL") {
11327
11319
  return {
11328
11320
  ...oldState,
11329
11321
  onlyOriginalShown: meta.value === true,
@@ -11331,7 +11323,7 @@ const TrackChangesBasePlugin = () => {
11331
11323
  decorations: getTrackChangesDecorations(newEditorState, meta.value === true, false)
11332
11324
  };
11333
11325
  }
11334
- if (meta.type === "SHOW_ONLY_MODIFIED") {
11326
+ if (meta && meta.type === "SHOW_ONLY_MODIFIED") {
11335
11327
  return {
11336
11328
  ...oldState,
11337
11329
  onlyOriginalShown: false,
@@ -11339,6 +11331,31 @@ const TrackChangesBasePlugin = () => {
11339
11331
  decorations: getTrackChangesDecorations(newEditorState, false, meta.value === true)
11340
11332
  };
11341
11333
  }
11334
+ if (!tr.docChanged) {
11335
+ return oldState;
11336
+ }
11337
+ if (!meta) {
11338
+ let mightAffectTrackChanges = false;
11339
+ tr.steps.forEach((step) => {
11340
+ if (step.slice || step.from !== step.to) {
11341
+ mightAffectTrackChanges = true;
11342
+ }
11343
+ });
11344
+ if (mightAffectTrackChanges) {
11345
+ return {
11346
+ ...oldState,
11347
+ decorations: getTrackChangesDecorations(
11348
+ newEditorState,
11349
+ oldState.onlyOriginalShown,
11350
+ oldState.onlyModifiedShown
11351
+ )
11352
+ };
11353
+ }
11354
+ return {
11355
+ ...oldState,
11356
+ decorations: oldState.decorations.map(tr.mapping, tr.doc)
11357
+ };
11358
+ }
11342
11359
  return {
11343
11360
  ...oldState,
11344
11361
  decorations: getTrackChangesDecorations(
@@ -11647,6 +11664,7 @@ const getHighlightColor = ({ activeThreadId, threadId, isInternal, editor }) =>
11647
11664
  const updateYdocDocxData = async (editor, ydoc) => {
11648
11665
  ydoc = ydoc || editor.options.ydoc;
11649
11666
  if (!ydoc) return;
11667
+ if (!editor || editor.isDestroyed) return;
11650
11668
  const metaMap = ydoc.getMap("meta");
11651
11669
  const docxValue = metaMap.get("docx");
11652
11670
  let docx = [];
@@ -11678,6 +11696,11 @@ const updateYdocDocxData = async (editor, ydoc) => {
11678
11696
  { event: "docx-update", user: editor.options.user }
11679
11697
  );
11680
11698
  };
11699
+ const STYLE_ISOLATION_CLASS = "sd-editor-scoped";
11700
+ const applyStyleIsolationClass = (target) => {
11701
+ if (!target || !target.classList) return;
11702
+ target.classList.add(STYLE_ISOLATION_CLASS);
11703
+ };
11681
11704
  const PaginationPluginKey = new PluginKey("paginationPlugin");
11682
11705
  const initPaginationData = async (editor) => {
11683
11706
  if (!editor.converter) return;
@@ -11713,6 +11736,7 @@ const getSectionHeight = async (editor, data) => {
11713
11736
  return new Promise((resolve) => {
11714
11737
  const editorContainer = document.createElement("div");
11715
11738
  editorContainer.className = "super-editor";
11739
+ applyStyleIsolationClass(editorContainer);
11716
11740
  editorContainer.style.padding = "0";
11717
11741
  editorContainer.style.margin = "0";
11718
11742
  const sectionEditor = createHeaderFooterEditor({ editor, data, editorContainer });
@@ -11740,6 +11764,7 @@ const createHeaderFooterEditor = ({
11740
11764
  const { fontSizePt, typeface, fontFamilyCss } = parentStyles;
11741
11765
  const fontSizeInPixles = fontSizePt * 1.3333;
11742
11766
  const lineHeight = fontSizeInPixles * 1.2;
11767
+ applyStyleIsolationClass(editorContainer);
11743
11768
  Object.assign(editorContainer.style, {
11744
11769
  padding: "0",
11745
11770
  margin: "0",
@@ -12093,6 +12118,7 @@ const CommentsPlugin = Extension.create({
12093
12118
  view() {
12094
12119
  let prevDoc;
12095
12120
  let prevActiveThreadId;
12121
+ let prevAllCommentPositions = {};
12096
12122
  return {
12097
12123
  update(view) {
12098
12124
  const { state } = view;
@@ -12103,16 +12129,19 @@ const CommentsPlugin = Extension.create({
12103
12129
  if (meta?.type === "setActiveComment" || meta?.forceUpdate) {
12104
12130
  shouldUpdate = true;
12105
12131
  }
12106
- if (prevDoc && !prevDoc.eq(doc2)) shouldUpdate = true;
12107
- if (prevActiveThreadId !== currentActiveThreadId) {
12132
+ const docChanged = prevDoc && !prevDoc.eq(doc2);
12133
+ if (docChanged) shouldUpdate = true;
12134
+ const activeThreadChanged = prevActiveThreadId !== currentActiveThreadId;
12135
+ if (activeThreadChanged) {
12108
12136
  shouldUpdate = true;
12109
12137
  prevActiveThreadId = currentActiveThreadId;
12110
12138
  }
12139
+ const onlyActiveThreadChanged = !docChanged && activeThreadChanged;
12111
12140
  if (!shouldUpdate) return;
12112
12141
  prevDoc = doc2;
12113
12142
  shouldUpdate = false;
12114
12143
  const decorations = [];
12115
- const allCommentPositions = {};
12144
+ const allCommentPositions = onlyActiveThreadChanged ? prevAllCommentPositions : {};
12116
12145
  doc2.descendants((node, pos) => {
12117
12146
  const { marks = [] } = node;
12118
12147
  const commentMarks = marks.filter((mark) => mark.type.name === CommentMarkName);
@@ -12120,14 +12149,16 @@ const CommentsPlugin = Extension.create({
12120
12149
  commentMarks.forEach((commentMark) => {
12121
12150
  const { attrs } = commentMark;
12122
12151
  const threadId = attrs.commentId || attrs.importedId;
12123
- const currentBounds = view.coordsAtPos(pos);
12124
- updatePosition({
12125
- allCommentPositions,
12126
- threadId,
12127
- pos,
12128
- currentBounds,
12129
- node
12130
- });
12152
+ if (!onlyActiveThreadChanged) {
12153
+ const currentBounds = view.coordsAtPos(pos);
12154
+ updatePosition({
12155
+ allCommentPositions,
12156
+ threadId,
12157
+ pos,
12158
+ currentBounds,
12159
+ node
12160
+ });
12161
+ }
12131
12162
  const isInternal = attrs.internal;
12132
12163
  if (!hasActive) hasActive = currentActiveThreadId === threadId;
12133
12164
  let color = getHighlightColor({
@@ -12150,20 +12181,22 @@ const CommentsPlugin = Extension.create({
12150
12181
  to: pos + node.nodeSize
12151
12182
  });
12152
12183
  if (trackedChangeMark) {
12153
- const currentBounds = view.coordsAtPos(pos);
12154
- const { id } = trackedChangeMark.mark.attrs;
12155
- updatePosition({
12156
- allCommentPositions,
12157
- threadId: id,
12158
- pos,
12159
- currentBounds,
12160
- node
12161
- });
12162
- const isActiveTrackedChange = currentActiveThreadId === id;
12184
+ if (!onlyActiveThreadChanged) {
12185
+ const currentBounds = view.coordsAtPos(pos);
12186
+ const { id } = trackedChangeMark.mark.attrs;
12187
+ updatePosition({
12188
+ allCommentPositions,
12189
+ threadId: id,
12190
+ pos,
12191
+ currentBounds,
12192
+ node
12193
+ });
12194
+ }
12195
+ const isActiveTrackedChange = currentActiveThreadId === trackedChangeMark.mark.attrs.id;
12163
12196
  if (isActiveTrackedChange) {
12164
12197
  const trackedChangeDeco = Decoration.inline(pos, pos + node.nodeSize, {
12165
12198
  style: `border-width: 2px;`,
12166
- "data-thread-id": id,
12199
+ "data-thread-id": trackedChangeMark.mark.attrs.id,
12167
12200
  class: "sd-editor-tracked-change-highlight"
12168
12201
  });
12169
12202
  decorations.push(trackedChangeDeco);
@@ -12181,7 +12214,13 @@ const CommentsPlugin = Extension.create({
12181
12214
  });
12182
12215
  view.dispatch(tr2);
12183
12216
  }
12184
- editor.emit("comment-positions", { allCommentPositions });
12217
+ if (!onlyActiveThreadChanged) {
12218
+ const positionsChanged = hasPositionsChanged(prevAllCommentPositions, allCommentPositions);
12219
+ if (positionsChanged) {
12220
+ prevAllCommentPositions = allCommentPositions;
12221
+ editor.emit("comment-positions", { allCommentPositions });
12222
+ }
12223
+ }
12185
12224
  }
12186
12225
  };
12187
12226
  }
@@ -12189,6 +12228,19 @@ const CommentsPlugin = Extension.create({
12189
12228
  return [commentsPlugin];
12190
12229
  }
12191
12230
  });
12231
+ const hasPositionsChanged = (prevPositions, currPositions) => {
12232
+ const prevKeys = Object.keys(prevPositions);
12233
+ const currKeys = Object.keys(currPositions);
12234
+ if (prevKeys.length !== currKeys.length) return true;
12235
+ for (const key2 of currKeys) {
12236
+ const prev = prevPositions[key2];
12237
+ const curr = currPositions[key2];
12238
+ if (!prev || prev.top !== curr.top || prev.left !== curr.left) {
12239
+ return true;
12240
+ }
12241
+ }
12242
+ return false;
12243
+ };
12192
12244
  const getActiveCommentId = (doc2, selection) => {
12193
12245
  if (!selection) return;
12194
12246
  const { $from, $to } = selection;
@@ -13103,6 +13155,16 @@ const Collaboration = Extension.create({
13103
13155
  });
13104
13156
  });
13105
13157
  return [syncPlugin];
13158
+ },
13159
+ addCommands() {
13160
+ return {
13161
+ addImageToCollaboration: ({ mediaPath, fileData }) => () => {
13162
+ if (!this.options.ydoc || !mediaPath || !fileData) return false;
13163
+ const mediaMap = this.options.ydoc.getMap("media");
13164
+ mediaMap.set(mediaPath, fileData);
13165
+ return true;
13166
+ }
13167
+ };
13106
13168
  }
13107
13169
  });
13108
13170
  const createSyncPlugin = (ydoc, editor) => {
@@ -15002,7 +15064,7 @@ const _Editor = class _Editor extends EventEmitter {
15002
15064
  { default: remarkStringify },
15003
15065
  { default: remarkGfm }
15004
15066
  ] = await Promise.all([
15005
- import("./index-njnq8umX.js"),
15067
+ import("./index-DQ6dCde6.js"),
15006
15068
  import("./index-DRCvimau.js"),
15007
15069
  import("./index-C_x_N6Uh.js"),
15008
15070
  import("./index-D_sWOSiG.js"),
@@ -15220,7 +15282,7 @@ const _Editor = class _Editor extends EventEmitter {
15220
15282
  * @returns {Object | void} Migration results
15221
15283
  */
15222
15284
  processCollaborationMigrations() {
15223
- console.debug("[checkVersionMigrations] Current editor version", "0.28.0");
15285
+ console.debug("[checkVersionMigrations] Current editor version", "0.28.2");
15224
15286
  if (!this.options.ydoc) return;
15225
15287
  const metaMap = this.options.ydoc.getMap("meta");
15226
15288
  let docVersion = metaMap.get("version");
@@ -15416,7 +15478,12 @@ initContainerElement_fn = function(options) {
15416
15478
  options.element.classList.add("sd-super-editor-html");
15417
15479
  }
15418
15480
  }
15419
- options.element = options.isHeadless ? null : options.element || document.createElement("div");
15481
+ if (options.isHeadless) {
15482
+ options.element = null;
15483
+ return;
15484
+ }
15485
+ options.element = options.element || document.createElement("div");
15486
+ applyStyleIsolationClass(options.element);
15420
15487
  };
15421
15488
  /**
15422
15489
  * Initialize the editor with the given options
@@ -19561,8 +19628,36 @@ const createLinkedStylesPlugin = (editor) => {
19561
19628
  if (!editor.converter || editor.options.mode !== "docx") return { ...prev };
19562
19629
  let decorations = prev.decorations || DecorationSet.empty;
19563
19630
  if (tr.docChanged) {
19564
- const styles = LinkedStylesPluginKey.getState(editor.state).styles;
19565
- decorations = generateDecorations(newEditorState, styles);
19631
+ let mightAffectStyles = false;
19632
+ const styleRelatedMarks = /* @__PURE__ */ new Set(["textStyle", "bold", "italic", "underline", "strike"]);
19633
+ tr.steps.forEach((step) => {
19634
+ if (step.slice) {
19635
+ step.slice.content.descendants((node) => {
19636
+ if (node.attrs?.styleId) {
19637
+ mightAffectStyles = true;
19638
+ return false;
19639
+ }
19640
+ if (node.marks.length > 0) {
19641
+ const hasStyleMarks = node.marks.some((mark) => styleRelatedMarks.has(mark.type.name));
19642
+ if (hasStyleMarks) {
19643
+ mightAffectStyles = true;
19644
+ return false;
19645
+ }
19646
+ }
19647
+ });
19648
+ }
19649
+ if (step.jsonID === "addMark" || step.jsonID === "removeMark") {
19650
+ if (step.mark && styleRelatedMarks.has(step.mark.type.name)) {
19651
+ mightAffectStyles = true;
19652
+ }
19653
+ }
19654
+ });
19655
+ if (mightAffectStyles) {
19656
+ const styles = LinkedStylesPluginKey.getState(editor.state).styles;
19657
+ decorations = generateDecorations(newEditorState, styles);
19658
+ } else {
19659
+ decorations = decorations.map(tr.mapping, tr.doc);
19660
+ }
19566
19661
  }
19567
19662
  return { ...prev, decorations };
19568
19663
  }
@@ -19875,6 +19970,12 @@ function parseFontFamilyFromRunProperties(listRunProperties) {
19875
19970
  const eastAsia = listRunProperties?.["w:eastAsia"];
19876
19971
  return ascii || hAnsi || eastAsia || null;
19877
19972
  }
19973
+ const computedStylesCache = /* @__PURE__ */ new WeakMap();
19974
+ function clearComputedStyleCache(domNode) {
19975
+ if (domNode) {
19976
+ computedStylesCache.delete(domNode);
19977
+ }
19978
+ }
19878
19979
  function readNodeViewStyles(view) {
19879
19980
  const fallback = { fontSize: null, fontFamily: null, lineHeight: null };
19880
19981
  if (!view?.dom) return fallback;
@@ -19884,13 +19985,27 @@ function readNodeViewStyles(view) {
19884
19985
  lineHeight: view.dom.style?.lineHeight || null
19885
19986
  };
19886
19987
  if (inline.fontSize && inline.fontFamily && inline.lineHeight) return inline;
19988
+ if (computedStylesCache.has(view.dom)) {
19989
+ const cached = computedStylesCache.get(view.dom);
19990
+ return {
19991
+ fontSize: inline.fontSize || cached.fontSize,
19992
+ fontFamily: inline.fontFamily || cached.fontFamily,
19993
+ lineHeight: inline.lineHeight || cached.lineHeight
19994
+ };
19995
+ }
19887
19996
  const globalWindow = typeof window !== "undefined" ? window : void 0;
19888
19997
  if (globalWindow?.getComputedStyle) {
19889
19998
  const computed2 = globalWindow.getComputedStyle(view.dom);
19999
+ const computedStyles = {
20000
+ fontSize: computed2.fontSize,
20001
+ fontFamily: computed2.fontFamily,
20002
+ lineHeight: computed2.lineHeight
20003
+ };
20004
+ computedStylesCache.set(view.dom, computedStyles);
19890
20005
  return {
19891
- fontSize: inline.fontSize || computed2.fontSize,
19892
- fontFamily: inline.fontFamily || computed2.fontFamily,
19893
- lineHeight: inline.lineHeight || computed2.lineHeight
20006
+ fontSize: inline.fontSize || computedStyles.fontSize,
20007
+ fontFamily: inline.fontFamily || computedStyles.fontFamily,
20008
+ lineHeight: inline.lineHeight || computedStyles.lineHeight
19894
20009
  };
19895
20010
  }
19896
20011
  return inline;
@@ -20104,9 +20219,14 @@ class ListItemNodeView {
20104
20219
  });
20105
20220
  }
20106
20221
  update(node, decorations) {
20222
+ const prevNode = this.node;
20107
20223
  this.node = node;
20108
20224
  this.decorations = decorations;
20109
20225
  this.invalidateResolvedPos();
20226
+ const stylingAttrsChanged = !prevNode || prevNode.attrs.styleId !== node.attrs.styleId || prevNode.attrs.numId !== node.attrs.numId || prevNode.attrs.level !== node.attrs.level;
20227
+ if (stylingAttrsChanged) {
20228
+ clearComputedStyleCache(this.dom);
20229
+ }
20110
20230
  const { fontSize, fontFamily, lineHeight } = resolveListItemTypography({
20111
20231
  node,
20112
20232
  pos: this.getResolvedPos(),
@@ -20117,11 +20237,15 @@ class ListItemNodeView {
20117
20237
  this.dom.style.fontSize = fontSize;
20118
20238
  this.dom.style.fontFamily = fontFamily || "inherit";
20119
20239
  this.dom.style.lineHeight = lineHeight || "";
20120
- this.refreshIndentStyling();
20240
+ const attrsChanged = stylingAttrsChanged || prevNode?.attrs.indent !== node.attrs.indent;
20241
+ if (attrsChanged) {
20242
+ this.refreshIndentStyling();
20243
+ }
20121
20244
  }
20122
20245
  destroy() {
20123
20246
  activeListItemNodeViews.delete(this);
20124
20247
  this.numberingDOM.removeEventListener("click", this.handleNumberingClick);
20248
+ clearComputedStyleCache(this.dom);
20125
20249
  const caf = typeof globalThis !== "undefined" ? globalThis.cancelAnimationFrame : void 0;
20126
20250
  if (this._pendingIndentRefresh != null && typeof caf === "function") {
20127
20251
  caf(this._pendingIndentRefresh);
@@ -20240,8 +20364,11 @@ function calculateMarkerWidth(dom, numberingDOM, editor, { withPadding = true }
20240
20364
  if (!markerText.trim()) return 0;
20241
20365
  try {
20242
20366
  if (editor?.options?.isHeadless) return 0;
20367
+ if (typeof globalThis.CanvasRenderingContext2D === "undefined") return 0;
20243
20368
  const canvas = document.createElement("canvas");
20369
+ if (typeof canvas.getContext !== "function") return 0;
20244
20370
  const context = canvas.getContext("2d");
20371
+ if (!context) return 0;
20245
20372
  const fontSizePx = fontSize.includes("pt") ? Number.parseFloat(fontSize) * POINT_TO_PIXEL_CONVERSION_FACTOR : Number.parseFloat(fontSize);
20246
20373
  context.font = `${fontSizePx}px ${fontFamily}`;
20247
20374
  const textWidth = context.measureText(markerText).width;
@@ -20260,7 +20387,9 @@ function orderedListSync(editor) {
20260
20387
  appendTransaction(transactions, oldState, newState) {
20261
20388
  if (transactions.every((tr2) => tr2.getMeta("y-sync$"))) return null;
20262
20389
  const updateNodeViews = transactions.some((tr2) => tr2.getMeta("updatedListItemNodeViews"));
20263
- if (updateNodeViews || !hasInitialized) refreshAllListItemNodeViews();
20390
+ if (updateNodeViews || !hasInitialized) {
20391
+ refreshAllListItemNodeViews();
20392
+ }
20264
20393
  const isFromPlugin = transactions.some((tr2) => tr2.getMeta("orderedListSync"));
20265
20394
  const docChanged = transactions.some((tr2) => tr2.docChanged) && !oldState.doc.eq(newState.doc);
20266
20395
  if (isFromPlugin || !docChanged) {
@@ -20272,10 +20401,24 @@ function orderedListSync(editor) {
20272
20401
  const listMap = /* @__PURE__ */ new Map();
20273
20402
  const listInitialized = /* @__PURE__ */ new Map();
20274
20403
  const shouldProcess = transactions.some((tr2) => {
20404
+ if (tr2.getMeta("updateListSync")) return true;
20275
20405
  return tr2.steps.some((step) => {
20276
20406
  const stepJSON = step.toJSON();
20277
- const hasUpdateMeta = tr2.getMeta("updateListSync");
20278
- return hasUpdateMeta || stepJSON && stepJSON.slice && JSON.stringify(stepJSON).includes('"listItem"');
20407
+ if (step.slice?.content) {
20408
+ let hasListItem = false;
20409
+ step.slice.content.descendants((node) => {
20410
+ if (node.type.name === "listItem") {
20411
+ hasListItem = true;
20412
+ return false;
20413
+ }
20414
+ });
20415
+ if (hasListItem) return true;
20416
+ }
20417
+ if (stepJSON && stepJSON.slice) {
20418
+ const jsonStr = JSON.stringify(stepJSON);
20419
+ if (jsonStr.includes('"listItem"')) return true;
20420
+ }
20421
+ return false;
20279
20422
  });
20280
20423
  });
20281
20424
  if (!shouldProcess) return null;
@@ -20339,6 +20482,9 @@ function orderedListSync(editor) {
20339
20482
  }
20340
20483
  });
20341
20484
  }
20485
+ const shouldSkipNodeView = (editor) => {
20486
+ return editor.options.isHeadless;
20487
+ };
20342
20488
  const ListItem = Node$1.create({
20343
20489
  name: "listItem",
20344
20490
  content: "paragraph* block*",
@@ -20365,9 +20511,11 @@ const ListItem = Node$1.create({
20365
20511
  },
20366
20512
  /**
20367
20513
  * Important: The listItem node uses a custom node view.
20368
- * @returns {import('@core/NodeView.js').NodeView}
20514
+ * Skip node view in headless mode for performance.
20515
+ * @returns {import('@core/NodeView.js').NodeView|null}
20369
20516
  */
20370
20517
  addNodeView() {
20518
+ if (shouldSkipNodeView(this.editor)) return null;
20371
20519
  return ({ node, editor, getPos, decorations }) => {
20372
20520
  return new ListItemNodeView(node, getPos, decorations, editor);
20373
20521
  };
@@ -20745,17 +20893,68 @@ const Paragraph = OxmlNode.create({
20745
20893
  },
20746
20894
  addPmPlugins() {
20747
20895
  const { view } = this.editor;
20896
+ const dropcapWidthCache = /* @__PURE__ */ new Map();
20897
+ const hasDropcapParagraph = (node) => node.type.name === "paragraph" && node.attrs.dropcap?.type === "margin";
20898
+ const invalidateCacheForRange = (from2, to) => {
20899
+ for (const [pos] of dropcapWidthCache) {
20900
+ if (pos >= from2 && pos <= to) {
20901
+ dropcapWidthCache.delete(pos);
20902
+ }
20903
+ }
20904
+ };
20748
20905
  const dropcapPlugin = new Plugin({
20749
20906
  name: "dropcapPlugin",
20750
20907
  key: new PluginKey("dropcapPlugin"),
20751
20908
  state: {
20752
20909
  init(_, state) {
20753
- let decorations = getDropcapDecorations(state, view);
20910
+ const decorations = getDropcapDecorations(state, view, dropcapWidthCache);
20754
20911
  return DecorationSet.create(state.doc, decorations);
20755
20912
  },
20756
20913
  apply(tr, oldDecorationSet, oldState, newState) {
20757
20914
  if (!tr.docChanged) return oldDecorationSet;
20758
- const decorations = getDropcapDecorations(newState, view);
20915
+ let hasDropcaps = false;
20916
+ newState.doc.descendants((node) => {
20917
+ if (hasDropcapParagraph(node)) {
20918
+ hasDropcaps = true;
20919
+ return false;
20920
+ }
20921
+ });
20922
+ if (!hasDropcaps) {
20923
+ dropcapWidthCache.clear();
20924
+ return DecorationSet.empty;
20925
+ }
20926
+ let affectsDropcaps = false;
20927
+ tr.steps.forEach((step) => {
20928
+ if (step.slice?.content) {
20929
+ step.slice.content.descendants((node) => {
20930
+ if (hasDropcapParagraph(node)) {
20931
+ affectsDropcaps = true;
20932
+ return false;
20933
+ }
20934
+ });
20935
+ }
20936
+ if (step.jsonID === "replace" && step.from !== void 0 && step.to !== void 0) {
20937
+ try {
20938
+ oldState.doc.nodesBetween(step.from, step.to, (node) => {
20939
+ if (hasDropcapParagraph(node)) {
20940
+ affectsDropcaps = true;
20941
+ return false;
20942
+ }
20943
+ });
20944
+ } catch {
20945
+ affectsDropcaps = true;
20946
+ }
20947
+ }
20948
+ });
20949
+ if (!affectsDropcaps) {
20950
+ return oldDecorationSet.map(tr.mapping, tr.doc);
20951
+ }
20952
+ tr.steps.forEach((step) => {
20953
+ if (step.from !== void 0 && step.to !== void 0) {
20954
+ invalidateCacheForRange(step.from, step.to);
20955
+ }
20956
+ });
20957
+ const decorations = getDropcapDecorations(newState, view, dropcapWidthCache);
20759
20958
  return DecorationSet.create(newState.doc, decorations);
20760
20959
  }
20761
20960
  },
@@ -20768,12 +20967,12 @@ const Paragraph = OxmlNode.create({
20768
20967
  return [dropcapPlugin];
20769
20968
  }
20770
20969
  });
20771
- const getDropcapDecorations = (state, view) => {
20772
- let decorations = [];
20970
+ const getDropcapDecorations = (state, view, widthCache) => {
20971
+ const decorations = [];
20773
20972
  state.doc.descendants((node, pos) => {
20774
20973
  if (node.type.name === "paragraph") {
20775
20974
  if (node.attrs.dropcap?.type === "margin") {
20776
- const width = getDropcapWidth(view, pos);
20975
+ const width = getDropcapWidth(view, pos, widthCache);
20777
20976
  decorations.push(Decoration.inline(pos, pos + node.nodeSize, { style: `margin-left: -${width}px;` }));
20778
20977
  }
20779
20978
  return false;
@@ -20781,12 +20980,17 @@ const getDropcapDecorations = (state, view) => {
20781
20980
  });
20782
20981
  return decorations;
20783
20982
  };
20784
- function getDropcapWidth(view, pos) {
20983
+ function getDropcapWidth(view, pos, widthCache) {
20984
+ if (widthCache.has(pos)) {
20985
+ return widthCache.get(pos);
20986
+ }
20785
20987
  const domNode = view.nodeDOM(pos);
20786
20988
  if (domNode) {
20787
20989
  const range = document.createRange();
20788
20990
  range.selectNodeContents(domNode);
20789
- return range.getBoundingClientRect().width;
20991
+ const width = range.getBoundingClientRect().width;
20992
+ widthCache.set(pos, width);
20993
+ return width;
20790
20994
  }
20791
20995
  return 0;
20792
20996
  }
@@ -20972,10 +21176,16 @@ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
20972
21176
  const paragraphContext = getParagraphContext($pos, paragraphCache, helpers2);
20973
21177
  if (!paragraphContext) return;
20974
21178
  try {
20975
- const { tabStops, flattened, startPos } = paragraphContext;
20976
- const entryIndex = flattened.findIndex((entry) => entry.pos === pos);
20977
- if (entryIndex === -1) return;
20978
- const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent, coordCache, domPosCache);
21179
+ const { tabStops, flattened, positionMap, startPos } = paragraphContext;
21180
+ const entryIndex = positionMap.get(pos);
21181
+ if (entryIndex === void 0) return;
21182
+ if (paragraphContext.indentWidth === void 0) {
21183
+ paragraphContext.indentWidth = getIndentWidth(view, startPos, paragraphContext.indent, coordCache, domPosCache);
21184
+ }
21185
+ if (paragraphContext.tabHeight === void 0) {
21186
+ paragraphContext.tabHeight = calcTabHeight($pos);
21187
+ }
21188
+ const indentWidth = paragraphContext.indentWidth;
20979
21189
  const accumulatedTabWidth = paragraphContext.accumulatedTabWidth || 0;
20980
21190
  const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos, coordCache, domPosCache) + accumulatedTabWidth;
20981
21191
  let tabWidth;
@@ -21017,7 +21227,7 @@ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
21017
21227
  tabWidth = defaultTabDistance - currentWidth % defaultLineLength % defaultTabDistance;
21018
21228
  if (tabWidth === 0) tabWidth = defaultTabDistance;
21019
21229
  }
21020
- const tabHeight = calcTabHeight($pos);
21230
+ const tabHeight = paragraphContext.tabHeight;
21021
21231
  decorations.push(
21022
21232
  Decoration.node(pos, pos + node.nodeSize, {
21023
21233
  style: `width: ${tabWidth}px; height: ${tabHeight};${extraStyles}`
@@ -21045,13 +21255,16 @@ function getParagraphContext($pos, cache, helpers2) {
21045
21255
  tabStops = style.definition.styles.tabStops;
21046
21256
  }
21047
21257
  }
21258
+ const { entries, positionMap } = flattenParagraph(node, startPos);
21048
21259
  cache.set(startPos, {
21049
21260
  paragraph: node,
21050
21261
  paragraphDepth: depth,
21051
21262
  startPos,
21052
21263
  indent: node.attrs?.indent || {},
21053
21264
  tabStops,
21054
- flattened: flattenParagraph(node, startPos),
21265
+ flattened: entries,
21266
+ positionMap,
21267
+ // Store position map for O(1) lookups
21055
21268
  accumulatedTabWidth: 0
21056
21269
  });
21057
21270
  }
@@ -21062,6 +21275,7 @@ function getParagraphContext($pos, cache, helpers2) {
21062
21275
  }
21063
21276
  function flattenParagraph(paragraph, paragraphStartPos) {
21064
21277
  const entries = [];
21278
+ const positionMap = /* @__PURE__ */ new Map();
21065
21279
  const walk = (node, basePos) => {
21066
21280
  if (!node) return;
21067
21281
  if (node.type?.name === "run") {
@@ -21071,13 +21285,16 @@ function flattenParagraph(paragraph, paragraphStartPos) {
21071
21285
  });
21072
21286
  return;
21073
21287
  }
21074
- entries.push({ node, pos: basePos - 1 });
21288
+ const pos = basePos - 1;
21289
+ const index2 = entries.length;
21290
+ entries.push({ node, pos });
21291
+ positionMap.set(pos, index2);
21075
21292
  };
21076
21293
  paragraph.forEach((child, offset2) => {
21077
21294
  const childPos = paragraphStartPos + offset2 + 1;
21078
21295
  walk(child, childPos);
21079
21296
  });
21080
- return entries;
21297
+ return { entries, positionMap };
21081
21298
  }
21082
21299
  function findNextTabIndex(flattened, fromIndex) {
21083
21300
  for (let i = fromIndex; i < flattened.length; i++) {
@@ -21235,6 +21452,21 @@ const TabNode = Node$1.create({
21235
21452
  },
21236
21453
  addPmPlugins() {
21237
21454
  const { view, helpers: helpers2 } = this.editor;
21455
+ const mergeRanges2 = (ranges) => {
21456
+ if (ranges.length === 0) return [];
21457
+ const sorted = ranges.slice().sort((a, b) => a[0] - b[0]);
21458
+ const merged = [sorted[0]];
21459
+ for (let i = 1; i < sorted.length; i++) {
21460
+ const [start2, end2] = sorted[i];
21461
+ const last = merged[merged.length - 1];
21462
+ if (start2 <= last[1]) {
21463
+ last[1] = Math.max(last[1], end2);
21464
+ } else {
21465
+ merged.push([start2, end2]);
21466
+ }
21467
+ }
21468
+ return merged;
21469
+ };
21238
21470
  const tabPlugin = new Plugin({
21239
21471
  name: "tabPlugin",
21240
21472
  key: new PluginKey("tabPlugin"),
@@ -21245,43 +21477,56 @@ const TabNode = Node$1.create({
21245
21477
  apply(tr, { decorations }, _oldState, newState) {
21246
21478
  if (!decorations) {
21247
21479
  decorations = DecorationSet.create(newState.doc, getTabDecorations(newState.doc, view, helpers2));
21480
+ return { decorations };
21248
21481
  }
21249
- if (!tr.docChanged || tr.getMeta("blockNodeInitialUpdate") === true) {
21482
+ if (!tr.docChanged || tr.getMeta("blockNodeInitialUpdate")) {
21250
21483
  return { decorations };
21251
21484
  }
21252
21485
  decorations = decorations.map(tr.mapping, tr.doc);
21253
- let rangesToRecalculate = [];
21486
+ const rangesToRecalculate = [];
21487
+ const containsTab = (node) => node.type.name === "tab";
21254
21488
  tr.steps.forEach((step, index2) => {
21255
- const stepMap = step.getMap();
21256
- if (step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1) {
21257
- const $from = tr.docs[index2].resolve(step.from);
21258
- const $to = tr.docs[index2].resolve(step.to);
21259
- const start2 = $from.start(Math.min($from.depth, 1));
21260
- const end2 = $to.end(Math.min($to.depth, 1));
21261
- let addRange = false;
21262
- tr.docs[index2].nodesBetween(start2, end2, (node) => {
21263
- if (node.type.name === "tab") {
21264
- addRange = true;
21489
+ if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1)) {
21490
+ return;
21491
+ }
21492
+ let hasTabInRange = false;
21493
+ if (step.slice?.content) {
21494
+ step.slice.content.descendants((node) => {
21495
+ if (containsTab(node)) {
21496
+ hasTabInRange = true;
21497
+ return false;
21265
21498
  }
21266
21499
  });
21267
- if (!addRange && step.slice?.content) {
21268
- step.slice.content.descendants((node) => {
21269
- if (node.type.name === "tab") {
21270
- addRange = true;
21271
- }
21272
- });
21273
- }
21274
- if (addRange) {
21275
- rangesToRecalculate.push([start2, end2]);
21276
- }
21277
21500
  }
21278
- rangesToRecalculate = rangesToRecalculate.map(([from2, to]) => {
21279
- const mappedFrom = stepMap.map(from2, -1);
21280
- const mappedTo = stepMap.map(to, 1);
21281
- return [mappedFrom, mappedTo];
21282
- });
21501
+ if (!hasTabInRange) {
21502
+ tr.docs[index2].nodesBetween(step.from, step.to, (node) => {
21503
+ if (containsTab(node)) {
21504
+ hasTabInRange = true;
21505
+ return false;
21506
+ }
21507
+ });
21508
+ }
21509
+ if (!hasTabInRange) {
21510
+ return;
21511
+ }
21512
+ let fromPos = step.from;
21513
+ let toPos = step.to;
21514
+ for (let i = index2; i < tr.steps.length; i++) {
21515
+ const stepMap = tr.steps[i].getMap();
21516
+ fromPos = stepMap.map(fromPos, -1);
21517
+ toPos = stepMap.map(toPos, 1);
21518
+ }
21519
+ const $from = newState.doc.resolve(fromPos);
21520
+ const $to = newState.doc.resolve(toPos);
21521
+ const start2 = $from.start(Math.min($from.depth, 1));
21522
+ const end2 = $to.end(Math.min($to.depth, 1));
21523
+ rangesToRecalculate.push([start2, end2]);
21283
21524
  });
21284
- rangesToRecalculate.forEach(([start2, end2]) => {
21525
+ if (rangesToRecalculate.length === 0) {
21526
+ return { decorations };
21527
+ }
21528
+ const mergedRanges = mergeRanges2(rangesToRecalculate);
21529
+ mergedRanges.forEach(([start2, end2]) => {
21285
21530
  const oldDecorations = decorations.find(start2, end2);
21286
21531
  decorations = decorations.remove(oldDecorations);
21287
21532
  const newDecorations = getTabDecorations(newState.doc, view, helpers2, start2, end2);
@@ -25183,6 +25428,29 @@ createAnnotation_fn = function({ displayLabel } = {}) {
25183
25428
  content
25184
25429
  };
25185
25430
  };
25431
+ const mergeRanges = (ranges) => {
25432
+ if (ranges.length === 0) return [];
25433
+ const sorted = [...ranges].sort((a, b) => a[0] - b[0]).map((range) => [...range]);
25434
+ const merged = [sorted[0]];
25435
+ for (let i = 1; i < sorted.length; i++) {
25436
+ const current = sorted[i];
25437
+ const lastMerged = merged[merged.length - 1];
25438
+ if (current[0] <= lastMerged[1]) {
25439
+ lastMerged[1] = Math.max(lastMerged[1], current[1]);
25440
+ } else {
25441
+ merged.push(current);
25442
+ }
25443
+ }
25444
+ return merged;
25445
+ };
25446
+ const clampRange = (start2, end2, docSize) => {
25447
+ const safeStart = Math.max(0, Math.min(start2, docSize));
25448
+ const safeEnd = Math.max(0, Math.min(end2, docSize));
25449
+ if (safeStart >= safeEnd) {
25450
+ return null;
25451
+ }
25452
+ return [safeStart, safeEnd];
25453
+ };
25186
25454
  const FieldAnnotationPlugin = (options = {}) => {
25187
25455
  let { editor, annotationClass: annotationClass2 } = options;
25188
25456
  return new Plugin({
@@ -25257,24 +25525,104 @@ const FieldAnnotationPlugin = (options = {}) => {
25257
25525
  },
25258
25526
  /// For y-prosemirror support.
25259
25527
  appendTransaction: (transactions, oldState, newState) => {
25260
- let docChanges = transactions.some((tr2) => tr2.docChanged) && !oldState.doc.eq(newState.doc);
25528
+ const docChanges = transactions.some((tr2) => tr2.docChanged) && !oldState.doc.eq(newState.doc);
25261
25529
  if (!docChanges) {
25262
25530
  return;
25263
25531
  }
25264
- let { tr } = newState;
25265
- let changed = false;
25266
- let annotations = getAllFieldAnnotations(newState);
25267
- if (!annotations.length) {
25268
- return;
25532
+ const affectedRanges = [];
25533
+ let hasFieldAnnotationsInSlice = false;
25534
+ let hasSteps = false;
25535
+ transactions.forEach((transaction) => {
25536
+ if (!transaction.steps) return;
25537
+ hasSteps = true;
25538
+ transaction.steps.forEach((step) => {
25539
+ if (step.slice?.content) {
25540
+ step.slice.content.descendants((node) => {
25541
+ if (node.type.name === "fieldAnnotation") {
25542
+ hasFieldAnnotationsInSlice = true;
25543
+ return false;
25544
+ }
25545
+ });
25546
+ }
25547
+ if (typeof step.from === "number" && typeof step.to === "number") {
25548
+ const from2 = step.from;
25549
+ const to = step.from === step.to && step.slice?.size ? step.from + step.slice.size : step.to;
25550
+ affectedRanges.push([from2, to]);
25551
+ }
25552
+ });
25553
+ });
25554
+ if (hasSteps && !hasFieldAnnotationsInSlice && affectedRanges.length > 0) {
25555
+ const mergedRanges = mergeRanges(affectedRanges);
25556
+ let hasExistingAnnotations = false;
25557
+ for (const [start2, end2] of mergedRanges) {
25558
+ const clampedRange = clampRange(start2, end2, newState.doc.content.size);
25559
+ if (!clampedRange) continue;
25560
+ const [validStart, validEnd] = clampedRange;
25561
+ try {
25562
+ newState.doc.nodesBetween(validStart, validEnd, (node) => {
25563
+ if (node.type.name === "fieldAnnotation") {
25564
+ hasExistingAnnotations = true;
25565
+ return false;
25566
+ }
25567
+ });
25568
+ } catch (error) {
25569
+ console.warn("FieldAnnotationPlugin: range check failed, assuming annotations exist", error);
25570
+ hasExistingAnnotations = true;
25571
+ break;
25572
+ }
25573
+ if (hasExistingAnnotations) break;
25574
+ }
25575
+ if (!hasExistingAnnotations) {
25576
+ return;
25577
+ }
25269
25578
  }
25270
- annotations.forEach(({ node, pos }) => {
25271
- let { marks } = node;
25272
- let currentNode = tr.doc.nodeAt(pos);
25579
+ const { tr } = newState;
25580
+ let changed = false;
25581
+ const removeMarksFromAnnotation = (node, pos) => {
25582
+ const { marks } = node;
25583
+ const currentNode = tr.doc.nodeAt(pos);
25273
25584
  if (marks.length > 0 && node.eq(currentNode)) {
25274
25585
  tr.removeMark(pos, pos + node.nodeSize, null);
25275
25586
  changed = true;
25276
25587
  }
25277
- });
25588
+ };
25589
+ if (affectedRanges.length > 0) {
25590
+ const mergedRanges = mergeRanges(affectedRanges);
25591
+ let shouldFallbackToFullScan = false;
25592
+ for (const [start2, end2] of mergedRanges) {
25593
+ const clampedRange = clampRange(start2, end2, newState.doc.content.size);
25594
+ if (!clampedRange) continue;
25595
+ const [validStart, validEnd] = clampedRange;
25596
+ try {
25597
+ newState.doc.nodesBetween(validStart, validEnd, (node, pos) => {
25598
+ if (node.type.name === "fieldAnnotation") {
25599
+ removeMarksFromAnnotation(node, pos);
25600
+ }
25601
+ });
25602
+ } catch (error) {
25603
+ console.warn("FieldAnnotationPlugin: nodesBetween failed, falling back to full scan", error);
25604
+ shouldFallbackToFullScan = true;
25605
+ break;
25606
+ }
25607
+ }
25608
+ if (shouldFallbackToFullScan) {
25609
+ const annotations = getAllFieldAnnotations(newState);
25610
+ if (!annotations.length) {
25611
+ return changed ? tr : null;
25612
+ }
25613
+ annotations.forEach(({ node, pos }) => {
25614
+ removeMarksFromAnnotation(node, pos);
25615
+ });
25616
+ }
25617
+ } else {
25618
+ const annotations = getAllFieldAnnotations(newState);
25619
+ if (!annotations.length) {
25620
+ return;
25621
+ }
25622
+ annotations.forEach(({ node, pos }) => {
25623
+ removeMarksFromAnnotation(node, pos);
25624
+ });
25625
+ }
25278
25626
  return changed ? tr : null;
25279
25627
  }
25280
25628
  ///
@@ -27084,7 +27432,9 @@ const registerImages = async (foundImages, editor, view) => {
27084
27432
  }
27085
27433
  });
27086
27434
  };
27435
+ const stepHasSlice = (step) => "slice" in step && Boolean(step.slice);
27087
27436
  const ImagePositionPluginKey = new PluginKey("ImagePosition");
27437
+ const pageBreakPositionCache = /* @__PURE__ */ new WeakMap();
27088
27438
  const ImagePositionPlugin = ({ editor }) => {
27089
27439
  const { view } = editor;
27090
27440
  let shouldUpdate = false;
@@ -27097,6 +27447,20 @@ const ImagePositionPlugin = ({ editor }) => {
27097
27447
  },
27098
27448
  apply(tr, oldDecorationSet, oldState, newState) {
27099
27449
  if (!tr.docChanged && !shouldUpdate) return oldDecorationSet;
27450
+ let affectsImages = false;
27451
+ tr.steps.forEach((step) => {
27452
+ if (stepHasSlice(step)) {
27453
+ step.slice.content.descendants((node) => {
27454
+ if (node.type.name === "image" || node.attrs?.anchorData) {
27455
+ affectsImages = true;
27456
+ return false;
27457
+ }
27458
+ });
27459
+ }
27460
+ });
27461
+ if (!affectsImages && !shouldUpdate) {
27462
+ return oldDecorationSet.map(tr.mapping, tr.doc);
27463
+ }
27100
27464
  const decorations = getImagePositionDecorations(newState, view);
27101
27465
  shouldUpdate = false;
27102
27466
  return DecorationSet.create(newState.doc, decorations);
@@ -27126,6 +27490,16 @@ const ImagePositionPlugin = ({ editor }) => {
27126
27490
  };
27127
27491
  const getImagePositionDecorations = (state, view) => {
27128
27492
  let decorations = [];
27493
+ let hasAnchoredImages = false;
27494
+ state.doc.descendants((node) => {
27495
+ if (node.attrs?.anchorData) {
27496
+ hasAnchoredImages = true;
27497
+ return false;
27498
+ }
27499
+ });
27500
+ if (!hasAnchoredImages) {
27501
+ return decorations;
27502
+ }
27129
27503
  state.doc.descendants((node, pos) => {
27130
27504
  if (node.attrs.anchorData) {
27131
27505
  let style = "";
@@ -27134,7 +27508,15 @@ const getImagePositionDecorations = (state, view) => {
27134
27508
  const { size, padding } = node.attrs;
27135
27509
  const pageBreak = findPreviousDomNodeWithClass(view, pos, "pagination-break-wrapper");
27136
27510
  if (pageBreak && vRelativeFrom === "margin" && alignH) {
27137
- const topPos = pageBreak?.offsetTop + pageBreak?.offsetHeight;
27511
+ let pageBreakPos = pageBreakPositionCache.get(pageBreak);
27512
+ if (!pageBreakPos) {
27513
+ pageBreakPos = {
27514
+ top: pageBreak.offsetTop,
27515
+ height: pageBreak.offsetHeight
27516
+ };
27517
+ pageBreakPositionCache.set(pageBreak, pageBreakPos);
27518
+ }
27519
+ const topPos = pageBreakPos.top + pageBreakPos.height;
27138
27520
  let horizontalAlignment = `${alignH}: 0;`;
27139
27521
  if (alignH === "center") horizontalAlignment = "left: 50%; transform: translateX(-50%);";
27140
27522
  style += vRelativeFrom === "margin" ? `position: absolute; top: ${topPos}px; ${horizontalAlignment}` : "";
@@ -27445,15 +27827,15 @@ const Image = Node$1.create({
27445
27827
  style += "float: right;";
27446
27828
  floatRight = true;
27447
27829
  } else if (["largest", "bothSides"].includes(attrs.wrapText)) {
27448
- const pageStylesData2 = getDataFromPageStyles({
27830
+ const pageStylesData = getDataFromPageStyles({
27449
27831
  editor: this.editor,
27450
27832
  marginOffset,
27451
27833
  size,
27452
27834
  attrs
27453
27835
  });
27454
- style += pageStylesData2.style;
27455
- floatRight = pageStylesData2.floatRight;
27456
- baseHorizontal = pageStylesData2.baseHorizontal;
27836
+ style += pageStylesData.style;
27837
+ floatRight = pageStylesData.floatRight;
27838
+ baseHorizontal = pageStylesData.baseHorizontal;
27457
27839
  }
27458
27840
  if (attrs.distTop) margin.top += attrs.distTop;
27459
27841
  if (attrs.distBottom) margin.bottom += attrs.distBottom;
@@ -27461,7 +27843,7 @@ const Image = Node$1.create({
27461
27843
  if (attrs.distRight) margin.right += attrs.distRight;
27462
27844
  break;
27463
27845
  case "Through":
27464
- case "Tight":
27846
+ case "Tight": {
27465
27847
  style += "clear: both;";
27466
27848
  const pageStylesData = getDataFromPageStyles({
27467
27849
  editor: this.editor,
@@ -27498,11 +27880,14 @@ const Image = Node$1.create({
27498
27880
  style += `shape-outside: polygon(${points});`;
27499
27881
  }
27500
27882
  break;
27883
+ }
27501
27884
  case "TopAndBottom":
27502
27885
  style += "display: block; clear: both;";
27886
+ if (!anchorData) {
27887
+ centered = true;
27888
+ }
27503
27889
  if (attrs.distTop) margin.top += attrs.distTop;
27504
27890
  if (attrs.distBottom) margin.bottom += attrs.distBottom;
27505
- centered = true;
27506
27891
  break;
27507
27892
  }
27508
27893
  }
@@ -27522,6 +27907,20 @@ const Image = Node$1.create({
27522
27907
  style += `position: absolute; ${anchorData.alignH}: 0;`;
27523
27908
  }
27524
27909
  break;
27910
+ case "column":
27911
+ if (anchorData.alignH === "center") {
27912
+ centered = true;
27913
+ } else if (anchorData.alignH === "right") {
27914
+ floatRight = true;
27915
+ if (!style.includes("float: right;")) {
27916
+ style += "float: right;";
27917
+ }
27918
+ } else if (anchorData.alignH === "left") {
27919
+ if (!style.includes("float: left;")) {
27920
+ style += "float: left;";
27921
+ }
27922
+ }
27923
+ break;
27525
27924
  }
27526
27925
  }
27527
27926
  if (hasAnchorData || hasMarginOffsets) {
@@ -28609,11 +29008,22 @@ const BlockNode = Extension.create({
28609
29008
  },
28610
29009
  addPmPlugins() {
28611
29010
  let hasInitialized = false;
29011
+ const assignBlockId = (tr, node, pos) => {
29012
+ tr.setNodeMarkup(
29013
+ pos,
29014
+ void 0,
29015
+ {
29016
+ ...node.attrs,
29017
+ sdBlockId: v4()
29018
+ },
29019
+ node.marks
29020
+ );
29021
+ };
28612
29022
  return [
28613
29023
  new Plugin({
28614
29024
  key: BlockNodePluginKey,
28615
29025
  appendTransaction: (transactions, oldState, newState) => {
28616
- let docChanges = transactions.some((tr2) => tr2.docChanged) && !oldState.doc.eq(newState.doc);
29026
+ const docChanges = transactions.some((tr2) => tr2.docChanged) && !oldState.doc.eq(newState.doc);
28617
29027
  if (hasInitialized && !docChanges) {
28618
29028
  return;
28619
29029
  }
@@ -28622,21 +29032,87 @@ const BlockNode = Extension.create({
28622
29032
  }
28623
29033
  const { tr } = newState;
28624
29034
  let changed = false;
28625
- newState.doc.descendants((node, pos) => {
28626
- if (!nodeAllowsSdBlockIdAttr(node) || !nodeNeedsSdBlockId(node)) {
28627
- return;
29035
+ if (!hasInitialized) {
29036
+ newState.doc.descendants((node, pos) => {
29037
+ if (nodeAllowsSdBlockIdAttr(node) && nodeNeedsSdBlockId(node)) {
29038
+ assignBlockId(tr, node, pos);
29039
+ changed = true;
29040
+ }
29041
+ });
29042
+ } else {
29043
+ const rangesToCheck = [];
29044
+ let shouldFallbackToFullTraversal = false;
29045
+ transactions.forEach((transaction, txIndex) => {
29046
+ transaction.steps.forEach((step, stepIndex) => {
29047
+ if (!(step instanceof ReplaceStep)) return;
29048
+ const hasNewBlockNodes = step.slice?.content?.content?.some((node) => nodeAllowsSdBlockIdAttr(node));
29049
+ if (!hasNewBlockNodes) return;
29050
+ const stepMap = step.getMap();
29051
+ stepMap.forEach((_oldStart, _oldEnd, newStart, newEnd) => {
29052
+ if (newEnd <= newStart) {
29053
+ if (process$1.env.NODE_ENV === "development") {
29054
+ console.debug("Block node: invalid range in step map, falling back to full traversal");
29055
+ }
29056
+ shouldFallbackToFullTraversal = true;
29057
+ return;
29058
+ }
29059
+ let rangeStart = newStart;
29060
+ let rangeEnd = newEnd;
29061
+ for (let i = stepIndex + 1; i < transaction.steps.length; i++) {
29062
+ const laterStepMap = transaction.steps[i].getMap();
29063
+ rangeStart = laterStepMap.map(rangeStart, -1);
29064
+ rangeEnd = laterStepMap.map(rangeEnd, 1);
29065
+ }
29066
+ for (let i = txIndex + 1; i < transactions.length; i++) {
29067
+ const laterTx = transactions[i];
29068
+ rangeStart = laterTx.mapping.map(rangeStart, -1);
29069
+ rangeEnd = laterTx.mapping.map(rangeEnd, 1);
29070
+ }
29071
+ if (rangeEnd <= rangeStart) {
29072
+ if (process$1.env.NODE_ENV === "development") {
29073
+ console.debug("Block node: invalid range after mapping, falling back to full traversal");
29074
+ }
29075
+ shouldFallbackToFullTraversal = true;
29076
+ return;
29077
+ }
29078
+ rangesToCheck.push([rangeStart, rangeEnd]);
29079
+ });
29080
+ });
29081
+ });
29082
+ const mergedRanges = mergeRanges(rangesToCheck);
29083
+ for (const [start2, end2] of mergedRanges) {
29084
+ const docSize = newState.doc.content.size;
29085
+ const clampedRange = clampRange(start2, end2, docSize);
29086
+ if (!clampedRange) {
29087
+ if (process$1.env.NODE_ENV === "development") {
29088
+ console.debug("Block node: invalid range after clamping, falling back to full traversal");
29089
+ }
29090
+ shouldFallbackToFullTraversal = true;
29091
+ break;
29092
+ }
29093
+ const [safeStart, safeEnd] = clampedRange;
29094
+ try {
29095
+ newState.doc.nodesBetween(safeStart, safeEnd, (node, pos) => {
29096
+ if (nodeAllowsSdBlockIdAttr(node) && nodeNeedsSdBlockId(node)) {
29097
+ assignBlockId(tr, node, pos);
29098
+ changed = true;
29099
+ }
29100
+ });
29101
+ } catch (error) {
29102
+ console.warn("Block node plugin: nodesBetween failed, falling back to full traversal", error);
29103
+ shouldFallbackToFullTraversal = true;
29104
+ break;
29105
+ }
28628
29106
  }
28629
- tr.setNodeMarkup(
28630
- pos,
28631
- void 0,
28632
- {
28633
- ...node.attrs,
28634
- sdBlockId: v4()
28635
- },
28636
- node.marks
28637
- );
28638
- changed = true;
28639
- });
29107
+ if (shouldFallbackToFullTraversal) {
29108
+ newState.doc.descendants((node, pos) => {
29109
+ if (nodeAllowsSdBlockIdAttr(node) && nodeNeedsSdBlockId(node)) {
29110
+ assignBlockId(tr, node, pos);
29111
+ changed = true;
29112
+ }
29113
+ });
29114
+ }
29115
+ }
28640
29116
  if (changed && !hasInitialized) {
28641
29117
  hasInitialized = true;
28642
29118
  tr.setMeta("blockNodeInitialUpdate", true);
@@ -35112,8 +35588,8 @@ const PopoverPlugin = Extension.create({
35112
35588
  return {};
35113
35589
  },
35114
35590
  apply: (tr, value) => {
35115
- let newValue = { ...value };
35116
- if (tr.docChanged) {
35591
+ const newValue = { ...value };
35592
+ if (tr.docChanged || tr.selectionSet) {
35117
35593
  newValue.shouldUpdate = true;
35118
35594
  } else {
35119
35595
  newValue.shouldUpdate = false;
@@ -35151,6 +35627,7 @@ class Popover {
35151
35627
  this.view = view;
35152
35628
  this.popover = document.createElement("div");
35153
35629
  this.popover.className = "sd-editor-popover";
35630
+ applyStyleIsolationClass(this.popover);
35154
35631
  document.body.appendChild(this.popover);
35155
35632
  this.tippyInstance = tippy(this.popover, {
35156
35633
  trigger: "manual",
@@ -36368,6 +36845,8 @@ const Pagination = Extension.create({
36368
36845
  let shouldUpdate = false;
36369
36846
  let hasInitialized = false;
36370
36847
  let shouldInitialize = false;
36848
+ let paginationTimeout = null;
36849
+ const PAGINATION_DEBOUNCE_MS = 150;
36371
36850
  const paginationPlugin = new Plugin({
36372
36851
  key: PaginationPluginKey,
36373
36852
  state: {
@@ -36395,6 +36874,9 @@ const Pagination = Extension.create({
36395
36874
  shouldUpdate = true;
36396
36875
  shouldInitialize = meta.isReadyToInit;
36397
36876
  }
36877
+ if (meta && meta.skipPagination) {
36878
+ return { ...oldState };
36879
+ }
36398
36880
  const syncMeta = tr.getMeta("y-sync$");
36399
36881
  const listSyncMeta = tr.getMeta("orderedListSync");
36400
36882
  if (syncMeta && syncMeta.isChangeOrigin || listSyncMeta) {
@@ -36426,11 +36908,23 @@ const Pagination = Extension.create({
36426
36908
  shouldUpdate = false;
36427
36909
  return { ...oldState };
36428
36910
  }
36911
+ if (!isForceUpdate && hasInitialized && tr.docChanged) {
36912
+ let isMarkOnlyChange = true;
36913
+ tr.steps.forEach((step) => {
36914
+ if (step.jsonID !== "addMark" && step.jsonID !== "removeMark") {
36915
+ isMarkOnlyChange = false;
36916
+ }
36917
+ });
36918
+ if (isMarkOnlyChange) {
36919
+ shouldUpdate = false;
36920
+ return { ...oldState };
36921
+ }
36922
+ }
36429
36923
  shouldUpdate = true;
36430
36924
  if (isForceUpdate) shouldUpdate = true;
36431
36925
  return {
36432
36926
  ...oldState,
36433
- decorations: meta?.decorations?.map(tr.mapping, tr.doc) || DecorationSet.empty,
36927
+ decorations: meta?.decorations?.map(tr.mapping, tr.doc) || oldState.decorations.map(tr.mapping, tr.doc),
36434
36928
  isReadyToInit: shouldInitialize
36435
36929
  };
36436
36930
  }
@@ -36442,11 +36936,22 @@ const Pagination = Extension.create({
36442
36936
  update: (view) => {
36443
36937
  if (!PaginationPluginKey.getState(view.state)?.isEnabled) return;
36444
36938
  if (!shouldUpdate || isUpdating) return;
36445
- isUpdating = true;
36446
- hasInitialized = true;
36447
- performUpdate(editor, view, previousDecorations);
36448
- isUpdating = false;
36449
- shouldUpdate = false;
36939
+ const performPaginationUpdate = () => {
36940
+ if (!shouldUpdate) return;
36941
+ isUpdating = true;
36942
+ hasInitialized = true;
36943
+ performUpdate(editor, view, previousDecorations);
36944
+ isUpdating = false;
36945
+ shouldUpdate = false;
36946
+ };
36947
+ if (!hasInitialized) {
36948
+ performPaginationUpdate();
36949
+ return;
36950
+ }
36951
+ if (paginationTimeout) {
36952
+ clearTimeout(paginationTimeout);
36953
+ }
36954
+ paginationTimeout = setTimeout(performPaginationUpdate, PAGINATION_DEBOUNCE_MS);
36450
36955
  }
36451
36956
  };
36452
36957
  },
@@ -36539,6 +37044,7 @@ const calculatePageBreaks = (view, editor, sectionData) => {
36539
37044
  const tempContainer = editor.options.element.cloneNode();
36540
37045
  if (!tempContainer) return [];
36541
37046
  tempContainer.className = "temp-container super-editor";
37047
+ applyStyleIsolationClass(tempContainer);
36542
37048
  const HIDDEN_EDITOR_OFFSET_TOP = 0;
36543
37049
  const HIDDEN_EDITOR_OFFSET_LEFT = 0;
36544
37050
  tempContainer.style.left = HIDDEN_EDITOR_OFFSET_TOP + "px";
@@ -37587,6 +38093,7 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
37587
38093
  handleEl.style.pointerEvents = "auto";
37588
38094
  resizeContainer.appendChild(handleEl);
37589
38095
  }
38096
+ applyStyleIsolationClass(resizeContainer);
37590
38097
  document.body.appendChild(resizeContainer);
37591
38098
  updateHandlePositions(wrapper.firstElementChild);
37592
38099
  }