@harbour-enterprises/superdoc 0.23.0-next.1 → 0.23.0-next.10
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-C9SGNZr6.cjs → PdfViewer-BsnSIYxD.cjs} +2 -2
- package/dist/chunks/{PdfViewer-D9atA783.es.js → PdfViewer-CPZ7QD5u.es.js} +2 -2
- package/dist/chunks/{eventemitter3-CZv6vEhA.es.js → eventemitter3-CR2eBWft.es.js} +1 -1
- package/dist/chunks/{eventemitter3-B_kO1Pxm.cjs → eventemitter3-DSRogsNq.cjs} +1 -1
- package/dist/chunks/{index-C8q6lenv.es.js → index-Cd9h9gMj.es.js} +32 -22
- package/dist/chunks/{index-CIbe1VMu.cjs → index-DOd9uvCv.cjs} +32 -22
- package/dist/chunks/{jszip-b7l8QkfH.cjs → jszip-B4LDL19y.cjs} +1 -1
- package/dist/chunks/{jszip-B8KIZSNe.es.js → jszip-DAXEPCUv.es.js} +1 -1
- package/dist/chunks/{super-editor.es-DxScE0ep.cjs → super-editor.es-DAS3_Nt9.cjs} +180 -54
- package/dist/chunks/{super-editor.es-Dj6Sxtr7.es.js → super-editor.es-l3dTZlZX.es.js} +180 -54
- package/dist/chunks/{vue-DWle4Cai.cjs → vue-DKMj1I9B.cjs} +39 -42
- package/dist/chunks/{vue-CXxsqYcP.es.js → vue-ZWZLQtoU.es.js} +39 -42
- package/dist/chunks/xml-js-Bbc0NeKa.es.js +2 -0
- package/dist/chunks/xml-js-CWV8R-ek.cjs +3 -0
- package/dist/core/SuperDoc.d.ts +5 -18
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/core/types/index.d.ts +29 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/stores/superdoc-store.d.ts.map +1 -1
- package/dist/style.css +73 -54
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-C08GQjNi.js → converter-ClnqoStR.js} +18 -19
- package/dist/super-editor/chunks/{docx-zipper-C3-uf2tI.js → docx-zipper-DC28ucAi.js} +1 -1
- package/dist/super-editor/chunks/{editor-C2IwVkIp.js → editor-B2aHhS9B.js} +161 -34
- package/dist/super-editor/chunks/{toolbar-De8G_9NV.js → toolbar-Cgyf_4bW.js} +4 -4
- 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/Attribute.d.ts +2 -2
- package/dist/super-editor/src/core/Schema.d.ts +2 -2
- package/dist/super-editor/src/extensions/image/imageHelpers/handleBase64.d.ts +4 -0
- package/dist/super-editor/src/extensions/image/imageHelpers/imageRegistrationPlugin.d.ts +1 -0
- package/dist/super-editor/src/extensions/image/imageHelpers/startImageUpload.d.ts +5 -0
- package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTagsByAlias.d.ts +8 -0
- package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/index.d.ts +1 -0
- package/dist/super-editor/style.css +46 -27
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +2 -2
- package/dist/superdoc.cjs +4 -4
- package/dist/superdoc.es.js +4 -4
- package/dist/superdoc.umd.js +240 -104
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/xml-js-CX8FH0He.cjs +0 -3
- package/dist/chunks/xml-js-D0tLGmKu.es.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const vue = require("./vue-
|
|
2
|
+
const vue = require("./vue-DKMj1I9B.cjs");
|
|
3
3
|
const Y = require("yjs");
|
|
4
4
|
function _interopNamespaceDefault(e) {
|
|
5
5
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -5111,6 +5111,19 @@ function requireSafeRegexTest() {
|
|
|
5111
5111
|
};
|
|
5112
5112
|
return safeRegexTest;
|
|
5113
5113
|
}
|
|
5114
|
+
var generatorFunction;
|
|
5115
|
+
var hasRequiredGeneratorFunction;
|
|
5116
|
+
function requireGeneratorFunction() {
|
|
5117
|
+
if (hasRequiredGeneratorFunction) return generatorFunction;
|
|
5118
|
+
hasRequiredGeneratorFunction = 1;
|
|
5119
|
+
const cached = (
|
|
5120
|
+
/** @type {GeneratorFunctionConstructor} */
|
|
5121
|
+
function* () {
|
|
5122
|
+
}.constructor
|
|
5123
|
+
);
|
|
5124
|
+
generatorFunction = () => cached;
|
|
5125
|
+
return generatorFunction;
|
|
5126
|
+
}
|
|
5114
5127
|
var isGeneratorFunction;
|
|
5115
5128
|
var hasRequiredIsGeneratorFunction;
|
|
5116
5129
|
function requireIsGeneratorFunction() {
|
|
@@ -5123,16 +5136,7 @@ function requireIsGeneratorFunction() {
|
|
|
5123
5136
|
var getProto2 = requireGetProto();
|
|
5124
5137
|
var toStr = callBound2("Object.prototype.toString");
|
|
5125
5138
|
var fnToStr = callBound2("Function.prototype.toString");
|
|
5126
|
-
var
|
|
5127
|
-
if (!hasToStringTag) {
|
|
5128
|
-
return false;
|
|
5129
|
-
}
|
|
5130
|
-
try {
|
|
5131
|
-
return Function("return function*() {}")();
|
|
5132
|
-
} catch (e) {
|
|
5133
|
-
}
|
|
5134
|
-
};
|
|
5135
|
-
var GeneratorFunction;
|
|
5139
|
+
var getGeneratorFunction = /* @__PURE__ */ requireGeneratorFunction();
|
|
5136
5140
|
isGeneratorFunction = function isGeneratorFunction2(fn2) {
|
|
5137
5141
|
if (typeof fn2 !== "function") {
|
|
5138
5142
|
return false;
|
|
@@ -5147,14 +5151,8 @@ function requireIsGeneratorFunction() {
|
|
|
5147
5151
|
if (!getProto2) {
|
|
5148
5152
|
return false;
|
|
5149
5153
|
}
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
GeneratorFunction = generatorFunc ? (
|
|
5153
|
-
/** @type {GeneratorFunctionConstructor} */
|
|
5154
|
-
getProto2(generatorFunc)
|
|
5155
|
-
) : false;
|
|
5156
|
-
}
|
|
5157
|
-
return getProto2(fn2) === GeneratorFunction;
|
|
5154
|
+
var GeneratorFunction = getGeneratorFunction();
|
|
5155
|
+
return GeneratorFunction && getProto2(fn2) === GeneratorFunction.prototype;
|
|
5158
5156
|
};
|
|
5159
5157
|
return isGeneratorFunction;
|
|
5160
5158
|
}
|
|
@@ -31895,7 +31893,8 @@ generateXml_fn = function(node) {
|
|
|
31895
31893
|
}
|
|
31896
31894
|
if (elements) {
|
|
31897
31895
|
if (name === "w:instrText") {
|
|
31898
|
-
|
|
31896
|
+
const textContent2 = (elements || []).map((child) => typeof child?.text === "string" ? child.text : "").join("");
|
|
31897
|
+
tags.push(__privateMethod$2(this, _DocxExporter_instances, replaceSpecialCharacters_fn).call(this, textContent2));
|
|
31899
31898
|
} else if (name === "w:t" || name === "w:delText" || name === "wp:posOffset") {
|
|
31900
31899
|
try {
|
|
31901
31900
|
let text = String(elements[0].text);
|
|
@@ -42091,8 +42090,7 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) {
|
|
|
42091
42090
|
let $to = parse.doc.resolveNoCache(change.endB - parse.from);
|
|
42092
42091
|
let $fromA = doc2.resolve(change.start);
|
|
42093
42092
|
let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;
|
|
42094
|
-
|
|
42095
|
-
if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", "")) && (nextSel = Selection.findFrom(parse.doc.resolve($from.pos + 1), 1, true)) && nextSel.head > $from.pos) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
|
|
42093
|
+
if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && $from.pos < $to.pos && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", ""))) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
|
|
42096
42094
|
view.input.lastIOSEnter = 0;
|
|
42097
42095
|
return;
|
|
42098
42096
|
}
|
|
@@ -54236,6 +54234,17 @@ function getStructuredContentTagsById(idOrIds, state2) {
|
|
|
54236
54234
|
});
|
|
54237
54235
|
return result;
|
|
54238
54236
|
}
|
|
54237
|
+
function getStructuredContentTagsByAlias(aliasOrAliases, state2) {
|
|
54238
|
+
const result = findChildren$5(state2.doc, (node) => {
|
|
54239
|
+
const isStructuredContent = ["structuredContent", "structuredContentBlock"].includes(node.type.name);
|
|
54240
|
+
if (Array.isArray(aliasOrAliases)) {
|
|
54241
|
+
return isStructuredContent && aliasOrAliases.includes(node.attrs.alias);
|
|
54242
|
+
} else {
|
|
54243
|
+
return isStructuredContent && node.attrs.alias === aliasOrAliases;
|
|
54244
|
+
}
|
|
54245
|
+
});
|
|
54246
|
+
return result;
|
|
54247
|
+
}
|
|
54239
54248
|
function getStructuredContentTags(state2) {
|
|
54240
54249
|
const result = findChildren$5(state2.doc, (node) => {
|
|
54241
54250
|
return node.type.name === "structuredContent" || node.type.name === "structuredContentBlock";
|
|
@@ -54255,6 +54264,7 @@ const structuredContentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ O
|
|
|
54255
54264
|
getStructuredContentBlockTags,
|
|
54256
54265
|
getStructuredContentInlineTags,
|
|
54257
54266
|
getStructuredContentTags,
|
|
54267
|
+
getStructuredContentTagsByAlias,
|
|
54258
54268
|
getStructuredContentTagsById
|
|
54259
54269
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
54260
54270
|
const STRUCTURED_CONTENT_NAMES = ["structuredContent", "structuredContentBlock"];
|
|
@@ -54343,10 +54353,11 @@ const StructuredContentCommands = Extension.create({
|
|
|
54343
54353
|
return true;
|
|
54344
54354
|
},
|
|
54345
54355
|
/**
|
|
54346
|
-
* Updates a structured content
|
|
54356
|
+
* Updates a single structured content field by its unique ID.
|
|
54357
|
+
* IDs are unique identifiers, so this will update at most one field.
|
|
54347
54358
|
* If the updated node does not match the schema, it will not be updated.
|
|
54348
54359
|
* @category Command
|
|
54349
|
-
* @param {string} id
|
|
54360
|
+
* @param {string} id - Unique identifier of the field
|
|
54350
54361
|
* @param {StructuredContentUpdate} options
|
|
54351
54362
|
*/
|
|
54352
54363
|
updateStructuredContentById: (id, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
|
|
@@ -54386,6 +54397,58 @@ const StructuredContentCommands = Extension.create({
|
|
|
54386
54397
|
}
|
|
54387
54398
|
return true;
|
|
54388
54399
|
},
|
|
54400
|
+
/**
|
|
54401
|
+
* Updates all structured content fields with the same alias.
|
|
54402
|
+
* Unlike IDs (which are unique), aliases can be shared across multiple fields.
|
|
54403
|
+
* This will update every field that matches the given alias.
|
|
54404
|
+
* If any updated node does not match the schema, no updates will be applied.
|
|
54405
|
+
* @category Command
|
|
54406
|
+
* @param {string | string[]} alias - Shared identifier for fields (e.g., "customer_name")
|
|
54407
|
+
* @param {StructuredContentUpdate} options
|
|
54408
|
+
*/
|
|
54409
|
+
updateStructuredContentByAlias: (alias, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
|
|
54410
|
+
const structuredContentTags = getStructuredContentTagsByAlias(alias, state2);
|
|
54411
|
+
if (!structuredContentTags.length) {
|
|
54412
|
+
return true;
|
|
54413
|
+
}
|
|
54414
|
+
const { schema } = editor;
|
|
54415
|
+
const createContent = (node) => {
|
|
54416
|
+
if (options.text) {
|
|
54417
|
+
return schema.text(options.text);
|
|
54418
|
+
}
|
|
54419
|
+
if (options.html) {
|
|
54420
|
+
const html = htmlHandler(options.html, editor);
|
|
54421
|
+
const doc2 = DOMParser$1.fromSchema(schema).parse(html);
|
|
54422
|
+
return doc2.content;
|
|
54423
|
+
}
|
|
54424
|
+
if (options.json) {
|
|
54425
|
+
return schema.nodeFromJSON(options.json);
|
|
54426
|
+
}
|
|
54427
|
+
return node.content;
|
|
54428
|
+
};
|
|
54429
|
+
for (const { node } of structuredContentTags) {
|
|
54430
|
+
const content = createContent(node);
|
|
54431
|
+
const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
|
|
54432
|
+
try {
|
|
54433
|
+
updatedNode.check();
|
|
54434
|
+
} catch {
|
|
54435
|
+
console.error("Updated node does not conform to the schema");
|
|
54436
|
+
return false;
|
|
54437
|
+
}
|
|
54438
|
+
}
|
|
54439
|
+
if (dispatch) {
|
|
54440
|
+
structuredContentTags.forEach(({ pos, node }) => {
|
|
54441
|
+
const mappedPos = tr.mapping.map(pos);
|
|
54442
|
+
const currentNode = tr.doc.nodeAt(mappedPos);
|
|
54443
|
+
if (currentNode && node.eq(currentNode)) {
|
|
54444
|
+
const content = createContent(node);
|
|
54445
|
+
const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
|
|
54446
|
+
tr.replaceWith(mappedPos, mappedPos + node.nodeSize, updatedNode);
|
|
54447
|
+
}
|
|
54448
|
+
});
|
|
54449
|
+
}
|
|
54450
|
+
return true;
|
|
54451
|
+
},
|
|
54389
54452
|
/**
|
|
54390
54453
|
* Removes a structured content.
|
|
54391
54454
|
* @category Command
|
|
@@ -62527,6 +62590,7 @@ function getFormatAttrsFromMarks(marks) {
|
|
|
62527
62590
|
}
|
|
62528
62591
|
return formatAttrs;
|
|
62529
62592
|
}
|
|
62593
|
+
const DEFAULT_MIME_TYPE = "application/octet-stream";
|
|
62530
62594
|
const simpleHash = (str) => {
|
|
62531
62595
|
let hash2 = 0;
|
|
62532
62596
|
for (let i = 0; i < str.length; i++) {
|
|
@@ -62536,21 +62600,40 @@ const simpleHash = (str) => {
|
|
|
62536
62600
|
}
|
|
62537
62601
|
return Math.abs(hash2).toString();
|
|
62538
62602
|
};
|
|
62539
|
-
const
|
|
62540
|
-
|
|
62541
|
-
|
|
62542
|
-
|
|
62543
|
-
|
|
62544
|
-
|
|
62603
|
+
const decodeBase64ToBinaryString = (data) => {
|
|
62604
|
+
if (!data) return "";
|
|
62605
|
+
if (typeof atob === "function") {
|
|
62606
|
+
return atob(data);
|
|
62607
|
+
}
|
|
62608
|
+
if (typeof Buffer2 !== "undefined" && typeof Buffer2.from === "function") {
|
|
62609
|
+
return Buffer2.from(data, "base64").toString("binary");
|
|
62610
|
+
}
|
|
62611
|
+
throw new Error("Unable to decode base64 payload in the current environment.");
|
|
62612
|
+
};
|
|
62613
|
+
const extractBase64Meta = (base64String) => {
|
|
62614
|
+
const [meta = "", payload = ""] = base64String.split(",");
|
|
62615
|
+
const mimeMatch = meta.match(/:(.*?);/);
|
|
62616
|
+
const rawMimeType = mimeMatch ? mimeMatch[1] : "";
|
|
62617
|
+
const mimeType = rawMimeType || DEFAULT_MIME_TYPE;
|
|
62618
|
+
const binaryString = decodeBase64ToBinaryString(payload);
|
|
62545
62619
|
const hash2 = simpleHash(binaryString);
|
|
62546
62620
|
const extension = mimeType.split("/")[1] || "bin";
|
|
62547
62621
|
const filename = `image-${hash2}.${extension}`;
|
|
62622
|
+
return { mimeType, binaryString, filename };
|
|
62623
|
+
};
|
|
62624
|
+
const getBase64FileMeta = (base64String) => {
|
|
62625
|
+
const { mimeType, filename } = extractBase64Meta(base64String);
|
|
62626
|
+
return { mimeType, filename };
|
|
62627
|
+
};
|
|
62628
|
+
const base64ToFile = (base64String) => {
|
|
62629
|
+
const { mimeType, binaryString, filename } = extractBase64Meta(base64String);
|
|
62630
|
+
const fileType = mimeType || DEFAULT_MIME_TYPE;
|
|
62548
62631
|
const bytes = new Uint8Array(binaryString.length);
|
|
62549
62632
|
for (let i = 0; i < binaryString.length; i++) {
|
|
62550
62633
|
bytes[i] = binaryString.charCodeAt(i);
|
|
62551
62634
|
}
|
|
62552
|
-
const blob = new Blob([bytes], { type:
|
|
62553
|
-
return new File([blob], filename, { type:
|
|
62635
|
+
const blob = new Blob([bytes], { type: fileType });
|
|
62636
|
+
return new File([blob], filename, { type: fileType });
|
|
62554
62637
|
};
|
|
62555
62638
|
const urlToFile = async (url, filename, mimeType) => {
|
|
62556
62639
|
try {
|
|
@@ -62926,6 +63009,7 @@ function addImageRelationship({ editor, path }) {
|
|
|
62926
63009
|
}
|
|
62927
63010
|
}
|
|
62928
63011
|
const key = new PluginKey("ImageRegistration");
|
|
63012
|
+
const WORD_MEDIA_PREFIX = "word/";
|
|
62929
63013
|
const ImageRegistrationPlugin = ({ editor }) => {
|
|
62930
63014
|
const { view } = editor;
|
|
62931
63015
|
return new Plugin({
|
|
@@ -62946,16 +63030,16 @@ const ImageRegistrationPlugin = ({ editor }) => {
|
|
|
62946
63030
|
},
|
|
62947
63031
|
appendTransaction: (trs, _oldState, state2) => {
|
|
62948
63032
|
let foundImages = [];
|
|
62949
|
-
trs.forEach((
|
|
62950
|
-
if (
|
|
62951
|
-
|
|
63033
|
+
trs.forEach((tr) => {
|
|
63034
|
+
if (tr.docChanged) {
|
|
63035
|
+
tr.steps.forEach((step, index2) => {
|
|
62952
63036
|
const stepMap = step.getMap();
|
|
62953
63037
|
foundImages = foundImages.map(({ node, pos, id }) => {
|
|
62954
63038
|
const mappedPos = stepMap.map(pos, -1);
|
|
62955
63039
|
return { node, pos: mappedPos, id };
|
|
62956
63040
|
});
|
|
62957
63041
|
if (step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1) {
|
|
62958
|
-
(
|
|
63042
|
+
(tr.docs[index2 + 1] || tr.doc).nodesBetween(
|
|
62959
63043
|
stepMap.map(step.from, -1),
|
|
62960
63044
|
stepMap.map(step.to, 1),
|
|
62961
63045
|
(node, pos) => {
|
|
@@ -62974,22 +63058,10 @@ const ImageRegistrationPlugin = ({ editor }) => {
|
|
|
62974
63058
|
if (!foundImages || foundImages.length === 0) {
|
|
62975
63059
|
return null;
|
|
62976
63060
|
}
|
|
62977
|
-
|
|
62978
|
-
|
|
62979
|
-
|
|
62980
|
-
foundImages
|
|
62981
|
-
let deco = Decoration.widget(pos, () => document.createElement("placeholder"), {
|
|
62982
|
-
side: -1,
|
|
62983
|
-
id
|
|
62984
|
-
});
|
|
62985
|
-
set = set.add(tr.doc, [deco]);
|
|
62986
|
-
});
|
|
62987
|
-
foundImages.slice().sort((a, b2) => b2.pos - a.pos).forEach(({ node, pos }) => {
|
|
62988
|
-
tr.delete(pos, pos + node.nodeSize);
|
|
62989
|
-
});
|
|
62990
|
-
set = set.map(tr.mapping, tr.doc);
|
|
62991
|
-
tr.setMeta(key, { set });
|
|
62992
|
-
return tr;
|
|
63061
|
+
if (editor.options.isHeadless) {
|
|
63062
|
+
return handleNodePath(foundImages, editor, state2);
|
|
63063
|
+
}
|
|
63064
|
+
return handleBrowserPath(foundImages, editor, view, state2);
|
|
62993
63065
|
},
|
|
62994
63066
|
props: {
|
|
62995
63067
|
decorations(state2) {
|
|
@@ -62999,6 +63071,59 @@ const ImageRegistrationPlugin = ({ editor }) => {
|
|
|
62999
63071
|
}
|
|
63000
63072
|
});
|
|
63001
63073
|
};
|
|
63074
|
+
const derivePreferredFileName = (src) => {
|
|
63075
|
+
if (typeof src !== "string" || src.length === 0) {
|
|
63076
|
+
return "image.bin";
|
|
63077
|
+
}
|
|
63078
|
+
if (src.startsWith("data:")) {
|
|
63079
|
+
return getBase64FileMeta(src).filename;
|
|
63080
|
+
}
|
|
63081
|
+
const lastSegment = src.split("/").pop() ?? "";
|
|
63082
|
+
const trimmed = lastSegment.split(/[?#]/)[0];
|
|
63083
|
+
return trimmed || "image.bin";
|
|
63084
|
+
};
|
|
63085
|
+
const handleNodePath = (foundImages, editor, state2) => {
|
|
63086
|
+
const { tr } = state2;
|
|
63087
|
+
const mediaStore = editor.storage.image.media ?? {};
|
|
63088
|
+
if (!editor.storage.image.media) {
|
|
63089
|
+
editor.storage.image.media = mediaStore;
|
|
63090
|
+
}
|
|
63091
|
+
const existingFileNames = new Set(Object.keys(mediaStore).map((key2) => key2.split("/").pop()));
|
|
63092
|
+
foundImages.forEach(({ node, pos }) => {
|
|
63093
|
+
const { src } = node.attrs;
|
|
63094
|
+
const preferredFileName = derivePreferredFileName(src);
|
|
63095
|
+
const uniqueFileName = ensureUniqueFileName(preferredFileName, existingFileNames);
|
|
63096
|
+
existingFileNames.add(uniqueFileName);
|
|
63097
|
+
const mediaPath = buildMediaPath(uniqueFileName);
|
|
63098
|
+
mediaStore[mediaPath] = src;
|
|
63099
|
+
const path = mediaPath.startsWith(WORD_MEDIA_PREFIX) ? mediaPath.slice(WORD_MEDIA_PREFIX.length) : mediaPath;
|
|
63100
|
+
const rId = addImageRelationship({ editor, path });
|
|
63101
|
+
tr.setNodeMarkup(pos, void 0, {
|
|
63102
|
+
...node.attrs,
|
|
63103
|
+
src: mediaPath,
|
|
63104
|
+
rId
|
|
63105
|
+
});
|
|
63106
|
+
});
|
|
63107
|
+
return tr;
|
|
63108
|
+
};
|
|
63109
|
+
const handleBrowserPath = (foundImages, editor, view, state2) => {
|
|
63110
|
+
registerImages(foundImages, editor, view);
|
|
63111
|
+
const tr = state2.tr;
|
|
63112
|
+
let { set } = key.getState(state2);
|
|
63113
|
+
foundImages.slice().sort((a, b2) => a.pos - b2.pos).forEach(({ pos, id }) => {
|
|
63114
|
+
let deco = Decoration.widget(pos, () => document.createElement("placeholder"), {
|
|
63115
|
+
side: -1,
|
|
63116
|
+
id
|
|
63117
|
+
});
|
|
63118
|
+
set = set.add(tr.doc, [deco]);
|
|
63119
|
+
});
|
|
63120
|
+
foundImages.slice().sort((a, b2) => b2.pos - a.pos).forEach(({ node, pos }) => {
|
|
63121
|
+
tr.delete(pos, pos + node.nodeSize);
|
|
63122
|
+
});
|
|
63123
|
+
set = set.map(tr.mapping, tr.doc);
|
|
63124
|
+
tr.setMeta(key, { set });
|
|
63125
|
+
return tr;
|
|
63126
|
+
};
|
|
63002
63127
|
const findPlaceholder = (state2, id) => {
|
|
63003
63128
|
let { set } = key.getState(state2);
|
|
63004
63129
|
let found2 = set?.find(null, null, (spec) => spec.id === id);
|
|
@@ -70116,6 +70241,7 @@ function getActualBreakCoords(view, pos, calculatedThreshold) {
|
|
|
70116
70241
|
return actualBreak;
|
|
70117
70242
|
}
|
|
70118
70243
|
const onImageLoad = (editor) => {
|
|
70244
|
+
if (typeof requestAnimationFrame !== "function") return;
|
|
70119
70245
|
requestAnimationFrame(() => {
|
|
70120
70246
|
const newTr = editor.view.state.tr;
|
|
70121
70247
|
newTr.setMeta("forceUpdatePagination", true);
|
|
@@ -71327,7 +71453,7 @@ const _sfc_main$4$1 = {
|
|
|
71327
71453
|
};
|
|
71328
71454
|
const handleInputSubmit = () => {
|
|
71329
71455
|
const value = inlineTextInput.value;
|
|
71330
|
-
const cleanValue = value.
|
|
71456
|
+
const cleanValue = value.match(/^\d+(\.5)?$/) ? value : Math.floor(parseFloat(value)).toString();
|
|
71331
71457
|
emit("textSubmit", cleanValue);
|
|
71332
71458
|
inlineTextInput.value = cleanValue;
|
|
71333
71459
|
};
|
|
@@ -71409,7 +71535,7 @@ const _sfc_main$4$1 = {
|
|
|
71409
71535
|
};
|
|
71410
71536
|
}
|
|
71411
71537
|
};
|
|
71412
|
-
const ToolbarButton = /* @__PURE__ */ _export_sfc(_sfc_main$4$1, [["__scopeId", "data-v-
|
|
71538
|
+
const ToolbarButton = /* @__PURE__ */ _export_sfc(_sfc_main$4$1, [["__scopeId", "data-v-cea02a58"]]);
|
|
71413
71539
|
const _hoisted_1$2$1 = {
|
|
71414
71540
|
class: "toolbar-separator",
|
|
71415
71541
|
role: "separator",
|