@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
|
@@ -5092,6 +5092,19 @@ function requireSafeRegexTest() {
|
|
|
5092
5092
|
};
|
|
5093
5093
|
return safeRegexTest;
|
|
5094
5094
|
}
|
|
5095
|
+
var generatorFunction;
|
|
5096
|
+
var hasRequiredGeneratorFunction;
|
|
5097
|
+
function requireGeneratorFunction() {
|
|
5098
|
+
if (hasRequiredGeneratorFunction) return generatorFunction;
|
|
5099
|
+
hasRequiredGeneratorFunction = 1;
|
|
5100
|
+
const cached = (
|
|
5101
|
+
/** @type {GeneratorFunctionConstructor} */
|
|
5102
|
+
function* () {
|
|
5103
|
+
}.constructor
|
|
5104
|
+
);
|
|
5105
|
+
generatorFunction = () => cached;
|
|
5106
|
+
return generatorFunction;
|
|
5107
|
+
}
|
|
5095
5108
|
var isGeneratorFunction;
|
|
5096
5109
|
var hasRequiredIsGeneratorFunction;
|
|
5097
5110
|
function requireIsGeneratorFunction() {
|
|
@@ -5104,16 +5117,7 @@ function requireIsGeneratorFunction() {
|
|
|
5104
5117
|
var getProto2 = requireGetProto();
|
|
5105
5118
|
var toStr = callBound2("Object.prototype.toString");
|
|
5106
5119
|
var fnToStr = callBound2("Function.prototype.toString");
|
|
5107
|
-
var
|
|
5108
|
-
if (!hasToStringTag) {
|
|
5109
|
-
return false;
|
|
5110
|
-
}
|
|
5111
|
-
try {
|
|
5112
|
-
return Function("return function*() {}")();
|
|
5113
|
-
} catch (e) {
|
|
5114
|
-
}
|
|
5115
|
-
};
|
|
5116
|
-
var GeneratorFunction;
|
|
5120
|
+
var getGeneratorFunction = /* @__PURE__ */ requireGeneratorFunction();
|
|
5117
5121
|
isGeneratorFunction = function isGeneratorFunction2(fn) {
|
|
5118
5122
|
if (typeof fn !== "function") {
|
|
5119
5123
|
return false;
|
|
@@ -5128,14 +5132,8 @@ function requireIsGeneratorFunction() {
|
|
|
5128
5132
|
if (!getProto2) {
|
|
5129
5133
|
return false;
|
|
5130
5134
|
}
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
GeneratorFunction = generatorFunc ? (
|
|
5134
|
-
/** @type {GeneratorFunctionConstructor} */
|
|
5135
|
-
getProto2(generatorFunc)
|
|
5136
|
-
) : false;
|
|
5137
|
-
}
|
|
5138
|
-
return getProto2(fn) === GeneratorFunction;
|
|
5135
|
+
var GeneratorFunction = getGeneratorFunction();
|
|
5136
|
+
return GeneratorFunction && getProto2(fn) === GeneratorFunction.prototype;
|
|
5139
5137
|
};
|
|
5140
5138
|
return isGeneratorFunction;
|
|
5141
5139
|
}
|
|
@@ -31885,7 +31883,8 @@ generateXml_fn = function(node) {
|
|
|
31885
31883
|
}
|
|
31886
31884
|
if (elements) {
|
|
31887
31885
|
if (name === "w:instrText") {
|
|
31888
|
-
|
|
31886
|
+
const textContent = (elements || []).map((child) => typeof child?.text === "string" ? child.text : "").join("");
|
|
31887
|
+
tags.push(__privateMethod(this, _DocxExporter_instances, replaceSpecialCharacters_fn).call(this, textContent));
|
|
31889
31888
|
} else if (name === "w:t" || name === "w:delText" || name === "wp:posOffset") {
|
|
31890
31889
|
try {
|
|
31891
31890
|
let text = String(elements[0].text);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as process$1, aw as commonjsGlobal, B as Buffer, ax as getDefaultExportFromCjs, ay as getContentTypesFromXml, az as xmljs } from "./converter-
|
|
1
|
+
import { p as process$1, aw as commonjsGlobal, B as Buffer, ax as getDefaultExportFromCjs, ay as getContentTypesFromXml, az as xmljs } from "./converter-ClnqoStR.js";
|
|
2
2
|
function commonjsRequire(path) {
|
|
3
3
|
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
4
4
|
}
|
|
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
12
12
|
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ListItemNodeView_instances, init_fn3, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
|
|
13
13
|
import * as Y from "yjs";
|
|
14
14
|
import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
|
|
15
|
-
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberigHelpers, ap as parseIndentElement, aq as combineIndents, ar as SelectionRange, as as Transform, at as isInTable$1, au as generateDocxRandomId, av as insertNewRelationship } from "./converter-
|
|
15
|
+
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberigHelpers, ap as parseIndentElement, aq as combineIndents, ar as SelectionRange, as as Transform, at as isInTable$1, au as generateDocxRandomId, av as insertNewRelationship } from "./converter-ClnqoStR.js";
|
|
16
16
|
import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
|
|
17
|
-
import { D as DocxZipper } from "./docx-zipper-
|
|
17
|
+
import { D as DocxZipper } from "./docx-zipper-DC28ucAi.js";
|
|
18
18
|
var GOOD_LEAF_SIZE = 200;
|
|
19
19
|
var RopeSequence = function RopeSequence2() {
|
|
20
20
|
};
|
|
@@ -5034,8 +5034,7 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) {
|
|
|
5034
5034
|
let $to = parse.doc.resolveNoCache(change.endB - parse.from);
|
|
5035
5035
|
let $fromA = doc2.resolve(change.start);
|
|
5036
5036
|
let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;
|
|
5037
|
-
|
|
5038
|
-
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")))) {
|
|
5037
|
+
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")))) {
|
|
5039
5038
|
view.input.lastIOSEnter = 0;
|
|
5040
5039
|
return;
|
|
5041
5040
|
}
|
|
@@ -17357,6 +17356,17 @@ function getStructuredContentTagsById(idOrIds, state) {
|
|
|
17357
17356
|
});
|
|
17358
17357
|
return result;
|
|
17359
17358
|
}
|
|
17359
|
+
function getStructuredContentTagsByAlias(aliasOrAliases, state) {
|
|
17360
|
+
const result = findChildren$5(state.doc, (node) => {
|
|
17361
|
+
const isStructuredContent = ["structuredContent", "structuredContentBlock"].includes(node.type.name);
|
|
17362
|
+
if (Array.isArray(aliasOrAliases)) {
|
|
17363
|
+
return isStructuredContent && aliasOrAliases.includes(node.attrs.alias);
|
|
17364
|
+
} else {
|
|
17365
|
+
return isStructuredContent && node.attrs.alias === aliasOrAliases;
|
|
17366
|
+
}
|
|
17367
|
+
});
|
|
17368
|
+
return result;
|
|
17369
|
+
}
|
|
17360
17370
|
function getStructuredContentTags(state) {
|
|
17361
17371
|
const result = findChildren$5(state.doc, (node) => {
|
|
17362
17372
|
return node.type.name === "structuredContent" || node.type.name === "structuredContentBlock";
|
|
@@ -17376,6 +17386,7 @@ const structuredContentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ O
|
|
|
17376
17386
|
getStructuredContentBlockTags,
|
|
17377
17387
|
getStructuredContentInlineTags,
|
|
17378
17388
|
getStructuredContentTags,
|
|
17389
|
+
getStructuredContentTagsByAlias,
|
|
17379
17390
|
getStructuredContentTagsById
|
|
17380
17391
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
17381
17392
|
const STRUCTURED_CONTENT_NAMES = ["structuredContent", "structuredContentBlock"];
|
|
@@ -17464,10 +17475,11 @@ const StructuredContentCommands = Extension.create({
|
|
|
17464
17475
|
return true;
|
|
17465
17476
|
},
|
|
17466
17477
|
/**
|
|
17467
|
-
* Updates a structured content
|
|
17478
|
+
* Updates a single structured content field by its unique ID.
|
|
17479
|
+
* IDs are unique identifiers, so this will update at most one field.
|
|
17468
17480
|
* If the updated node does not match the schema, it will not be updated.
|
|
17469
17481
|
* @category Command
|
|
17470
|
-
* @param {string} id
|
|
17482
|
+
* @param {string} id - Unique identifier of the field
|
|
17471
17483
|
* @param {StructuredContentUpdate} options
|
|
17472
17484
|
*/
|
|
17473
17485
|
updateStructuredContentById: (id, options = {}) => ({ editor, dispatch, state, tr }) => {
|
|
@@ -17507,6 +17519,58 @@ const StructuredContentCommands = Extension.create({
|
|
|
17507
17519
|
}
|
|
17508
17520
|
return true;
|
|
17509
17521
|
},
|
|
17522
|
+
/**
|
|
17523
|
+
* Updates all structured content fields with the same alias.
|
|
17524
|
+
* Unlike IDs (which are unique), aliases can be shared across multiple fields.
|
|
17525
|
+
* This will update every field that matches the given alias.
|
|
17526
|
+
* If any updated node does not match the schema, no updates will be applied.
|
|
17527
|
+
* @category Command
|
|
17528
|
+
* @param {string | string[]} alias - Shared identifier for fields (e.g., "customer_name")
|
|
17529
|
+
* @param {StructuredContentUpdate} options
|
|
17530
|
+
*/
|
|
17531
|
+
updateStructuredContentByAlias: (alias, options = {}) => ({ editor, dispatch, state, tr }) => {
|
|
17532
|
+
const structuredContentTags = getStructuredContentTagsByAlias(alias, state);
|
|
17533
|
+
if (!structuredContentTags.length) {
|
|
17534
|
+
return true;
|
|
17535
|
+
}
|
|
17536
|
+
const { schema } = editor;
|
|
17537
|
+
const createContent = (node) => {
|
|
17538
|
+
if (options.text) {
|
|
17539
|
+
return schema.text(options.text);
|
|
17540
|
+
}
|
|
17541
|
+
if (options.html) {
|
|
17542
|
+
const html = htmlHandler(options.html, editor);
|
|
17543
|
+
const doc2 = DOMParser$1.fromSchema(schema).parse(html);
|
|
17544
|
+
return doc2.content;
|
|
17545
|
+
}
|
|
17546
|
+
if (options.json) {
|
|
17547
|
+
return schema.nodeFromJSON(options.json);
|
|
17548
|
+
}
|
|
17549
|
+
return node.content;
|
|
17550
|
+
};
|
|
17551
|
+
for (const { node } of structuredContentTags) {
|
|
17552
|
+
const content = createContent(node);
|
|
17553
|
+
const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
|
|
17554
|
+
try {
|
|
17555
|
+
updatedNode.check();
|
|
17556
|
+
} catch {
|
|
17557
|
+
console.error("Updated node does not conform to the schema");
|
|
17558
|
+
return false;
|
|
17559
|
+
}
|
|
17560
|
+
}
|
|
17561
|
+
if (dispatch) {
|
|
17562
|
+
structuredContentTags.forEach(({ pos, node }) => {
|
|
17563
|
+
const mappedPos = tr.mapping.map(pos);
|
|
17564
|
+
const currentNode = tr.doc.nodeAt(mappedPos);
|
|
17565
|
+
if (currentNode && node.eq(currentNode)) {
|
|
17566
|
+
const content = createContent(node);
|
|
17567
|
+
const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
|
|
17568
|
+
tr.replaceWith(mappedPos, mappedPos + node.nodeSize, updatedNode);
|
|
17569
|
+
}
|
|
17570
|
+
});
|
|
17571
|
+
}
|
|
17572
|
+
return true;
|
|
17573
|
+
},
|
|
17510
17574
|
/**
|
|
17511
17575
|
* Removes a structured content.
|
|
17512
17576
|
* @category Command
|
|
@@ -25648,6 +25712,7 @@ function getFormatAttrsFromMarks(marks) {
|
|
|
25648
25712
|
}
|
|
25649
25713
|
return formatAttrs;
|
|
25650
25714
|
}
|
|
25715
|
+
const DEFAULT_MIME_TYPE = "application/octet-stream";
|
|
25651
25716
|
const simpleHash = (str) => {
|
|
25652
25717
|
let hash2 = 0;
|
|
25653
25718
|
for (let i = 0; i < str.length; i++) {
|
|
@@ -25657,21 +25722,40 @@ const simpleHash = (str) => {
|
|
|
25657
25722
|
}
|
|
25658
25723
|
return Math.abs(hash2).toString();
|
|
25659
25724
|
};
|
|
25660
|
-
const
|
|
25661
|
-
|
|
25662
|
-
|
|
25663
|
-
|
|
25664
|
-
|
|
25665
|
-
|
|
25725
|
+
const decodeBase64ToBinaryString = (data) => {
|
|
25726
|
+
if (!data) return "";
|
|
25727
|
+
if (typeof atob === "function") {
|
|
25728
|
+
return atob(data);
|
|
25729
|
+
}
|
|
25730
|
+
if (typeof Buffer2 !== "undefined" && typeof Buffer2.from === "function") {
|
|
25731
|
+
return Buffer2.from(data, "base64").toString("binary");
|
|
25732
|
+
}
|
|
25733
|
+
throw new Error("Unable to decode base64 payload in the current environment.");
|
|
25734
|
+
};
|
|
25735
|
+
const extractBase64Meta = (base64String) => {
|
|
25736
|
+
const [meta = "", payload = ""] = base64String.split(",");
|
|
25737
|
+
const mimeMatch = meta.match(/:(.*?);/);
|
|
25738
|
+
const rawMimeType = mimeMatch ? mimeMatch[1] : "";
|
|
25739
|
+
const mimeType = rawMimeType || DEFAULT_MIME_TYPE;
|
|
25740
|
+
const binaryString = decodeBase64ToBinaryString(payload);
|
|
25666
25741
|
const hash2 = simpleHash(binaryString);
|
|
25667
25742
|
const extension = mimeType.split("/")[1] || "bin";
|
|
25668
25743
|
const filename = `image-${hash2}.${extension}`;
|
|
25744
|
+
return { mimeType, binaryString, filename };
|
|
25745
|
+
};
|
|
25746
|
+
const getBase64FileMeta = (base64String) => {
|
|
25747
|
+
const { mimeType, filename } = extractBase64Meta(base64String);
|
|
25748
|
+
return { mimeType, filename };
|
|
25749
|
+
};
|
|
25750
|
+
const base64ToFile = (base64String) => {
|
|
25751
|
+
const { mimeType, binaryString, filename } = extractBase64Meta(base64String);
|
|
25752
|
+
const fileType = mimeType || DEFAULT_MIME_TYPE;
|
|
25669
25753
|
const bytes = new Uint8Array(binaryString.length);
|
|
25670
25754
|
for (let i = 0; i < binaryString.length; i++) {
|
|
25671
25755
|
bytes[i] = binaryString.charCodeAt(i);
|
|
25672
25756
|
}
|
|
25673
|
-
const blob = new Blob([bytes], { type:
|
|
25674
|
-
return new File([blob], filename, { type:
|
|
25757
|
+
const blob = new Blob([bytes], { type: fileType });
|
|
25758
|
+
return new File([blob], filename, { type: fileType });
|
|
25675
25759
|
};
|
|
25676
25760
|
const urlToFile = async (url, filename, mimeType) => {
|
|
25677
25761
|
try {
|
|
@@ -26047,6 +26131,7 @@ function addImageRelationship({ editor, path }) {
|
|
|
26047
26131
|
}
|
|
26048
26132
|
}
|
|
26049
26133
|
const key = new PluginKey("ImageRegistration");
|
|
26134
|
+
const WORD_MEDIA_PREFIX = "word/";
|
|
26050
26135
|
const ImageRegistrationPlugin = ({ editor }) => {
|
|
26051
26136
|
const { view } = editor;
|
|
26052
26137
|
return new Plugin({
|
|
@@ -26067,16 +26152,16 @@ const ImageRegistrationPlugin = ({ editor }) => {
|
|
|
26067
26152
|
},
|
|
26068
26153
|
appendTransaction: (trs, _oldState, state) => {
|
|
26069
26154
|
let foundImages = [];
|
|
26070
|
-
trs.forEach((
|
|
26071
|
-
if (
|
|
26072
|
-
|
|
26155
|
+
trs.forEach((tr) => {
|
|
26156
|
+
if (tr.docChanged) {
|
|
26157
|
+
tr.steps.forEach((step, index2) => {
|
|
26073
26158
|
const stepMap = step.getMap();
|
|
26074
26159
|
foundImages = foundImages.map(({ node, pos, id }) => {
|
|
26075
26160
|
const mappedPos = stepMap.map(pos, -1);
|
|
26076
26161
|
return { node, pos: mappedPos, id };
|
|
26077
26162
|
});
|
|
26078
26163
|
if (step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1) {
|
|
26079
|
-
(
|
|
26164
|
+
(tr.docs[index2 + 1] || tr.doc).nodesBetween(
|
|
26080
26165
|
stepMap.map(step.from, -1),
|
|
26081
26166
|
stepMap.map(step.to, 1),
|
|
26082
26167
|
(node, pos) => {
|
|
@@ -26095,22 +26180,10 @@ const ImageRegistrationPlugin = ({ editor }) => {
|
|
|
26095
26180
|
if (!foundImages || foundImages.length === 0) {
|
|
26096
26181
|
return null;
|
|
26097
26182
|
}
|
|
26098
|
-
|
|
26099
|
-
|
|
26100
|
-
|
|
26101
|
-
foundImages
|
|
26102
|
-
let deco = Decoration.widget(pos, () => document.createElement("placeholder"), {
|
|
26103
|
-
side: -1,
|
|
26104
|
-
id
|
|
26105
|
-
});
|
|
26106
|
-
set = set.add(tr.doc, [deco]);
|
|
26107
|
-
});
|
|
26108
|
-
foundImages.slice().sort((a, b) => b.pos - a.pos).forEach(({ node, pos }) => {
|
|
26109
|
-
tr.delete(pos, pos + node.nodeSize);
|
|
26110
|
-
});
|
|
26111
|
-
set = set.map(tr.mapping, tr.doc);
|
|
26112
|
-
tr.setMeta(key, { set });
|
|
26113
|
-
return tr;
|
|
26183
|
+
if (editor.options.isHeadless) {
|
|
26184
|
+
return handleNodePath(foundImages, editor, state);
|
|
26185
|
+
}
|
|
26186
|
+
return handleBrowserPath(foundImages, editor, view, state);
|
|
26114
26187
|
},
|
|
26115
26188
|
props: {
|
|
26116
26189
|
decorations(state) {
|
|
@@ -26120,6 +26193,59 @@ const ImageRegistrationPlugin = ({ editor }) => {
|
|
|
26120
26193
|
}
|
|
26121
26194
|
});
|
|
26122
26195
|
};
|
|
26196
|
+
const derivePreferredFileName = (src) => {
|
|
26197
|
+
if (typeof src !== "string" || src.length === 0) {
|
|
26198
|
+
return "image.bin";
|
|
26199
|
+
}
|
|
26200
|
+
if (src.startsWith("data:")) {
|
|
26201
|
+
return getBase64FileMeta(src).filename;
|
|
26202
|
+
}
|
|
26203
|
+
const lastSegment = src.split("/").pop() ?? "";
|
|
26204
|
+
const trimmed = lastSegment.split(/[?#]/)[0];
|
|
26205
|
+
return trimmed || "image.bin";
|
|
26206
|
+
};
|
|
26207
|
+
const handleNodePath = (foundImages, editor, state) => {
|
|
26208
|
+
const { tr } = state;
|
|
26209
|
+
const mediaStore = editor.storage.image.media ?? {};
|
|
26210
|
+
if (!editor.storage.image.media) {
|
|
26211
|
+
editor.storage.image.media = mediaStore;
|
|
26212
|
+
}
|
|
26213
|
+
const existingFileNames = new Set(Object.keys(mediaStore).map((key2) => key2.split("/").pop()));
|
|
26214
|
+
foundImages.forEach(({ node, pos }) => {
|
|
26215
|
+
const { src } = node.attrs;
|
|
26216
|
+
const preferredFileName = derivePreferredFileName(src);
|
|
26217
|
+
const uniqueFileName = ensureUniqueFileName(preferredFileName, existingFileNames);
|
|
26218
|
+
existingFileNames.add(uniqueFileName);
|
|
26219
|
+
const mediaPath = buildMediaPath(uniqueFileName);
|
|
26220
|
+
mediaStore[mediaPath] = src;
|
|
26221
|
+
const path = mediaPath.startsWith(WORD_MEDIA_PREFIX) ? mediaPath.slice(WORD_MEDIA_PREFIX.length) : mediaPath;
|
|
26222
|
+
const rId = addImageRelationship({ editor, path });
|
|
26223
|
+
tr.setNodeMarkup(pos, void 0, {
|
|
26224
|
+
...node.attrs,
|
|
26225
|
+
src: mediaPath,
|
|
26226
|
+
rId
|
|
26227
|
+
});
|
|
26228
|
+
});
|
|
26229
|
+
return tr;
|
|
26230
|
+
};
|
|
26231
|
+
const handleBrowserPath = (foundImages, editor, view, state) => {
|
|
26232
|
+
registerImages(foundImages, editor, view);
|
|
26233
|
+
const tr = state.tr;
|
|
26234
|
+
let { set } = key.getState(state);
|
|
26235
|
+
foundImages.slice().sort((a, b) => a.pos - b.pos).forEach(({ pos, id }) => {
|
|
26236
|
+
let deco = Decoration.widget(pos, () => document.createElement("placeholder"), {
|
|
26237
|
+
side: -1,
|
|
26238
|
+
id
|
|
26239
|
+
});
|
|
26240
|
+
set = set.add(tr.doc, [deco]);
|
|
26241
|
+
});
|
|
26242
|
+
foundImages.slice().sort((a, b) => b.pos - a.pos).forEach(({ node, pos }) => {
|
|
26243
|
+
tr.delete(pos, pos + node.nodeSize);
|
|
26244
|
+
});
|
|
26245
|
+
set = set.map(tr.mapping, tr.doc);
|
|
26246
|
+
tr.setMeta(key, { set });
|
|
26247
|
+
return tr;
|
|
26248
|
+
};
|
|
26123
26249
|
const findPlaceholder = (state, id) => {
|
|
26124
26250
|
let { set } = key.getState(state);
|
|
26125
26251
|
let found = set?.find(null, null, (spec) => spec.id === id);
|
|
@@ -33237,6 +33363,7 @@ function getActualBreakCoords(view, pos, calculatedThreshold) {
|
|
|
33237
33363
|
return actualBreak;
|
|
33238
33364
|
}
|
|
33239
33365
|
const onImageLoad = (editor) => {
|
|
33366
|
+
if (typeof requestAnimationFrame !== "function") return;
|
|
33240
33367
|
requestAnimationFrame(() => {
|
|
33241
33368
|
const newTr = editor.view.state.tr;
|
|
33242
33369
|
newTr.setMeta("forceUpdatePagination", true);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
|
|
2
|
-
import { p as process$1 } from "./converter-
|
|
3
|
-
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-
|
|
2
|
+
import { p as process$1 } from "./converter-ClnqoStR.js";
|
|
3
|
+
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-B2aHhS9B.js";
|
|
4
4
|
const sanitizeNumber = (value, defaultNumber) => {
|
|
5
5
|
let sanitized = value.replace(/[^0-9.]/g, "");
|
|
6
6
|
sanitized = parseFloat(sanitized);
|
|
@@ -278,7 +278,7 @@ const _sfc_main$4 = {
|
|
|
278
278
|
};
|
|
279
279
|
const handleInputSubmit = () => {
|
|
280
280
|
const value = inlineTextInput.value;
|
|
281
|
-
const cleanValue = value.
|
|
281
|
+
const cleanValue = value.match(/^\d+(\.5)?$/) ? value : Math.floor(parseFloat(value)).toString();
|
|
282
282
|
emit("textSubmit", cleanValue);
|
|
283
283
|
inlineTextInput.value = cleanValue;
|
|
284
284
|
};
|
|
@@ -360,7 +360,7 @@ const _sfc_main$4 = {
|
|
|
360
360
|
};
|
|
361
361
|
}
|
|
362
362
|
};
|
|
363
|
-
const ToolbarButton = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
363
|
+
const ToolbarButton = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-cea02a58"]]);
|
|
364
364
|
const _hoisted_1$2 = {
|
|
365
365
|
class: "toolbar-separator",
|
|
366
366
|
role: "separator",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E } from "./chunks/editor-
|
|
2
|
-
import "./chunks/converter-
|
|
3
|
-
import "./chunks/docx-zipper-
|
|
1
|
+
import { E } from "./chunks/editor-B2aHhS9B.js";
|
|
2
|
+
import "./chunks/converter-ClnqoStR.js";
|
|
3
|
+
import "./chunks/docx-zipper-DC28ucAi.js";
|
|
4
4
|
export {
|
|
5
5
|
E as Editor
|
|
6
6
|
};
|
|
@@ -15,14 +15,14 @@ export class Attribute {
|
|
|
15
15
|
* @param defaultAttribute Default attribute.
|
|
16
16
|
* @returns Global extension attributes.
|
|
17
17
|
*/
|
|
18
|
-
static #getGlobalAttributes(extensions: any, defaultAttribute: any): any[];
|
|
18
|
+
static "__#private@#getGlobalAttributes"(extensions: any, defaultAttribute: any): any[];
|
|
19
19
|
/**
|
|
20
20
|
* Get a list of attributes defined in the Node and Mark extensions.
|
|
21
21
|
* @param extensions List of all extensions.
|
|
22
22
|
* @param defaultAttribute Default attribute.
|
|
23
23
|
* @returns Node and Mark extension attributes.
|
|
24
24
|
*/
|
|
25
|
-
static #getNodeAndMarksAttributes(extensions: any, defaultAttribute: any): {
|
|
25
|
+
static "__#private@#getNodeAndMarksAttributes"(extensions: any, defaultAttribute: any): {
|
|
26
26
|
type: any;
|
|
27
27
|
name: string;
|
|
28
28
|
attribute: any;
|
|
@@ -16,7 +16,7 @@ export class Schema {
|
|
|
16
16
|
* @param editor Editor instance.
|
|
17
17
|
* @returns Nodes schema.
|
|
18
18
|
*/
|
|
19
|
-
static #createNodesSchema(nodeExtensions: any, attributes: any, editor: any): {
|
|
19
|
+
static "__#private@#createNodesSchema"(nodeExtensions: any, attributes: any, editor: any): {
|
|
20
20
|
[k: string]: any;
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
@@ -26,7 +26,7 @@ export class Schema {
|
|
|
26
26
|
* @param editor Editor instance.
|
|
27
27
|
* @returns Marks schema.
|
|
28
28
|
*/
|
|
29
|
-
static #createMarksSchema(markExtensions: any, attributes: any, editor: any): {
|
|
29
|
+
static "__#private@#createMarksSchema"(markExtensions: any, attributes: any, editor: any): {
|
|
30
30
|
[k: string]: any;
|
|
31
31
|
};
|
|
32
32
|
}
|
|
@@ -3,6 +3,7 @@ export function ImageRegistrationPlugin({ editor }: {
|
|
|
3
3
|
}): Plugin<{
|
|
4
4
|
set: DecorationSet;
|
|
5
5
|
}>;
|
|
6
|
+
export function handleNodePath(foundImages: any[], editor: any, state: import("prosemirror-state").EditorState): import("prosemirror-state").Transaction;
|
|
6
7
|
export function findPlaceholder(state: any, id: any): any;
|
|
7
8
|
export function removeImagePlaceholder(state: any, tr: any, id: any): any;
|
|
8
9
|
export function addImagePlaceholder(state: any, tr: any, id: any, pos: any): any;
|
|
@@ -10,6 +10,10 @@ export function uploadAndInsertImage({ editor, view, file, size, id }: {
|
|
|
10
10
|
size: any;
|
|
11
11
|
id: any;
|
|
12
12
|
}): Promise<void>;
|
|
13
|
+
export function addImageRelationship({ editor, path }: {
|
|
14
|
+
editor: any;
|
|
15
|
+
path: any;
|
|
16
|
+
}): string;
|
|
13
17
|
export function checkAndProcessImage({ getMaxContentSize, file }: {
|
|
14
18
|
getMaxContentSize: any;
|
|
15
19
|
file: any;
|
|
@@ -20,3 +24,4 @@ export function checkAndProcessImage({ getMaxContentSize, file }: {
|
|
|
20
24
|
height: any;
|
|
21
25
|
};
|
|
22
26
|
}>;
|
|
27
|
+
export function generateUniqueDocPrId(editor: any): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets structured content tags by alias in the state.
|
|
3
|
+
* @param {string | string[]} aliasOrAliases
|
|
4
|
+
* @param {EditorState} state Editor state.
|
|
5
|
+
* @returns {Array}
|
|
6
|
+
*/
|
|
7
|
+
export function getStructuredContentTagsByAlias(aliasOrAliases: string | string[], state: EditorState): any[];
|
|
8
|
+
import { EditorState } from 'prosemirror-state';
|