superdoc 0.33.0 → 0.34.0
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-CvEaYTTI.es.js → PdfViewer-QoTBuPvf.es.js} +1 -1
- package/dist/chunks/{PdfViewer-DQvzXWoG.cjs → PdfViewer-ucye4VI0.cjs} +1 -1
- package/dist/chunks/{index--tOlLMNW.es.js → index-Bt64DU6g.es.js} +3 -3
- package/dist/chunks/{index-CIbMY9Bm-Dt4hHnew.es.js → index-UvHeMhoE-5Gu2ghe5.es.js} +1 -1
- package/dist/chunks/{index-CIbMY9Bm-DqnTTic6.cjs → index-UvHeMhoE-ukCcgvCU.cjs} +1 -1
- package/dist/chunks/{index-Dx306Sib.cjs → index-v2Mq8HRp.cjs} +3 -3
- package/dist/chunks/{super-editor.es-CUj_HXIP.cjs → super-editor.es-C-xsuwsj.cjs} +110 -3
- package/dist/chunks/{super-editor.es-CNAfYsLL.es.js → super-editor.es-brkQW7ao.es.js} +110 -3
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts +2 -0
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/packages/superdoc/src/core/types/index.d.ts +2 -0
- package/dist/packages/superdoc/src/core/types/index.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BT3EWHD6.js → converter-D6ElhI07.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-CmdlRMBW.js → docx-zipper-Ci7V0UkA.js} +1 -1
- package/dist/super-editor/chunks/{editor-DTJ6lEWC.js → editor-D82VSNig.js} +111 -4
- package/dist/super-editor/chunks/{index-CIbMY9Bm.js → index-UvHeMhoE.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-kGgbsteb.js → toolbar-BA72pClQ.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor/src/core/Editor.d.ts +11 -0
- package/dist/super-editor/super-editor/src/core/Editor.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/Schema.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/schema-summary.d.ts +8 -0
- package/dist/super-editor/super-editor/src/core/schema-summary.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/types/index.d.ts +8 -0
- package/dist/super-editor/super-editor/src/core/types/index.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/ai/ai-marks.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/ai/ai-nodes.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/mention/mention.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/paragraph/paragraph.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/structured-content/document-part-object.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/track-changes/permission-helpers.d.ts +2 -0
- package/dist/super-editor/super-editor/src/extensions/track-changes/permission-helpers.d.ts.map +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +112 -5
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -35776,7 +35776,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35776
35776
|
static getStoredSuperdocVersion(docx) {
|
|
35777
35777
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
35778
35778
|
}
|
|
35779
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.
|
|
35779
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.34.0") {
|
|
35780
35780
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
35781
35781
|
}
|
|
35782
35782
|
/**
|
|
@@ -54811,6 +54811,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
54811
54811
|
code: callOrGet(getExtensionConfigField(extension, "code", context)),
|
|
54812
54812
|
defining: callOrGet(getExtensionConfigField(extension, "defining", context)),
|
|
54813
54813
|
isolating: callOrGet(getExtensionConfigField(extension, "isolating", context)),
|
|
54814
|
+
summary: getExtensionConfigField(extension, "summary", context),
|
|
54814
54815
|
attrs,
|
|
54815
54816
|
...additionalNodeFields
|
|
54816
54817
|
});
|
|
@@ -61055,6 +61056,56 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61055
61056
|
const lvl = node2.getAttribute("data-level");
|
|
61056
61057
|
return lvl ? parseInt(lvl, 10) : 0;
|
|
61057
61058
|
};
|
|
61059
|
+
const summaryVersion = typeof globalThis.__APP_VERSION__ === "string" && globalThis.__APP_VERSION__ || typeof globalThis.version === "string" && globalThis.version || "0.0.0";
|
|
61060
|
+
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
61061
|
+
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
61062
|
+
function mapAttributes(attrs) {
|
|
61063
|
+
if (!attrs) return {};
|
|
61064
|
+
return Object.fromEntries(
|
|
61065
|
+
Object.entries(attrs).map(([name, attrSpec]) => {
|
|
61066
|
+
const defaultValue = attrSpec?.default;
|
|
61067
|
+
return [
|
|
61068
|
+
name,
|
|
61069
|
+
{
|
|
61070
|
+
default: defaultValue ?? null,
|
|
61071
|
+
required: defaultValue === void 0
|
|
61072
|
+
}
|
|
61073
|
+
];
|
|
61074
|
+
})
|
|
61075
|
+
);
|
|
61076
|
+
}
|
|
61077
|
+
function pickSpecFields(spec, keys2) {
|
|
61078
|
+
return Object.fromEntries(keys2.map((key2) => [key2, spec[key2]]).filter(([, value]) => value !== void 0));
|
|
61079
|
+
}
|
|
61080
|
+
function buildSchemaSummary(schema, schemaVersion) {
|
|
61081
|
+
if (!schema || typeof schema !== "object") {
|
|
61082
|
+
throw new Error("Invalid schema: schema must be a valid ProseMirror Schema object.");
|
|
61083
|
+
}
|
|
61084
|
+
const resolvedSchemaVersion = schemaVersion || "current";
|
|
61085
|
+
const nodes = [];
|
|
61086
|
+
schema.spec.nodes.forEach((name, spec) => {
|
|
61087
|
+
nodes.push({
|
|
61088
|
+
name,
|
|
61089
|
+
attrs: mapAttributes(spec.attrs),
|
|
61090
|
+
...pickSpecFields(spec, nodeKeys)
|
|
61091
|
+
});
|
|
61092
|
+
});
|
|
61093
|
+
const marks = [];
|
|
61094
|
+
schema.spec.marks.forEach((name, spec) => {
|
|
61095
|
+
marks.push({
|
|
61096
|
+
name,
|
|
61097
|
+
attrs: mapAttributes(spec.attrs),
|
|
61098
|
+
...pickSpecFields(spec, markKeys)
|
|
61099
|
+
});
|
|
61100
|
+
});
|
|
61101
|
+
return {
|
|
61102
|
+
version: summaryVersion,
|
|
61103
|
+
schemaVersion: resolvedSchemaVersion,
|
|
61104
|
+
topNode: schema.topNodeType?.name,
|
|
61105
|
+
nodes,
|
|
61106
|
+
marks
|
|
61107
|
+
};
|
|
61108
|
+
}
|
|
61058
61109
|
const _Editor = class _Editor2 extends EventEmitter$2 {
|
|
61059
61110
|
/**
|
|
61060
61111
|
* Create a new Editor instance
|
|
@@ -61467,6 +61518,56 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61467
61518
|
console.warn("updateDocumentVersion is deprecated, use setDocumentVersion instead");
|
|
61468
61519
|
return _Editor2.setDocumentVersion(doc2, version2);
|
|
61469
61520
|
}
|
|
61521
|
+
/**
|
|
61522
|
+
* Generates a schema summary for the current runtime schema.
|
|
61523
|
+
* @returns {Promise<Object>} Schema summary JSON
|
|
61524
|
+
*/
|
|
61525
|
+
async getSchemaSummaryJSON() {
|
|
61526
|
+
if (!this.schema) {
|
|
61527
|
+
throw new Error("Schema is not initialized.");
|
|
61528
|
+
}
|
|
61529
|
+
const schemaVersion = this.converter?.getSuperdocVersion?.() || "current";
|
|
61530
|
+
const suppressedNames = new Set(
|
|
61531
|
+
(this.extensionService?.extensions || []).filter((ext) => {
|
|
61532
|
+
const config2 = ext?.config;
|
|
61533
|
+
const suppressFlag = config2?.excludeFromSummaryJSON;
|
|
61534
|
+
return Boolean(suppressFlag);
|
|
61535
|
+
}).map((ext) => ext.name)
|
|
61536
|
+
);
|
|
61537
|
+
const summary = buildSchemaSummary(this.schema, schemaVersion);
|
|
61538
|
+
if (!suppressedNames.size) {
|
|
61539
|
+
return summary;
|
|
61540
|
+
}
|
|
61541
|
+
return {
|
|
61542
|
+
...summary,
|
|
61543
|
+
nodes: summary.nodes.filter((node2) => !suppressedNames.has(node2.name)),
|
|
61544
|
+
marks: summary.marks.filter((mark2) => !suppressedNames.has(mark2.name))
|
|
61545
|
+
};
|
|
61546
|
+
}
|
|
61547
|
+
/**
|
|
61548
|
+
* Validates a ProseMirror JSON document against the current schema.
|
|
61549
|
+
* @param {Object|Object[]} doc - ProseMirror JSON representation of the document
|
|
61550
|
+
* @returns {Object} ProseMirror node
|
|
61551
|
+
*/
|
|
61552
|
+
validateJSON(doc2) {
|
|
61553
|
+
if (!this.schema) {
|
|
61554
|
+
throw new Error("Schema is not initialized.");
|
|
61555
|
+
}
|
|
61556
|
+
const topNodeName = this.schema.topNodeType?.name || "doc";
|
|
61557
|
+
const normalizedDoc = Array.isArray(doc2) ? { type: topNodeName, content: doc2 } : doc2 && typeof doc2 === "object" && doc2.type ? doc2.type === topNodeName || doc2.type === "doc" ? doc2 : { type: topNodeName, content: [doc2] } : (() => {
|
|
61558
|
+
throw new Error("Invalid document shape: expected a node object or an array of node objects.");
|
|
61559
|
+
})();
|
|
61560
|
+
try {
|
|
61561
|
+
return this.schema.nodeFromJSON(normalizedDoc);
|
|
61562
|
+
} catch (error) {
|
|
61563
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
61564
|
+
const validationError = new Error(`Invalid document for current schema: ${detail}`);
|
|
61565
|
+
if (error instanceof Error) {
|
|
61566
|
+
validationError.cause = error;
|
|
61567
|
+
}
|
|
61568
|
+
throw validationError;
|
|
61569
|
+
}
|
|
61570
|
+
}
|
|
61470
61571
|
/**
|
|
61471
61572
|
* Creates all node views.
|
|
61472
61573
|
* @returns {void}
|
|
@@ -61715,7 +61816,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61715
61816
|
{ default: remarkStringify2 },
|
|
61716
61817
|
{ default: remarkGfm2 }
|
|
61717
61818
|
] = await Promise.all([
|
|
61718
|
-
Promise.resolve().then(() =>
|
|
61819
|
+
Promise.resolve().then(() => indexUvHeMhoE),
|
|
61719
61820
|
Promise.resolve().then(() => indexDRCvimau),
|
|
61720
61821
|
Promise.resolve().then(() => indexC_x_N6Uh),
|
|
61721
61822
|
Promise.resolve().then(() => indexD_sWOSiG),
|
|
@@ -61933,7 +62034,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61933
62034
|
* @returns {Object | void} Migration results
|
|
61934
62035
|
*/
|
|
61935
62036
|
processCollaborationMigrations() {
|
|
61936
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.
|
|
62037
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.34.0");
|
|
61937
62038
|
if (!this.options.ydoc) return;
|
|
61938
62039
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
61939
62040
|
let docVersion = metaMap.get("version");
|
|
@@ -63547,6 +63648,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
63547
63648
|
name: AiMarkName,
|
|
63548
63649
|
group: "ai",
|
|
63549
63650
|
inclusive: false,
|
|
63651
|
+
excludeFromSummaryJSON: true,
|
|
63550
63652
|
addOptions() {
|
|
63551
63653
|
return {
|
|
63552
63654
|
htmlAttributes: { class: "sd-ai-highlight" }
|
|
@@ -63573,6 +63675,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
63573
63675
|
inclusive: false,
|
|
63574
63676
|
spanning: false,
|
|
63575
63677
|
excludes: AiAnimationMarkName,
|
|
63678
|
+
excludeFromSummaryJSON: true,
|
|
63576
63679
|
addOptions() {
|
|
63577
63680
|
return {
|
|
63578
63681
|
htmlAttributes: {}
|
|
@@ -63604,6 +63707,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
63604
63707
|
const dotsLoader = "data:image/svg+xml,%3csvg%20fill='hsla(278,%2077.40%25,%2020.80%25,%200.65)'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='4'%20cy='12'%20r='0'%3e%3canimate%20begin='0;spinner_z0Or.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3canimate%20begin='spinner_OLMs.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3canimate%20begin='spinner_UHR2.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3canimate%20id='spinner_lo66'%20begin='spinner_Aguh.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_z0Or'%20begin='spinner_lo66.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3c/circle%3e%3ccircle%20cx='4'%20cy='12'%20r='3'%3e%3canimate%20begin='0;spinner_z0Or.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3canimate%20begin='spinner_OLMs.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3canimate%20id='spinner_JsnR'%20begin='spinner_UHR2.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_Aguh'%20begin='spinner_JsnR.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3canimate%20begin='spinner_Aguh.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3c/circle%3e%3ccircle%20cx='12'%20cy='12'%20r='3'%3e%3canimate%20begin='0;spinner_z0Or.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3canimate%20id='spinner_hSjk'%20begin='spinner_OLMs.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_UHR2'%20begin='spinner_hSjk.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3canimate%20begin='spinner_UHR2.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3canimate%20begin='spinner_Aguh.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3c/circle%3e%3ccircle%20cx='20'%20cy='12'%20r='3'%3e%3canimate%20id='spinner_4v5M'%20begin='0;spinner_z0Or.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_OLMs'%20begin='spinner_4v5M.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3canimate%20begin='spinner_OLMs.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3canimate%20begin='spinner_UHR2.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3canimate%20begin='spinner_Aguh.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3c/circle%3e%3c/svg%3e";
|
|
63605
63708
|
const AiLoaderNode = Node$1.create({
|
|
63606
63709
|
name: AiLoaderNodeName,
|
|
63710
|
+
excludeFromSummaryJSON: true,
|
|
63607
63711
|
group: "inline",
|
|
63608
63712
|
inline: true,
|
|
63609
63713
|
atom: true,
|
|
@@ -65190,6 +65294,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
65190
65294
|
group: "block",
|
|
65191
65295
|
content: "block*",
|
|
65192
65296
|
isolating: true,
|
|
65297
|
+
excludeFromSummaryJSON: true,
|
|
65193
65298
|
addOptions() {
|
|
65194
65299
|
return {
|
|
65195
65300
|
htmlAttributes: {
|
|
@@ -67384,6 +67489,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67384
67489
|
group: "block",
|
|
67385
67490
|
content: "inline*",
|
|
67386
67491
|
inline: false,
|
|
67492
|
+
summary: "The paragraph node mirrors MS Word w:p paragraphs, and also represents lists in the schema.",
|
|
67387
67493
|
addOptions() {
|
|
67388
67494
|
return {
|
|
67389
67495
|
headingLevels: [1, 2, 3, 4, 5, 6],
|
|
@@ -74975,6 +75081,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
74975
75081
|
group: "inline",
|
|
74976
75082
|
inline: true,
|
|
74977
75083
|
selectable: false,
|
|
75084
|
+
excludeFromSummaryJSON: true,
|
|
74978
75085
|
atom: true,
|
|
74979
75086
|
addOptions() {
|
|
74980
75087
|
return {
|
|
@@ -118373,7 +118480,7 @@ ${style2}
|
|
|
118373
118480
|
this.config.colors = shuffleArray(this.config.colors);
|
|
118374
118481
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
118375
118482
|
this.colorIndex = 0;
|
|
118376
|
-
this.version = "0.
|
|
118483
|
+
this.version = "0.34.0";
|
|
118377
118484
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
118378
118485
|
this.superdocId = config2.superdocId || v4();
|
|
118379
118486
|
this.colors = this.config.colors;
|
|
@@ -120773,7 +120880,7 @@ ${style2}
|
|
|
120773
120880
|
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
|
120774
120881
|
);
|
|
120775
120882
|
}
|
|
120776
|
-
const
|
|
120883
|
+
const indexUvHeMhoE = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
120777
120884
|
__proto__: null,
|
|
120778
120885
|
unified
|
|
120779
120886
|
}, Symbol.toStringTag, { value: "Module" }));
|