@harbour-enterprises/superdoc 1.8.1-next.2 → 1.8.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.
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-De9wkgLl.cjs");
4
- const superdoc = require("./index-DCxuzPSu.cjs");
5
- const index = require("./index-xgUhjESM.cjs");
4
+ const superdoc = require("./index-DLL8vacV.cjs");
5
+ const index = require("./index-D7AeHB9E.cjs");
6
6
  function self(vars) {
7
7
  const {
8
8
  opacityDisabled,
@@ -1,6 +1,6 @@
1
1
  import { d as defineComponent, h, T as Transition, p as process$1, w as watchEffect, c as computed, r as ref, f as onMounted, X as onUnmounted, E as createElementBlock, G as openBlock, K as createBaseVNode, M as createCommentVNode, I as createVNode, v as unref } from "./vue-BnBKJwCW.es.js";
2
- import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-DhfDuALL.es.js";
3
- import { C as derived, r as c, q as cB, aF as fadeInTransition, y as cM, I as warnOnce, J as useConfig, N as useTheme, aG as pxfy, P as createKey, Q as useThemeClass, aH as useCompitable, ai as _export_sfc } from "./index-B7RrRGVg.es.js";
2
+ import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-NH0NP96k.es.js";
3
+ import { C as derived, r as c, q as cB, aF as fadeInTransition, y as cM, I as warnOnce, J as useConfig, N as useTheme, aG as pxfy, P as createKey, Q as useThemeClass, aH as useCompitable, ai as _export_sfc } from "./index-DVA3fxbW.es.js";
4
4
  function self(vars) {
5
5
  const {
6
6
  opacityDisabled,
@@ -33508,7 +33508,7 @@ class SuperConverter {
33508
33508
  static getStoredSuperdocVersion(docx) {
33509
33509
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
33510
33510
  }
33511
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.8.1-next.2") {
33511
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.8.1") {
33512
33512
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
33513
33513
  }
33514
33514
  /**
@@ -33664,20 +33664,29 @@ class SuperConverter {
33664
33664
  }
33665
33665
  getDocumentFonts() {
33666
33666
  const inlineDocumentFonts = [...new Set(this.inlineDocumentFonts || [])];
33667
+ const defaults = this.getDocumentDefaultStyles?.() || {};
33668
+ const defaultTypeface = typeof defaults.typeface === "string" ? defaults.typeface : null;
33669
+ const defaultFontFamilyCss = typeof defaults.fontFamilyCss === "string" ? defaults.fontFamilyCss : null;
33670
+ const fallbackFont = defaultTypeface || (defaultFontFamilyCss ? defaultFontFamilyCss.split(",")[0]?.replace(/["']/g, "").trim() : null);
33671
+ const withDefaultFont = (fonts) => {
33672
+ const result = [...fonts];
33673
+ if (fallbackFont && !result.includes(fallbackFont)) result.push(fallbackFont);
33674
+ return result;
33675
+ };
33667
33676
  const fontTable = this.convertedXml["word/fontTable.xml"];
33668
33677
  if (!fontTable) {
33669
- return inlineDocumentFonts;
33678
+ return withDefaultFont(inlineDocumentFonts);
33670
33679
  }
33671
33680
  const wFonts = fontTable.elements?.find((element) => element.name === "w:fonts");
33672
33681
  if (!wFonts) {
33673
- return inlineDocumentFonts;
33682
+ return withDefaultFont(inlineDocumentFonts);
33674
33683
  }
33675
33684
  if (!wFonts.elements) {
33676
- return inlineDocumentFonts;
33685
+ return withDefaultFont(inlineDocumentFonts);
33677
33686
  }
33678
33687
  const fontsInFontTable = wFonts.elements.filter((element) => element.name === "w:font").map((element) => element.attributes["w:name"]);
33679
33688
  const allFonts = [...inlineDocumentFonts, ...fontsInFontTable];
33680
- return [...new Set(allFonts)];
33689
+ return withDefaultFont([...new Set(allFonts)]);
33681
33690
  }
33682
33691
  getFontFaceImportString() {
33683
33692
  const fontTable = this.convertedXml["word/fontTable.xml"];
@@ -33509,7 +33509,7 @@ class SuperConverter {
33509
33509
  static getStoredSuperdocVersion(docx) {
33510
33510
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
33511
33511
  }
33512
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.8.1-next.2") {
33512
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.8.1") {
33513
33513
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
33514
33514
  }
33515
33515
  /**
@@ -33665,20 +33665,29 @@ class SuperConverter {
33665
33665
  }
33666
33666
  getDocumentFonts() {
33667
33667
  const inlineDocumentFonts = [...new Set(this.inlineDocumentFonts || [])];
33668
+ const defaults = this.getDocumentDefaultStyles?.() || {};
33669
+ const defaultTypeface = typeof defaults.typeface === "string" ? defaults.typeface : null;
33670
+ const defaultFontFamilyCss = typeof defaults.fontFamilyCss === "string" ? defaults.fontFamilyCss : null;
33671
+ const fallbackFont = defaultTypeface || (defaultFontFamilyCss ? defaultFontFamilyCss.split(",")[0]?.replace(/["']/g, "").trim() : null);
33672
+ const withDefaultFont = (fonts) => {
33673
+ const result = [...fonts];
33674
+ if (fallbackFont && !result.includes(fallbackFont)) result.push(fallbackFont);
33675
+ return result;
33676
+ };
33668
33677
  const fontTable = this.convertedXml["word/fontTable.xml"];
33669
33678
  if (!fontTable) {
33670
- return inlineDocumentFonts;
33679
+ return withDefaultFont(inlineDocumentFonts);
33671
33680
  }
33672
33681
  const wFonts = fontTable.elements?.find((element) => element.name === "w:fonts");
33673
33682
  if (!wFonts) {
33674
- return inlineDocumentFonts;
33683
+ return withDefaultFont(inlineDocumentFonts);
33675
33684
  }
33676
33685
  if (!wFonts.elements) {
33677
- return inlineDocumentFonts;
33686
+ return withDefaultFont(inlineDocumentFonts);
33678
33687
  }
33679
33688
  const fontsInFontTable = wFonts.elements.filter((element) => element.name === "w:font").map((element) => element.attributes["w:name"]);
33680
33689
  const allFonts = [...inlineDocumentFonts, ...fontsInFontTable];
33681
- return [...new Set(allFonts)];
33690
+ return withDefaultFont([...new Set(allFonts)]);
33682
33691
  }
33683
33692
  getFontFaceImportString() {
33684
33693
  const fontTable = this.convertedXml["word/fontTable.xml"];
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const jszip = require("./jszip-C8_CqJxM.cjs");
3
3
  const helpers$1 = require("./helpers-nOdwpmwb.cjs");
4
- const superEditor_converter = require("./SuperConverter-BYVTOVA-.cjs");
4
+ const superEditor_converter = require("./SuperConverter-CZmFeaFZ.cjs");
5
5
  const vue = require("./vue-De9wkgLl.cjs");
6
6
  require("./jszip.min-BPh2MMAa.cjs");
7
7
  const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
@@ -15795,7 +15795,7 @@ const canUseDOM = () => {
15795
15795
  return false;
15796
15796
  }
15797
15797
  };
15798
- const summaryVersion = "1.8.1-next.2";
15798
+ const summaryVersion = "1.8.1";
15799
15799
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15800
15800
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15801
15801
  function mapAttributes(attrs) {
@@ -18518,7 +18518,7 @@ class Editor extends EventEmitter {
18518
18518
  * Process collaboration migrations
18519
18519
  */
18520
18520
  processCollaborationMigrations() {
18521
- console.debug("[checkVersionMigrations] Current editor version", "1.8.1-next.2");
18521
+ console.debug("[checkVersionMigrations] Current editor version", "1.8.1");
18522
18522
  if (!this.options.ydoc) return;
18523
18523
  const metaMap = this.options.ydoc.getMap("meta");
18524
18524
  let docVersion = metaMap.get("version");
@@ -61300,75 +61300,26 @@ const getParagraphAtPos = (doc2, pos) => {
61300
61300
  return null;
61301
61301
  };
61302
61302
  const resolveRunPropertiesFromParagraphStyle = (paragraphNode, editor) => {
61303
- if (!paragraphNode || !editor?.converter) return {};
61303
+ if (!paragraphNode || !editor?.converter) return { runProperties: {}, markDefs: [] };
61304
61304
  const styleId = paragraphNode.attrs?.paragraphProperties?.styleId;
61305
- if (!styleId) return {};
61305
+ if (!styleId) return { runProperties: {}, markDefs: [] };
61306
61306
  try {
61307
61307
  const params2 = {
61308
61308
  translatedNumbering: editor.converter.translatedNumbering,
61309
61309
  translatedLinkedStyles: editor.converter.translatedLinkedStyles
61310
61310
  };
61311
61311
  const resolvedPpr = { styleId };
61312
- const runProps = superEditor_converter.resolveRunProperties(params2, {}, resolvedPpr, false, false);
61313
- const runProperties = {};
61314
- if (runProps.fontFamily) {
61315
- const fontValue = runProps.fontFamily.ascii || runProps.fontFamily;
61316
- if (fontValue) {
61317
- runProperties.fontFamily = typeof fontValue === "string" ? fontValue : fontValue.ascii;
61318
- }
61319
- }
61320
- if (runProps.fontSize) {
61321
- runProperties.fontSize = `${runProps.fontSize / 2}pt`;
61322
- }
61323
- if (runProps.bold) runProperties.bold = true;
61324
- if (runProps.italic) runProperties.italic = true;
61325
- if (runProps.underline) runProperties.underline = runProps.underline;
61326
- if (runProps.strike) runProperties.strike = true;
61327
- return runProperties;
61312
+ const runProperties = superEditor_converter.resolveRunProperties(params2, {}, resolvedPpr, null, false, false);
61313
+ const markDefs = superEditor_converter.encodeMarksFromRPr(runProperties, editor.converter.convertedXml);
61314
+ return { runProperties, markDefs: Array.isArray(markDefs) ? markDefs : [] };
61328
61315
  } catch (_e) {
61329
- return {};
61316
+ return { runProperties: {}, markDefs: [] };
61330
61317
  }
61331
61318
  };
61332
61319
  const createMarksFromDefs = (schema, markDefs = []) => markDefs.map((def) => {
61333
61320
  const markType = schema.marks[def.type];
61334
61321
  return markType ? markType.create(def.attrs) : null;
61335
61322
  }).filter(Boolean);
61336
- const createMarkDefsFromStyleRunProps = (styleRunProps) => {
61337
- const markDefs = [];
61338
- const textStyleAttrs = {};
61339
- if (styleRunProps.fontSize) {
61340
- textStyleAttrs.fontSize = styleRunProps.fontSize;
61341
- }
61342
- if (styleRunProps.fontFamily) {
61343
- textStyleAttrs.fontFamily = styleRunProps.fontFamily;
61344
- }
61345
- if (Object.keys(textStyleAttrs).length > 0) {
61346
- markDefs.push({ type: "textStyle", attrs: textStyleAttrs });
61347
- }
61348
- if (styleRunProps.bold) {
61349
- markDefs.push({ type: "bold", attrs: { value: true } });
61350
- }
61351
- if (styleRunProps.italic) {
61352
- markDefs.push({ type: "italic", attrs: { value: true } });
61353
- }
61354
- if (styleRunProps.strike) {
61355
- markDefs.push({ type: "strike", attrs: { value: true } });
61356
- }
61357
- if (styleRunProps.underline) {
61358
- const underlineType = styleRunProps.underline["w:val"];
61359
- if (underlineType) {
61360
- let underlineColor = styleRunProps.underline["w:color"];
61361
- if (underlineColor && underlineColor.toLowerCase() !== "auto" && !underlineColor.startsWith("#")) {
61362
- underlineColor = `#${underlineColor}`;
61363
- }
61364
- markDefs.push({
61365
- type: "underline",
61366
- attrs: { underlineType, underlineColor }
61367
- });
61368
- }
61369
- }
61370
- return markDefs;
61371
- };
61372
61323
  const normalizeSelectionIntoRun = (tr, runType) => {
61373
61324
  const selection = tr.selection;
61374
61325
  if (!(selection instanceof superEditor_converter.TextSelection)) return;
@@ -61404,10 +61355,13 @@ const buildWrapTransaction = (state, ranges, runType, editor, markDefsFromMeta =
61404
61355
  let runProperties = superEditor_converter.decodeRPrFromMarks(node.marks);
61405
61356
  if ((!node.marks || node.marks.length === 0) && editor?.converter) {
61406
61357
  const paragraphNode = getParagraphAtPos(state.doc, pos);
61407
- const styleRunProps = resolveRunPropertiesFromParagraphStyle(paragraphNode, editor);
61358
+ const { runProperties: styleRunProps, markDefs: styleMarkDefs } = resolveRunPropertiesFromParagraphStyle(
61359
+ paragraphNode,
61360
+ editor
61361
+ );
61408
61362
  if (Object.keys(styleRunProps).length > 0) {
61409
61363
  runProperties = styleRunProps;
61410
- const markDefs = metaStyleMarks.length ? markDefsFromMeta : createMarkDefsFromStyleRunProps(styleRunProps);
61364
+ const markDefs = metaStyleMarks.length ? markDefsFromMeta : styleMarkDefs;
61411
61365
  const styleMarks = metaStyleMarks.length ? metaStyleMarks : createMarksFromDefs(state.schema, markDefs);
61412
61366
  if (styleMarks.length && typeof state.schema.text === "function") {
61413
61367
  const textNode = state.schema.text(node.text || "", styleMarks);
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
- const index = require("./index-xgUhjESM.cjs");
2
+ const index = require("./index-D7AeHB9E.cjs");
3
3
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
4
4
  const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
5
5
  const provider = require("@hocuspocus/provider");
6
6
  require("./jszip-C8_CqJxM.cjs");
7
7
  require("./helpers-nOdwpmwb.cjs");
8
- require("./SuperConverter-BYVTOVA-.cjs");
8
+ require("./SuperConverter-CZmFeaFZ.cjs");
9
9
  const vue = require("./vue-De9wkgLl.cjs");
10
10
  require("./jszip.min-BPh2MMAa.cjs");
11
11
  const superEditor_fileZipper = require("../super-editor/file-zipper.cjs");
@@ -7689,7 +7689,7 @@ const _sfc_main = {
7689
7689
  __name: "SuperDoc",
7690
7690
  emits: ["selection-update"],
7691
7691
  setup(__props, { emit: __emit }) {
7692
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-B_SYdY56.cjs")));
7692
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-Bdde5qKS.cjs")));
7693
7693
  const superdocStore = useSuperdocStore();
7694
7694
  const commentsStore = useCommentsStore();
7695
7695
  const {
@@ -8674,7 +8674,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
8674
8674
  this.config.colors = shuffleArray(this.config.colors);
8675
8675
  this.userColorMap = /* @__PURE__ */ new Map();
8676
8676
  this.colorIndex = 0;
8677
- this.version = "1.8.1-next.2";
8677
+ this.version = "1.8.1";
8678
8678
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8679
8679
  this.superdocId = config.superdocId || uuid.v4();
8680
8680
  this.colors = this.config.colors;
@@ -1,6 +1,6 @@
1
1
  import { B as Buffer$2 } from "./jszip-B1fkPkPJ.es.js";
2
2
  import { t as twipsToInches, i as inchesToTwips, p as ptToTwips, l as linesToTwips, a as twipsToLines, b as pixelsToTwips, h as halfPointToPoints, c as twipsToPixels$2, d as convertSizeToCSS, e as inchesToPixels } from "./helpers-C8e9wR5l.es.js";
3
- import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, F as Fragment, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName, O as TrackInsertMarkName, Q as TrackFormatMarkName, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as resolveParagraphProperties, a0 as resolveDocxFontFamily, a1 as _getReferencedTableStyles, a2 as decodeRPrFromMarks, a3 as calculateResolvedParagraphProperties, a4 as encodeCSSFromPPr, a5 as encodeCSSFromRPr, a6 as generateOrderedListIndex, a7 as docxNumberingHelpers, a8 as InputRule, a9 as insertNewRelationship, aa as kebabCase$1, ab as getUnderlineCssString } from "./SuperConverter-BZs9cPcQ.es.js";
3
+ import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, F as Fragment, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName, O as TrackInsertMarkName, Q as TrackFormatMarkName, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as resolveParagraphProperties, a0 as resolveDocxFontFamily, a1 as _getReferencedTableStyles, a2 as decodeRPrFromMarks, a3 as calculateResolvedParagraphProperties, a4 as encodeCSSFromPPr, a5 as encodeCSSFromRPr, a6 as generateOrderedListIndex, a7 as docxNumberingHelpers, a8 as InputRule, a9 as insertNewRelationship, aa as kebabCase$1, ab as getUnderlineCssString } from "./SuperConverter-BGMfUD0m.es.js";
4
4
  import { p as process$1, r as ref, C as global$1, c as computed, E as createElementBlock, F as Fragment$1, S as renderList, O as withModifiers, G as openBlock, P as normalizeClass, M as createCommentVNode, H as toDisplayString, K as createBaseVNode, U as createApp, f as onMounted, X as onUnmounted, R as withDirectives, v as unref, Y as vModelText, y as nextTick, L as normalizeStyle, u as watch, Z as withKeys, _ as createTextVNode, I as createVNode, h as h$1, $ as readonly, s as getCurrentInstance, o as onBeforeUnmount, j as reactive, b as onBeforeMount, i as inject, a0 as onActivated, a1 as onDeactivated, a2 as Comment, d as defineComponent, a as provide, g as Teleport, t as toRef, a3 as renderSlot, a4 as isVNode, D as shallowRef, w as watchEffect, T as Transition, a5 as mergeProps, a6 as vShow, a7 as cloneVNode, a8 as Text$2, m as markRaw, N as createBlock, J as withCtx, a9 as useCssVars, V as resolveDynamicComponent, aa as normalizeProps, ab as guardReactiveProps } from "./vue-BnBKJwCW.es.js";
5
5
  import "./jszip.min-DCl8qkFO.es.js";
6
6
  import { E as EventEmitter$1 } from "./eventemitter3-CwrdEv8r.es.js";
@@ -15778,7 +15778,7 @@ const canUseDOM = () => {
15778
15778
  return false;
15779
15779
  }
15780
15780
  };
15781
- const summaryVersion = "1.8.1-next.2";
15781
+ const summaryVersion = "1.8.1";
15782
15782
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15783
15783
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15784
15784
  function mapAttributes(attrs) {
@@ -18501,7 +18501,7 @@ class Editor extends EventEmitter {
18501
18501
  * Process collaboration migrations
18502
18502
  */
18503
18503
  processCollaborationMigrations() {
18504
- console.debug("[checkVersionMigrations] Current editor version", "1.8.1-next.2");
18504
+ console.debug("[checkVersionMigrations] Current editor version", "1.8.1");
18505
18505
  if (!this.options.ydoc) return;
18506
18506
  const metaMap = this.options.ydoc.getMap("meta");
18507
18507
  let docVersion = metaMap.get("version");
@@ -61283,75 +61283,26 @@ const getParagraphAtPos = (doc2, pos) => {
61283
61283
  return null;
61284
61284
  };
61285
61285
  const resolveRunPropertiesFromParagraphStyle = (paragraphNode, editor) => {
61286
- if (!paragraphNode || !editor?.converter) return {};
61286
+ if (!paragraphNode || !editor?.converter) return { runProperties: {}, markDefs: [] };
61287
61287
  const styleId = paragraphNode.attrs?.paragraphProperties?.styleId;
61288
- if (!styleId) return {};
61288
+ if (!styleId) return { runProperties: {}, markDefs: [] };
61289
61289
  try {
61290
61290
  const params2 = {
61291
61291
  translatedNumbering: editor.converter.translatedNumbering,
61292
61292
  translatedLinkedStyles: editor.converter.translatedLinkedStyles
61293
61293
  };
61294
61294
  const resolvedPpr = { styleId };
61295
- const runProps = resolveRunProperties(params2, {}, resolvedPpr, false, false);
61296
- const runProperties = {};
61297
- if (runProps.fontFamily) {
61298
- const fontValue = runProps.fontFamily.ascii || runProps.fontFamily;
61299
- if (fontValue) {
61300
- runProperties.fontFamily = typeof fontValue === "string" ? fontValue : fontValue.ascii;
61301
- }
61302
- }
61303
- if (runProps.fontSize) {
61304
- runProperties.fontSize = `${runProps.fontSize / 2}pt`;
61305
- }
61306
- if (runProps.bold) runProperties.bold = true;
61307
- if (runProps.italic) runProperties.italic = true;
61308
- if (runProps.underline) runProperties.underline = runProps.underline;
61309
- if (runProps.strike) runProperties.strike = true;
61310
- return runProperties;
61295
+ const runProperties = resolveRunProperties(params2, {}, resolvedPpr, null, false, false);
61296
+ const markDefs = encodeMarksFromRPr(runProperties, editor.converter.convertedXml);
61297
+ return { runProperties, markDefs: Array.isArray(markDefs) ? markDefs : [] };
61311
61298
  } catch (_e) {
61312
- return {};
61299
+ return { runProperties: {}, markDefs: [] };
61313
61300
  }
61314
61301
  };
61315
61302
  const createMarksFromDefs = (schema, markDefs = []) => markDefs.map((def) => {
61316
61303
  const markType = schema.marks[def.type];
61317
61304
  return markType ? markType.create(def.attrs) : null;
61318
61305
  }).filter(Boolean);
61319
- const createMarkDefsFromStyleRunProps = (styleRunProps) => {
61320
- const markDefs = [];
61321
- const textStyleAttrs = {};
61322
- if (styleRunProps.fontSize) {
61323
- textStyleAttrs.fontSize = styleRunProps.fontSize;
61324
- }
61325
- if (styleRunProps.fontFamily) {
61326
- textStyleAttrs.fontFamily = styleRunProps.fontFamily;
61327
- }
61328
- if (Object.keys(textStyleAttrs).length > 0) {
61329
- markDefs.push({ type: "textStyle", attrs: textStyleAttrs });
61330
- }
61331
- if (styleRunProps.bold) {
61332
- markDefs.push({ type: "bold", attrs: { value: true } });
61333
- }
61334
- if (styleRunProps.italic) {
61335
- markDefs.push({ type: "italic", attrs: { value: true } });
61336
- }
61337
- if (styleRunProps.strike) {
61338
- markDefs.push({ type: "strike", attrs: { value: true } });
61339
- }
61340
- if (styleRunProps.underline) {
61341
- const underlineType = styleRunProps.underline["w:val"];
61342
- if (underlineType) {
61343
- let underlineColor = styleRunProps.underline["w:color"];
61344
- if (underlineColor && underlineColor.toLowerCase() !== "auto" && !underlineColor.startsWith("#")) {
61345
- underlineColor = `#${underlineColor}`;
61346
- }
61347
- markDefs.push({
61348
- type: "underline",
61349
- attrs: { underlineType, underlineColor }
61350
- });
61351
- }
61352
- }
61353
- return markDefs;
61354
- };
61355
61306
  const normalizeSelectionIntoRun = (tr, runType) => {
61356
61307
  const selection = tr.selection;
61357
61308
  if (!(selection instanceof TextSelection$1)) return;
@@ -61387,10 +61338,13 @@ const buildWrapTransaction = (state, ranges, runType, editor, markDefsFromMeta =
61387
61338
  let runProperties = decodeRPrFromMarks(node.marks);
61388
61339
  if ((!node.marks || node.marks.length === 0) && editor?.converter) {
61389
61340
  const paragraphNode = getParagraphAtPos(state.doc, pos);
61390
- const styleRunProps = resolveRunPropertiesFromParagraphStyle(paragraphNode, editor);
61341
+ const { runProperties: styleRunProps, markDefs: styleMarkDefs } = resolveRunPropertiesFromParagraphStyle(
61342
+ paragraphNode,
61343
+ editor
61344
+ );
61391
61345
  if (Object.keys(styleRunProps).length > 0) {
61392
61346
  runProperties = styleRunProps;
61393
- const markDefs = metaStyleMarks.length ? markDefsFromMeta : createMarkDefsFromStyleRunProps(styleRunProps);
61347
+ const markDefs = metaStyleMarks.length ? markDefsFromMeta : styleMarkDefs;
61394
61348
  const styleMarks = metaStyleMarks.length ? metaStyleMarks : createMarksFromDefs(state.schema, markDefs);
61395
61349
  if (styleMarks.length && typeof state.schema.text === "function") {
61396
61350
  const textNode = state.schema.text(node.text || "", styleMarks);
@@ -1,10 +1,10 @@
1
- import { B as BIT8, M as MAX_SAFE_INTEGER, c as create, a as BITS7, u as utf8TextDecoder, b as create$1, s as setIfUndefined, d as create$2, f as from, e as floor$1, g as equalityDeep, w as writeVarUint, h as writeVarString, t as toUint8Array, i as createEncoder, j as createInjectionKey, k as toString, l as throwError, m as useSsrAdapter, n as configProviderInjectionKey, o as cssrAnchorMetaName, p as globalStyle, q as cB, r as c, v as isMounted, x as commonVariables$2, y as cM, z as cNotM, A as cE, C as derived, D as changeColor, E as insideModal, F as insidePopover, G as resolveWrappedSlot, H as on, I as warnOnce, J as useConfig, K as useMergedState, L as useMemo, N as useTheme, O as useRtl, P as createKey, Q as useThemeClass, R as createId, S as call, T as render, U as messageProviderInjectionKey, V as messageApiInjectionKey, W as fromBase64, X as onChange, Y as varStorage, Z as toBase64, _ as createUint8ArrayFromArrayBuffer, $ as offChange, a0 as writeVarUint8Array, a1 as map, a2 as length, a3 as isNode, a4 as min, a5 as pow, a6 as comments_module_events, a7 as getFileObject, a8 as getTrackChanges, a9 as CommentsPluginKey, aa as TrackChangesBasePluginKey, ab as Editor, ac as getRichTextExtensions, ad as ellipsisVerticalSvg, ae as xmarkIconSvg, af as checkIconSvg, ag as caretDownIconSvg, ah as commentIconSvg, ai as _export_sfc, aj as NDropdown, ak as SuperInput, al as vClickOutside, am as PresentationEditor, an as SuperEditor, ao as AIWriter, ap as NConfigProvider, aq as SuperToolbar } from "./index-B7RrRGVg.es.js";
1
+ import { B as BIT8, M as MAX_SAFE_INTEGER, c as create, a as BITS7, u as utf8TextDecoder, b as create$1, s as setIfUndefined, d as create$2, f as from, e as floor$1, g as equalityDeep, w as writeVarUint, h as writeVarString, t as toUint8Array, i as createEncoder, j as createInjectionKey, k as toString, l as throwError, m as useSsrAdapter, n as configProviderInjectionKey, o as cssrAnchorMetaName, p as globalStyle, q as cB, r as c, v as isMounted, x as commonVariables$2, y as cM, z as cNotM, A as cE, C as derived, D as changeColor, E as insideModal, F as insidePopover, G as resolveWrappedSlot, H as on, I as warnOnce, J as useConfig, K as useMergedState, L as useMemo, N as useTheme, O as useRtl, P as createKey, Q as useThemeClass, R as createId, S as call, T as render, U as messageProviderInjectionKey, V as messageApiInjectionKey, W as fromBase64, X as onChange, Y as varStorage, Z as toBase64, _ as createUint8ArrayFromArrayBuffer, $ as offChange, a0 as writeVarUint8Array, a1 as map, a2 as length, a3 as isNode, a4 as min, a5 as pow, a6 as comments_module_events, a7 as getFileObject, a8 as getTrackChanges, a9 as CommentsPluginKey, aa as TrackChangesBasePluginKey, ab as Editor, ac as getRichTextExtensions, ad as ellipsisVerticalSvg, ae as xmarkIconSvg, af as checkIconSvg, ag as caretDownIconSvg, ah as commentIconSvg, ai as _export_sfc, aj as NDropdown, ak as SuperInput, al as vClickOutside, am as PresentationEditor, an as SuperEditor, ao as AIWriter, ap as NConfigProvider, aq as SuperToolbar } from "./index-DVA3fxbW.es.js";
2
2
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
3
3
  import { E as EventEmitter } from "./eventemitter3-CwrdEv8r.es.js";
4
4
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
5
5
  import "./jszip-B1fkPkPJ.es.js";
6
6
  import "./helpers-C8e9wR5l.es.js";
7
- import "./SuperConverter-BZs9cPcQ.es.js";
7
+ import "./SuperConverter-BGMfUD0m.es.js";
8
8
  import { i as inject, a as provide, c as computed, o as onBeforeUnmount, p as process$1, b as onBeforeMount, d as defineComponent, h, t as toRef, T as Transition, e as TransitionGroup, w as watchEffect, r as ref, f as onMounted, g as Teleport, F as Fragment, j as reactive, k as effectScope, m as markRaw, l as toRaw, n as isRef, q as isReactive, s as getCurrentInstance, u as watch, v as unref, x as hasInjectionContext, y as nextTick, z as getCurrentScope, A as onScopeDispose, B as toRefs, C as global, D as shallowRef, E as createElementBlock, G as openBlock, H as toDisplayString, I as createVNode, J as withCtx, K as createBaseVNode, L as normalizeStyle, M as createCommentVNode, N as createBlock, O as withModifiers, P as normalizeClass, Q as resolveDirective, R as withDirectives, S as renderList, U as createApp, V as resolveDynamicComponent, W as defineAsyncComponent } from "./vue-BnBKJwCW.es.js";
9
9
  import "./jszip.min-DCl8qkFO.es.js";
10
10
  import { createZip } from "../super-editor/file-zipper.es.js";
@@ -7672,7 +7672,7 @@ const _sfc_main = {
7672
7672
  __name: "SuperDoc",
7673
7673
  emits: ["selection-update"],
7674
7674
  setup(__props, { emit: __emit }) {
7675
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CIBxGYxr.es.js"));
7675
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-BeFy7iUF.es.js"));
7676
7676
  const superdocStore = useSuperdocStore();
7677
7677
  const commentsStore = useCommentsStore();
7678
7678
  const {
@@ -8657,7 +8657,7 @@ class SuperDoc extends EventEmitter {
8657
8657
  this.config.colors = shuffleArray(this.config.colors);
8658
8658
  this.userColorMap = /* @__PURE__ */ new Map();
8659
8659
  this.colorIndex = 0;
8660
- this.version = "1.8.1-next.2";
8660
+ this.version = "1.8.1";
8661
8661
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8662
8662
  this.superdocId = config.superdocId || v4();
8663
8663
  this.colors = this.config.colors;
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("../chunks/jszip-C8_CqJxM.cjs");
4
4
  require("../chunks/helpers-nOdwpmwb.cjs");
5
- const superEditor_converter = require("../chunks/SuperConverter-BYVTOVA-.cjs");
5
+ const superEditor_converter = require("../chunks/SuperConverter-CZmFeaFZ.cjs");
6
6
  require("../chunks/uuid-R7L08bOx.cjs");
7
7
  exports.SuperConverter = superEditor_converter.SuperConverter;
@@ -1,6 +1,6 @@
1
1
  import "../chunks/jszip-B1fkPkPJ.es.js";
2
2
  import "../chunks/helpers-C8e9wR5l.es.js";
3
- import { S } from "../chunks/SuperConverter-BZs9cPcQ.es.js";
3
+ import { S } from "../chunks/SuperConverter-BGMfUD0m.es.js";
4
4
  import "../chunks/uuid-CjlX8hrF.es.js";
5
5
  export {
6
6
  S as SuperConverter
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-xgUhjESM.cjs");
3
+ const index = require("./chunks/index-D7AeHB9E.cjs");
4
4
  const superEditor_docxZipper = require("./super-editor/docx-zipper.cjs");
5
5
  const superEditor_fileZipper = require("./super-editor/file-zipper.cjs");
6
6
  const vue = require("./chunks/vue-De9wkgLl.cjs");
7
- const superEditor_converter = require("./chunks/SuperConverter-BYVTOVA-.cjs");
7
+ const superEditor_converter = require("./chunks/SuperConverter-CZmFeaFZ.cjs");
8
8
  function isNodeType(node, name) {
9
9
  return node.type.name === name;
10
10
  }
@@ -1,9 +1,9 @@
1
- import { ax as Node, ay as Mark } from "./chunks/index-B7RrRGVg.es.js";
2
- import { ao, au, a9, ab, aw, am, av, aA, an, ak, aq, az, aa, as, aC, aE, aB, ac, aD, ar, at } from "./chunks/index-B7RrRGVg.es.js";
1
+ import { ax as Node, ay as Mark } from "./chunks/index-DVA3fxbW.es.js";
2
+ import { ao, au, a9, ab, aw, am, av, aA, an, ak, aq, az, aa, as, aC, aE, aB, ac, aD, ar, at } from "./chunks/index-DVA3fxbW.es.js";
3
3
  import { default as default2 } from "./super-editor/docx-zipper.es.js";
4
4
  import { createZip } from "./super-editor/file-zipper.es.js";
5
5
  import { d as defineComponent, E as createElementBlock, G as openBlock, K as createBaseVNode } from "./chunks/vue-BnBKJwCW.es.js";
6
- import { S, r } from "./chunks/SuperConverter-BZs9cPcQ.es.js";
6
+ import { S, r } from "./chunks/SuperConverter-BGMfUD0m.es.js";
7
7
  function isNodeType(node, name) {
8
8
  return node.type.name === name;
9
9
  }
package/dist/superdoc.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-xgUhjESM.cjs");
4
- const superdoc = require("./chunks/index-DCxuzPSu.cjs");
3
+ const index = require("./chunks/index-D7AeHB9E.cjs");
4
+ const superdoc = require("./chunks/index-DLL8vacV.cjs");
5
5
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
6
- const superEditor_converter = require("./chunks/SuperConverter-BYVTOVA-.cjs");
6
+ const superEditor_converter = require("./chunks/SuperConverter-CZmFeaFZ.cjs");
7
7
  require("./chunks/jszip-C8_CqJxM.cjs");
8
8
  require("./chunks/helpers-nOdwpmwb.cjs");
9
9
  require("./chunks/jszip.min-BPh2MMAa.cjs");
@@ -1,7 +1,7 @@
1
- import { au, ab, aw, av, as, a7, ac, ar, at } from "./chunks/index-B7RrRGVg.es.js";
2
- import { D, H, P, S, c } from "./chunks/index-DhfDuALL.es.js";
1
+ import { au, ab, aw, av, as, a7, ac, ar, at } from "./chunks/index-DVA3fxbW.es.js";
2
+ import { D, H, P, S, c } from "./chunks/index-NH0NP96k.es.js";
3
3
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
4
- import { S as S2, r } from "./chunks/SuperConverter-BZs9cPcQ.es.js";
4
+ import { S as S2, r } from "./chunks/SuperConverter-BGMfUD0m.es.js";
5
5
  import "./chunks/jszip-B1fkPkPJ.es.js";
6
6
  import "./chunks/helpers-C8e9wR5l.es.js";
7
7
  import "./chunks/jszip.min-DCl8qkFO.es.js";