@harbour-enterprises/superdoc 1.8.1-next.2 → 1.8.1-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{PdfViewer-CIBxGYxr.es.js → PdfViewer-BMQ_aatT.es.js} +2 -2
- package/dist/chunks/{PdfViewer-B_SYdY56.cjs → PdfViewer-CG3fXB6W.cjs} +2 -2
- package/dist/chunks/{SuperConverter-BZs9cPcQ.es.js → SuperConverter-0lz82cmH.es.js} +14 -5
- package/dist/chunks/{SuperConverter-BYVTOVA-.cjs → SuperConverter-C4jc-A34.cjs} +14 -5
- package/dist/chunks/{index-DhfDuALL.es.js → index-0in1nXsV.es.js} +4 -4
- package/dist/chunks/{index-xgUhjESM.cjs → index-B__DcNBW.cjs} +14 -60
- package/dist/chunks/{index-DCxuzPSu.cjs → index-Cn36ZWmU.cjs} +4 -4
- package/dist/chunks/{index-B7RrRGVg.es.js → index-DPmjm9Nw.es.js} +14 -60
- package/dist/super-editor/converter.cjs +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +3 -3
- package/dist/superdoc.cjs +3 -3
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +28 -65
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -39009,7 +39009,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39009
39009
|
static getStoredSuperdocVersion(docx) {
|
|
39010
39010
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
39011
39011
|
}
|
|
39012
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.8.1-next.
|
|
39012
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.8.1-next.3") {
|
|
39013
39013
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
39014
39014
|
}
|
|
39015
39015
|
/**
|
|
@@ -39165,20 +39165,29 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39165
39165
|
}
|
|
39166
39166
|
getDocumentFonts() {
|
|
39167
39167
|
const inlineDocumentFonts = [...new Set(this.inlineDocumentFonts || [])];
|
|
39168
|
+
const defaults2 = this.getDocumentDefaultStyles?.() || {};
|
|
39169
|
+
const defaultTypeface = typeof defaults2.typeface === "string" ? defaults2.typeface : null;
|
|
39170
|
+
const defaultFontFamilyCss = typeof defaults2.fontFamilyCss === "string" ? defaults2.fontFamilyCss : null;
|
|
39171
|
+
const fallbackFont = defaultTypeface || (defaultFontFamilyCss ? defaultFontFamilyCss.split(",")[0]?.replace(/["']/g, "").trim() : null);
|
|
39172
|
+
const withDefaultFont = (fonts) => {
|
|
39173
|
+
const result = [...fonts];
|
|
39174
|
+
if (fallbackFont && !result.includes(fallbackFont)) result.push(fallbackFont);
|
|
39175
|
+
return result;
|
|
39176
|
+
};
|
|
39168
39177
|
const fontTable = this.convertedXml["word/fontTable.xml"];
|
|
39169
39178
|
if (!fontTable) {
|
|
39170
|
-
return inlineDocumentFonts;
|
|
39179
|
+
return withDefaultFont(inlineDocumentFonts);
|
|
39171
39180
|
}
|
|
39172
39181
|
const wFonts = fontTable.elements?.find((element2) => element2.name === "w:fonts");
|
|
39173
39182
|
if (!wFonts) {
|
|
39174
|
-
return inlineDocumentFonts;
|
|
39183
|
+
return withDefaultFont(inlineDocumentFonts);
|
|
39175
39184
|
}
|
|
39176
39185
|
if (!wFonts.elements) {
|
|
39177
|
-
return inlineDocumentFonts;
|
|
39186
|
+
return withDefaultFont(inlineDocumentFonts);
|
|
39178
39187
|
}
|
|
39179
39188
|
const fontsInFontTable = wFonts.elements.filter((element2) => element2.name === "w:font").map((element2) => element2.attributes["w:name"]);
|
|
39180
39189
|
const allFonts = [...inlineDocumentFonts, ...fontsInFontTable];
|
|
39181
|
-
return [...new Set(allFonts)];
|
|
39190
|
+
return withDefaultFont([...new Set(allFonts)]);
|
|
39182
39191
|
}
|
|
39183
39192
|
getFontFaceImportString() {
|
|
39184
39193
|
const fontTable = this.convertedXml["word/fontTable.xml"];
|
|
@@ -65395,7 +65404,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
65395
65404
|
return false;
|
|
65396
65405
|
}
|
|
65397
65406
|
};
|
|
65398
|
-
const summaryVersion = "1.8.1-next.
|
|
65407
|
+
const summaryVersion = "1.8.1-next.3";
|
|
65399
65408
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
65400
65409
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
65401
65410
|
function mapAttributes(attrs) {
|
|
@@ -68119,7 +68128,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68119
68128
|
* Process collaboration migrations
|
|
68120
68129
|
*/
|
|
68121
68130
|
processCollaborationMigrations() {
|
|
68122
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.8.1-next.
|
|
68131
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.8.1-next.3");
|
|
68123
68132
|
if (!this.options.ydoc) return;
|
|
68124
68133
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
68125
68134
|
let docVersion = metaMap.get("version");
|
|
@@ -110819,75 +110828,26 @@ ${o}
|
|
|
110819
110828
|
return null;
|
|
110820
110829
|
};
|
|
110821
110830
|
const resolveRunPropertiesFromParagraphStyle = (paragraphNode, editor) => {
|
|
110822
|
-
if (!paragraphNode || !editor?.converter) return {};
|
|
110831
|
+
if (!paragraphNode || !editor?.converter) return { runProperties: {}, markDefs: [] };
|
|
110823
110832
|
const styleId = paragraphNode.attrs?.paragraphProperties?.styleId;
|
|
110824
|
-
if (!styleId) return {};
|
|
110833
|
+
if (!styleId) return { runProperties: {}, markDefs: [] };
|
|
110825
110834
|
try {
|
|
110826
110835
|
const params2 = {
|
|
110827
110836
|
translatedNumbering: editor.converter.translatedNumbering,
|
|
110828
110837
|
translatedLinkedStyles: editor.converter.translatedLinkedStyles
|
|
110829
110838
|
};
|
|
110830
110839
|
const resolvedPpr = { styleId };
|
|
110831
|
-
const
|
|
110832
|
-
const
|
|
110833
|
-
|
|
110834
|
-
const fontValue = runProps.fontFamily.ascii || runProps.fontFamily;
|
|
110835
|
-
if (fontValue) {
|
|
110836
|
-
runProperties.fontFamily = typeof fontValue === "string" ? fontValue : fontValue.ascii;
|
|
110837
|
-
}
|
|
110838
|
-
}
|
|
110839
|
-
if (runProps.fontSize) {
|
|
110840
|
-
runProperties.fontSize = `${runProps.fontSize / 2}pt`;
|
|
110841
|
-
}
|
|
110842
|
-
if (runProps.bold) runProperties.bold = true;
|
|
110843
|
-
if (runProps.italic) runProperties.italic = true;
|
|
110844
|
-
if (runProps.underline) runProperties.underline = runProps.underline;
|
|
110845
|
-
if (runProps.strike) runProperties.strike = true;
|
|
110846
|
-
return runProperties;
|
|
110840
|
+
const runProperties = resolveRunProperties(params2, {}, resolvedPpr, null, false, false);
|
|
110841
|
+
const markDefs = encodeMarksFromRPr(runProperties, editor.converter.convertedXml);
|
|
110842
|
+
return { runProperties, markDefs: Array.isArray(markDefs) ? markDefs : [] };
|
|
110847
110843
|
} catch (_e2) {
|
|
110848
|
-
return {};
|
|
110844
|
+
return { runProperties: {}, markDefs: [] };
|
|
110849
110845
|
}
|
|
110850
110846
|
};
|
|
110851
110847
|
const createMarksFromDefs = (schema, markDefs = []) => markDefs.map((def2) => {
|
|
110852
110848
|
const markType = schema.marks[def2.type];
|
|
110853
110849
|
return markType ? markType.create(def2.attrs) : null;
|
|
110854
110850
|
}).filter(Boolean);
|
|
110855
|
-
const createMarkDefsFromStyleRunProps = (styleRunProps) => {
|
|
110856
|
-
const markDefs = [];
|
|
110857
|
-
const textStyleAttrs = {};
|
|
110858
|
-
if (styleRunProps.fontSize) {
|
|
110859
|
-
textStyleAttrs.fontSize = styleRunProps.fontSize;
|
|
110860
|
-
}
|
|
110861
|
-
if (styleRunProps.fontFamily) {
|
|
110862
|
-
textStyleAttrs.fontFamily = styleRunProps.fontFamily;
|
|
110863
|
-
}
|
|
110864
|
-
if (Object.keys(textStyleAttrs).length > 0) {
|
|
110865
|
-
markDefs.push({ type: "textStyle", attrs: textStyleAttrs });
|
|
110866
|
-
}
|
|
110867
|
-
if (styleRunProps.bold) {
|
|
110868
|
-
markDefs.push({ type: "bold", attrs: { value: true } });
|
|
110869
|
-
}
|
|
110870
|
-
if (styleRunProps.italic) {
|
|
110871
|
-
markDefs.push({ type: "italic", attrs: { value: true } });
|
|
110872
|
-
}
|
|
110873
|
-
if (styleRunProps.strike) {
|
|
110874
|
-
markDefs.push({ type: "strike", attrs: { value: true } });
|
|
110875
|
-
}
|
|
110876
|
-
if (styleRunProps.underline) {
|
|
110877
|
-
const underlineType = styleRunProps.underline["w:val"];
|
|
110878
|
-
if (underlineType) {
|
|
110879
|
-
let underlineColor = styleRunProps.underline["w:color"];
|
|
110880
|
-
if (underlineColor && underlineColor.toLowerCase() !== "auto" && !underlineColor.startsWith("#")) {
|
|
110881
|
-
underlineColor = `#${underlineColor}`;
|
|
110882
|
-
}
|
|
110883
|
-
markDefs.push({
|
|
110884
|
-
type: "underline",
|
|
110885
|
-
attrs: { underlineType, underlineColor }
|
|
110886
|
-
});
|
|
110887
|
-
}
|
|
110888
|
-
}
|
|
110889
|
-
return markDefs;
|
|
110890
|
-
};
|
|
110891
110851
|
const normalizeSelectionIntoRun = (tr, runType) => {
|
|
110892
110852
|
const selection = tr.selection;
|
|
110893
110853
|
if (!(selection instanceof TextSelection$1)) return;
|
|
@@ -110923,10 +110883,13 @@ ${o}
|
|
|
110923
110883
|
let runProperties = decodeRPrFromMarks(node2.marks);
|
|
110924
110884
|
if ((!node2.marks || node2.marks.length === 0) && editor?.converter) {
|
|
110925
110885
|
const paragraphNode = getParagraphAtPos(state.doc, pos);
|
|
110926
|
-
const styleRunProps = resolveRunPropertiesFromParagraphStyle(
|
|
110886
|
+
const { runProperties: styleRunProps, markDefs: styleMarkDefs } = resolveRunPropertiesFromParagraphStyle(
|
|
110887
|
+
paragraphNode,
|
|
110888
|
+
editor
|
|
110889
|
+
);
|
|
110927
110890
|
if (Object.keys(styleRunProps).length > 0) {
|
|
110928
110891
|
runProperties = styleRunProps;
|
|
110929
|
-
const markDefs = metaStyleMarks.length ? markDefsFromMeta :
|
|
110892
|
+
const markDefs = metaStyleMarks.length ? markDefsFromMeta : styleMarkDefs;
|
|
110930
110893
|
const styleMarks = metaStyleMarks.length ? metaStyleMarks : createMarksFromDefs(state.schema, markDefs);
|
|
110931
110894
|
if (styleMarks.length && typeof state.schema.text === "function") {
|
|
110932
110895
|
const textNode = state.schema.text(node2.text || "", styleMarks);
|
|
@@ -152216,7 +152179,7 @@ ${reason}`);
|
|
|
152216
152179
|
this.config.colors = shuffleArray(this.config.colors);
|
|
152217
152180
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
152218
152181
|
this.colorIndex = 0;
|
|
152219
|
-
this.version = "1.8.1-next.
|
|
152182
|
+
this.version = "1.8.1-next.3";
|
|
152220
152183
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
152221
152184
|
this.superdocId = config2.superdocId || v4();
|
|
152222
152185
|
this.colors = this.config.colors;
|