superdoc 1.2.0-next.3 → 1.2.0-next.4
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-YF1CVu0a.es.js → PdfViewer-CTZhxpdL.es.js} +2 -2
- package/dist/chunks/{PdfViewer-CcxDV0Xx.cjs → PdfViewer-D6Fjs_9h.cjs} +2 -2
- package/dist/chunks/{SuperConverter-DSzyLsbD.es.js → SuperConverter-DLBk_s6P.es.js} +10 -8
- package/dist/chunks/{SuperConverter-DxT3ozmY.cjs → SuperConverter-DyHCVb21.cjs} +10 -8
- package/dist/chunks/{index-q918FQld.cjs → index-CJK21oZ-.cjs} +156 -86
- package/dist/chunks/{index-Cmm-GVXX.es.js → index-CjyAlN64.es.js} +26 -14
- package/dist/chunks/{index-DfAlk6gQ.es.js → index-Cm6f-cOP.es.js} +165 -95
- package/dist/chunks/{index-DgdLGt4h.cjs → index-D8sPE5mi.cjs} +26 -14
- package/dist/super-editor/converter.cjs +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/src/components/toolbar/toolbarIcons.d.ts +62 -0
- package/dist/super-editor/src/components/toolbar/toolbarIcons.d.ts.map +1 -0
- package/dist/super-editor/src/core/DocxZipper.d.ts +4 -0
- package/dist/super-editor/src/core/Extension.d.ts +33 -0
- package/dist/super-editor/src/core/Extension.d.ts.map +1 -0
- package/dist/super-editor/src/core/helpers/getExtensionConfigField.d.ts +35 -0
- package/dist/super-editor/src/core/helpers/getExtensionConfigField.d.ts.map +1 -0
- package/dist/super-editor/src/core/utilities/callOrGet.d.ts +13 -0
- package/dist/super-editor/src/core/utilities/callOrGet.d.ts.map +1 -0
- package/dist/super-editor/src/extensions/comment/comments-constants.d.ts +2 -0
- package/dist/super-editor/src/extensions/comment/comments-constants.d.ts.map +1 -0
- package/dist/super-editor/src/extensions/comment/comments-plugin.d.ts +1 -0
- package/dist/super-editor/src/index.d.ts +362 -0
- package/dist/super-editor.cjs +24 -2
- package/dist/super-editor.es.js +31 -8
- package/dist/superdoc/src/components/CommentsLayer/CommentDialog.vue.d.ts +5 -5
- package/dist/superdoc/src/components/CommentsLayer/CommentInput.vue.d.ts +2 -2
- package/dist/superdoc/src/components/HtmlViewer/HtmlViewer.vue.d.ts +2 -2
- package/dist/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/superdoc/src/stores/comments-store.d.ts +1 -1
- package/dist/superdoc/src/stores/superdoc-store.d.ts +4 -4
- package/dist/superdoc.cjs +3 -3
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +281 -199
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +2 -2
|
@@ -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-
|
|
3
|
-
import { C as derived, r as c, q as cB,
|
|
2
|
+
import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-CjyAlN64.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-Cm6f-cOP.es.js";
|
|
4
4
|
function self(vars) {
|
|
5
5
|
const {
|
|
6
6
|
opacityDisabled,
|
|
@@ -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-
|
|
5
|
-
const index = require("./index-
|
|
4
|
+
const superdoc = require("./index-D8sPE5mi.cjs");
|
|
5
|
+
const index = require("./index-CJK21oZ-.cjs");
|
|
6
6
|
function self(vars) {
|
|
7
7
|
const {
|
|
8
8
|
opacityDisabled,
|
|
@@ -7803,7 +7803,7 @@ function encodeMarksFromRPr(runProperties, docx) {
|
|
|
7803
7803
|
textStyleAttrs[key] = fontFamily;
|
|
7804
7804
|
const eastAsiaFamily = value["eastAsia"];
|
|
7805
7805
|
if (eastAsiaFamily) {
|
|
7806
|
-
const eastAsiaCss =
|
|
7806
|
+
const eastAsiaCss = getFontFamilyValue$1({ "w:ascii": eastAsiaFamily }, docx);
|
|
7807
7807
|
if (!fontFamily || eastAsiaCss !== textStyleAttrs.fontFamily) {
|
|
7808
7808
|
textStyleAttrs.eastAsiaFontFamily = eastAsiaCss;
|
|
7809
7809
|
}
|
|
@@ -8045,7 +8045,7 @@ function encodeCSSFromRPr(runProperties, docx) {
|
|
|
8045
8045
|
}
|
|
8046
8046
|
const eastAsiaFamily = value["eastAsia"];
|
|
8047
8047
|
if (eastAsiaFamily) {
|
|
8048
|
-
const eastAsiaCss =
|
|
8048
|
+
const eastAsiaCss = getFontFamilyValue$1({ "w:ascii": eastAsiaFamily }, docx);
|
|
8049
8049
|
if (eastAsiaCss && (!fontFamily || eastAsiaCss !== fontFamily)) {
|
|
8050
8050
|
css["font-family"] = css["font-family"] || eastAsiaCss;
|
|
8051
8051
|
}
|
|
@@ -9062,7 +9062,8 @@ const encode$x = (params, encodedAttrs = {}) => {
|
|
|
9062
9062
|
const runProperties = rPrNode ? translator$1O.encode({ ...params, nodes: [rPrNode] }) : {};
|
|
9063
9063
|
const paragraphProperties = params?.extraParams?.paragraphProperties || {};
|
|
9064
9064
|
const resolvedRunProperties = resolveRunProperties(params, runProperties ?? {}, paragraphProperties);
|
|
9065
|
-
const
|
|
9065
|
+
const marksResult = encodeMarksFromRPr(resolvedRunProperties, params?.docx);
|
|
9066
|
+
const marks = Array.isArray(marksResult) ? marksResult : [];
|
|
9066
9067
|
const rPrChange = rPrNode?.elements?.find((el) => el.name === "w:rPrChange");
|
|
9067
9068
|
const styleChangeMarks = handleStyleChangeMarksV2(rPrChange, marks, params) || [];
|
|
9068
9069
|
let runLevelMarks = Array.isArray(runNode.marks) ? runNode.marks.map((mark) => cloneMark$1(mark)) : [];
|
|
@@ -9072,7 +9073,7 @@ const encode$x = (params, encodedAttrs = {}) => {
|
|
|
9072
9073
|
const contentElements = rPrNode ? elements.filter((el) => el !== rPrNode) : elements;
|
|
9073
9074
|
const childParams = { ...params, nodes: contentElements };
|
|
9074
9075
|
const content = nodeListHandler?.handler(childParams) || [];
|
|
9075
|
-
const contentWithRunMarks = content.map((child) => {
|
|
9076
|
+
const contentWithRunMarks = (Array.isArray(content) ? content : []).map((child) => {
|
|
9076
9077
|
if (!child || typeof child !== "object") return child;
|
|
9077
9078
|
const baseMarks = Array.isArray(child.marks) ? child.marks : [];
|
|
9078
9079
|
let childMarks = [...marks, ...baseMarks, ...runLevelMarks].map((mark) => cloneMark$1(mark));
|
|
@@ -19766,8 +19767,6 @@ class CommandService {
|
|
|
19766
19767
|
* @returns {boolean} True if dispatch succeeded, false if editor was destroyed or unavailable.
|
|
19767
19768
|
*
|
|
19768
19769
|
* @throws {Error} Throws wrapped error with context: `[CommandService] Dispatch failed: <original error message>`
|
|
19769
|
-
*
|
|
19770
|
-
* @private
|
|
19771
19770
|
*/
|
|
19772
19771
|
#dispatchWithFallback(tr, { editor, view }) {
|
|
19773
19772
|
if (editor?.isDestroyed) {
|
|
@@ -19785,7 +19784,9 @@ class CommandService {
|
|
|
19785
19784
|
}
|
|
19786
19785
|
return true;
|
|
19787
19786
|
} catch (error) {
|
|
19788
|
-
|
|
19787
|
+
const err = new Error(`[CommandService] Dispatch failed: ${error.message}`);
|
|
19788
|
+
err.cause = error;
|
|
19789
|
+
throw err;
|
|
19789
19790
|
}
|
|
19790
19791
|
}
|
|
19791
19792
|
}
|
|
@@ -27444,6 +27445,7 @@ const translatorList = Array.from(
|
|
|
27444
27445
|
);
|
|
27445
27446
|
const additionalHandlers = Object.freeze(
|
|
27446
27447
|
translatorList.reduce((acc, translator2) => {
|
|
27448
|
+
if (typeof translator2 === "function") return acc;
|
|
27447
27449
|
const key = translator2?.xmlName;
|
|
27448
27450
|
if (!key) return acc;
|
|
27449
27451
|
acc[key] = translator2;
|
|
@@ -30735,7 +30737,7 @@ class SuperConverter {
|
|
|
30735
30737
|
static getStoredSuperdocVersion(docx) {
|
|
30736
30738
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
30737
30739
|
}
|
|
30738
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.2.0-next.
|
|
30740
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.2.0-next.4") {
|
|
30739
30741
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
30740
30742
|
}
|
|
30741
30743
|
/**
|
|
@@ -7804,7 +7804,7 @@ function encodeMarksFromRPr(runProperties, docx) {
|
|
|
7804
7804
|
textStyleAttrs[key] = fontFamily;
|
|
7805
7805
|
const eastAsiaFamily = value["eastAsia"];
|
|
7806
7806
|
if (eastAsiaFamily) {
|
|
7807
|
-
const eastAsiaCss =
|
|
7807
|
+
const eastAsiaCss = getFontFamilyValue$1({ "w:ascii": eastAsiaFamily }, docx);
|
|
7808
7808
|
if (!fontFamily || eastAsiaCss !== textStyleAttrs.fontFamily) {
|
|
7809
7809
|
textStyleAttrs.eastAsiaFontFamily = eastAsiaCss;
|
|
7810
7810
|
}
|
|
@@ -8046,7 +8046,7 @@ function encodeCSSFromRPr(runProperties, docx) {
|
|
|
8046
8046
|
}
|
|
8047
8047
|
const eastAsiaFamily = value["eastAsia"];
|
|
8048
8048
|
if (eastAsiaFamily) {
|
|
8049
|
-
const eastAsiaCss =
|
|
8049
|
+
const eastAsiaCss = getFontFamilyValue$1({ "w:ascii": eastAsiaFamily }, docx);
|
|
8050
8050
|
if (eastAsiaCss && (!fontFamily || eastAsiaCss !== fontFamily)) {
|
|
8051
8051
|
css["font-family"] = css["font-family"] || eastAsiaCss;
|
|
8052
8052
|
}
|
|
@@ -9063,7 +9063,8 @@ const encode$x = (params, encodedAttrs = {}) => {
|
|
|
9063
9063
|
const runProperties = rPrNode ? translator$1O.encode({ ...params, nodes: [rPrNode] }) : {};
|
|
9064
9064
|
const paragraphProperties = params?.extraParams?.paragraphProperties || {};
|
|
9065
9065
|
const resolvedRunProperties = resolveRunProperties(params, runProperties ?? {}, paragraphProperties);
|
|
9066
|
-
const
|
|
9066
|
+
const marksResult = encodeMarksFromRPr(resolvedRunProperties, params?.docx);
|
|
9067
|
+
const marks = Array.isArray(marksResult) ? marksResult : [];
|
|
9067
9068
|
const rPrChange = rPrNode?.elements?.find((el) => el.name === "w:rPrChange");
|
|
9068
9069
|
const styleChangeMarks = handleStyleChangeMarksV2(rPrChange, marks, params) || [];
|
|
9069
9070
|
let runLevelMarks = Array.isArray(runNode.marks) ? runNode.marks.map((mark) => cloneMark$1(mark)) : [];
|
|
@@ -9073,7 +9074,7 @@ const encode$x = (params, encodedAttrs = {}) => {
|
|
|
9073
9074
|
const contentElements = rPrNode ? elements.filter((el) => el !== rPrNode) : elements;
|
|
9074
9075
|
const childParams = { ...params, nodes: contentElements };
|
|
9075
9076
|
const content = nodeListHandler?.handler(childParams) || [];
|
|
9076
|
-
const contentWithRunMarks = content.map((child) => {
|
|
9077
|
+
const contentWithRunMarks = (Array.isArray(content) ? content : []).map((child) => {
|
|
9077
9078
|
if (!child || typeof child !== "object") return child;
|
|
9078
9079
|
const baseMarks = Array.isArray(child.marks) ? child.marks : [];
|
|
9079
9080
|
let childMarks = [...marks, ...baseMarks, ...runLevelMarks].map((mark) => cloneMark$1(mark));
|
|
@@ -19767,8 +19768,6 @@ class CommandService {
|
|
|
19767
19768
|
* @returns {boolean} True if dispatch succeeded, false if editor was destroyed or unavailable.
|
|
19768
19769
|
*
|
|
19769
19770
|
* @throws {Error} Throws wrapped error with context: `[CommandService] Dispatch failed: <original error message>`
|
|
19770
|
-
*
|
|
19771
|
-
* @private
|
|
19772
19771
|
*/
|
|
19773
19772
|
#dispatchWithFallback(tr, { editor, view }) {
|
|
19774
19773
|
if (editor?.isDestroyed) {
|
|
@@ -19786,7 +19785,9 @@ class CommandService {
|
|
|
19786
19785
|
}
|
|
19787
19786
|
return true;
|
|
19788
19787
|
} catch (error) {
|
|
19789
|
-
|
|
19788
|
+
const err = new Error(`[CommandService] Dispatch failed: ${error.message}`);
|
|
19789
|
+
err.cause = error;
|
|
19790
|
+
throw err;
|
|
19790
19791
|
}
|
|
19791
19792
|
}
|
|
19792
19793
|
}
|
|
@@ -27445,6 +27446,7 @@ const translatorList = Array.from(
|
|
|
27445
27446
|
);
|
|
27446
27447
|
const additionalHandlers = Object.freeze(
|
|
27447
27448
|
translatorList.reduce((acc, translator2) => {
|
|
27449
|
+
if (typeof translator2 === "function") return acc;
|
|
27448
27450
|
const key = translator2?.xmlName;
|
|
27449
27451
|
if (!key) return acc;
|
|
27450
27452
|
acc[key] = translator2;
|
|
@@ -30736,7 +30738,7 @@ class SuperConverter {
|
|
|
30736
30738
|
static getStoredSuperdocVersion(docx) {
|
|
30737
30739
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
30738
30740
|
}
|
|
30739
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.2.0-next.
|
|
30741
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.2.0-next.4") {
|
|
30740
30742
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
30741
30743
|
}
|
|
30742
30744
|
/**
|
|
@@ -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-
|
|
4
|
+
const superEditor_converter = require("./SuperConverter-DyHCVb21.cjs");
|
|
5
5
|
const vue = require("./vue-De9wkgLl.cjs");
|
|
6
6
|
require("./jszip.min-BPh2MMAa.cjs");
|
|
7
7
|
const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
|
|
@@ -26,6 +26,14 @@ function _interopNamespaceDefault(e) {
|
|
|
26
26
|
return Object.freeze(n);
|
|
27
27
|
}
|
|
28
28
|
const Y__namespace = /* @__PURE__ */ _interopNamespaceDefault(Y);
|
|
29
|
+
function getExtensionConfigField(extension, field, context = { name: "" }) {
|
|
30
|
+
const fieldValue = extension.config[field];
|
|
31
|
+
if (typeof fieldValue === "function") {
|
|
32
|
+
const boundValue = fieldValue.bind({ ...context });
|
|
33
|
+
return boundValue;
|
|
34
|
+
}
|
|
35
|
+
return fieldValue;
|
|
36
|
+
}
|
|
29
37
|
function callOrGet(value, context = null, ...props) {
|
|
30
38
|
if (typeof value === "function") {
|
|
31
39
|
const fn2 = value;
|
|
@@ -34,6 +42,75 @@ function callOrGet(value, context = null, ...props) {
|
|
|
34
42
|
}
|
|
35
43
|
return value;
|
|
36
44
|
}
|
|
45
|
+
let Node$1 = class Node2 {
|
|
46
|
+
constructor(config) {
|
|
47
|
+
this.type = "node";
|
|
48
|
+
this.name = "node";
|
|
49
|
+
this.config = {
|
|
50
|
+
...config,
|
|
51
|
+
name: config.name || this.name
|
|
52
|
+
};
|
|
53
|
+
this.name = this.config.name;
|
|
54
|
+
this.group = this.config.group;
|
|
55
|
+
if (this.config.addOptions) {
|
|
56
|
+
this.options = callOrGet(
|
|
57
|
+
getExtensionConfigField(this, "addOptions", {
|
|
58
|
+
name: this.name
|
|
59
|
+
})
|
|
60
|
+
) || {};
|
|
61
|
+
} else {
|
|
62
|
+
this.options = {};
|
|
63
|
+
}
|
|
64
|
+
this.storage = callOrGet(
|
|
65
|
+
getExtensionConfigField(this, "addStorage", {
|
|
66
|
+
name: this.name,
|
|
67
|
+
options: this.options
|
|
68
|
+
})
|
|
69
|
+
) || {};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Factory method to construct a new Node extension.
|
|
73
|
+
* @param config - The node configuration.
|
|
74
|
+
* @returns A new Node instance.
|
|
75
|
+
*/
|
|
76
|
+
static create(config) {
|
|
77
|
+
return new Node2(config);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
class Mark {
|
|
81
|
+
constructor(config) {
|
|
82
|
+
this.type = "mark";
|
|
83
|
+
this.name = "mark";
|
|
84
|
+
this.config = {
|
|
85
|
+
...config,
|
|
86
|
+
name: config.name || this.name
|
|
87
|
+
};
|
|
88
|
+
this.name = this.config.name;
|
|
89
|
+
this.isExternal = Boolean(this.config.isExternal);
|
|
90
|
+
if (this.config.addOptions) {
|
|
91
|
+
this.options = callOrGet(
|
|
92
|
+
getExtensionConfigField(this, "addOptions", {
|
|
93
|
+
name: this.name
|
|
94
|
+
})
|
|
95
|
+
) || {};
|
|
96
|
+
} else {
|
|
97
|
+
this.options = {};
|
|
98
|
+
}
|
|
99
|
+
this.storage = callOrGet(
|
|
100
|
+
getExtensionConfigField(this, "addStorage", {
|
|
101
|
+
name: this.name,
|
|
102
|
+
options: this.options
|
|
103
|
+
})
|
|
104
|
+
) || {};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Static method for creating Mark extension.
|
|
108
|
+
* @param config Configuration for the mark.
|
|
109
|
+
*/
|
|
110
|
+
static create(config) {
|
|
111
|
+
return new Mark(config);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
37
114
|
function isEmptyObject(value = {}) {
|
|
38
115
|
return Object.keys(value).length === 0 && value.constructor === Object;
|
|
39
116
|
}
|
|
@@ -109,14 +186,6 @@ function createDocument(converter, schema, editor, { check = false } = {}) {
|
|
|
109
186
|
}
|
|
110
187
|
return schema.topNodeType.createAndFill();
|
|
111
188
|
}
|
|
112
|
-
function getExtensionConfigField(extension, field, context = { name: "" }) {
|
|
113
|
-
const fieldValue = extension.config[field];
|
|
114
|
-
if (typeof fieldValue === "function") {
|
|
115
|
-
const boundValue = fieldValue.bind({ ...context });
|
|
116
|
-
return boundValue;
|
|
117
|
-
}
|
|
118
|
-
return fieldValue;
|
|
119
|
-
}
|
|
120
189
|
function getSchemaTypeByName(name, schema) {
|
|
121
190
|
return schema.nodes[name] || schema.marks[name] || null;
|
|
122
191
|
}
|
|
@@ -8581,75 +8650,6 @@ const createUndoPlugin = () => {
|
|
|
8581
8650
|
const yUndoPluginInstance = yUndoPlugin();
|
|
8582
8651
|
return yUndoPluginInstance;
|
|
8583
8652
|
};
|
|
8584
|
-
let Node$1 = class Node2 {
|
|
8585
|
-
constructor(config) {
|
|
8586
|
-
this.type = "node";
|
|
8587
|
-
this.name = "node";
|
|
8588
|
-
this.config = {
|
|
8589
|
-
...config,
|
|
8590
|
-
name: config.name || this.name
|
|
8591
|
-
};
|
|
8592
|
-
this.name = this.config.name;
|
|
8593
|
-
this.group = this.config.group;
|
|
8594
|
-
if (this.config.addOptions) {
|
|
8595
|
-
this.options = callOrGet(
|
|
8596
|
-
getExtensionConfigField(this, "addOptions", {
|
|
8597
|
-
name: this.name
|
|
8598
|
-
})
|
|
8599
|
-
) || {};
|
|
8600
|
-
} else {
|
|
8601
|
-
this.options = {};
|
|
8602
|
-
}
|
|
8603
|
-
this.storage = callOrGet(
|
|
8604
|
-
getExtensionConfigField(this, "addStorage", {
|
|
8605
|
-
name: this.name,
|
|
8606
|
-
options: this.options
|
|
8607
|
-
})
|
|
8608
|
-
) || {};
|
|
8609
|
-
}
|
|
8610
|
-
/**
|
|
8611
|
-
* Factory method to construct a new Node extension.
|
|
8612
|
-
* @param config - The node configuration.
|
|
8613
|
-
* @returns A new Node instance.
|
|
8614
|
-
*/
|
|
8615
|
-
static create(config) {
|
|
8616
|
-
return new Node2(config);
|
|
8617
|
-
}
|
|
8618
|
-
};
|
|
8619
|
-
class Mark {
|
|
8620
|
-
constructor(config) {
|
|
8621
|
-
this.type = "mark";
|
|
8622
|
-
this.name = "mark";
|
|
8623
|
-
this.config = {
|
|
8624
|
-
...config,
|
|
8625
|
-
name: config.name || this.name
|
|
8626
|
-
};
|
|
8627
|
-
this.name = this.config.name;
|
|
8628
|
-
this.isExternal = Boolean(this.config.isExternal);
|
|
8629
|
-
if (this.config.addOptions) {
|
|
8630
|
-
this.options = callOrGet(
|
|
8631
|
-
getExtensionConfigField(this, "addOptions", {
|
|
8632
|
-
name: this.name
|
|
8633
|
-
})
|
|
8634
|
-
) || {};
|
|
8635
|
-
} else {
|
|
8636
|
-
this.options = {};
|
|
8637
|
-
}
|
|
8638
|
-
this.storage = callOrGet(
|
|
8639
|
-
getExtensionConfigField(this, "addStorage", {
|
|
8640
|
-
name: this.name,
|
|
8641
|
-
options: this.options
|
|
8642
|
-
})
|
|
8643
|
-
) || {};
|
|
8644
|
-
}
|
|
8645
|
-
/**
|
|
8646
|
-
* Static method for creating Mark extension.
|
|
8647
|
-
* @param config Configuration for the mark.
|
|
8648
|
-
*/
|
|
8649
|
-
static create(config) {
|
|
8650
|
-
return new Mark(config);
|
|
8651
|
-
}
|
|
8652
|
-
}
|
|
8653
8653
|
class Attribute {
|
|
8654
8654
|
/**
|
|
8655
8655
|
* Get a list of all attributes defined in the extensions.
|
|
@@ -14915,7 +14915,7 @@ const canUseDOM = () => {
|
|
|
14915
14915
|
return false;
|
|
14916
14916
|
}
|
|
14917
14917
|
};
|
|
14918
|
-
const summaryVersion = "1.2.0-next.
|
|
14918
|
+
const summaryVersion = "1.2.0-next.4";
|
|
14919
14919
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
14920
14920
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
14921
14921
|
function mapAttributes(attrs) {
|
|
@@ -16024,11 +16024,10 @@ class Editor extends EventEmitter {
|
|
|
16024
16024
|
#checkHeadless(options) {
|
|
16025
16025
|
if (!options.isHeadless) return;
|
|
16026
16026
|
if (typeof navigator === "undefined") {
|
|
16027
|
-
|
|
16027
|
+
vue.global.navigator = {
|
|
16028
16028
|
platform: "node",
|
|
16029
16029
|
userAgent: "Node.js"
|
|
16030
16030
|
};
|
|
16031
|
-
vue.global.navigator = minimalNavigator;
|
|
16032
16031
|
}
|
|
16033
16032
|
if (options.mockDocument) {
|
|
16034
16033
|
console.warn(
|
|
@@ -16512,7 +16511,11 @@ class Editor extends EventEmitter {
|
|
|
16512
16511
|
* Set the document version
|
|
16513
16512
|
*/
|
|
16514
16513
|
static setDocumentVersion(doc2, version2) {
|
|
16515
|
-
|
|
16514
|
+
const result = superEditor_converter.SuperConverter.setStoredSuperdocVersion(doc2, version2);
|
|
16515
|
+
if (typeof result === "string") {
|
|
16516
|
+
return result;
|
|
16517
|
+
}
|
|
16518
|
+
return version2;
|
|
16516
16519
|
}
|
|
16517
16520
|
/**
|
|
16518
16521
|
* Get the document GUID
|
|
@@ -17545,7 +17548,7 @@ class Editor extends EventEmitter {
|
|
|
17545
17548
|
* Process collaboration migrations
|
|
17546
17549
|
*/
|
|
17547
17550
|
processCollaborationMigrations() {
|
|
17548
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.2.0-next.
|
|
17551
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.2.0-next.4");
|
|
17549
17552
|
if (!this.options.ydoc) return;
|
|
17550
17553
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
17551
17554
|
let docVersion = metaMap.get("version");
|
|
@@ -50675,6 +50678,53 @@ class PresentationEditor extends EventEmitter {
|
|
|
50675
50678
|
height: rect.height
|
|
50676
50679
|
};
|
|
50677
50680
|
}
|
|
50681
|
+
/**
|
|
50682
|
+
* Scroll the visible host so a given document position is brought into view.
|
|
50683
|
+
*
|
|
50684
|
+
* This is primarily used by commands like search navigation when running in
|
|
50685
|
+
* PresentationEditor mode, where ProseMirror's `scrollIntoView()` operates on the
|
|
50686
|
+
* hidden editor and does not affect the rendered viewport.
|
|
50687
|
+
*
|
|
50688
|
+
* @param pos - Document position in the active editor to scroll to
|
|
50689
|
+
* @param options - Scrolling options
|
|
50690
|
+
* @param options.block - Alignment within the viewport ('start' | 'center' | 'end' | 'nearest')
|
|
50691
|
+
* @param options.behavior - Scroll behavior ('auto' | 'smooth')
|
|
50692
|
+
* @returns True if the position could be mapped and scrolling was applied
|
|
50693
|
+
*/
|
|
50694
|
+
scrollToPosition(pos, options = {}) {
|
|
50695
|
+
const activeEditor = this.getActiveEditor();
|
|
50696
|
+
const doc2 = activeEditor?.state?.doc;
|
|
50697
|
+
if (!doc2) return false;
|
|
50698
|
+
if (!Number.isFinite(pos)) return false;
|
|
50699
|
+
const clampedPos = Math.max(0, Math.min(pos, doc2.content.size));
|
|
50700
|
+
const behavior = options.behavior ?? "auto";
|
|
50701
|
+
const block = options.block ?? "center";
|
|
50702
|
+
const layout = this.#layoutState.layout;
|
|
50703
|
+
if (layout && this.#session.mode === "body") {
|
|
50704
|
+
let pageIndex = null;
|
|
50705
|
+
for (let idx = 0; idx < layout.pages.length; idx++) {
|
|
50706
|
+
const page = layout.pages[idx];
|
|
50707
|
+
for (const fragment of page.fragments) {
|
|
50708
|
+
const frag = fragment;
|
|
50709
|
+
if (frag.pmStart != null && frag.pmEnd != null && clampedPos >= frag.pmStart && clampedPos <= frag.pmEnd) {
|
|
50710
|
+
pageIndex = idx;
|
|
50711
|
+
break;
|
|
50712
|
+
}
|
|
50713
|
+
}
|
|
50714
|
+
if (pageIndex != null) break;
|
|
50715
|
+
}
|
|
50716
|
+
if (pageIndex != null) {
|
|
50717
|
+
const pageEl = getPageElementByIndex(this.#viewportHost, pageIndex);
|
|
50718
|
+
if (pageEl) {
|
|
50719
|
+
pageEl.scrollIntoView({ block, inline: "nearest", behavior });
|
|
50720
|
+
return true;
|
|
50721
|
+
}
|
|
50722
|
+
}
|
|
50723
|
+
return false;
|
|
50724
|
+
} else {
|
|
50725
|
+
return false;
|
|
50726
|
+
}
|
|
50727
|
+
}
|
|
50678
50728
|
/**
|
|
50679
50729
|
* Get document position from viewport coordinates (header/footer-aware).
|
|
50680
50730
|
*
|
|
@@ -51566,7 +51616,12 @@ class PresentationEditor extends EventEmitter {
|
|
|
51566
51616
|
lineIndex: rawHit.lineIndex,
|
|
51567
51617
|
layoutEpoch: rawHit.layoutEpoch
|
|
51568
51618
|
} : null,
|
|
51569
|
-
mapped: mapped ? mapped.ok ? { ok: true, pos: mapped.pos, fromEpoch: mapped.fromEpoch, toEpoch: mapped.toEpoch } : {
|
|
51619
|
+
mapped: mapped ? mapped.ok ? { ok: true, pos: mapped.pos, fromEpoch: mapped.fromEpoch, toEpoch: mapped.toEpoch } : {
|
|
51620
|
+
ok: false,
|
|
51621
|
+
reason: mapped.reason,
|
|
51622
|
+
fromEpoch: mapped.fromEpoch,
|
|
51623
|
+
toEpoch: mapped.toEpoch
|
|
51624
|
+
} : null,
|
|
51570
51625
|
hit: hit ? { pos: hit.pos, pageIndex: hit.pageIndex, layoutEpoch: hit.layoutEpoch } : null
|
|
51571
51626
|
})}`
|
|
51572
51627
|
);
|
|
@@ -71078,12 +71133,20 @@ const Search = Extension.create({
|
|
|
71078
71133
|
*/
|
|
71079
71134
|
goToFirstMatch: () => (
|
|
71080
71135
|
/** @returns {boolean} */
|
|
71081
|
-
({ state, editor }) => {
|
|
71136
|
+
({ state, editor, dispatch }) => {
|
|
71082
71137
|
const highlights = getMatchHighlights(state);
|
|
71083
71138
|
if (!highlights) return false;
|
|
71084
71139
|
const decorations = highlights.find();
|
|
71085
71140
|
if (!decorations?.length) return false;
|
|
71086
71141
|
const firstMatch = decorations[0];
|
|
71142
|
+
editor.view.focus();
|
|
71143
|
+
const tr = state.tr.setSelection(superEditor_converter.TextSelection.create(state.doc, firstMatch.from, firstMatch.to)).scrollIntoView();
|
|
71144
|
+
if (dispatch) dispatch(tr);
|
|
71145
|
+
const presentationEditor = editor.presentationEditor;
|
|
71146
|
+
if (presentationEditor && typeof presentationEditor.scrollToPosition === "function") {
|
|
71147
|
+
const didScroll = presentationEditor.scrollToPosition(firstMatch.from, { block: "center" });
|
|
71148
|
+
if (didScroll) return true;
|
|
71149
|
+
}
|
|
71087
71150
|
const domPos = editor.view.domAtPos(firstMatch.from);
|
|
71088
71151
|
domPos?.node?.scrollIntoView(true);
|
|
71089
71152
|
return true;
|
|
@@ -71168,7 +71231,12 @@ const Search = Extension.create({
|
|
|
71168
71231
|
const { from: from3, to } = match;
|
|
71169
71232
|
editor.view.focus();
|
|
71170
71233
|
const tr = state.tr.setSelection(superEditor_converter.TextSelection.create(state.doc, from3, to)).scrollIntoView();
|
|
71171
|
-
dispatch(tr);
|
|
71234
|
+
if (dispatch) dispatch(tr);
|
|
71235
|
+
const presentationEditor = editor.presentationEditor;
|
|
71236
|
+
if (presentationEditor && typeof presentationEditor.scrollToPosition === "function") {
|
|
71237
|
+
const didScroll = presentationEditor.scrollToPosition(from3, { block: "center" });
|
|
71238
|
+
if (didScroll) return true;
|
|
71239
|
+
}
|
|
71172
71240
|
const { node } = editor.view.domAtPos(from3);
|
|
71173
71241
|
if (node?.scrollIntoView) {
|
|
71174
71242
|
node.scrollIntoView({ block: "center", inline: "nearest" });
|
|
@@ -89104,8 +89172,10 @@ exports.CommentsPluginKey = CommentsPluginKey;
|
|
|
89104
89172
|
exports.Editor = Editor;
|
|
89105
89173
|
exports.Extensions = Extensions;
|
|
89106
89174
|
exports.MAX_SAFE_INTEGER = MAX_SAFE_INTEGER$2;
|
|
89175
|
+
exports.Mark = Mark;
|
|
89107
89176
|
exports.NConfigProvider = NConfigProvider;
|
|
89108
89177
|
exports.NDropdown = NDropdown;
|
|
89178
|
+
exports.Node = Node$1;
|
|
89109
89179
|
exports.PresentationEditor = PresentationEditor;
|
|
89110
89180
|
exports.SectionHelpers = SectionHelpers;
|
|
89111
89181
|
exports.SuperEditor = SuperEditor;
|
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
2
|
-
import "./SuperConverter-
|
|
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-Cm6f-cOP.es.js";
|
|
2
|
+
import "./SuperConverter-DLBk_s6P.es.js";
|
|
3
3
|
import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
|
|
4
4
|
import { E as EventEmitter } from "./eventemitter3-CwrdEv8r.es.js";
|
|
5
5
|
import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
|
|
@@ -7444,7 +7444,7 @@ const _sfc_main = {
|
|
|
7444
7444
|
__name: "SuperDoc",
|
|
7445
7445
|
emits: ["selection-update"],
|
|
7446
7446
|
setup(__props, { emit: __emit }) {
|
|
7447
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
7447
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CTZhxpdL.es.js"));
|
|
7448
7448
|
const superdocStore = useSuperdocStore();
|
|
7449
7449
|
const commentsStore = useCommentsStore();
|
|
7450
7450
|
const {
|
|
@@ -8242,6 +8242,8 @@ const DEFAULT_USER = Object.freeze({
|
|
|
8242
8242
|
class SuperDoc extends EventEmitter {
|
|
8243
8243
|
/** @type {Array<string>} */
|
|
8244
8244
|
static allowedTypes = [DOCX, PDF, HTML];
|
|
8245
|
+
/** @type {boolean} */
|
|
8246
|
+
#destroyed = false;
|
|
8245
8247
|
/** @type {string} */
|
|
8246
8248
|
version;
|
|
8247
8249
|
/** @type {User[]} */
|
|
@@ -8348,12 +8350,16 @@ class SuperDoc extends EventEmitter {
|
|
|
8348
8350
|
this.config.colors = shuffleArray(this.config.colors);
|
|
8349
8351
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
8350
8352
|
this.colorIndex = 0;
|
|
8351
|
-
this.version = "1.2.0-next.
|
|
8353
|
+
this.version = "1.2.0-next.4";
|
|
8352
8354
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
8353
8355
|
this.superdocId = config.superdocId || v4();
|
|
8354
8356
|
this.colors = this.config.colors;
|
|
8355
8357
|
this.#initDocuments();
|
|
8356
8358
|
await this.#initCollaboration(this.config.modules);
|
|
8359
|
+
if (this.#destroyed) {
|
|
8360
|
+
this.#cleanupCollaboration();
|
|
8361
|
+
return;
|
|
8362
|
+
}
|
|
8357
8363
|
if (this.config.cspNonce) this.#patchNaiveUIStyles();
|
|
8358
8364
|
this.#initVueApp();
|
|
8359
8365
|
this.#initListeners();
|
|
@@ -9039,14 +9045,10 @@ class SuperDoc extends EventEmitter {
|
|
|
9039
9045
|
return result;
|
|
9040
9046
|
}
|
|
9041
9047
|
/**
|
|
9042
|
-
*
|
|
9048
|
+
* Clean up collaboration resources (providers, ydocs, sockets)
|
|
9043
9049
|
* @returns {void}
|
|
9044
9050
|
*/
|
|
9045
|
-
|
|
9046
|
-
if (!this.app) {
|
|
9047
|
-
return;
|
|
9048
|
-
}
|
|
9049
|
-
this.#log("[superdoc] Unmounting app");
|
|
9051
|
+
#cleanupCollaboration() {
|
|
9050
9052
|
this.config.socket?.cancelWebsocketRetry();
|
|
9051
9053
|
this.config.socket?.disconnect();
|
|
9052
9054
|
this.config.socket?.destroy();
|
|
@@ -9054,12 +9056,22 @@ class SuperDoc extends EventEmitter {
|
|
|
9054
9056
|
this.provider?.disconnect();
|
|
9055
9057
|
this.provider?.destroy();
|
|
9056
9058
|
this.config.documents.forEach((doc) => {
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
doc.provider.destroy();
|
|
9060
|
-
}
|
|
9059
|
+
doc.provider?.disconnect();
|
|
9060
|
+
doc.provider?.destroy();
|
|
9061
9061
|
doc.ydoc?.destroy();
|
|
9062
9062
|
});
|
|
9063
|
+
}
|
|
9064
|
+
/**
|
|
9065
|
+
* Destroy the superdoc instance
|
|
9066
|
+
* @returns {void}
|
|
9067
|
+
*/
|
|
9068
|
+
destroy() {
|
|
9069
|
+
this.#destroyed = true;
|
|
9070
|
+
this.#cleanupCollaboration();
|
|
9071
|
+
if (!this.app) {
|
|
9072
|
+
return;
|
|
9073
|
+
}
|
|
9074
|
+
this.#log("[superdoc] Unmounting app");
|
|
9063
9075
|
this.superdocStore.reset();
|
|
9064
9076
|
this.app.unmount();
|
|
9065
9077
|
this.removeAllListeners();
|