superdoc 0.31.0-next.5 → 0.31.0-next.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/chunks/{PdfViewer-DXwcotXc.cjs → PdfViewer-BSud7RY4.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-BjFaPQBd.es.js → PdfViewer-DK93vPf1.es.js} +1 -1
  3. package/dist/chunks/{index-B6TttOzK.es.js → index-Bz2Q2Xq2.es.js} +3 -3
  4. package/dist/chunks/{index-BF_Yvius.cjs → index-Crequs_q.cjs} +3 -3
  5. package/dist/chunks/{index-B7dC-H-Q-BeQx_MXI.es.js → index-DAES86tg-BDL6WVta.es.js} +1 -1
  6. package/dist/chunks/{index-B7dC-H-Q-DfBEU7rR.cjs → index-DAES86tg-Cjexh3WM.cjs} +1 -1
  7. package/dist/chunks/{super-editor.es-M2e4wbRW.es.js → super-editor.es-BWeMHRHm.es.js} +35 -5
  8. package/dist/chunks/{super-editor.es-CVDIAxlg.cjs → super-editor.es-D8NdQdlk.cjs} +35 -5
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-BIsS-JzD.js → converter-DEQxlCAJ.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-DVDiaIyD.js → docx-zipper-C6VMEIY_.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-ZbcM1RTL.js → editor-D0zFmUwx.js} +36 -6
  13. package/dist/super-editor/chunks/{index-B7dC-H-Q.js → index-DAES86tg.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-8qqw8IXG.js → toolbar-Cwx5bBDV.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor/src/extensions/linked-styles/helpers.d.ts +1 -0
  20. package/dist/super-editor/super-editor/src/extensions/linked-styles/helpers.d.ts.map +1 -1
  21. package/dist/super-editor/super-editor/src/extensions/linked-styles/plugin.d.ts.map +1 -1
  22. package/dist/super-editor/super-editor/src/extensions/paragraph/paragraph.d.ts.map +1 -1
  23. package/dist/super-editor/super-editor.es.js +6 -6
  24. package/dist/super-editor/toolbar.es.js +2 -2
  25. package/dist/super-editor.cjs +1 -1
  26. package/dist/super-editor.es.js +1 -1
  27. package/dist/superdoc.cjs +2 -2
  28. package/dist/superdoc.es.js +2 -2
  29. package/dist/superdoc.umd.js +37 -7
  30. package/dist/superdoc.umd.js.map +1 -1
  31. package/package.json +1 -1
@@ -35303,7 +35303,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35303
35303
  static getStoredSuperdocVersion(docx) {
35304
35304
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35305
35305
  }
35306
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.31.0-next.5") {
35306
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.31.0-next.6") {
35307
35307
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35308
35308
  }
35309
35309
  /**
@@ -60304,7 +60304,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60304
60304
  { default: remarkStringify2 },
60305
60305
  { default: remarkGfm2 }
60306
60306
  ] = await Promise.all([
60307
- Promise.resolve().then(() => indexB7dCHQ),
60307
+ Promise.resolve().then(() => indexDAES86tg),
60308
60308
  Promise.resolve().then(() => indexDRCvimau),
60309
60309
  Promise.resolve().then(() => indexC_x_N6Uh),
60310
60310
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -60505,7 +60505,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60505
60505
  * Process collaboration migrations
60506
60506
  */
60507
60507
  processCollaborationMigrations() {
60508
- console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.5");
60508
+ console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.6");
60509
60509
  if (!this.options.ydoc) return;
60510
60510
  const metaMap = this.options.ydoc.getMap("meta");
60511
60511
  let docVersion = metaMap.get("version");
@@ -64324,7 +64324,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64324
64324
  let selection = tr.selection;
64325
64325
  const state2 = editor.state;
64326
64326
  const focusState = CustomSelectionPluginKey.getState(state2);
64327
- if (selection.empty && focusState?.preservedSelection) {
64327
+ if (selection.empty && focusState?.preservedSelection && !focusState?.preservedSelection.empty) {
64328
64328
  selection = focusState.preservedSelection;
64329
64329
  tr.setSelection(selection);
64330
64330
  } else if (selection.empty && editor.options.lastSelection) {
@@ -64391,6 +64391,31 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64391
64391
  });
64392
64392
  return true;
64393
64393
  };
64394
+ const stepInsertsTextIntoStyledParagraph = (tr, oldEditorState, step, stepIndex) => {
64395
+ if (!step.slice || step.slice.size === 0 || typeof step.from !== "number") {
64396
+ return false;
64397
+ }
64398
+ let insertsText = false;
64399
+ step.slice.content.descendants((node2) => {
64400
+ if (node2.type?.name === "text" && node2.text?.length) {
64401
+ insertsText = true;
64402
+ return false;
64403
+ }
64404
+ return true;
64405
+ });
64406
+ if (!insertsText) return false;
64407
+ const docBeforeStep = tr.docs?.[stepIndex] || oldEditorState.doc;
64408
+ if (!docBeforeStep) return false;
64409
+ const resolvedPos = Math.min(step.from, docBeforeStep.content.size);
64410
+ const $pos = docBeforeStep.resolve(resolvedPos);
64411
+ for (let depth = $pos.depth; depth >= 0; depth--) {
64412
+ const node2 = $pos.node(depth);
64413
+ if (node2?.type?.name === "paragraph") {
64414
+ return Boolean(node2.attrs?.styleId);
64415
+ }
64416
+ }
64417
+ return false;
64418
+ };
64394
64419
  const LinkedStylesPluginKey = new PluginKey("linkedStyles");
64395
64420
  const createLinkedStylesPlugin = (editor) => {
64396
64421
  return new Plugin({
@@ -64424,7 +64449,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64424
64449
  if (tr.docChanged) {
64425
64450
  let mightAffectStyles = false;
64426
64451
  const styleRelatedMarks = /* @__PURE__ */ new Set(["textStyle", "bold", "italic", "underline", "strike"]);
64427
- tr.steps.forEach((step) => {
64452
+ tr.steps.forEach((step, index2) => {
64428
64453
  if (step.slice) {
64429
64454
  step.slice.content.descendants((node2) => {
64430
64455
  if (node2.attrs?.styleId) {
@@ -64445,6 +64470,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64445
64470
  mightAffectStyles = true;
64446
64471
  }
64447
64472
  }
64473
+ if (!mightAffectStyles && stepInsertsTextIntoStyledParagraph(tr, oldEditorState, step, index2)) {
64474
+ mightAffectStyles = true;
64475
+ }
64448
64476
  });
64449
64477
  if (mightAffectStyles) {
64450
64478
  const styles = LinkedStylesPluginKey.getState(editor.state).styles;
@@ -65795,6 +65823,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65795
65823
  }
65796
65824
  },
65797
65825
  styleId: {
65826
+ default: null,
65827
+ keepOnSplit: false,
65798
65828
  renderDOM: (attrs) => {
65799
65829
  if (!attrs.styleId) return {};
65800
65830
  return { styleid: attrs.styleId };
@@ -116630,7 +116660,7 @@ ${style2}
116630
116660
  this.config.colors = shuffleArray(this.config.colors);
116631
116661
  this.userColorMap = /* @__PURE__ */ new Map();
116632
116662
  this.colorIndex = 0;
116633
- this.version = "0.31.0-next.5";
116663
+ this.version = "0.31.0-next.6";
116634
116664
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
116635
116665
  this.superdocId = config2.superdocId || v4();
116636
116666
  this.colors = this.config.colors;
@@ -119030,7 +119060,7 @@ ${style2}
119030
119060
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
119031
119061
  );
119032
119062
  }
119033
- const indexB7dCHQ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
119063
+ const indexDAES86tg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
119034
119064
  __proto__: null,
119035
119065
  unified
119036
119066
  }, Symbol.toStringTag, { value: "Module" }));