@harbour-enterprises/superdoc 0.17.0 → 0.18.0-next.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.
- package/dist/chunks/{PdfViewer-GP6I2zIW.cjs → PdfViewer-CNZTqGHw.cjs} +1 -1
- package/dist/chunks/{PdfViewer-C9MkdsYe.es.js → PdfViewer-D5cujgSt.es.js} +1 -1
- package/dist/chunks/{index-DyzJFuXw.es.js → index-BDwD6Uex.es.js} +4 -3
- package/dist/chunks/{index-D__8AUF5.cjs → index-BDysJRQU.cjs} +4 -3
- package/dist/chunks/{super-editor.es-v-3xRSOD.es.js → super-editor.es-BoCmoEkp.es.js} +472 -257
- package/dist/chunks/{super-editor.es-JiSMNI00.cjs → super-editor.es-aOm7eWFU.cjs} +471 -256
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-WThahWt0.js → converter-DvdFP4MZ.js} +339 -146
- package/dist/super-editor/chunks/{docx-zipper-6iJv_uCL.js → docx-zipper-CxFpxZUz.js} +1 -1
- package/dist/super-editor/chunks/{editor-OX-YyKoc.js → editor-CeWNMKjc.js} +32 -4
- package/dist/super-editor/chunks/{toolbar-CUglet_U.js → toolbar-Di2oAvyr.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/src/core/super-converter/exporter.d.ts +17 -0
- package/dist/super-editor/src/core/super-converter/v2/importer/lineBreakImporter.d.ts +3 -5
- package/dist/super-editor/src/core/super-converter/v2/importer/tabImporter.d.ts +2 -1
- package/dist/super-editor/src/core/super-converter/v2/importer/types/index.d.ts +75 -0
- package/dist/super-editor/src/core/super-converter/v2/types/index.d.ts +8 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/index.d.ts +8 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/br/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/br/attributes/w-clear.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/br/attributes/w-line-break-type.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/br/br-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/br/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/index.d.ts +3 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/w-tab-leader.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/w-tab-pos.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/w-tab-size.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tab/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tab/tab-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/node-translator/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +203 -0
- package/dist/super-editor/src/extensions/block-node/block-node.d.ts +0 -1
- package/dist/super-editor/src/index.d.ts +2 -1
- package/dist/super-editor/super-editor.es.js +12 -7
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +2 -1
- package/dist/super-editor.es.js +2 -1
- package/dist/superdoc.cjs +3 -2
- package/dist/superdoc.es.js +3 -2
- package/dist/superdoc.umd.js +594 -378
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/super-editor/src/core/super-converter/v2/handlers/index.d.ts +0 -1
- package/dist/super-editor/src/extensions/field-annotation/field-annotation-marks-impl.d.ts +0 -5
- /package/dist/super-editor/src/{extensions/document-attributes → core/super-converter/v3/handlers/types}/index.d.ts +0 -0
|
@@ -1895,14 +1895,14 @@ function requireEvents() {
|
|
|
1895
1895
|
err.context = er;
|
|
1896
1896
|
throw err;
|
|
1897
1897
|
}
|
|
1898
|
-
var
|
|
1899
|
-
if (
|
|
1898
|
+
var handler2 = events2[type2];
|
|
1899
|
+
if (handler2 === void 0)
|
|
1900
1900
|
return false;
|
|
1901
|
-
if (typeof
|
|
1902
|
-
ReflectApply(
|
|
1901
|
+
if (typeof handler2 === "function") {
|
|
1902
|
+
ReflectApply(handler2, this, args);
|
|
1903
1903
|
} else {
|
|
1904
|
-
var len =
|
|
1905
|
-
var listeners = arrayClone(
|
|
1904
|
+
var len = handler2.length;
|
|
1905
|
+
var listeners = arrayClone(handler2, len);
|
|
1906
1906
|
for (var i = 0; i < len; ++i)
|
|
1907
1907
|
ReflectApply(listeners[i], this, args);
|
|
1908
1908
|
}
|
|
@@ -2142,9 +2142,9 @@ function requireEvents() {
|
|
|
2142
2142
|
}
|
|
2143
2143
|
});
|
|
2144
2144
|
}
|
|
2145
|
-
function addErrorHandlerIfEventEmitter(emitter,
|
|
2145
|
+
function addErrorHandlerIfEventEmitter(emitter, handler2, flags) {
|
|
2146
2146
|
if (typeof emitter.on === "function") {
|
|
2147
|
-
eventTargetAgnosticAddListener(emitter, "error",
|
|
2147
|
+
eventTargetAgnosticAddListener(emitter, "error", handler2, flags);
|
|
2148
2148
|
}
|
|
2149
2149
|
}
|
|
2150
2150
|
function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
|
|
@@ -6926,15 +6926,15 @@ function requireBrowser() {
|
|
|
6926
6926
|
hasRequiredBrowser = 1;
|
|
6927
6927
|
browser = deprecate;
|
|
6928
6928
|
function deprecate(fn2, msg2) {
|
|
6929
|
-
if (
|
|
6929
|
+
if (config2("noDeprecation")) {
|
|
6930
6930
|
return fn2;
|
|
6931
6931
|
}
|
|
6932
6932
|
var warned = false;
|
|
6933
6933
|
function deprecated() {
|
|
6934
6934
|
if (!warned) {
|
|
6935
|
-
if (
|
|
6935
|
+
if (config2("throwDeprecation")) {
|
|
6936
6936
|
throw new Error(msg2);
|
|
6937
|
-
} else if (
|
|
6937
|
+
} else if (config2("traceDeprecation")) {
|
|
6938
6938
|
console.trace(msg2);
|
|
6939
6939
|
} else {
|
|
6940
6940
|
console.warn(msg2);
|
|
@@ -6945,7 +6945,7 @@ function requireBrowser() {
|
|
|
6945
6945
|
}
|
|
6946
6946
|
return deprecated;
|
|
6947
6947
|
}
|
|
6948
|
-
function
|
|
6948
|
+
function config2(name) {
|
|
6949
6949
|
try {
|
|
6950
6950
|
if (!commonjsGlobal.localStorage) return false;
|
|
6951
6951
|
} catch (_2) {
|
|
@@ -9320,7 +9320,7 @@ function requireSax() {
|
|
|
9320
9320
|
this._parser.end();
|
|
9321
9321
|
return true;
|
|
9322
9322
|
};
|
|
9323
|
-
SAXStream.prototype.on = function(ev,
|
|
9323
|
+
SAXStream.prototype.on = function(ev, handler2) {
|
|
9324
9324
|
var me = this;
|
|
9325
9325
|
if (!me._parser["on" + ev] && streamWraps.indexOf(ev) !== -1) {
|
|
9326
9326
|
me._parser["on" + ev] = function() {
|
|
@@ -9329,7 +9329,7 @@ function requireSax() {
|
|
|
9329
9329
|
me.emit.apply(me, args);
|
|
9330
9330
|
};
|
|
9331
9331
|
}
|
|
9332
|
-
return Stream.prototype.on.call(me, ev,
|
|
9332
|
+
return Stream.prototype.on.call(me, ev, handler2);
|
|
9333
9333
|
};
|
|
9334
9334
|
var CDATA = "[CDATA[";
|
|
9335
9335
|
var DOCTYPE = "DOCTYPE";
|
|
@@ -11543,8 +11543,8 @@ function requireHe() {
|
|
|
11543
11543
|
"useNamedReferences": false,
|
|
11544
11544
|
"decimal": false
|
|
11545
11545
|
};
|
|
11546
|
-
var
|
|
11547
|
-
options = merge2(options,
|
|
11546
|
+
var decode2 = function(html, options) {
|
|
11547
|
+
options = merge2(options, decode2.options);
|
|
11548
11548
|
var strict = options.strict;
|
|
11549
11549
|
if (strict && regexInvalidEntity.test(html)) {
|
|
11550
11550
|
parseError("malformed character reference");
|
|
@@ -11603,7 +11603,7 @@ function requireHe() {
|
|
|
11603
11603
|
return $0;
|
|
11604
11604
|
});
|
|
11605
11605
|
};
|
|
11606
|
-
|
|
11606
|
+
decode2.options = {
|
|
11607
11607
|
"isAttributeValue": false,
|
|
11608
11608
|
"strict": false
|
|
11609
11609
|
};
|
|
@@ -11615,9 +11615,9 @@ function requireHe() {
|
|
|
11615
11615
|
var he2 = {
|
|
11616
11616
|
"version": "1.2.0",
|
|
11617
11617
|
"encode": encode2,
|
|
11618
|
-
"decode":
|
|
11618
|
+
"decode": decode2,
|
|
11619
11619
|
"escape": escape,
|
|
11620
|
-
"unescape":
|
|
11620
|
+
"unescape": decode2
|
|
11621
11621
|
};
|
|
11622
11622
|
if (freeExports2 && !freeExports2.nodeType) {
|
|
11623
11623
|
if (freeModule2) {
|
|
@@ -17383,24 +17383,24 @@ class FieldDesc {
|
|
|
17383
17383
|
}
|
|
17384
17384
|
const baseFields = [
|
|
17385
17385
|
new FieldDesc("doc", {
|
|
17386
|
-
init(
|
|
17387
|
-
return
|
|
17386
|
+
init(config2) {
|
|
17387
|
+
return config2.doc || config2.schema.topNodeType.createAndFill();
|
|
17388
17388
|
},
|
|
17389
17389
|
apply(tr) {
|
|
17390
17390
|
return tr.doc;
|
|
17391
17391
|
}
|
|
17392
17392
|
}),
|
|
17393
17393
|
new FieldDesc("selection", {
|
|
17394
|
-
init(
|
|
17395
|
-
return
|
|
17394
|
+
init(config2, instance) {
|
|
17395
|
+
return config2.selection || Selection.atStart(instance.doc);
|
|
17396
17396
|
},
|
|
17397
17397
|
apply(tr) {
|
|
17398
17398
|
return tr.selection;
|
|
17399
17399
|
}
|
|
17400
17400
|
}),
|
|
17401
17401
|
new FieldDesc("storedMarks", {
|
|
17402
|
-
init(
|
|
17403
|
-
return
|
|
17402
|
+
init(config2) {
|
|
17403
|
+
return config2.storedMarks || null;
|
|
17404
17404
|
},
|
|
17405
17405
|
apply(tr, _marks, _old, state2) {
|
|
17406
17406
|
return state2.selection.$cursor ? tr.storedMarks : null;
|
|
@@ -17436,8 +17436,8 @@ class EditorState {
|
|
|
17436
17436
|
/**
|
|
17437
17437
|
@internal
|
|
17438
17438
|
*/
|
|
17439
|
-
constructor(
|
|
17440
|
-
this.config =
|
|
17439
|
+
constructor(config2) {
|
|
17440
|
+
this.config = config2;
|
|
17441
17441
|
}
|
|
17442
17442
|
/**
|
|
17443
17443
|
The schema of the state's document.
|
|
@@ -17528,11 +17528,11 @@ class EditorState {
|
|
|
17528
17528
|
/**
|
|
17529
17529
|
Create a new state.
|
|
17530
17530
|
*/
|
|
17531
|
-
static create(
|
|
17532
|
-
let $config = new Configuration(
|
|
17531
|
+
static create(config2) {
|
|
17532
|
+
let $config = new Configuration(config2.doc ? config2.doc.type.schema : config2.schema, config2.plugins);
|
|
17533
17533
|
let instance = new EditorState($config);
|
|
17534
17534
|
for (let i = 0; i < $config.fields.length; i++)
|
|
17535
|
-
instance[$config.fields[i].name] = $config.fields[i].init(
|
|
17535
|
+
instance[$config.fields[i].name] = $config.fields[i].init(config2, instance);
|
|
17536
17536
|
return instance;
|
|
17537
17537
|
}
|
|
17538
17538
|
/**
|
|
@@ -17543,12 +17543,12 @@ class EditorState {
|
|
|
17543
17543
|
[`init`](https://prosemirror.net/docs/ref/#state.StateField.init) method, passing in the new
|
|
17544
17544
|
configuration object..
|
|
17545
17545
|
*/
|
|
17546
|
-
reconfigure(
|
|
17547
|
-
let $config = new Configuration(this.schema,
|
|
17546
|
+
reconfigure(config2) {
|
|
17547
|
+
let $config = new Configuration(this.schema, config2.plugins);
|
|
17548
17548
|
let fields = $config.fields, instance = new EditorState($config);
|
|
17549
17549
|
for (let i = 0; i < fields.length; i++) {
|
|
17550
17550
|
let name = fields[i].name;
|
|
17551
|
-
instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i].init(
|
|
17551
|
+
instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i].init(config2, instance);
|
|
17552
17552
|
}
|
|
17553
17553
|
return instance;
|
|
17554
17554
|
}
|
|
@@ -17580,31 +17580,31 @@ class EditorState {
|
|
|
17580
17580
|
to deserialize the state of plugins, by associating plugin
|
|
17581
17581
|
instances with the property names they use in the JSON object.
|
|
17582
17582
|
*/
|
|
17583
|
-
static fromJSON(
|
|
17583
|
+
static fromJSON(config2, json, pluginFields) {
|
|
17584
17584
|
if (!json)
|
|
17585
17585
|
throw new RangeError("Invalid input for EditorState.fromJSON");
|
|
17586
|
-
if (!
|
|
17586
|
+
if (!config2.schema)
|
|
17587
17587
|
throw new RangeError("Required config field 'schema' missing");
|
|
17588
|
-
let $config = new Configuration(
|
|
17588
|
+
let $config = new Configuration(config2.schema, config2.plugins);
|
|
17589
17589
|
let instance = new EditorState($config);
|
|
17590
17590
|
$config.fields.forEach((field) => {
|
|
17591
17591
|
if (field.name == "doc") {
|
|
17592
|
-
instance.doc = Node$1$1.fromJSON(
|
|
17592
|
+
instance.doc = Node$1$1.fromJSON(config2.schema, json.doc);
|
|
17593
17593
|
} else if (field.name == "selection") {
|
|
17594
17594
|
instance.selection = Selection.fromJSON(instance.doc, json.selection);
|
|
17595
17595
|
} else if (field.name == "storedMarks") {
|
|
17596
17596
|
if (json.storedMarks)
|
|
17597
|
-
instance.storedMarks = json.storedMarks.map(
|
|
17597
|
+
instance.storedMarks = json.storedMarks.map(config2.schema.markFromJSON);
|
|
17598
17598
|
} else {
|
|
17599
17599
|
if (pluginFields)
|
|
17600
17600
|
for (let prop in pluginFields) {
|
|
17601
17601
|
let plugin2 = pluginFields[prop], state2 = plugin2.spec.state;
|
|
17602
17602
|
if (plugin2.key == field.name && state2 && state2.fromJSON && Object.prototype.hasOwnProperty.call(json, prop)) {
|
|
17603
|
-
instance[field.name] = state2.fromJSON.call(plugin2,
|
|
17603
|
+
instance[field.name] = state2.fromJSON.call(plugin2, config2, json[prop], instance);
|
|
17604
17604
|
return;
|
|
17605
17605
|
}
|
|
17606
17606
|
}
|
|
17607
|
-
instance[field.name] = field.init(
|
|
17607
|
+
instance[field.name] = field.init(config2, instance);
|
|
17608
17608
|
}
|
|
17609
17609
|
});
|
|
17610
17610
|
return instance;
|
|
@@ -23857,11 +23857,11 @@ function mergeSeparateLists(container) {
|
|
|
23857
23857
|
return tempCont;
|
|
23858
23858
|
}
|
|
23859
23859
|
class InputRule {
|
|
23860
|
-
constructor(
|
|
23860
|
+
constructor(config2) {
|
|
23861
23861
|
__publicField$2(this, "match");
|
|
23862
23862
|
__publicField$2(this, "handler");
|
|
23863
|
-
this.match =
|
|
23864
|
-
this.handler =
|
|
23863
|
+
this.match = config2.match;
|
|
23864
|
+
this.handler = config2.handler;
|
|
23865
23865
|
}
|
|
23866
23866
|
}
|
|
23867
23867
|
const inputRuleMatcherHandler = (text, match) => {
|
|
@@ -23884,8 +23884,8 @@ const inputRuleMatcherHandler = (text, match) => {
|
|
|
23884
23884
|
}
|
|
23885
23885
|
return result;
|
|
23886
23886
|
};
|
|
23887
|
-
const run = (
|
|
23888
|
-
const { editor, from: from2, to, text, rules, plugin: plugin2 } =
|
|
23887
|
+
const run = (config2) => {
|
|
23888
|
+
const { editor, from: from2, to, text, rules, plugin: plugin2 } = config2;
|
|
23889
23889
|
const { view } = editor;
|
|
23890
23890
|
if (view.composing) {
|
|
23891
23891
|
return false;
|
|
@@ -23914,7 +23914,7 @@ const run = (config) => {
|
|
|
23914
23914
|
editor,
|
|
23915
23915
|
state: state2
|
|
23916
23916
|
});
|
|
23917
|
-
const
|
|
23917
|
+
const handler2 = rule.handler({
|
|
23918
23918
|
state: state2,
|
|
23919
23919
|
range: range2,
|
|
23920
23920
|
match,
|
|
@@ -23922,7 +23922,7 @@ const run = (config) => {
|
|
|
23922
23922
|
chain,
|
|
23923
23923
|
can
|
|
23924
23924
|
});
|
|
23925
|
-
if (
|
|
23925
|
+
if (handler2 === null || !tr.steps.length) {
|
|
23926
23926
|
return;
|
|
23927
23927
|
}
|
|
23928
23928
|
tr.setMeta(plugin2, {
|
|
@@ -25411,6 +25411,241 @@ const generateSdtPrTagForDocumentSection = (id, title, tag) => {
|
|
|
25411
25411
|
]
|
|
25412
25412
|
};
|
|
25413
25413
|
};
|
|
25414
|
+
const TranslatorTypes = Object.freeze({
|
|
25415
|
+
NODE: "node",
|
|
25416
|
+
ATTRIBUTE: "attribute"
|
|
25417
|
+
});
|
|
25418
|
+
const _NodeTranslator = class _NodeTranslator2 {
|
|
25419
|
+
/**
|
|
25420
|
+
* @param {string} xmlName
|
|
25421
|
+
* @param {string} sdNodeOrKeyName
|
|
25422
|
+
* @param {NodeTranslatorEncodeFn} encode
|
|
25423
|
+
* @param {NodeTranslatorDecodeFn} decode
|
|
25424
|
+
* @param {number} [priority]
|
|
25425
|
+
* @param {MatchesEncodeFn} [matchesEncode]
|
|
25426
|
+
* @param {MatchesDecodeFn} [matchesDecode]
|
|
25427
|
+
* @param {AttributesHandlerList[]} [attributes]
|
|
25428
|
+
*/
|
|
25429
|
+
constructor(xmlName, sdNodeOrKeyName, encode2, decode2, priority, matchesEncode, matchesDecode, attributes) {
|
|
25430
|
+
__publicField$2(this, "xmlName");
|
|
25431
|
+
__publicField$2(this, "sdNodeOrKeyName");
|
|
25432
|
+
__publicField$2(this, "priority");
|
|
25433
|
+
__publicField$2(this, "encodeFn");
|
|
25434
|
+
__publicField$2(this, "decodeFn");
|
|
25435
|
+
__publicField$2(this, "matchesEncode");
|
|
25436
|
+
__publicField$2(this, "matchesDecode");
|
|
25437
|
+
__publicField$2(this, "attributes");
|
|
25438
|
+
this.xmlName = xmlName;
|
|
25439
|
+
this.sdNodeOrKeyName = sdNodeOrKeyName;
|
|
25440
|
+
this.encodeFn = encode2;
|
|
25441
|
+
this.decodeFn = decode2;
|
|
25442
|
+
this.attributes = attributes || [];
|
|
25443
|
+
this.priority = typeof priority === "number" ? priority : 0;
|
|
25444
|
+
this.matchesEncode = typeof matchesEncode === "function" ? matchesEncode : () => true;
|
|
25445
|
+
this.matchesDecode = typeof matchesDecode === "function" ? matchesDecode : () => true;
|
|
25446
|
+
}
|
|
25447
|
+
/**
|
|
25448
|
+
* Encode the attributes for the node.
|
|
25449
|
+
* @param {SCEncoderConfig} params
|
|
25450
|
+
* @returns {Object} Encoded attributes object.
|
|
25451
|
+
*/
|
|
25452
|
+
encodeAttributes(params2) {
|
|
25453
|
+
const { nodes = [] } = params2 || {};
|
|
25454
|
+
const node2 = nodes[0];
|
|
25455
|
+
const { attributes = {} } = node2 || {};
|
|
25456
|
+
const encodedAttrs = {};
|
|
25457
|
+
this.attributes.forEach(({ sdName, encode: encode2 }) => {
|
|
25458
|
+
if (!encode2) return;
|
|
25459
|
+
const encodedAttr = encode2(attributes);
|
|
25460
|
+
if (encodedAttr !== void 0 && encodedAttr !== null) {
|
|
25461
|
+
encodedAttrs[sdName] = encodedAttr;
|
|
25462
|
+
}
|
|
25463
|
+
});
|
|
25464
|
+
return encodedAttrs;
|
|
25465
|
+
}
|
|
25466
|
+
/**
|
|
25467
|
+
* Decode the attributes for the node.
|
|
25468
|
+
* @param {SCDecoderConfig} params
|
|
25469
|
+
* @returns {Object} Decoded attributes object.
|
|
25470
|
+
*/
|
|
25471
|
+
decodeAttributes(params2) {
|
|
25472
|
+
const { node: node2 } = params2 || {};
|
|
25473
|
+
const { attrs = {} } = node2 || {};
|
|
25474
|
+
const decodedAttrs = {};
|
|
25475
|
+
this.attributes.forEach(({ xmlName, decode: decode2 }) => {
|
|
25476
|
+
if (!decode2) return;
|
|
25477
|
+
const decodedAttr = decode2(attrs);
|
|
25478
|
+
if (decodedAttr !== void 0 && decodedAttr !== null) {
|
|
25479
|
+
decodedAttrs[xmlName] = decodedAttr;
|
|
25480
|
+
}
|
|
25481
|
+
});
|
|
25482
|
+
return decodedAttrs;
|
|
25483
|
+
}
|
|
25484
|
+
/**
|
|
25485
|
+
* Decode the attributes for the node.
|
|
25486
|
+
* @param {SCDecoderConfig} params
|
|
25487
|
+
* @returns {Object} Decoded attributes object.
|
|
25488
|
+
*/
|
|
25489
|
+
decode(params2) {
|
|
25490
|
+
const decodedAttrs = this.decodeAttributes(params2);
|
|
25491
|
+
return this.decodeFn ? this.decodeFn(params2, decodedAttrs) : void 0;
|
|
25492
|
+
}
|
|
25493
|
+
/**
|
|
25494
|
+
* Encode the attributes for the node.
|
|
25495
|
+
* @param {SCEncoderConfig} params
|
|
25496
|
+
* @returns {Object} Encoded attributes object.
|
|
25497
|
+
*/
|
|
25498
|
+
encode(params2) {
|
|
25499
|
+
const encodedAttrs = this.encodeAttributes(params2);
|
|
25500
|
+
return this.encodeFn ? this.encodeFn(params2, encodedAttrs) : void 0;
|
|
25501
|
+
}
|
|
25502
|
+
/**
|
|
25503
|
+
* Create a new NodeTranslator instance from a configuration object.
|
|
25504
|
+
* @param {NodeTranslatorConfig} config - The configuration object.
|
|
25505
|
+
* @returns {NodeTranslator} The created NodeTranslator instance.
|
|
25506
|
+
*/
|
|
25507
|
+
static from(config2) {
|
|
25508
|
+
const { xmlName, sdNodeOrKeyName, encode: encode2, decode: decode2, priority = 0, matchesEncode, matchesDecode, attributes } = config2;
|
|
25509
|
+
if (typeof encode2 !== "function" || !!decode2 && typeof decode2 !== "function") {
|
|
25510
|
+
throw new TypeError(`${xmlName}: encode/decode must be functions`);
|
|
25511
|
+
}
|
|
25512
|
+
const inst = new _NodeTranslator2(
|
|
25513
|
+
xmlName,
|
|
25514
|
+
sdNodeOrKeyName,
|
|
25515
|
+
encode2,
|
|
25516
|
+
decode2,
|
|
25517
|
+
priority,
|
|
25518
|
+
matchesEncode,
|
|
25519
|
+
matchesDecode,
|
|
25520
|
+
attributes
|
|
25521
|
+
);
|
|
25522
|
+
return Object.freeze(inst);
|
|
25523
|
+
}
|
|
25524
|
+
/**
|
|
25525
|
+
* Convert the NodeTranslator instance to a string representation.
|
|
25526
|
+
* @returns {string} - The string representation of the NodeTranslator instance.
|
|
25527
|
+
*/
|
|
25528
|
+
toString() {
|
|
25529
|
+
return `NodeTranslator(${this.xmlName}, priority=${this.priority})`;
|
|
25530
|
+
}
|
|
25531
|
+
};
|
|
25532
|
+
__publicField$2(_NodeTranslator, "translatorTypes", TranslatorTypes);
|
|
25533
|
+
let NodeTranslator = _NodeTranslator;
|
|
25534
|
+
const lineBreakTypeEncoder = (attributes) => {
|
|
25535
|
+
return attributes["w:type"];
|
|
25536
|
+
};
|
|
25537
|
+
const lineBreakTypeDecoder = (attrs) => {
|
|
25538
|
+
const { lineBreakType } = attrs;
|
|
25539
|
+
return lineBreakType;
|
|
25540
|
+
};
|
|
25541
|
+
const wClearEncoder = (attributes) => {
|
|
25542
|
+
const xmlAttrValue = attributes["w:clear"];
|
|
25543
|
+
return xmlAttrValue;
|
|
25544
|
+
};
|
|
25545
|
+
const wClearDecoder = (attrs) => {
|
|
25546
|
+
const { clear } = attrs;
|
|
25547
|
+
return clear;
|
|
25548
|
+
};
|
|
25549
|
+
const XML_NODE_NAME$1 = "w:br";
|
|
25550
|
+
const SD_NODE_NAME$1 = "lineBreak";
|
|
25551
|
+
const validXmlAttributes$1 = [
|
|
25552
|
+
{ xmlName: "w:type", sdName: "lineBreakType", encode: lineBreakTypeEncoder, decode: lineBreakTypeDecoder },
|
|
25553
|
+
{ xmlName: "w:clear", sdName: "clear", encode: wClearEncoder, decode: wClearDecoder }
|
|
25554
|
+
];
|
|
25555
|
+
const encode$1 = (_2, encodedAttrs) => {
|
|
25556
|
+
const isPageBreak = encodedAttrs?.lineBreakType === "page";
|
|
25557
|
+
const translated = {
|
|
25558
|
+
type: isPageBreak ? "hardBreak" : "lineBreak"
|
|
25559
|
+
};
|
|
25560
|
+
if (encodedAttrs) {
|
|
25561
|
+
translated.attrs = { ...encodedAttrs };
|
|
25562
|
+
}
|
|
25563
|
+
return translated;
|
|
25564
|
+
};
|
|
25565
|
+
const decode$1 = (params2, decodedAttrs) => {
|
|
25566
|
+
const { node: node2 } = params2;
|
|
25567
|
+
if (!node2) return;
|
|
25568
|
+
const wBreak = { name: "w:br" };
|
|
25569
|
+
if (decodedAttrs) {
|
|
25570
|
+
wBreak.attributes = { ...decodedAttrs };
|
|
25571
|
+
}
|
|
25572
|
+
const isPageBreak = node2.type === "hardBreak";
|
|
25573
|
+
if (isPageBreak && (!wBreak.attributes || !wBreak.attributes["w:type"])) {
|
|
25574
|
+
wBreak.attributes = { ...wBreak.attributes, "w:type": "page" };
|
|
25575
|
+
}
|
|
25576
|
+
const translated = {
|
|
25577
|
+
name: "w:r",
|
|
25578
|
+
elements: [wBreak]
|
|
25579
|
+
};
|
|
25580
|
+
return translated;
|
|
25581
|
+
};
|
|
25582
|
+
const config$1 = {
|
|
25583
|
+
xmlName: XML_NODE_NAME$1,
|
|
25584
|
+
sdNodeOrKeyName: SD_NODE_NAME$1,
|
|
25585
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
25586
|
+
encode: encode$1,
|
|
25587
|
+
decode: decode$1,
|
|
25588
|
+
attributes: validXmlAttributes$1
|
|
25589
|
+
};
|
|
25590
|
+
const translator$1 = NodeTranslator.from(config$1);
|
|
25591
|
+
const tabSizeEncoder = (attributes) => {
|
|
25592
|
+
return attributes["w:val"];
|
|
25593
|
+
};
|
|
25594
|
+
const tabSizeDecoder = (attrs) => {
|
|
25595
|
+
const { tabSize } = attrs;
|
|
25596
|
+
return tabSize;
|
|
25597
|
+
};
|
|
25598
|
+
const tabLeaderEncoder = (attributes) => {
|
|
25599
|
+
return attributes["w:leader"];
|
|
25600
|
+
};
|
|
25601
|
+
const tabLeaderDecoder = (attrs) => {
|
|
25602
|
+
const { leader } = attrs;
|
|
25603
|
+
return leader;
|
|
25604
|
+
};
|
|
25605
|
+
const tabPositionEncoder = (attributes) => {
|
|
25606
|
+
return attributes["w:pos"];
|
|
25607
|
+
};
|
|
25608
|
+
const tabPositionDecoder = (attrs) => {
|
|
25609
|
+
const { pos } = attrs;
|
|
25610
|
+
return pos;
|
|
25611
|
+
};
|
|
25612
|
+
const XML_NODE_NAME = "w:tab";
|
|
25613
|
+
const SD_NODE_NAME = "tab";
|
|
25614
|
+
const validXmlAttributes = [
|
|
25615
|
+
{ xmlName: "w:val", sdName: "tabSize", encode: tabSizeEncoder, decode: tabSizeDecoder },
|
|
25616
|
+
{ xmlName: "w:pos", sdName: "pos", encode: tabPositionEncoder, decode: tabPositionDecoder },
|
|
25617
|
+
{ xmlName: "w:leader", sdName: "leader", encode: tabLeaderEncoder, decode: tabLeaderDecoder }
|
|
25618
|
+
];
|
|
25619
|
+
const encode$2 = (_2, encodedAttrs = {}) => {
|
|
25620
|
+
const translated = { type: "tab" };
|
|
25621
|
+
if (encodedAttrs) translated.attrs = { ...encodedAttrs };
|
|
25622
|
+
return translated;
|
|
25623
|
+
};
|
|
25624
|
+
const decode = (params2, decodedAttrs = {}) => {
|
|
25625
|
+
const { node: node2 } = params2 || {};
|
|
25626
|
+
if (!node2) return;
|
|
25627
|
+
const wTab = { name: "w:tab" };
|
|
25628
|
+
if (decodedAttrs) wTab.attributes = { ...decodedAttrs };
|
|
25629
|
+
const translated = {
|
|
25630
|
+
name: "w:r",
|
|
25631
|
+
elements: [wTab]
|
|
25632
|
+
};
|
|
25633
|
+
const { marks: nodeMarks = [] } = node2;
|
|
25634
|
+
const outputMarks = processOutputMarks(nodeMarks);
|
|
25635
|
+
if (outputMarks.length) {
|
|
25636
|
+
translated.elements.unshift(generateRunProps(outputMarks));
|
|
25637
|
+
}
|
|
25638
|
+
return translated;
|
|
25639
|
+
};
|
|
25640
|
+
const config = {
|
|
25641
|
+
xmlName: XML_NODE_NAME,
|
|
25642
|
+
sdNodeOrKeyName: SD_NODE_NAME,
|
|
25643
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
25644
|
+
encode: encode$2,
|
|
25645
|
+
decode,
|
|
25646
|
+
attributes: validXmlAttributes
|
|
25647
|
+
};
|
|
25648
|
+
const translator = NodeTranslator.from(config);
|
|
25414
25649
|
function exportSchemaToJson(params2) {
|
|
25415
25650
|
const { type: type2 } = params2.node || {};
|
|
25416
25651
|
const router = {
|
|
@@ -25421,15 +25656,15 @@ function exportSchemaToJson(params2) {
|
|
|
25421
25656
|
text: translateTextNode,
|
|
25422
25657
|
bulletList: translateList,
|
|
25423
25658
|
orderedList: translateList,
|
|
25424
|
-
lineBreak:
|
|
25659
|
+
lineBreak: translator$1,
|
|
25425
25660
|
table: translateTable,
|
|
25426
25661
|
tableRow: translateTableRow,
|
|
25427
25662
|
tableCell: translateTableCell,
|
|
25428
25663
|
bookmarkStart: translateBookmarkStart,
|
|
25429
25664
|
fieldAnnotation: translateFieldAnnotation,
|
|
25430
|
-
tab:
|
|
25665
|
+
tab: translator,
|
|
25431
25666
|
image: translateImageNode,
|
|
25432
|
-
hardBreak:
|
|
25667
|
+
hardBreak: translator$1,
|
|
25433
25668
|
commentRangeStart: () => translateCommentNode(params2, "Start"),
|
|
25434
25669
|
commentRangeEnd: () => translateCommentNode(params2, "End"),
|
|
25435
25670
|
commentReference: () => null,
|
|
@@ -25442,11 +25677,15 @@ function exportSchemaToJson(params2) {
|
|
|
25442
25677
|
"page-number": translatePageNumberNode,
|
|
25443
25678
|
"total-page-number": translateTotalPageNumberNode
|
|
25444
25679
|
};
|
|
25445
|
-
|
|
25680
|
+
let handler2 = router[type2];
|
|
25681
|
+
if (handler2 && "decode" in handler2 && typeof handler2.decode === "function") {
|
|
25682
|
+
return handler2.decode(params2);
|
|
25683
|
+
}
|
|
25684
|
+
if (!handler2) {
|
|
25446
25685
|
console.error("No translation function found for node type:", type2);
|
|
25447
25686
|
return null;
|
|
25448
25687
|
}
|
|
25449
|
-
return
|
|
25688
|
+
return handler2(params2);
|
|
25450
25689
|
}
|
|
25451
25690
|
function translateBodyNode(params2) {
|
|
25452
25691
|
let sectPr = params2.bodyNode?.elements.find((n) => n.name === "w:sectPr") || {};
|
|
@@ -25640,9 +25879,10 @@ function generateParagraphProperties(node2) {
|
|
|
25640
25879
|
const { tabStops } = attrs;
|
|
25641
25880
|
if (tabStops && tabStops.length > 0) {
|
|
25642
25881
|
const tabElements = tabStops.map((tab) => {
|
|
25882
|
+
const posValue = tab.originalPos !== void 0 ? tab.originalPos : pixelsToTwips(tab.pos).toString();
|
|
25643
25883
|
const tabAttributes = {
|
|
25644
25884
|
"w:val": tab.val || "start",
|
|
25645
|
-
"w:pos":
|
|
25885
|
+
"w:pos": posValue
|
|
25646
25886
|
};
|
|
25647
25887
|
if (tab.leader) {
|
|
25648
25888
|
tabAttributes["w:leader"] = tab.leader;
|
|
@@ -26066,23 +26306,6 @@ const generateNumPrTag = (numId, level) => {
|
|
|
26066
26306
|
]
|
|
26067
26307
|
};
|
|
26068
26308
|
};
|
|
26069
|
-
function translateLineBreak(params2) {
|
|
26070
|
-
const attributes = {};
|
|
26071
|
-
const { lineBreakType } = params2.node?.attrs || {};
|
|
26072
|
-
if (lineBreakType) {
|
|
26073
|
-
attributes["w:type"] = lineBreakType;
|
|
26074
|
-
}
|
|
26075
|
-
return {
|
|
26076
|
-
name: "w:r",
|
|
26077
|
-
elements: [
|
|
26078
|
-
{
|
|
26079
|
-
name: "w:br",
|
|
26080
|
-
attributes
|
|
26081
|
-
}
|
|
26082
|
-
],
|
|
26083
|
-
attributes
|
|
26084
|
-
};
|
|
26085
|
-
}
|
|
26086
26309
|
function translateTable(params2) {
|
|
26087
26310
|
params2.node = preProcessVerticalMergeCells(params2.node, params2);
|
|
26088
26311
|
const elements = translateChildNodes(params2);
|
|
@@ -26129,14 +26352,6 @@ function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
|
26129
26352
|
}
|
|
26130
26353
|
return table;
|
|
26131
26354
|
}
|
|
26132
|
-
function translateTab(params2) {
|
|
26133
|
-
const { marks = [] } = params2.node;
|
|
26134
|
-
const outputMarks = processOutputMarks(marks);
|
|
26135
|
-
const tabNode = {
|
|
26136
|
-
name: "w:tab"
|
|
26137
|
-
};
|
|
26138
|
-
return wrapTextInRun(tabNode, outputMarks);
|
|
26139
|
-
}
|
|
26140
26355
|
function generateTableProperties(node2) {
|
|
26141
26356
|
const elements = [];
|
|
26142
26357
|
const { attrs } = node2;
|
|
@@ -26975,22 +27190,6 @@ function translateFieldAnnotation(params2) {
|
|
|
26975
27190
|
};
|
|
26976
27191
|
return result;
|
|
26977
27192
|
}
|
|
26978
|
-
function translateHardBreak(params2) {
|
|
26979
|
-
const { node: node2 = {} } = params2;
|
|
26980
|
-
const { attrs = {} } = node2;
|
|
26981
|
-
const { pageBreakSource } = attrs;
|
|
26982
|
-
if (pageBreakSource === "sectPr") return null;
|
|
26983
|
-
return {
|
|
26984
|
-
name: "w:r",
|
|
26985
|
-
elements: [
|
|
26986
|
-
{
|
|
26987
|
-
name: "w:br",
|
|
26988
|
-
type: "element",
|
|
26989
|
-
attributes: { "w:type": "page" }
|
|
26990
|
-
}
|
|
26991
|
-
]
|
|
26992
|
-
};
|
|
26993
|
-
}
|
|
26994
27193
|
function translateShapeContainer(params2) {
|
|
26995
27194
|
const { node: node2 } = params2;
|
|
26996
27195
|
const elements = translateChildNodes(params2);
|
|
@@ -28490,10 +28689,14 @@ const handleParagraphNode = (params2) => {
|
|
|
28490
28689
|
} else if (val == "right") {
|
|
28491
28690
|
val = "end";
|
|
28492
28691
|
}
|
|
28692
|
+
const rawPos = tab.attributes["w:pos"];
|
|
28493
28693
|
const tabStop = {
|
|
28494
28694
|
val,
|
|
28495
|
-
pos: twipsToPixels(
|
|
28695
|
+
pos: twipsToPixels(rawPos)
|
|
28496
28696
|
};
|
|
28697
|
+
if (rawPos !== void 0) {
|
|
28698
|
+
tabStop.originalPos = rawPos;
|
|
28699
|
+
}
|
|
28497
28700
|
if (tab.attributes["w:leader"]) {
|
|
28498
28701
|
tabStop.leader = tab.attributes["w:leader"];
|
|
28499
28702
|
}
|
|
@@ -28846,8 +29049,8 @@ const handleDocPartObj = (params2) => {
|
|
|
28846
29049
|
return { nodes: [], consumed: 0 };
|
|
28847
29050
|
}
|
|
28848
29051
|
const content = node2?.elements.find((el) => el.name === "w:sdtContent");
|
|
28849
|
-
const
|
|
28850
|
-
const result =
|
|
29052
|
+
const handler2 = validGalleryTypeMap[docPartGalleryType];
|
|
29053
|
+
const result = handler2({ ...params2, nodes: [content] });
|
|
28851
29054
|
return {
|
|
28852
29055
|
nodes: result,
|
|
28853
29056
|
consumed: 1
|
|
@@ -29113,25 +29316,21 @@ const standardNodeHandlerEntity = {
|
|
|
29113
29316
|
handlerName: "standardNodeHandler",
|
|
29114
29317
|
handler: handleStandardNode
|
|
29115
29318
|
};
|
|
29116
|
-
const
|
|
29319
|
+
const handler = (params2) => {
|
|
29117
29320
|
const { nodes } = params2;
|
|
29118
29321
|
if (nodes.length === 0 || nodes[0].name !== "w:br") {
|
|
29119
29322
|
return { nodes: [], consumed: 0 };
|
|
29120
29323
|
}
|
|
29121
|
-
const
|
|
29122
|
-
|
|
29324
|
+
const result = translator$1.encode(params2);
|
|
29325
|
+
if (!result) return { nodes: [], consumed: 0 };
|
|
29123
29326
|
return {
|
|
29124
|
-
nodes: [
|
|
29125
|
-
{
|
|
29126
|
-
type: breakType
|
|
29127
|
-
}
|
|
29128
|
-
],
|
|
29327
|
+
nodes: [result],
|
|
29129
29328
|
consumed: 1
|
|
29130
29329
|
};
|
|
29131
29330
|
};
|
|
29132
29331
|
const lineBreakNodeHandlerEntity = {
|
|
29133
29332
|
handlerName: "lineBreakNodeHandler",
|
|
29134
|
-
handler
|
|
29333
|
+
handler
|
|
29135
29334
|
};
|
|
29136
29335
|
const handleBookmarkNode = (params2) => {
|
|
29137
29336
|
const { nodes, nodeListHandler: nodeListHandler2, editor } = params2;
|
|
@@ -29256,34 +29455,6 @@ const autoTotalPageCountEntity = {
|
|
|
29256
29455
|
handlerName: "autoTotalPageCountEntity",
|
|
29257
29456
|
handler: handleAutoTotalPageNumber
|
|
29258
29457
|
};
|
|
29259
|
-
const handleTabNode = (params2) => {
|
|
29260
|
-
const { nodes, docx, parentStyleId } = params2;
|
|
29261
|
-
if (nodes.length === 0 || nodes[0].name !== "w:tab") {
|
|
29262
|
-
return { nodes: [], consumed: 0 };
|
|
29263
|
-
}
|
|
29264
|
-
const node2 = nodes[0];
|
|
29265
|
-
const styles = docx["word/styles.xml"];
|
|
29266
|
-
if (styles && styles.elements?.length) {
|
|
29267
|
-
const style2 = styles.elements[0]?.elements?.find((s) => s.attributes?.["w:styleId"] === parentStyleId);
|
|
29268
|
-
const pPr = style2?.elements?.find((s) => s.name === "w:pPr");
|
|
29269
|
-
const tabsDef = pPr?.elements?.find((s) => s.name === "w:tabs");
|
|
29270
|
-
const firstTab = tabsDef?.elements?.find((s) => s.name === "w:tab");
|
|
29271
|
-
twipsToPixels(firstTab?.attributes?.["w:pos"]);
|
|
29272
|
-
}
|
|
29273
|
-
const { attributes = {} } = node2;
|
|
29274
|
-
const processedNode = {
|
|
29275
|
-
type: "tab",
|
|
29276
|
-
attrs: {
|
|
29277
|
-
tabSize: attributes["w:val"] || 48
|
|
29278
|
-
},
|
|
29279
|
-
content: []
|
|
29280
|
-
};
|
|
29281
|
-
return { nodes: [processedNode], consumed: 1 };
|
|
29282
|
-
};
|
|
29283
|
-
const tabNodeEntityHandler = {
|
|
29284
|
-
handlerName: "tabNodeHandler",
|
|
29285
|
-
handler: handleTabNode
|
|
29286
|
-
};
|
|
29287
29458
|
const handlePictNode = (params2) => {
|
|
29288
29459
|
const { nodes } = params2;
|
|
29289
29460
|
if (!nodes.length || nodes[0].name !== "w:p") {
|
|
@@ -29583,6 +29754,18 @@ const getExtendedDetails = (commentEx) => {
|
|
|
29583
29754
|
};
|
|
29584
29755
|
const IGNORED_NODE_NAMES = ["w:proofErr", "w:lastRenderedPageBreak"];
|
|
29585
29756
|
const pruneIgnoredNodes = (nodes = []) => nodes.filter((node2) => !IGNORED_NODE_NAMES.includes(node2.name)).map((node2) => node2.elements ? { ...node2, elements: pruneIgnoredNodes(node2.elements) } : node2);
|
|
29757
|
+
const handleTabNode = (params2) => {
|
|
29758
|
+
const { nodes } = params2;
|
|
29759
|
+
if (!nodes.length || nodes[0].name !== "w:tab") {
|
|
29760
|
+
return { nodes: [], consumed: 0 };
|
|
29761
|
+
}
|
|
29762
|
+
const node2 = translator.encode(params2);
|
|
29763
|
+
return { nodes: [node2], consumed: 1 };
|
|
29764
|
+
};
|
|
29765
|
+
const tabNodeEntityHandler = {
|
|
29766
|
+
handlerName: "w:tabTranslator",
|
|
29767
|
+
handler: handleTabNode
|
|
29768
|
+
};
|
|
29586
29769
|
const createDocumentJson = (docx, converter, editor) => {
|
|
29587
29770
|
const json = carbonCopy(getInitialJSON(docx));
|
|
29588
29771
|
if (!json) return null;
|
|
@@ -29667,11 +29850,10 @@ const defaultNodeListHandler = () => {
|
|
|
29667
29850
|
autoPageHandlerEntity,
|
|
29668
29851
|
autoTotalPageCountEntity,
|
|
29669
29852
|
standardNodeHandlerEntity
|
|
29670
|
-
// This is the last one as it can handle everything
|
|
29671
29853
|
];
|
|
29672
|
-
const
|
|
29854
|
+
const handler2 = createNodeListHandler(entities);
|
|
29673
29855
|
return {
|
|
29674
|
-
handler,
|
|
29856
|
+
handler: handler2,
|
|
29675
29857
|
handlerEntities: entities
|
|
29676
29858
|
};
|
|
29677
29859
|
};
|
|
@@ -29716,9 +29898,9 @@ const createNodeListHandler = (nodeHandlers) => {
|
|
|
29716
29898
|
continue;
|
|
29717
29899
|
}
|
|
29718
29900
|
const { nodes, consumed, unhandled } = nodeHandlers.reduce(
|
|
29719
|
-
(res,
|
|
29901
|
+
(res, handler2) => {
|
|
29720
29902
|
if (res.consumed > 0) return res;
|
|
29721
|
-
return
|
|
29903
|
+
return handler2.handler({
|
|
29722
29904
|
nodes: nodesToHandle,
|
|
29723
29905
|
docx,
|
|
29724
29906
|
nodeListHandler: { handler: nodeListHandlerFn, handlerEntities: nodeHandlers },
|
|
@@ -30181,7 +30363,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
30181
30363
|
return;
|
|
30182
30364
|
}
|
|
30183
30365
|
}
|
|
30184
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.
|
|
30366
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.17.0") {
|
|
30185
30367
|
const customLocation = "docProps/custom.xml";
|
|
30186
30368
|
if (!docx[customLocation]) {
|
|
30187
30369
|
docx[customLocation] = generateCustomXml();
|
|
@@ -30663,7 +30845,7 @@ function storeSuperdocVersion(docx) {
|
|
|
30663
30845
|
function generateCustomXml() {
|
|
30664
30846
|
return DEFAULT_CUSTOM_XML;
|
|
30665
30847
|
}
|
|
30666
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.
|
|
30848
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.17.0") {
|
|
30667
30849
|
return {
|
|
30668
30850
|
type: "element",
|
|
30669
30851
|
name: "property",
|
|
@@ -33728,10 +33910,10 @@ function mustPreserveItems(state2) {
|
|
|
33728
33910
|
}
|
|
33729
33911
|
const historyKey = new PluginKey("history");
|
|
33730
33912
|
const closeHistoryKey = new PluginKey("closeHistory");
|
|
33731
|
-
function history(
|
|
33732
|
-
|
|
33733
|
-
depth:
|
|
33734
|
-
newGroupDelay:
|
|
33913
|
+
function history(config2 = {}) {
|
|
33914
|
+
config2 = {
|
|
33915
|
+
depth: config2.depth || 100,
|
|
33916
|
+
newGroupDelay: config2.newGroupDelay || 500
|
|
33735
33917
|
};
|
|
33736
33918
|
return new Plugin({
|
|
33737
33919
|
key: historyKey,
|
|
@@ -33740,10 +33922,10 @@ function history(config = {}) {
|
|
|
33740
33922
|
return new HistoryState(Branch.empty, Branch.empty, null, 0, -1);
|
|
33741
33923
|
},
|
|
33742
33924
|
apply(tr, hist, state2) {
|
|
33743
|
-
return applyTransaction(hist, state2, tr,
|
|
33925
|
+
return applyTransaction(hist, state2, tr, config2);
|
|
33744
33926
|
}
|
|
33745
33927
|
},
|
|
33746
|
-
config,
|
|
33928
|
+
config: config2,
|
|
33747
33929
|
props: {
|
|
33748
33930
|
handleDOMEvents: {
|
|
33749
33931
|
beforeinput(view, e) {
|
|
@@ -33782,7 +33964,7 @@ function redoDepth(state2) {
|
|
|
33782
33964
|
return hist ? hist.undone.eventCount : 0;
|
|
33783
33965
|
}
|
|
33784
33966
|
class Extension {
|
|
33785
|
-
constructor(
|
|
33967
|
+
constructor(config2) {
|
|
33786
33968
|
__publicField$1(this, "type", "extension");
|
|
33787
33969
|
__publicField$1(this, "name", "extension");
|
|
33788
33970
|
__publicField$1(this, "options");
|
|
@@ -33792,7 +33974,7 @@ class Extension {
|
|
|
33792
33974
|
});
|
|
33793
33975
|
this.config = {
|
|
33794
33976
|
...this.config,
|
|
33795
|
-
...
|
|
33977
|
+
...config2
|
|
33796
33978
|
};
|
|
33797
33979
|
this.name = this.config.name;
|
|
33798
33980
|
if (this.config.addOptions) {
|
|
@@ -33876,7 +34058,7 @@ let Node$1 = class Node22 {
|
|
|
33876
34058
|
/**
|
|
33877
34059
|
* @param {import('./types/index.js').EditorNodeConfig} config
|
|
33878
34060
|
*/
|
|
33879
|
-
constructor(
|
|
34061
|
+
constructor(config2) {
|
|
33880
34062
|
__publicField$1(this, "type", "node");
|
|
33881
34063
|
__publicField$1(this, "name", "node");
|
|
33882
34064
|
__publicField$1(this, "options");
|
|
@@ -33889,7 +34071,7 @@ let Node$1 = class Node22 {
|
|
|
33889
34071
|
});
|
|
33890
34072
|
this.config = {
|
|
33891
34073
|
...this.config,
|
|
33892
|
-
...
|
|
34074
|
+
...config2
|
|
33893
34075
|
};
|
|
33894
34076
|
this.name = this.config.name;
|
|
33895
34077
|
this.group = this.config.group;
|
|
@@ -33913,12 +34095,12 @@ let Node$1 = class Node22 {
|
|
|
33913
34095
|
* @param {import('./types/index.js').EditorNodeConfig} config - The node configuration.
|
|
33914
34096
|
* @returns {Node} A new Node instance.
|
|
33915
34097
|
*/
|
|
33916
|
-
static create(
|
|
33917
|
-
return new Node22(
|
|
34098
|
+
static create(config2) {
|
|
34099
|
+
return new Node22(config2);
|
|
33918
34100
|
}
|
|
33919
34101
|
};
|
|
33920
34102
|
class Mark2 {
|
|
33921
|
-
constructor(
|
|
34103
|
+
constructor(config2) {
|
|
33922
34104
|
__publicField$1(this, "type", "mark");
|
|
33923
34105
|
__publicField$1(this, "name", "mark");
|
|
33924
34106
|
__publicField$1(this, "options");
|
|
@@ -33929,7 +34111,7 @@ class Mark2 {
|
|
|
33929
34111
|
});
|
|
33930
34112
|
this.config = {
|
|
33931
34113
|
...this.config,
|
|
33932
|
-
...
|
|
34114
|
+
...config2
|
|
33933
34115
|
};
|
|
33934
34116
|
this.name = this.config.name;
|
|
33935
34117
|
this.isExternal = Boolean(this.config.isExternal);
|
|
@@ -39182,10 +39364,10 @@ class InputState {
|
|
|
39182
39364
|
}
|
|
39183
39365
|
function initInput(view) {
|
|
39184
39366
|
for (let event in handlers) {
|
|
39185
|
-
let
|
|
39367
|
+
let handler2 = handlers[event];
|
|
39186
39368
|
view.dom.addEventListener(event, view.input.eventHandlers[event] = (event2) => {
|
|
39187
39369
|
if (eventBelongsToView(view, event2) && !runCustomHandler(view, event2) && (view.editable || !(event2.type in editHandlers)))
|
|
39188
|
-
|
|
39370
|
+
handler2(view, event2);
|
|
39189
39371
|
}, passiveHandlers[event] ? { passive: true } : void 0);
|
|
39190
39372
|
}
|
|
39191
39373
|
if (safari)
|
|
@@ -39212,8 +39394,8 @@ function ensureListeners(view) {
|
|
|
39212
39394
|
}
|
|
39213
39395
|
function runCustomHandler(view, event) {
|
|
39214
39396
|
return view.someProp("handleDOMEvents", (handlers2) => {
|
|
39215
|
-
let
|
|
39216
|
-
return
|
|
39397
|
+
let handler2 = handlers2[event.type];
|
|
39398
|
+
return handler2 ? handler2(view, event) || event.defaultPrevented : false;
|
|
39217
39399
|
});
|
|
39218
39400
|
}
|
|
39219
39401
|
function eventBelongsToView(view, event) {
|
|
@@ -45548,9 +45730,9 @@ const getFieldAttrs = (field, value, input) => {
|
|
|
45548
45730
|
yesno: annotateYesNo,
|
|
45549
45731
|
date: annotateDate
|
|
45550
45732
|
};
|
|
45551
|
-
const
|
|
45552
|
-
if (!
|
|
45553
|
-
return
|
|
45733
|
+
const handler2 = annotatorHandlers[type2];
|
|
45734
|
+
if (!handler2) return {};
|
|
45735
|
+
return handler2(value, input);
|
|
45554
45736
|
};
|
|
45555
45737
|
const annotateHtml = (value) => ({ rawHtml: value });
|
|
45556
45738
|
const annotateText = (value) => ({ displayLabel: value });
|
|
@@ -47523,7 +47705,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
47523
47705
|
* @returns {Object | void} Migration results
|
|
47524
47706
|
*/
|
|
47525
47707
|
processCollaborationMigrations() {
|
|
47526
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.
|
|
47708
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.17.0");
|
|
47527
47709
|
if (!this.options.ydoc) return;
|
|
47528
47710
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
47529
47711
|
let docVersion = metaMap.get("version");
|
|
@@ -48663,15 +48845,15 @@ class DropCursorView {
|
|
|
48663
48845
|
this.color = options.color === false ? void 0 : options.color || "black";
|
|
48664
48846
|
this.class = options.class;
|
|
48665
48847
|
this.handlers = ["dragover", "dragend", "drop", "dragleave"].map((name) => {
|
|
48666
|
-
let
|
|
48848
|
+
let handler2 = (e) => {
|
|
48667
48849
|
this[name](e);
|
|
48668
48850
|
};
|
|
48669
|
-
editorView.dom.addEventListener(name,
|
|
48670
|
-
return { name, handler };
|
|
48851
|
+
editorView.dom.addEventListener(name, handler2);
|
|
48852
|
+
return { name, handler: handler2 };
|
|
48671
48853
|
});
|
|
48672
48854
|
}
|
|
48673
48855
|
destroy() {
|
|
48674
|
-
this.handlers.forEach(({ name, handler }) => this.editorView.dom.removeEventListener(name,
|
|
48856
|
+
this.handlers.forEach(({ name, handler: handler2 }) => this.editorView.dom.removeEventListener(name, handler2));
|
|
48675
48857
|
}
|
|
48676
48858
|
update(editorView, prevState) {
|
|
48677
48859
|
if (this.cursorPos != null && prevState.doc != editorView.state.doc) {
|
|
@@ -50397,8 +50579,8 @@ const LinkedStyles = Extension.create({
|
|
|
50397
50579
|
}
|
|
50398
50580
|
});
|
|
50399
50581
|
const generateOrderedListIndex = ({ listLevel, lvlText, listNumberingType, customFormat }) => {
|
|
50400
|
-
const
|
|
50401
|
-
return
|
|
50582
|
+
const handler2 = listIndexMap[listNumberingType];
|
|
50583
|
+
return handler2 ? handler2(listLevel, lvlText, customFormat) : null;
|
|
50402
50584
|
};
|
|
50403
50585
|
const handleDecimal = (path, lvlText) => generateNumbering(path, lvlText, String);
|
|
50404
50586
|
const handleRoman = (path, lvlText) => generateNumbering(path, lvlText, intToRoman);
|
|
@@ -51693,6 +51875,22 @@ const LineBreak = Node$1.create({
|
|
|
51693
51875
|
renderDOM() {
|
|
51694
51876
|
return ["br", {}];
|
|
51695
51877
|
},
|
|
51878
|
+
addAttributes() {
|
|
51879
|
+
return {
|
|
51880
|
+
/**
|
|
51881
|
+
* @private
|
|
51882
|
+
* @category Attribute
|
|
51883
|
+
* @param {string} [lineBreakType] - Type of line break - passthrough in this node
|
|
51884
|
+
*/
|
|
51885
|
+
lineBreakType: { rendered: false },
|
|
51886
|
+
/**
|
|
51887
|
+
* @private
|
|
51888
|
+
* @category Attribute
|
|
51889
|
+
* @param {string} [clear] - Clear attribute - passthrough in this node
|
|
51890
|
+
*/
|
|
51891
|
+
clear: { rendered: false }
|
|
51892
|
+
};
|
|
51893
|
+
},
|
|
51696
51894
|
addCommands() {
|
|
51697
51895
|
return {
|
|
51698
51896
|
/**
|
|
@@ -51749,7 +51947,19 @@ const HardBreak = Node$1.create({
|
|
|
51749
51947
|
pageBreakType: {
|
|
51750
51948
|
default: null,
|
|
51751
51949
|
rendered: false
|
|
51752
|
-
}
|
|
51950
|
+
},
|
|
51951
|
+
/**
|
|
51952
|
+
* @private
|
|
51953
|
+
* @category Attribute
|
|
51954
|
+
* @param {string} [lineBreakType] - Type of line break - passthrough in this node
|
|
51955
|
+
*/
|
|
51956
|
+
lineBreakType: { rendered: false },
|
|
51957
|
+
/**
|
|
51958
|
+
* @private
|
|
51959
|
+
* @category Attribute
|
|
51960
|
+
* @param {string} [clear] - Clear attribute - passthrough in this node
|
|
51961
|
+
*/
|
|
51962
|
+
clear: { rendered: false }
|
|
51753
51963
|
};
|
|
51754
51964
|
},
|
|
51755
51965
|
parseDOM() {
|
|
@@ -57162,10 +57372,10 @@ const BookmarkStart = Node$1.create({
|
|
|
57162
57372
|
* insertBookmark({ name: 'introduction', id: 'intro-001' })
|
|
57163
57373
|
* @note Bookmarks are invisible markers for navigation and cross-references
|
|
57164
57374
|
*/
|
|
57165
|
-
insertBookmark: (
|
|
57375
|
+
insertBookmark: (config2) => ({ commands: commands2 }) => {
|
|
57166
57376
|
return commands2.insertContent({
|
|
57167
57377
|
type: this.name,
|
|
57168
|
-
attrs:
|
|
57378
|
+
attrs: config2
|
|
57169
57379
|
});
|
|
57170
57380
|
},
|
|
57171
57381
|
/**
|
|
@@ -57722,10 +57932,10 @@ const ContentBlock = Node$1.create({
|
|
|
57722
57932
|
* })
|
|
57723
57933
|
* @note Used for spacing, dividers, and special inline content
|
|
57724
57934
|
*/
|
|
57725
|
-
insertContentBlock: (
|
|
57935
|
+
insertContentBlock: (config2) => ({ commands: commands2 }) => {
|
|
57726
57936
|
return commands2.insertContent({
|
|
57727
57937
|
type: this.name,
|
|
57728
|
-
attrs:
|
|
57938
|
+
attrs: config2
|
|
57729
57939
|
});
|
|
57730
57940
|
}
|
|
57731
57941
|
};
|
|
@@ -61540,17 +61750,17 @@ function createTippy(reference2, passedProps) {
|
|
|
61540
61750
|
updateTransitionEndListener(box, "add", listener);
|
|
61541
61751
|
currentTransitionEndListener = listener;
|
|
61542
61752
|
}
|
|
61543
|
-
function on2(eventType,
|
|
61753
|
+
function on2(eventType, handler2, options) {
|
|
61544
61754
|
if (options === void 0) {
|
|
61545
61755
|
options = false;
|
|
61546
61756
|
}
|
|
61547
61757
|
var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
|
|
61548
61758
|
nodes.forEach(function(node2) {
|
|
61549
|
-
node2.addEventListener(eventType,
|
|
61759
|
+
node2.addEventListener(eventType, handler2, options);
|
|
61550
61760
|
listeners.push({
|
|
61551
61761
|
node: node2,
|
|
61552
61762
|
eventType,
|
|
61553
|
-
handler,
|
|
61763
|
+
handler: handler2,
|
|
61554
61764
|
options
|
|
61555
61765
|
});
|
|
61556
61766
|
});
|
|
@@ -61584,8 +61794,8 @@ function createTippy(reference2, passedProps) {
|
|
|
61584
61794
|
}
|
|
61585
61795
|
function removeListeners() {
|
|
61586
61796
|
listeners.forEach(function(_ref) {
|
|
61587
|
-
var node2 = _ref.node, eventType = _ref.eventType,
|
|
61588
|
-
node2.removeEventListener(eventType,
|
|
61797
|
+
var node2 = _ref.node, eventType = _ref.eventType, handler2 = _ref.handler, options = _ref.options;
|
|
61798
|
+
node2.removeEventListener(eventType, handler2, options);
|
|
61589
61799
|
});
|
|
61590
61800
|
listeners = [];
|
|
61591
61801
|
}
|
|
@@ -62425,13 +62635,13 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
62425
62635
|
}
|
|
62426
62636
|
return coords;
|
|
62427
62637
|
}
|
|
62428
|
-
const computePosition$1 = async (reference2, floating,
|
|
62638
|
+
const computePosition$1 = async (reference2, floating, config2) => {
|
|
62429
62639
|
const {
|
|
62430
62640
|
placement = "bottom",
|
|
62431
62641
|
strategy = "absolute",
|
|
62432
62642
|
middleware = [],
|
|
62433
62643
|
platform: platform2
|
|
62434
|
-
} =
|
|
62644
|
+
} = config2;
|
|
62435
62645
|
const validMiddleware = middleware.filter(Boolean);
|
|
62436
62646
|
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
|
|
62437
62647
|
let rects = await platform2.getElementRects({
|
|
@@ -64036,15 +64246,15 @@ class SearchQuery {
|
|
|
64036
64246
|
/**
|
|
64037
64247
|
Create a query object.
|
|
64038
64248
|
*/
|
|
64039
|
-
constructor(
|
|
64040
|
-
this.search =
|
|
64041
|
-
this.caseSensitive = !!
|
|
64042
|
-
this.literal = !!
|
|
64043
|
-
this.regexp = !!
|
|
64044
|
-
this.replace =
|
|
64249
|
+
constructor(config2) {
|
|
64250
|
+
this.search = config2.search;
|
|
64251
|
+
this.caseSensitive = !!config2.caseSensitive;
|
|
64252
|
+
this.literal = !!config2.literal;
|
|
64253
|
+
this.regexp = !!config2.regexp;
|
|
64254
|
+
this.replace = config2.replace || "";
|
|
64045
64255
|
this.valid = !!this.search && !(this.regexp && !validRegExp(this.search));
|
|
64046
|
-
this.wholeWord = !!
|
|
64047
|
-
this.filter =
|
|
64256
|
+
this.wholeWord = !!config2.wholeWord;
|
|
64257
|
+
this.filter = config2.filter || null;
|
|
64048
64258
|
this.impl = !this.valid ? nullQuery : this.regexp ? new RegExpQuery(this) : new StringQuery(this);
|
|
64049
64259
|
}
|
|
64050
64260
|
/**
|
|
@@ -65766,13 +65976,13 @@ const c$2 = function(instance, $2, props, children) {
|
|
|
65766
65976
|
return createCNode(instance, $2, props, null);
|
|
65767
65977
|
}
|
|
65768
65978
|
};
|
|
65769
|
-
function CssRender(
|
|
65979
|
+
function CssRender(config2 = {}) {
|
|
65770
65980
|
const cssr2 = {
|
|
65771
65981
|
c: ((...args) => c$2(cssr2, ...args)),
|
|
65772
65982
|
use: (plugin2, ...args) => plugin2.install(cssr2, ...args),
|
|
65773
65983
|
find: queryElement,
|
|
65774
65984
|
context: {},
|
|
65775
|
-
config
|
|
65985
|
+
config: config2
|
|
65776
65986
|
};
|
|
65777
65987
|
return cssr2;
|
|
65778
65988
|
}
|
|
@@ -66279,21 +66489,21 @@ function createTrapHandler(name, el, originalHandler) {
|
|
|
66279
66489
|
);
|
|
66280
66490
|
return {};
|
|
66281
66491
|
}
|
|
66282
|
-
function ensureTrapHandlers(name, el,
|
|
66492
|
+
function ensureTrapHandlers(name, el, handler2) {
|
|
66283
66493
|
const handlers2 = traps[name];
|
|
66284
66494
|
let elHandlers = handlers2.get(el);
|
|
66285
66495
|
if (elHandlers === void 0) {
|
|
66286
66496
|
handlers2.set(el, elHandlers = /* @__PURE__ */ new WeakMap());
|
|
66287
66497
|
}
|
|
66288
|
-
let trapHandler = elHandlers.get(
|
|
66498
|
+
let trapHandler = elHandlers.get(handler2);
|
|
66289
66499
|
if (trapHandler === void 0) {
|
|
66290
|
-
elHandlers.set(
|
|
66500
|
+
elHandlers.set(handler2, trapHandler = createTrapHandler(name, el, handler2));
|
|
66291
66501
|
}
|
|
66292
66502
|
return trapHandler;
|
|
66293
66503
|
}
|
|
66294
|
-
function trapOn(name, el,
|
|
66504
|
+
function trapOn(name, el, handler2, options) {
|
|
66295
66505
|
if (name === "mousemoveoutside" || name === "clickoutside") {
|
|
66296
|
-
const trapHandlers = ensureTrapHandlers(name, el,
|
|
66506
|
+
const trapHandlers = ensureTrapHandlers(name, el, handler2);
|
|
66297
66507
|
Object.keys(trapHandlers).forEach((key) => {
|
|
66298
66508
|
on(key, document, trapHandlers[key], options);
|
|
66299
66509
|
});
|
|
@@ -66301,9 +66511,9 @@ function trapOn(name, el, handler, options) {
|
|
|
66301
66511
|
}
|
|
66302
66512
|
return false;
|
|
66303
66513
|
}
|
|
66304
|
-
function trapOff(name, el,
|
|
66514
|
+
function trapOff(name, el, handler2, options) {
|
|
66305
66515
|
if (name === "mousemoveoutside" || name === "clickoutside") {
|
|
66306
|
-
const trapHandlers = ensureTrapHandlers(name, el,
|
|
66516
|
+
const trapHandlers = ensureTrapHandlers(name, el, handler2);
|
|
66307
66517
|
Object.keys(trapHandlers).forEach((key) => {
|
|
66308
66518
|
off(key, document, trapHandlers[key], options);
|
|
66309
66519
|
});
|
|
@@ -66393,19 +66603,19 @@ function createDelegate() {
|
|
|
66393
66603
|
const handlers2 = captureElToHandlers.get(target2);
|
|
66394
66604
|
if (handlers2 !== void 0) {
|
|
66395
66605
|
currentTargets.set(e, target2);
|
|
66396
|
-
for (const
|
|
66606
|
+
for (const handler2 of handlers2) {
|
|
66397
66607
|
if (immediatePropagationStopped.has(e))
|
|
66398
66608
|
break;
|
|
66399
|
-
|
|
66609
|
+
handler2(e);
|
|
66400
66610
|
}
|
|
66401
66611
|
}
|
|
66402
66612
|
if (i === 0 && !bubbles && bubbleElToHandlers !== void 0) {
|
|
66403
66613
|
const bubbleHandlers = bubbleElToHandlers.get(target2);
|
|
66404
66614
|
if (bubbleHandlers !== void 0) {
|
|
66405
|
-
for (const
|
|
66615
|
+
for (const handler2 of bubbleHandlers) {
|
|
66406
66616
|
if (immediatePropagationStopped.has(e))
|
|
66407
66617
|
break;
|
|
66408
|
-
|
|
66618
|
+
handler2(e);
|
|
66409
66619
|
}
|
|
66410
66620
|
}
|
|
66411
66621
|
}
|
|
@@ -66420,10 +66630,10 @@ function createDelegate() {
|
|
|
66420
66630
|
const handlers2 = bubbleElToHandlers.get(target2);
|
|
66421
66631
|
if (handlers2 !== void 0) {
|
|
66422
66632
|
currentTargets.set(e, target2);
|
|
66423
|
-
for (const
|
|
66633
|
+
for (const handler2 of handlers2) {
|
|
66424
66634
|
if (immediatePropagationStopped.has(e))
|
|
66425
66635
|
break;
|
|
66426
|
-
|
|
66636
|
+
handler2(e);
|
|
66427
66637
|
}
|
|
66428
66638
|
}
|
|
66429
66639
|
}
|
|
@@ -66443,7 +66653,7 @@ function createDelegate() {
|
|
|
66443
66653
|
const handlers2 = typeToWindowEventHandlers[type2];
|
|
66444
66654
|
if (handlers2 === void 0)
|
|
66445
66655
|
return;
|
|
66446
|
-
handlers2.forEach((
|
|
66656
|
+
handlers2.forEach((handler2) => handler2(e));
|
|
66447
66657
|
};
|
|
66448
66658
|
delegateHandler.displayName = "evtdUnifiedWindowEventHandler";
|
|
66449
66659
|
return delegateHandler;
|
|
@@ -66473,35 +66683,35 @@ function createDelegate() {
|
|
|
66473
66683
|
}
|
|
66474
66684
|
return elHandlers;
|
|
66475
66685
|
}
|
|
66476
|
-
function handlerExist(el, phase, type2,
|
|
66686
|
+
function handlerExist(el, phase, type2, handler2) {
|
|
66477
66687
|
const elToHandlers = phaseToTypeToElToHandlers[phase][type2];
|
|
66478
66688
|
if (elToHandlers !== void 0) {
|
|
66479
66689
|
const handlers2 = elToHandlers.get(el);
|
|
66480
66690
|
if (handlers2 !== void 0) {
|
|
66481
|
-
if (handlers2.has(
|
|
66691
|
+
if (handlers2.has(handler2))
|
|
66482
66692
|
return true;
|
|
66483
66693
|
}
|
|
66484
66694
|
}
|
|
66485
66695
|
return false;
|
|
66486
66696
|
}
|
|
66487
|
-
function windowEventHandlerExist(type2,
|
|
66697
|
+
function windowEventHandlerExist(type2, handler2) {
|
|
66488
66698
|
const handlers2 = typeToWindowEventHandlers[type2];
|
|
66489
66699
|
if (handlers2 !== void 0) {
|
|
66490
|
-
if (handlers2.has(
|
|
66700
|
+
if (handlers2.has(handler2)) {
|
|
66491
66701
|
return true;
|
|
66492
66702
|
}
|
|
66493
66703
|
}
|
|
66494
66704
|
return false;
|
|
66495
66705
|
}
|
|
66496
|
-
function on2(type2, el,
|
|
66706
|
+
function on2(type2, el, handler2, options) {
|
|
66497
66707
|
let mergedHandler;
|
|
66498
66708
|
if (typeof options === "object" && options.once === true) {
|
|
66499
66709
|
mergedHandler = (e) => {
|
|
66500
66710
|
off2(type2, el, mergedHandler, options);
|
|
66501
|
-
|
|
66711
|
+
handler2(e);
|
|
66502
66712
|
};
|
|
66503
66713
|
} else {
|
|
66504
|
-
mergedHandler =
|
|
66714
|
+
mergedHandler = handler2;
|
|
66505
66715
|
}
|
|
66506
66716
|
const trapped = trapOn(type2, el, mergedHandler, options);
|
|
66507
66717
|
if (trapped)
|
|
@@ -66518,8 +66728,8 @@ function createDelegate() {
|
|
|
66518
66728
|
}
|
|
66519
66729
|
}
|
|
66520
66730
|
}
|
|
66521
|
-
function off2(type2, el,
|
|
66522
|
-
const trapped = trapOff(type2, el,
|
|
66731
|
+
function off2(type2, el, handler2, options) {
|
|
66732
|
+
const trapped = trapOff(type2, el, handler2, options);
|
|
66523
66733
|
if (trapped)
|
|
66524
66734
|
return;
|
|
66525
66735
|
const capture = options === true || typeof options === "object" && options.capture === true;
|
|
@@ -66528,17 +66738,17 @@ function createDelegate() {
|
|
|
66528
66738
|
const handlers2 = ensureHandlers(elToHandlers, el);
|
|
66529
66739
|
if (el === window) {
|
|
66530
66740
|
const mirrorPhase = capture ? "bubble" : "capture";
|
|
66531
|
-
if (!handlerExist(el, mirrorPhase, type2,
|
|
66741
|
+
if (!handlerExist(el, mirrorPhase, type2, handler2) && windowEventHandlerExist(type2, handler2)) {
|
|
66532
66742
|
const windowEventHandlers = typeToWindowEventHandlers[type2];
|
|
66533
|
-
windowEventHandlers.delete(
|
|
66743
|
+
windowEventHandlers.delete(handler2);
|
|
66534
66744
|
if (windowEventHandlers.size === 0) {
|
|
66535
66745
|
window.removeEventListener(type2, unfiendWindowEventHandler);
|
|
66536
66746
|
typeToWindowEventHandlers[type2] = void 0;
|
|
66537
66747
|
}
|
|
66538
66748
|
}
|
|
66539
66749
|
}
|
|
66540
|
-
if (handlers2.has(
|
|
66541
|
-
handlers2.delete(
|
|
66750
|
+
if (handlers2.has(handler2))
|
|
66751
|
+
handlers2.delete(handler2);
|
|
66542
66752
|
if (handlers2.size === 0) {
|
|
66543
66753
|
elToHandlers.delete(el);
|
|
66544
66754
|
}
|
|
@@ -66684,16 +66894,16 @@ function useKeyboard(options = {}, enabledRef) {
|
|
|
66684
66894
|
Object.keys(keydown).forEach((key) => {
|
|
66685
66895
|
if (key !== e.key)
|
|
66686
66896
|
return;
|
|
66687
|
-
const
|
|
66688
|
-
if (typeof
|
|
66689
|
-
|
|
66897
|
+
const handler2 = keydown[key];
|
|
66898
|
+
if (typeof handler2 === "function") {
|
|
66899
|
+
handler2(e);
|
|
66690
66900
|
} else {
|
|
66691
|
-
const { stop = false, prevent = false } =
|
|
66901
|
+
const { stop = false, prevent = false } = handler2;
|
|
66692
66902
|
if (stop)
|
|
66693
66903
|
e.stopPropagation();
|
|
66694
66904
|
if (prevent)
|
|
66695
66905
|
e.preventDefault();
|
|
66696
|
-
|
|
66906
|
+
handler2.handler(e);
|
|
66697
66907
|
}
|
|
66698
66908
|
});
|
|
66699
66909
|
}
|
|
@@ -66718,16 +66928,16 @@ function useKeyboard(options = {}, enabledRef) {
|
|
|
66718
66928
|
Object.keys(keyup).forEach((key) => {
|
|
66719
66929
|
if (key !== e.key)
|
|
66720
66930
|
return;
|
|
66721
|
-
const
|
|
66722
|
-
if (typeof
|
|
66723
|
-
|
|
66931
|
+
const handler2 = keyup[key];
|
|
66932
|
+
if (typeof handler2 === "function") {
|
|
66933
|
+
handler2(e);
|
|
66724
66934
|
} else {
|
|
66725
|
-
const { stop = false, prevent = false } =
|
|
66935
|
+
const { stop = false, prevent = false } = handler2;
|
|
66726
66936
|
if (stop)
|
|
66727
66937
|
e.stopPropagation();
|
|
66728
66938
|
if (prevent)
|
|
66729
66939
|
e.preventDefault();
|
|
66730
|
-
|
|
66940
|
+
handler2.handler(e);
|
|
66731
66941
|
}
|
|
66732
66942
|
});
|
|
66733
66943
|
}
|
|
@@ -67145,9 +67355,9 @@ const mousemoveoutside = {
|
|
|
67145
67355
|
}
|
|
67146
67356
|
},
|
|
67147
67357
|
unmounted(el) {
|
|
67148
|
-
const { handler } = el[ctxKey$1];
|
|
67149
|
-
if (
|
|
67150
|
-
off("mousemoveoutside", el,
|
|
67358
|
+
const { handler: handler2 } = el[ctxKey$1];
|
|
67359
|
+
if (handler2) {
|
|
67360
|
+
off("mousemoveoutside", el, handler2);
|
|
67151
67361
|
}
|
|
67152
67362
|
el[ctxKey$1].handler = void 0;
|
|
67153
67363
|
}
|
|
@@ -67194,9 +67404,9 @@ const clickoutside = {
|
|
|
67194
67404
|
}
|
|
67195
67405
|
},
|
|
67196
67406
|
unmounted(el, { modifiers: modifiers2 }) {
|
|
67197
|
-
const { handler } = el[ctxKey];
|
|
67198
|
-
if (
|
|
67199
|
-
off("clickoutside", el,
|
|
67407
|
+
const { handler: handler2 } = el[ctxKey];
|
|
67408
|
+
if (handler2) {
|
|
67409
|
+
off("clickoutside", el, handler2, {
|
|
67200
67410
|
capture: modifiers2.capture
|
|
67201
67411
|
});
|
|
67202
67412
|
}
|
|
@@ -68185,10 +68395,10 @@ var queueMicroTask = function(callback) {
|
|
|
68185
68395
|
if (!trigger) {
|
|
68186
68396
|
var toggle_1 = 0;
|
|
68187
68397
|
var el_1 = document.createTextNode("");
|
|
68188
|
-
var
|
|
68398
|
+
var config2 = { characterData: true };
|
|
68189
68399
|
new MutationObserver(function() {
|
|
68190
68400
|
return notify();
|
|
68191
|
-
}).observe(el_1,
|
|
68401
|
+
}).observe(el_1, config2);
|
|
68192
68402
|
trigger = function() {
|
|
68193
68403
|
el_1.textContent = "".concat(toggle_1 ? toggle_1-- : toggle_1++);
|
|
68194
68404
|
};
|
|
@@ -68432,14 +68642,14 @@ class ResizeObserverDelegate {
|
|
|
68432
68642
|
}
|
|
68433
68643
|
handleResize(entries) {
|
|
68434
68644
|
for (const entry of entries) {
|
|
68435
|
-
const
|
|
68436
|
-
if (
|
|
68437
|
-
|
|
68645
|
+
const handler2 = this.elHandlersMap.get(entry.target);
|
|
68646
|
+
if (handler2 !== void 0) {
|
|
68647
|
+
handler2(entry);
|
|
68438
68648
|
}
|
|
68439
68649
|
}
|
|
68440
68650
|
}
|
|
68441
|
-
registerHandler(el,
|
|
68442
|
-
this.elHandlersMap.set(el,
|
|
68651
|
+
registerHandler(el, handler2) {
|
|
68652
|
+
this.elHandlersMap.set(el, handler2);
|
|
68443
68653
|
this.observer.observe(el);
|
|
68444
68654
|
}
|
|
68445
68655
|
unregisterHandler(el) {
|
|
@@ -72708,13 +72918,13 @@ function appendEvents(vNode, trigger2, events2) {
|
|
|
72708
72918
|
vNode.props = Object.assign({}, vNode.props);
|
|
72709
72919
|
}
|
|
72710
72920
|
const originalHandler = vNode.props[eventName];
|
|
72711
|
-
const
|
|
72921
|
+
const handler2 = events2[eventName];
|
|
72712
72922
|
if (!originalHandler) {
|
|
72713
|
-
vNode.props[eventName] =
|
|
72923
|
+
vNode.props[eventName] = handler2;
|
|
72714
72924
|
} else {
|
|
72715
72925
|
vNode.props[eventName] = (...args) => {
|
|
72716
72926
|
originalHandler(...args);
|
|
72717
|
-
|
|
72927
|
+
handler2(...args);
|
|
72718
72928
|
};
|
|
72719
72929
|
}
|
|
72720
72930
|
});
|
|
@@ -78024,7 +78234,7 @@ class SuperToolbar extends EventEmitter2 {
|
|
|
78024
78234
|
* @param {ToolbarConfig} config - The configuration for the toolbar
|
|
78025
78235
|
* @returns {void}
|
|
78026
78236
|
*/
|
|
78027
|
-
constructor(
|
|
78237
|
+
constructor(config2) {
|
|
78028
78238
|
super();
|
|
78029
78239
|
__privateAdd(this, _SuperToolbar_instances);
|
|
78030
78240
|
__publicField(this, "config", {
|
|
@@ -78303,27 +78513,27 @@ class SuperToolbar extends EventEmitter2 {
|
|
|
78303
78513
|
__privateMethod(this, _SuperToolbar_instances, deactivateAll_fn).call(this);
|
|
78304
78514
|
}
|
|
78305
78515
|
});
|
|
78306
|
-
this.config = { ...this.config, ...
|
|
78516
|
+
this.config = { ...this.config, ...config2 };
|
|
78307
78517
|
this.toolbarItems = [];
|
|
78308
78518
|
this.overflowItems = [];
|
|
78309
|
-
this.documentMode =
|
|
78310
|
-
this.isDev =
|
|
78311
|
-
this.superdoc =
|
|
78312
|
-
this.role =
|
|
78519
|
+
this.documentMode = config2.documentMode || "editing";
|
|
78520
|
+
this.isDev = config2.isDev || false;
|
|
78521
|
+
this.superdoc = config2.superdoc;
|
|
78522
|
+
this.role = config2.role || "editor";
|
|
78313
78523
|
this.toolbarContainer = null;
|
|
78314
78524
|
if (this.config.editor) {
|
|
78315
78525
|
this.config.mode = this.config.editor.options.mode;
|
|
78316
78526
|
}
|
|
78317
78527
|
this.config.icons = {
|
|
78318
78528
|
...toolbarIcons,
|
|
78319
|
-
...
|
|
78529
|
+
...config2.icons
|
|
78320
78530
|
};
|
|
78321
78531
|
this.config.texts = {
|
|
78322
78532
|
...toolbarTexts,
|
|
78323
|
-
...
|
|
78533
|
+
...config2.texts
|
|
78324
78534
|
};
|
|
78325
|
-
this.config.hideButtons =
|
|
78326
|
-
this.config.responsiveToContainer =
|
|
78535
|
+
this.config.hideButtons = config2.hideButtons ?? true;
|
|
78536
|
+
this.config.responsiveToContainer = config2.responsiveToContainer ?? false;
|
|
78327
78537
|
if (!this.config.selector && this.config.element) {
|
|
78328
78538
|
this.config.selector = this.config.element;
|
|
78329
78539
|
}
|
|
@@ -78335,7 +78545,7 @@ class SuperToolbar extends EventEmitter2 {
|
|
|
78335
78545
|
texts: this.config.texts,
|
|
78336
78546
|
fonts: this.config.fonts,
|
|
78337
78547
|
hideButtons: this.config.hideButtons,
|
|
78338
|
-
isDev:
|
|
78548
|
+
isDev: config2.isDev
|
|
78339
78549
|
});
|
|
78340
78550
|
if (this.config.selector && !this.toolbarContainer) {
|
|
78341
78551
|
return;
|
|
@@ -78346,7 +78556,7 @@ class SuperToolbar extends EventEmitter2 {
|
|
|
78346
78556
|
if (this.toolbarContainer) {
|
|
78347
78557
|
this.toolbar = this.app.mount(this.toolbarContainer);
|
|
78348
78558
|
}
|
|
78349
|
-
this.activeEditor =
|
|
78559
|
+
this.activeEditor = config2.editor || null;
|
|
78350
78560
|
this.updateToolbarState();
|
|
78351
78561
|
}
|
|
78352
78562
|
findElementBySelector(selector) {
|
|
@@ -80053,6 +80263,10 @@ const _sfc_main = {
|
|
|
80053
80263
|
}
|
|
80054
80264
|
};
|
|
80055
80265
|
const SuperInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4d5cff52"]]);
|
|
80266
|
+
const registeredHandlers = Object.freeze({
|
|
80267
|
+
"w:br": translator$1,
|
|
80268
|
+
"w:tab": translator
|
|
80269
|
+
});
|
|
80056
80270
|
const Extensions = {
|
|
80057
80271
|
Node: Node$1,
|
|
80058
80272
|
Attribute: Attribute2,
|
|
@@ -80084,3 +80298,4 @@ exports.getStarterExtensions = getStarterExtensions;
|
|
|
80084
80298
|
exports.helpers = helpers;
|
|
80085
80299
|
exports.index = index;
|
|
80086
80300
|
exports.index$1 = index$1;
|
|
80301
|
+
exports.registeredHandlers = registeredHandlers;
|