@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,4 +1,4 @@
|
|
|
1
|
-
import { g as global$2, c as createElementBlock, o as openBlock, a as createBaseVNode, r as ref$1, b as createApp, d as computed, F as Fragment$1, e as renderList, n as normalizeClass, w as withModifiers, f as createCommentVNode, t as toDisplayString, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as defineComponent, p as getCurrentInstance, q as onDeactivated, s as nextTick, u as createBlock, v as createVNode, x as unref, y as withCtx, z as createTextVNode, A as normalizeStyle, B as h$1, C as toRef, D as provide, E as mergeProps, G as cloneVNode, T as Text$2, H as withDirectives, I as watchEffect, J as shallowRef, K as vModelText, L as withKeys, M as reactive, N as readonly, O as Transition, P as vShow, Q as Comment, R as renderSlot, S as onActivated, U as Teleport, V as isVNode, W as onUnmounted, X as resolveDynamicComponent, Y as normalizeProps, Z as guardReactiveProps, _ as markRaw } from "./vue-
|
|
1
|
+
import { g as global$2, c as createElementBlock, o as openBlock, a as createBaseVNode, r as ref$1, b as createApp, d as computed, F as Fragment$1, e as renderList, n as normalizeClass, w as withModifiers, f as createCommentVNode, t as toDisplayString, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as defineComponent, p as getCurrentInstance, q as onDeactivated, s as nextTick, u as createBlock, v as createVNode, x as unref, y as withCtx, z as createTextVNode, A as normalizeStyle, B as h$1, C as toRef, D as provide, E as mergeProps, G as cloneVNode, T as Text$2, H as withDirectives, I as watchEffect, J as shallowRef, K as vModelText, L as withKeys, M as reactive, N as readonly, O as Transition, P as vShow, Q as Comment, R as renderSlot, S as onActivated, U as Teleport, V as isVNode, W as onUnmounted, X as resolveDynamicComponent, Y as normalizeProps, Z as guardReactiveProps, _ as markRaw } from "./vue-ZWZLQtoU.es.js";
|
|
2
2
|
import * as Y from "yjs";
|
|
3
3
|
import { UndoManager, Item as Item$2, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
|
|
4
4
|
var __defProp$2 = Object.defineProperty;
|
|
@@ -5094,6 +5094,19 @@ function requireSafeRegexTest() {
|
|
|
5094
5094
|
};
|
|
5095
5095
|
return safeRegexTest;
|
|
5096
5096
|
}
|
|
5097
|
+
var generatorFunction;
|
|
5098
|
+
var hasRequiredGeneratorFunction;
|
|
5099
|
+
function requireGeneratorFunction() {
|
|
5100
|
+
if (hasRequiredGeneratorFunction) return generatorFunction;
|
|
5101
|
+
hasRequiredGeneratorFunction = 1;
|
|
5102
|
+
const cached = (
|
|
5103
|
+
/** @type {GeneratorFunctionConstructor} */
|
|
5104
|
+
function* () {
|
|
5105
|
+
}.constructor
|
|
5106
|
+
);
|
|
5107
|
+
generatorFunction = () => cached;
|
|
5108
|
+
return generatorFunction;
|
|
5109
|
+
}
|
|
5097
5110
|
var isGeneratorFunction;
|
|
5098
5111
|
var hasRequiredIsGeneratorFunction;
|
|
5099
5112
|
function requireIsGeneratorFunction() {
|
|
@@ -5106,16 +5119,7 @@ function requireIsGeneratorFunction() {
|
|
|
5106
5119
|
var getProto2 = requireGetProto();
|
|
5107
5120
|
var toStr = callBound2("Object.prototype.toString");
|
|
5108
5121
|
var fnToStr = callBound2("Function.prototype.toString");
|
|
5109
|
-
var
|
|
5110
|
-
if (!hasToStringTag) {
|
|
5111
|
-
return false;
|
|
5112
|
-
}
|
|
5113
|
-
try {
|
|
5114
|
-
return Function("return function*() {}")();
|
|
5115
|
-
} catch (e) {
|
|
5116
|
-
}
|
|
5117
|
-
};
|
|
5118
|
-
var GeneratorFunction;
|
|
5122
|
+
var getGeneratorFunction = /* @__PURE__ */ requireGeneratorFunction();
|
|
5119
5123
|
isGeneratorFunction = function isGeneratorFunction2(fn2) {
|
|
5120
5124
|
if (typeof fn2 !== "function") {
|
|
5121
5125
|
return false;
|
|
@@ -5130,14 +5134,8 @@ function requireIsGeneratorFunction() {
|
|
|
5130
5134
|
if (!getProto2) {
|
|
5131
5135
|
return false;
|
|
5132
5136
|
}
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
GeneratorFunction = generatorFunc ? (
|
|
5136
|
-
/** @type {GeneratorFunctionConstructor} */
|
|
5137
|
-
getProto2(generatorFunc)
|
|
5138
|
-
) : false;
|
|
5139
|
-
}
|
|
5140
|
-
return getProto2(fn2) === GeneratorFunction;
|
|
5137
|
+
var GeneratorFunction = getGeneratorFunction();
|
|
5138
|
+
return GeneratorFunction && getProto2(fn2) === GeneratorFunction.prototype;
|
|
5141
5139
|
};
|
|
5142
5140
|
return isGeneratorFunction;
|
|
5143
5141
|
}
|
|
@@ -31878,7 +31876,8 @@ generateXml_fn = function(node) {
|
|
|
31878
31876
|
}
|
|
31879
31877
|
if (elements) {
|
|
31880
31878
|
if (name === "w:instrText") {
|
|
31881
|
-
|
|
31879
|
+
const textContent2 = (elements || []).map((child) => typeof child?.text === "string" ? child.text : "").join("");
|
|
31880
|
+
tags.push(__privateMethod$2(this, _DocxExporter_instances, replaceSpecialCharacters_fn).call(this, textContent2));
|
|
31882
31881
|
} else if (name === "w:t" || name === "w:delText" || name === "wp:posOffset") {
|
|
31883
31882
|
try {
|
|
31884
31883
|
let text = String(elements[0].text);
|
|
@@ -42074,8 +42073,7 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) {
|
|
|
42074
42073
|
let $to = parse.doc.resolveNoCache(change.endB - parse.from);
|
|
42075
42074
|
let $fromA = doc2.resolve(change.start);
|
|
42076
42075
|
let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;
|
|
42077
|
-
|
|
42078
|
-
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")))) {
|
|
42076
|
+
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")))) {
|
|
42079
42077
|
view.input.lastIOSEnter = 0;
|
|
42080
42078
|
return;
|
|
42081
42079
|
}
|
|
@@ -54219,6 +54217,17 @@ function getStructuredContentTagsById(idOrIds, state2) {
|
|
|
54219
54217
|
});
|
|
54220
54218
|
return result;
|
|
54221
54219
|
}
|
|
54220
|
+
function getStructuredContentTagsByAlias(aliasOrAliases, state2) {
|
|
54221
|
+
const result = findChildren$5(state2.doc, (node) => {
|
|
54222
|
+
const isStructuredContent = ["structuredContent", "structuredContentBlock"].includes(node.type.name);
|
|
54223
|
+
if (Array.isArray(aliasOrAliases)) {
|
|
54224
|
+
return isStructuredContent && aliasOrAliases.includes(node.attrs.alias);
|
|
54225
|
+
} else {
|
|
54226
|
+
return isStructuredContent && node.attrs.alias === aliasOrAliases;
|
|
54227
|
+
}
|
|
54228
|
+
});
|
|
54229
|
+
return result;
|
|
54230
|
+
}
|
|
54222
54231
|
function getStructuredContentTags(state2) {
|
|
54223
54232
|
const result = findChildren$5(state2.doc, (node) => {
|
|
54224
54233
|
return node.type.name === "structuredContent" || node.type.name === "structuredContentBlock";
|
|
@@ -54238,6 +54247,7 @@ const structuredContentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ O
|
|
|
54238
54247
|
getStructuredContentBlockTags,
|
|
54239
54248
|
getStructuredContentInlineTags,
|
|
54240
54249
|
getStructuredContentTags,
|
|
54250
|
+
getStructuredContentTagsByAlias,
|
|
54241
54251
|
getStructuredContentTagsById
|
|
54242
54252
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
54243
54253
|
const STRUCTURED_CONTENT_NAMES = ["structuredContent", "structuredContentBlock"];
|
|
@@ -54326,10 +54336,11 @@ const StructuredContentCommands = Extension.create({
|
|
|
54326
54336
|
return true;
|
|
54327
54337
|
},
|
|
54328
54338
|
/**
|
|
54329
|
-
* Updates a structured content
|
|
54339
|
+
* Updates a single structured content field by its unique ID.
|
|
54340
|
+
* IDs are unique identifiers, so this will update at most one field.
|
|
54330
54341
|
* If the updated node does not match the schema, it will not be updated.
|
|
54331
54342
|
* @category Command
|
|
54332
|
-
* @param {string} id
|
|
54343
|
+
* @param {string} id - Unique identifier of the field
|
|
54333
54344
|
* @param {StructuredContentUpdate} options
|
|
54334
54345
|
*/
|
|
54335
54346
|
updateStructuredContentById: (id, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
|
|
@@ -54369,6 +54380,58 @@ const StructuredContentCommands = Extension.create({
|
|
|
54369
54380
|
}
|
|
54370
54381
|
return true;
|
|
54371
54382
|
},
|
|
54383
|
+
/**
|
|
54384
|
+
* Updates all structured content fields with the same alias.
|
|
54385
|
+
* Unlike IDs (which are unique), aliases can be shared across multiple fields.
|
|
54386
|
+
* This will update every field that matches the given alias.
|
|
54387
|
+
* If any updated node does not match the schema, no updates will be applied.
|
|
54388
|
+
* @category Command
|
|
54389
|
+
* @param {string | string[]} alias - Shared identifier for fields (e.g., "customer_name")
|
|
54390
|
+
* @param {StructuredContentUpdate} options
|
|
54391
|
+
*/
|
|
54392
|
+
updateStructuredContentByAlias: (alias, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
|
|
54393
|
+
const structuredContentTags = getStructuredContentTagsByAlias(alias, state2);
|
|
54394
|
+
if (!structuredContentTags.length) {
|
|
54395
|
+
return true;
|
|
54396
|
+
}
|
|
54397
|
+
const { schema } = editor;
|
|
54398
|
+
const createContent = (node) => {
|
|
54399
|
+
if (options.text) {
|
|
54400
|
+
return schema.text(options.text);
|
|
54401
|
+
}
|
|
54402
|
+
if (options.html) {
|
|
54403
|
+
const html = htmlHandler(options.html, editor);
|
|
54404
|
+
const doc2 = DOMParser$1.fromSchema(schema).parse(html);
|
|
54405
|
+
return doc2.content;
|
|
54406
|
+
}
|
|
54407
|
+
if (options.json) {
|
|
54408
|
+
return schema.nodeFromJSON(options.json);
|
|
54409
|
+
}
|
|
54410
|
+
return node.content;
|
|
54411
|
+
};
|
|
54412
|
+
for (const { node } of structuredContentTags) {
|
|
54413
|
+
const content = createContent(node);
|
|
54414
|
+
const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
|
|
54415
|
+
try {
|
|
54416
|
+
updatedNode.check();
|
|
54417
|
+
} catch {
|
|
54418
|
+
console.error("Updated node does not conform to the schema");
|
|
54419
|
+
return false;
|
|
54420
|
+
}
|
|
54421
|
+
}
|
|
54422
|
+
if (dispatch) {
|
|
54423
|
+
structuredContentTags.forEach(({ pos, node }) => {
|
|
54424
|
+
const mappedPos = tr.mapping.map(pos);
|
|
54425
|
+
const currentNode = tr.doc.nodeAt(mappedPos);
|
|
54426
|
+
if (currentNode && node.eq(currentNode)) {
|
|
54427
|
+
const content = createContent(node);
|
|
54428
|
+
const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
|
|
54429
|
+
tr.replaceWith(mappedPos, mappedPos + node.nodeSize, updatedNode);
|
|
54430
|
+
}
|
|
54431
|
+
});
|
|
54432
|
+
}
|
|
54433
|
+
return true;
|
|
54434
|
+
},
|
|
54372
54435
|
/**
|
|
54373
54436
|
* Removes a structured content.
|
|
54374
54437
|
* @category Command
|
|
@@ -62510,6 +62573,7 @@ function getFormatAttrsFromMarks(marks) {
|
|
|
62510
62573
|
}
|
|
62511
62574
|
return formatAttrs;
|
|
62512
62575
|
}
|
|
62576
|
+
const DEFAULT_MIME_TYPE = "application/octet-stream";
|
|
62513
62577
|
const simpleHash = (str) => {
|
|
62514
62578
|
let hash2 = 0;
|
|
62515
62579
|
for (let i = 0; i < str.length; i++) {
|
|
@@ -62519,21 +62583,40 @@ const simpleHash = (str) => {
|
|
|
62519
62583
|
}
|
|
62520
62584
|
return Math.abs(hash2).toString();
|
|
62521
62585
|
};
|
|
62522
|
-
const
|
|
62523
|
-
|
|
62524
|
-
|
|
62525
|
-
|
|
62526
|
-
|
|
62527
|
-
|
|
62586
|
+
const decodeBase64ToBinaryString = (data) => {
|
|
62587
|
+
if (!data) return "";
|
|
62588
|
+
if (typeof atob === "function") {
|
|
62589
|
+
return atob(data);
|
|
62590
|
+
}
|
|
62591
|
+
if (typeof Buffer2 !== "undefined" && typeof Buffer2.from === "function") {
|
|
62592
|
+
return Buffer2.from(data, "base64").toString("binary");
|
|
62593
|
+
}
|
|
62594
|
+
throw new Error("Unable to decode base64 payload in the current environment.");
|
|
62595
|
+
};
|
|
62596
|
+
const extractBase64Meta = (base64String) => {
|
|
62597
|
+
const [meta = "", payload = ""] = base64String.split(",");
|
|
62598
|
+
const mimeMatch = meta.match(/:(.*?);/);
|
|
62599
|
+
const rawMimeType = mimeMatch ? mimeMatch[1] : "";
|
|
62600
|
+
const mimeType = rawMimeType || DEFAULT_MIME_TYPE;
|
|
62601
|
+
const binaryString = decodeBase64ToBinaryString(payload);
|
|
62528
62602
|
const hash2 = simpleHash(binaryString);
|
|
62529
62603
|
const extension = mimeType.split("/")[1] || "bin";
|
|
62530
62604
|
const filename = `image-${hash2}.${extension}`;
|
|
62605
|
+
return { mimeType, binaryString, filename };
|
|
62606
|
+
};
|
|
62607
|
+
const getBase64FileMeta = (base64String) => {
|
|
62608
|
+
const { mimeType, filename } = extractBase64Meta(base64String);
|
|
62609
|
+
return { mimeType, filename };
|
|
62610
|
+
};
|
|
62611
|
+
const base64ToFile = (base64String) => {
|
|
62612
|
+
const { mimeType, binaryString, filename } = extractBase64Meta(base64String);
|
|
62613
|
+
const fileType = mimeType || DEFAULT_MIME_TYPE;
|
|
62531
62614
|
const bytes = new Uint8Array(binaryString.length);
|
|
62532
62615
|
for (let i = 0; i < binaryString.length; i++) {
|
|
62533
62616
|
bytes[i] = binaryString.charCodeAt(i);
|
|
62534
62617
|
}
|
|
62535
|
-
const blob = new Blob([bytes], { type:
|
|
62536
|
-
return new File([blob], filename, { type:
|
|
62618
|
+
const blob = new Blob([bytes], { type: fileType });
|
|
62619
|
+
return new File([blob], filename, { type: fileType });
|
|
62537
62620
|
};
|
|
62538
62621
|
const urlToFile = async (url, filename, mimeType) => {
|
|
62539
62622
|
try {
|
|
@@ -62909,6 +62992,7 @@ function addImageRelationship({ editor, path }) {
|
|
|
62909
62992
|
}
|
|
62910
62993
|
}
|
|
62911
62994
|
const key = new PluginKey("ImageRegistration");
|
|
62995
|
+
const WORD_MEDIA_PREFIX = "word/";
|
|
62912
62996
|
const ImageRegistrationPlugin = ({ editor }) => {
|
|
62913
62997
|
const { view } = editor;
|
|
62914
62998
|
return new Plugin({
|
|
@@ -62929,16 +63013,16 @@ const ImageRegistrationPlugin = ({ editor }) => {
|
|
|
62929
63013
|
},
|
|
62930
63014
|
appendTransaction: (trs, _oldState, state2) => {
|
|
62931
63015
|
let foundImages = [];
|
|
62932
|
-
trs.forEach((
|
|
62933
|
-
if (
|
|
62934
|
-
|
|
63016
|
+
trs.forEach((tr) => {
|
|
63017
|
+
if (tr.docChanged) {
|
|
63018
|
+
tr.steps.forEach((step, index2) => {
|
|
62935
63019
|
const stepMap = step.getMap();
|
|
62936
63020
|
foundImages = foundImages.map(({ node, pos, id }) => {
|
|
62937
63021
|
const mappedPos = stepMap.map(pos, -1);
|
|
62938
63022
|
return { node, pos: mappedPos, id };
|
|
62939
63023
|
});
|
|
62940
63024
|
if (step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1) {
|
|
62941
|
-
(
|
|
63025
|
+
(tr.docs[index2 + 1] || tr.doc).nodesBetween(
|
|
62942
63026
|
stepMap.map(step.from, -1),
|
|
62943
63027
|
stepMap.map(step.to, 1),
|
|
62944
63028
|
(node, pos) => {
|
|
@@ -62957,22 +63041,10 @@ const ImageRegistrationPlugin = ({ editor }) => {
|
|
|
62957
63041
|
if (!foundImages || foundImages.length === 0) {
|
|
62958
63042
|
return null;
|
|
62959
63043
|
}
|
|
62960
|
-
|
|
62961
|
-
|
|
62962
|
-
|
|
62963
|
-
foundImages
|
|
62964
|
-
let deco = Decoration.widget(pos, () => document.createElement("placeholder"), {
|
|
62965
|
-
side: -1,
|
|
62966
|
-
id
|
|
62967
|
-
});
|
|
62968
|
-
set = set.add(tr.doc, [deco]);
|
|
62969
|
-
});
|
|
62970
|
-
foundImages.slice().sort((a, b2) => b2.pos - a.pos).forEach(({ node, pos }) => {
|
|
62971
|
-
tr.delete(pos, pos + node.nodeSize);
|
|
62972
|
-
});
|
|
62973
|
-
set = set.map(tr.mapping, tr.doc);
|
|
62974
|
-
tr.setMeta(key, { set });
|
|
62975
|
-
return tr;
|
|
63044
|
+
if (editor.options.isHeadless) {
|
|
63045
|
+
return handleNodePath(foundImages, editor, state2);
|
|
63046
|
+
}
|
|
63047
|
+
return handleBrowserPath(foundImages, editor, view, state2);
|
|
62976
63048
|
},
|
|
62977
63049
|
props: {
|
|
62978
63050
|
decorations(state2) {
|
|
@@ -62982,6 +63054,59 @@ const ImageRegistrationPlugin = ({ editor }) => {
|
|
|
62982
63054
|
}
|
|
62983
63055
|
});
|
|
62984
63056
|
};
|
|
63057
|
+
const derivePreferredFileName = (src) => {
|
|
63058
|
+
if (typeof src !== "string" || src.length === 0) {
|
|
63059
|
+
return "image.bin";
|
|
63060
|
+
}
|
|
63061
|
+
if (src.startsWith("data:")) {
|
|
63062
|
+
return getBase64FileMeta(src).filename;
|
|
63063
|
+
}
|
|
63064
|
+
const lastSegment = src.split("/").pop() ?? "";
|
|
63065
|
+
const trimmed = lastSegment.split(/[?#]/)[0];
|
|
63066
|
+
return trimmed || "image.bin";
|
|
63067
|
+
};
|
|
63068
|
+
const handleNodePath = (foundImages, editor, state2) => {
|
|
63069
|
+
const { tr } = state2;
|
|
63070
|
+
const mediaStore = editor.storage.image.media ?? {};
|
|
63071
|
+
if (!editor.storage.image.media) {
|
|
63072
|
+
editor.storage.image.media = mediaStore;
|
|
63073
|
+
}
|
|
63074
|
+
const existingFileNames = new Set(Object.keys(mediaStore).map((key2) => key2.split("/").pop()));
|
|
63075
|
+
foundImages.forEach(({ node, pos }) => {
|
|
63076
|
+
const { src } = node.attrs;
|
|
63077
|
+
const preferredFileName = derivePreferredFileName(src);
|
|
63078
|
+
const uniqueFileName = ensureUniqueFileName(preferredFileName, existingFileNames);
|
|
63079
|
+
existingFileNames.add(uniqueFileName);
|
|
63080
|
+
const mediaPath = buildMediaPath(uniqueFileName);
|
|
63081
|
+
mediaStore[mediaPath] = src;
|
|
63082
|
+
const path = mediaPath.startsWith(WORD_MEDIA_PREFIX) ? mediaPath.slice(WORD_MEDIA_PREFIX.length) : mediaPath;
|
|
63083
|
+
const rId = addImageRelationship({ editor, path });
|
|
63084
|
+
tr.setNodeMarkup(pos, void 0, {
|
|
63085
|
+
...node.attrs,
|
|
63086
|
+
src: mediaPath,
|
|
63087
|
+
rId
|
|
63088
|
+
});
|
|
63089
|
+
});
|
|
63090
|
+
return tr;
|
|
63091
|
+
};
|
|
63092
|
+
const handleBrowserPath = (foundImages, editor, view, state2) => {
|
|
63093
|
+
registerImages(foundImages, editor, view);
|
|
63094
|
+
const tr = state2.tr;
|
|
63095
|
+
let { set } = key.getState(state2);
|
|
63096
|
+
foundImages.slice().sort((a, b2) => a.pos - b2.pos).forEach(({ pos, id }) => {
|
|
63097
|
+
let deco = Decoration.widget(pos, () => document.createElement("placeholder"), {
|
|
63098
|
+
side: -1,
|
|
63099
|
+
id
|
|
63100
|
+
});
|
|
63101
|
+
set = set.add(tr.doc, [deco]);
|
|
63102
|
+
});
|
|
63103
|
+
foundImages.slice().sort((a, b2) => b2.pos - a.pos).forEach(({ node, pos }) => {
|
|
63104
|
+
tr.delete(pos, pos + node.nodeSize);
|
|
63105
|
+
});
|
|
63106
|
+
set = set.map(tr.mapping, tr.doc);
|
|
63107
|
+
tr.setMeta(key, { set });
|
|
63108
|
+
return tr;
|
|
63109
|
+
};
|
|
62985
63110
|
const findPlaceholder = (state2, id) => {
|
|
62986
63111
|
let { set } = key.getState(state2);
|
|
62987
63112
|
let found2 = set?.find(null, null, (spec) => spec.id === id);
|
|
@@ -70099,6 +70224,7 @@ function getActualBreakCoords(view, pos, calculatedThreshold) {
|
|
|
70099
70224
|
return actualBreak;
|
|
70100
70225
|
}
|
|
70101
70226
|
const onImageLoad = (editor) => {
|
|
70227
|
+
if (typeof requestAnimationFrame !== "function") return;
|
|
70102
70228
|
requestAnimationFrame(() => {
|
|
70103
70229
|
const newTr = editor.view.state.tr;
|
|
70104
70230
|
newTr.setMeta("forceUpdatePagination", true);
|
|
@@ -71310,7 +71436,7 @@ const _sfc_main$4$1 = {
|
|
|
71310
71436
|
};
|
|
71311
71437
|
const handleInputSubmit = () => {
|
|
71312
71438
|
const value = inlineTextInput.value;
|
|
71313
|
-
const cleanValue = value.
|
|
71439
|
+
const cleanValue = value.match(/^\d+(\.5)?$/) ? value : Math.floor(parseFloat(value)).toString();
|
|
71314
71440
|
emit("textSubmit", cleanValue);
|
|
71315
71441
|
inlineTextInput.value = cleanValue;
|
|
71316
71442
|
};
|
|
@@ -71392,7 +71518,7 @@ const _sfc_main$4$1 = {
|
|
|
71392
71518
|
};
|
|
71393
71519
|
}
|
|
71394
71520
|
};
|
|
71395
|
-
const ToolbarButton = /* @__PURE__ */ _export_sfc(_sfc_main$4$1, [["__scopeId", "data-v-
|
|
71521
|
+
const ToolbarButton = /* @__PURE__ */ _export_sfc(_sfc_main$4$1, [["__scopeId", "data-v-cea02a58"]]);
|
|
71396
71522
|
const _hoisted_1$2$1 = {
|
|
71397
71523
|
class: "toolbar-separator",
|
|
71398
71524
|
role: "separator",
|
|
@@ -163,7 +163,7 @@ process.umask = function() {
|
|
|
163
163
|
var browserExports = browser.exports;
|
|
164
164
|
const process$1 = /* @__PURE__ */ getDefaultExportFromCjs(browserExports);
|
|
165
165
|
/**
|
|
166
|
-
* @vue/shared v3.5.
|
|
166
|
+
* @vue/shared v3.5.22
|
|
167
167
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
168
168
|
* @license MIT
|
|
169
169
|
**/
|
|
@@ -1127,7 +1127,7 @@ function iterator(self2, method, wrapValue) {
|
|
|
1127
1127
|
iter._next = iter.next;
|
|
1128
1128
|
iter.next = () => {
|
|
1129
1129
|
const result = iter._next();
|
|
1130
|
-
if (result.
|
|
1130
|
+
if (!result.done) {
|
|
1131
1131
|
result.value = wrapValue(result.value);
|
|
1132
1132
|
}
|
|
1133
1133
|
return result;
|
|
@@ -1253,7 +1253,8 @@ class BaseReactiveHandler {
|
|
|
1253
1253
|
return res;
|
|
1254
1254
|
}
|
|
1255
1255
|
if (isRef(res)) {
|
|
1256
|
-
|
|
1256
|
+
const value = targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
1257
|
+
return isReadonly2 && isObject(value) ? readonly(value) : value;
|
|
1257
1258
|
}
|
|
1258
1259
|
if (isObject(res)) {
|
|
1259
1260
|
return isReadonly2 ? readonly(res) : reactive(res);
|
|
@@ -2494,14 +2495,11 @@ function checkRecursiveUpdates(seen, fn) {
|
|
|
2494
2495
|
let isHmrUpdating = false;
|
|
2495
2496
|
const hmrDirtyComponents = /* @__PURE__ */ new Map();
|
|
2496
2497
|
if (!!(process$1.env.NODE_ENV !== "production")) {
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
reload: tryWrap(reload)
|
|
2503
|
-
};
|
|
2504
|
-
}
|
|
2498
|
+
getGlobalThis().__VUE_HMR_RUNTIME__ = {
|
|
2499
|
+
createRecord: tryWrap(createRecord),
|
|
2500
|
+
rerender: tryWrap(rerender),
|
|
2501
|
+
reload: tryWrap(reload)
|
|
2502
|
+
};
|
|
2505
2503
|
}
|
|
2506
2504
|
const map = /* @__PURE__ */ new Map();
|
|
2507
2505
|
function registerHMR(instance) {
|
|
@@ -2870,9 +2868,6 @@ const TeleportImpl = {
|
|
|
2870
2868
|
insert(mainAnchor, container, anchor);
|
|
2871
2869
|
const mount = (container2, anchor2) => {
|
|
2872
2870
|
if (shapeFlag & 16) {
|
|
2873
|
-
if (parentComponent && parentComponent.isCE) {
|
|
2874
|
-
parentComponent.ce._teleportTarget = container2;
|
|
2875
|
-
}
|
|
2876
2871
|
mountChildren(
|
|
2877
2872
|
children,
|
|
2878
2873
|
container2,
|
|
@@ -2894,6 +2889,9 @@ const TeleportImpl = {
|
|
|
2894
2889
|
} else if (namespace !== "mathml" && isTargetMathML(target)) {
|
|
2895
2890
|
namespace = "mathml";
|
|
2896
2891
|
}
|
|
2892
|
+
if (parentComponent && parentComponent.isCE) {
|
|
2893
|
+
(parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
2894
|
+
}
|
|
2897
2895
|
if (!disabled) {
|
|
2898
2896
|
mount(target, targetAnchor);
|
|
2899
2897
|
updateCssVars(n2, false);
|
|
@@ -4059,11 +4057,12 @@ function renderList(source, renderItem, cache, index) {
|
|
|
4059
4057
|
}
|
|
4060
4058
|
function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
4061
4059
|
if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
|
|
4060
|
+
const hasProps = Object.keys(props).length > 0;
|
|
4062
4061
|
return openBlock(), createBlock(
|
|
4063
4062
|
Fragment,
|
|
4064
4063
|
null,
|
|
4065
4064
|
[createVNode("slot", props, fallback)],
|
|
4066
|
-
64
|
|
4065
|
+
hasProps ? -2 : 64
|
|
4067
4066
|
);
|
|
4068
4067
|
}
|
|
4069
4068
|
let slot = slots[name];
|
|
@@ -8383,31 +8382,28 @@ const computed = (getterOrOptions, debugOptions) => {
|
|
|
8383
8382
|
return c;
|
|
8384
8383
|
};
|
|
8385
8384
|
function h(type, propsOrChildren, children) {
|
|
8386
|
-
|
|
8385
|
+
try {
|
|
8387
8386
|
setBlockTracking(-1);
|
|
8388
|
-
|
|
8389
|
-
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
if (isVNode(propsOrChildren)) {
|
|
8398
|
-
return doCreateVNode(type, null, [propsOrChildren]);
|
|
8387
|
+
const l = arguments.length;
|
|
8388
|
+
if (l === 2) {
|
|
8389
|
+
if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
|
|
8390
|
+
if (isVNode(propsOrChildren)) {
|
|
8391
|
+
return createVNode(type, null, [propsOrChildren]);
|
|
8392
|
+
}
|
|
8393
|
+
return createVNode(type, propsOrChildren);
|
|
8394
|
+
} else {
|
|
8395
|
+
return createVNode(type, null, propsOrChildren);
|
|
8399
8396
|
}
|
|
8400
|
-
return doCreateVNode(type, propsOrChildren);
|
|
8401
8397
|
} else {
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
children = [children];
|
|
8398
|
+
if (l > 3) {
|
|
8399
|
+
children = Array.prototype.slice.call(arguments, 2);
|
|
8400
|
+
} else if (l === 3 && isVNode(children)) {
|
|
8401
|
+
children = [children];
|
|
8402
|
+
}
|
|
8403
|
+
return createVNode(type, propsOrChildren, children);
|
|
8409
8404
|
}
|
|
8410
|
-
|
|
8405
|
+
} finally {
|
|
8406
|
+
setBlockTracking(1);
|
|
8411
8407
|
}
|
|
8412
8408
|
}
|
|
8413
8409
|
function initCustomFormatter() {
|
|
@@ -8589,7 +8585,7 @@ function initCustomFormatter() {
|
|
|
8589
8585
|
window.devtoolsFormatters = [formatter];
|
|
8590
8586
|
}
|
|
8591
8587
|
}
|
|
8592
|
-
const version = "3.5.
|
|
8588
|
+
const version = "3.5.22";
|
|
8593
8589
|
const warn = !!(process$1.env.NODE_ENV !== "production") ? warn$1 : NOOP;
|
|
8594
8590
|
!!(process$1.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
|
|
8595
8591
|
!!(process$1.env.NODE_ENV !== "production") || true ? setDevtoolsHook$1 : NOOP;
|
|
@@ -8799,11 +8795,11 @@ function resolveTransitionProps(rawProps) {
|
|
|
8799
8795
|
const resolve2 = () => finishLeave(el, done);
|
|
8800
8796
|
addTransitionClass(el, leaveFromClass);
|
|
8801
8797
|
if (!el._enterCancelled) {
|
|
8802
|
-
forceReflow();
|
|
8798
|
+
forceReflow(el);
|
|
8803
8799
|
addTransitionClass(el, leaveActiveClass);
|
|
8804
8800
|
} else {
|
|
8805
8801
|
addTransitionClass(el, leaveActiveClass);
|
|
8806
|
-
forceReflow();
|
|
8802
|
+
forceReflow(el);
|
|
8807
8803
|
}
|
|
8808
8804
|
nextFrame(() => {
|
|
8809
8805
|
if (!el._isLeaving) {
|
|
@@ -8949,8 +8945,9 @@ function toMs(s) {
|
|
|
8949
8945
|
if (s === "auto") return 0;
|
|
8950
8946
|
return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
|
|
8951
8947
|
}
|
|
8952
|
-
function forceReflow() {
|
|
8953
|
-
|
|
8948
|
+
function forceReflow(el) {
|
|
8949
|
+
const targetDocument = el ? el.ownerDocument : document;
|
|
8950
|
+
return targetDocument.body.offsetHeight;
|
|
8954
8951
|
}
|
|
8955
8952
|
function patchClass(el, value, isSVG) {
|
|
8956
8953
|
const transitionClasses = el[vtcKey];
|
|
@@ -9360,7 +9357,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
|
|
|
9360
9357
|
prevChildren.forEach(callPendingCbs);
|
|
9361
9358
|
prevChildren.forEach(recordPosition);
|
|
9362
9359
|
const movedChildren = prevChildren.filter(applyTranslation);
|
|
9363
|
-
forceReflow();
|
|
9360
|
+
forceReflow(instance.vnode.el);
|
|
9364
9361
|
movedChildren.forEach((c) => {
|
|
9365
9362
|
const el = c.el;
|
|
9366
9363
|
const style = el.style;
|