superdoc 1.0.0-beta.16 → 1.0.0-beta.18
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-ODeuH1gb.es.js → PdfViewer-CDEQktlZ.es.js} +1 -1
- package/dist/chunks/{PdfViewer-93eWvs8z.cjs → PdfViewer-CZgU5VTe.cjs} +1 -1
- package/dist/chunks/{index-RquHXtgI.cjs → index-CBFc2Hsa.cjs} +8 -4
- package/dist/chunks/{index-DexFffM7-Cbdy0Zy6.es.js → index-DpnfmQSg--uFI4inB.es.js} +1 -1
- package/dist/chunks/{index-DexFffM7-XZD_g6eY.cjs → index-DpnfmQSg-D54nF5iO.cjs} +1 -1
- package/dist/chunks/{index-DW5_UKLM.es.js → index-yYYhcBhg.es.js} +8 -4
- package/dist/chunks/{super-editor.es-Dg5uoFkw.es.js → super-editor.es-BNkRY9J-.es.js} +2518 -1261
- package/dist/chunks/{super-editor.es-BLKWkx5G.cjs → super-editor.es-BfPsU6H-.cjs} +2517 -1260
- package/dist/packages/superdoc/src/components/CommentsLayer/use-comment.d.ts.map +1 -1
- package/dist/packages/superdoc/src/stores/comments-store.d.ts.map +1 -1
- package/dist/style.css +13 -13
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-C_R_BK8X.js → converter-Cz21HA_9.js} +277 -48
- package/dist/super-editor/chunks/{docx-zipper-BvQAYmi1.js → docx-zipper-DiEfO4LE.js} +1 -1
- package/dist/super-editor/chunks/{editor-DFFvalb1.js → editor-DoxVe-iR.js} +2082 -1159
- package/dist/super-editor/chunks/{index-DexFffM7.js → index-DpnfmQSg.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-DLPfegtw.js → toolbar-CKdQr5PG.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/style.css +13 -13
- package/dist/super-editor/super-editor.es.js +250 -80
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +3 -3
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +2516 -1255
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-comment.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CommentsLayer/use-comment.js"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,2CAHW,MAAM,GACJ,MAAM,
|
|
1
|
+
{"version":3,"file":"use-comment.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CommentsLayer/use-comment.js"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,2CAHW,MAAM,GACJ,MAAM,CA0RlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comments-store.d.ts","sourceRoot":"","sources":["../../../../../src/stores/comments-store.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA2Ca,MAAM,KACJ,IAAI;qBAiBN,MAAM,KACJ,MAAM;0CAUR,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;gFA8Ld;QAAuB,SAAS,EAAxB,MAAM;QACS,UAAU;QACV,eAAe;KACtC,KAAU,MAAM;;0DAqDhB;QAAuB,QAAQ,EAAvB,MAAM;KACd,KAAU,IAAI;sCAyEJ,IAAI;;;;;6CAzFJ,IAAI;4EAsGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;+
|
|
1
|
+
{"version":3,"file":"comments-store.d.ts","sourceRoot":"","sources":["../../../../../src/stores/comments-store.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA2Ca,MAAM,KACJ,IAAI;qBAiBN,MAAM,KACJ,MAAM;0CAUR,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;gFA8Ld;QAAuB,SAAS,EAAxB,MAAM;QACS,UAAU;QACV,eAAe;KACtC,KAAU,MAAM;;0DAqDhB;QAAuB,QAAQ,EAAvB,MAAM;KACd,KAAU,IAAI;sCAyEJ,IAAI;;;;;6CAzFJ,IAAI;4EAsGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;+DA4HJ,IAAI;sDAnbd;QAAuB,QAAQ,EAAvB,MAAM;QACS,MAAM,EAArB,MAAM;KACd,KAAU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAxDN,MAAM,KACJ,IAAI;qBAiBN,MAAM,KACJ,MAAM;0CAUR,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;gFA8Ld;QAAuB,SAAS,EAAxB,MAAM;QACS,UAAU;QACV,eAAe;KACtC,KAAU,MAAM;;0DAqDhB;QAAuB,QAAQ,EAAvB,MAAM;KACd,KAAU,IAAI;sCAyEJ,IAAI;;;;;6CAzFJ,IAAI;4EAsGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;+DA4HJ,IAAI;sDAnbd;QAAuB,QAAQ,EAAvB,MAAM;QACS,MAAM,EAArB,MAAM;KACd,KAAU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAxDN,MAAM,KACJ,IAAI;qBAiBN,MAAM,KACJ,MAAM;0CAUR,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;gFA8Ld;QAAuB,SAAS,EAAxB,MAAM;QACS,UAAU;QACV,eAAe;KACtC,KAAU,MAAM;;0DAqDhB;QAAuB,QAAQ,EAAvB,MAAM;KACd,KAAU,IAAI;sCAyEJ,IAAI;;;;;6CAzFJ,IAAI;4EAsGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;+DA4HJ,IAAI;sDAnbd;QAAuB,QAAQ,EAAvB,MAAM;QACS,MAAM,EAArB,MAAM;KACd,KAAU,IAAI;wUA2jBhB"}
|
package/dist/style.css
CHANGED
|
@@ -2250,7 +2250,7 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
|
|
|
2250
2250
|
}
|
|
2251
2251
|
|
|
2252
2252
|
/* @remarks - popover adds a slight shadow, this can be removed if needed */
|
|
2253
|
-
.generic-popover[data-v-
|
|
2253
|
+
.generic-popover[data-v-157855b5] {
|
|
2254
2254
|
/* @remarks - this should ideally be handled by the content or component - but some are missing */
|
|
2255
2255
|
background-color: white;
|
|
2256
2256
|
position: absolute;
|
|
@@ -2263,18 +2263,18 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
|
|
|
2263
2263
|
min-height: 40px;
|
|
2264
2264
|
}
|
|
2265
2265
|
|
|
2266
|
-
.superdoc-table-resize-overlay[data-v-
|
|
2266
|
+
.superdoc-table-resize-overlay[data-v-2fdf7836] {
|
|
2267
2267
|
position: absolute;
|
|
2268
2268
|
pointer-events: none;
|
|
2269
2269
|
user-select: none;
|
|
2270
2270
|
}
|
|
2271
|
-
.resize-handle[data-v-
|
|
2271
|
+
.resize-handle[data-v-2fdf7836] {
|
|
2272
2272
|
position: absolute;
|
|
2273
2273
|
cursor: col-resize;
|
|
2274
2274
|
user-select: none;
|
|
2275
2275
|
z-index: 15;
|
|
2276
2276
|
}
|
|
2277
|
-
.resize-handle[data-v-
|
|
2277
|
+
.resize-handle[data-v-2fdf7836]::before {
|
|
2278
2278
|
content: '';
|
|
2279
2279
|
position: absolute;
|
|
2280
2280
|
left: 50%;
|
|
@@ -2287,17 +2287,17 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
|
|
|
2287
2287
|
background-color 0.2s ease,
|
|
2288
2288
|
width 0.2s ease;
|
|
2289
2289
|
}
|
|
2290
|
-
.resize-handle[data-v-
|
|
2290
|
+
.resize-handle[data-v-2fdf7836]:hover::before {
|
|
2291
2291
|
background-color: #4a90e2;
|
|
2292
2292
|
width: 3px;
|
|
2293
2293
|
transform: translateX(-1.5px);
|
|
2294
2294
|
}
|
|
2295
|
-
.resize-handle--active[data-v-
|
|
2295
|
+
.resize-handle--active[data-v-2fdf7836]::before {
|
|
2296
2296
|
background-color: #4a90e2;
|
|
2297
2297
|
width: 2px;
|
|
2298
2298
|
transform: translateX(-1px);
|
|
2299
2299
|
}
|
|
2300
|
-
.resize-guideline[data-v-
|
|
2300
|
+
.resize-guideline[data-v-2fdf7836] {
|
|
2301
2301
|
position: absolute;
|
|
2302
2302
|
background-color: #4a90e2;
|
|
2303
2303
|
pointer-events: none;
|
|
@@ -2343,10 +2343,10 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
|
|
|
2343
2343
|
box-shadow: 0 0 4px rgba(74, 144, 226, 0.5);
|
|
2344
2344
|
}
|
|
2345
2345
|
|
|
2346
|
-
.editor-element[data-v-
|
|
2346
|
+
.editor-element[data-v-08b32c3d] {
|
|
2347
2347
|
position: relative;
|
|
2348
2348
|
}
|
|
2349
|
-
.super-editor-container[data-v-
|
|
2349
|
+
.super-editor-container[data-v-08b32c3d] {
|
|
2350
2350
|
width: auto;
|
|
2351
2351
|
height: auto;
|
|
2352
2352
|
min-width: 8in;
|
|
@@ -2355,14 +2355,14 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
|
|
|
2355
2355
|
display: flex;
|
|
2356
2356
|
flex-direction: column;
|
|
2357
2357
|
}
|
|
2358
|
-
.ruler[data-v-
|
|
2358
|
+
.ruler[data-v-08b32c3d] {
|
|
2359
2359
|
margin-bottom: 2px;
|
|
2360
2360
|
}
|
|
2361
|
-
.super-editor[data-v-
|
|
2361
|
+
.super-editor[data-v-08b32c3d] {
|
|
2362
2362
|
color: initial;
|
|
2363
2363
|
overflow: hidden;
|
|
2364
2364
|
}
|
|
2365
|
-
.placeholder-editor[data-v-
|
|
2365
|
+
.placeholder-editor[data-v-08b32c3d] {
|
|
2366
2366
|
position: absolute;
|
|
2367
2367
|
top: 0;
|
|
2368
2368
|
left: 0;
|
|
@@ -2374,7 +2374,7 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
|
|
|
2374
2374
|
background-color: white;
|
|
2375
2375
|
box-sizing: border-box;
|
|
2376
2376
|
}
|
|
2377
|
-
.placeholder-title[data-v-
|
|
2377
|
+
.placeholder-title[data-v-08b32c3d] {
|
|
2378
2378
|
display: flex;
|
|
2379
2379
|
justify-content: center;
|
|
2380
2380
|
margin-bottom: 40px;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
|
|
2
|
-
import { T as TextSelection } from "./chunks/converter-
|
|
3
|
-
import { _ as _export_sfc } from "./chunks/editor-
|
|
2
|
+
import { T as TextSelection } from "./chunks/converter-Cz21HA_9.js";
|
|
3
|
+
import { _ as _export_sfc } from "./chunks/editor-DoxVe-iR.js";
|
|
4
4
|
const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
|
|
5
5
|
const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
|
|
6
6
|
async function baseInsightsFetch(payload, options = {}) {
|
|
@@ -19180,6 +19180,7 @@ function getUnderlineCssString({ type: type2 = "single", color = null, thickness
|
|
|
19180
19180
|
if (color) add("text-decoration-color", color);
|
|
19181
19181
|
return parts.join("; ");
|
|
19182
19182
|
}
|
|
19183
|
+
const INLINE_OVERRIDE_PROPERTIES = ["fontSize", "bold", "italic", "strike", "underline", "letterSpacing"];
|
|
19183
19184
|
const resolveRunProperties = (params, inlineRpr, resolvedPpr, isListNumber = false, numberingDefinedInline = false) => {
|
|
19184
19185
|
const paragraphStyleId = resolvedPpr?.styleId;
|
|
19185
19186
|
const paragraphStyleProps = resolveStyleChain(params, paragraphStyleId, translator$1N);
|
|
@@ -19216,6 +19217,11 @@ const resolveRunProperties = (params, inlineRpr, resolvedPpr, isListNumber = fal
|
|
|
19216
19217
|
styleChain = [...styleChain, paragraphStyleProps, runStyleProps, inlineRpr];
|
|
19217
19218
|
}
|
|
19218
19219
|
const finalProps = combineProperties(styleChain, ["fontFamily", "color"]);
|
|
19220
|
+
for (const prop of INLINE_OVERRIDE_PROPERTIES) {
|
|
19221
|
+
if (inlineRpr?.[prop] != null) {
|
|
19222
|
+
finalProps[prop] = inlineRpr[prop];
|
|
19223
|
+
}
|
|
19224
|
+
}
|
|
19219
19225
|
return finalProps;
|
|
19220
19226
|
};
|
|
19221
19227
|
function resolveParagraphProperties(params, inlineProps, insideTable = false, overrideInlineStyleId = false, tableStyleId = null) {
|
|
@@ -19773,7 +19779,7 @@ function decodeRPrFromMarks(marks) {
|
|
|
19773
19779
|
return runProperties;
|
|
19774
19780
|
}
|
|
19775
19781
|
marks.forEach((mark) => {
|
|
19776
|
-
switch (mark.type) {
|
|
19782
|
+
switch (mark.type.name ?? mark.type) {
|
|
19777
19783
|
case "strike":
|
|
19778
19784
|
case "italic":
|
|
19779
19785
|
case "bold":
|
|
@@ -20839,6 +20845,11 @@ const decode$q = (params, decodedAttrs = {}) => {
|
|
|
20839
20845
|
runs.push(trackedClone);
|
|
20840
20846
|
return;
|
|
20841
20847
|
}
|
|
20848
|
+
if (child.name === "w:commentRangeStart" || child.name === "w:commentRangeEnd") {
|
|
20849
|
+
const commentRangeClone = cloneXmlNode(child);
|
|
20850
|
+
runs.push(commentRangeClone);
|
|
20851
|
+
return;
|
|
20852
|
+
}
|
|
20842
20853
|
const runWrapper = { name: XML_NODE_NAME$i, elements: [] };
|
|
20843
20854
|
applyBaseRunProps(runWrapper);
|
|
20844
20855
|
if (!Array.isArray(runWrapper.elements)) runWrapper.elements = [];
|
|
@@ -25018,8 +25029,8 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
25018
25029
|
horizontal: positionHValue,
|
|
25019
25030
|
top: positionVValue
|
|
25020
25031
|
};
|
|
25021
|
-
const useSimplePos = attributes["simplePos"] === "1" || attributes["simplePos"] === 1;
|
|
25022
|
-
const
|
|
25032
|
+
const useSimplePos = attributes["simplePos"] === "1" || attributes["simplePos"] === 1 || attributes["simplePos"] === true;
|
|
25033
|
+
const simplePosNode = node.elements.find((el) => el.name === "wp:simplePos");
|
|
25023
25034
|
const wrapNode = isAnchor ? node.elements.find(
|
|
25024
25035
|
(el) => ["wp:wrapNone", "wp:wrapSquare", "wp:wrapThrough", "wp:wrapTight", "wp:wrapTopAndBottom"].includes(el.name)
|
|
25025
25036
|
) : null;
|
|
@@ -25159,10 +25170,10 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
25159
25170
|
anchorData,
|
|
25160
25171
|
isAnchor,
|
|
25161
25172
|
transformData,
|
|
25162
|
-
...
|
|
25173
|
+
...useSimplePos && {
|
|
25163
25174
|
simplePos: {
|
|
25164
|
-
x:
|
|
25165
|
-
y:
|
|
25175
|
+
x: simplePosNode.attributes?.x,
|
|
25176
|
+
y: simplePosNode.attributes?.y
|
|
25166
25177
|
}
|
|
25167
25178
|
},
|
|
25168
25179
|
wrap: wrap2,
|
|
@@ -27964,9 +27975,11 @@ function updateNumberingProperties(newNumberingProperties, paragraphNode, pos, e
|
|
|
27964
27975
|
const newAttrs = {
|
|
27965
27976
|
...paragraphNode.attrs,
|
|
27966
27977
|
paragraphProperties: newProperties,
|
|
27967
|
-
numberingProperties: newProperties.numberingProperties
|
|
27968
|
-
listRendering: null
|
|
27978
|
+
numberingProperties: newProperties.numberingProperties
|
|
27969
27979
|
};
|
|
27980
|
+
if (!newNumberingProperties) {
|
|
27981
|
+
newAttrs.listRendering = null;
|
|
27982
|
+
}
|
|
27970
27983
|
tr.setNodeMarkup(pos, null, newAttrs);
|
|
27971
27984
|
}
|
|
27972
27985
|
const generateNewListDefinition = ({ numId, listType, level, start, text, fmt, editor }) => {
|
|
@@ -28498,13 +28511,36 @@ const handleDocxPaste = (html, editor, view) => {
|
|
|
28498
28511
|
extractAndRemoveConditionalPrefix(item);
|
|
28499
28512
|
});
|
|
28500
28513
|
transformWordLists(tempDiv, editor);
|
|
28501
|
-
|
|
28514
|
+
let doc2 = DOMParser$1.fromSchema(editor.schema).parse(tempDiv);
|
|
28515
|
+
doc2 = wrapTextsInRuns(doc2);
|
|
28502
28516
|
tempDiv.remove();
|
|
28503
28517
|
const { dispatch } = editor.view;
|
|
28504
28518
|
if (!dispatch) return false;
|
|
28505
28519
|
dispatch(view.state.tr.replaceSelectionWith(doc2, true));
|
|
28506
28520
|
return true;
|
|
28507
28521
|
};
|
|
28522
|
+
const wrapTextsInRuns = (doc2) => {
|
|
28523
|
+
const runType = doc2.type?.schema?.nodes?.run;
|
|
28524
|
+
if (!runType) return doc2;
|
|
28525
|
+
const wrapNode = (node, parent) => {
|
|
28526
|
+
if (node.isText) {
|
|
28527
|
+
if (parent?.type?.name === "run") return node;
|
|
28528
|
+
const runProperties = decodeRPrFromMarks(node.marks);
|
|
28529
|
+
return runType.create({ runProperties }, [node]);
|
|
28530
|
+
}
|
|
28531
|
+
if (!node.childCount) return node;
|
|
28532
|
+
let changed = false;
|
|
28533
|
+
const wrappedChildren = [];
|
|
28534
|
+
node.forEach((child) => {
|
|
28535
|
+
const wrappedChild = wrapNode(child, node);
|
|
28536
|
+
if (wrappedChild !== child) changed = true;
|
|
28537
|
+
wrappedChildren.push(wrappedChild);
|
|
28538
|
+
});
|
|
28539
|
+
if (!changed) return node;
|
|
28540
|
+
return node.copy(Fragment.fromArray(wrappedChildren));
|
|
28541
|
+
};
|
|
28542
|
+
return wrapNode(doc2, null);
|
|
28543
|
+
};
|
|
28508
28544
|
const transformWordLists = (container, editor) => {
|
|
28509
28545
|
const listItems = Array.from(container.querySelectorAll("[data-num-id]"));
|
|
28510
28546
|
const lists = {};
|
|
@@ -28934,7 +28970,8 @@ const handleGoogleDocsHtml = (html, editor, view) => {
|
|
|
28934
28970
|
tempDiv.innerHTML = cleanedHtml;
|
|
28935
28971
|
const htmlWithMergedLists = mergeSeparateLists(tempDiv);
|
|
28936
28972
|
const flattenHtml = flattenListsInHtml(htmlWithMergedLists, editor);
|
|
28937
|
-
|
|
28973
|
+
let doc2 = DOMParser$1.fromSchema(editor.schema).parse(flattenHtml);
|
|
28974
|
+
doc2 = wrapTextsInRuns(doc2);
|
|
28938
28975
|
tempDiv.remove();
|
|
28939
28976
|
const { dispatch } = editor.view;
|
|
28940
28977
|
if (!dispatch) return false;
|
|
@@ -29267,7 +29304,8 @@ function isGoogleDocsHtml(html) {
|
|
|
29267
29304
|
function handleHtmlPaste(html, editor, source) {
|
|
29268
29305
|
let cleanedHtml;
|
|
29269
29306
|
cleanedHtml = htmlHandler(html, editor);
|
|
29270
|
-
|
|
29307
|
+
let doc2 = DOMParser$1.fromSchema(editor.schema).parse(cleanedHtml);
|
|
29308
|
+
doc2 = wrapTextsInRuns(doc2);
|
|
29271
29309
|
const { dispatch, state: state2 } = editor.view;
|
|
29272
29310
|
if (!dispatch) return false;
|
|
29273
29311
|
const { $from } = state2.selection;
|
|
@@ -29372,7 +29410,9 @@ function createDocFromHTML(content, editor, options = {}) {
|
|
|
29372
29410
|
} else {
|
|
29373
29411
|
parsedContent = content;
|
|
29374
29412
|
}
|
|
29375
|
-
|
|
29413
|
+
let doc2 = DOMParser$1.fromSchema(editor.schema).parse(parsedContent);
|
|
29414
|
+
doc2 = wrapTextsInRuns(doc2);
|
|
29415
|
+
return doc2;
|
|
29376
29416
|
}
|
|
29377
29417
|
function L() {
|
|
29378
29418
|
return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
|
|
@@ -30496,9 +30536,11 @@ function processContent({ content, type: type2, editor }) {
|
|
|
30496
30536
|
para.textContent = content;
|
|
30497
30537
|
wrapper.appendChild(para);
|
|
30498
30538
|
doc2 = DOMParser$1.fromSchema(editor.schema).parse(wrapper);
|
|
30539
|
+
doc2 = wrapTextsInRuns(doc2);
|
|
30499
30540
|
break;
|
|
30500
30541
|
case "schema":
|
|
30501
30542
|
doc2 = editor.schema.nodeFromJSON(content);
|
|
30543
|
+
doc2 = wrapTextsInRuns(doc2);
|
|
30502
30544
|
break;
|
|
30503
30545
|
default:
|
|
30504
30546
|
throw new Error(`Unknown content type: ${type2}`);
|
|
@@ -30889,12 +30931,13 @@ function translateShapeGroup(params) {
|
|
|
30889
30931
|
function translateAnchorNode(params) {
|
|
30890
30932
|
const { attrs } = params.node;
|
|
30891
30933
|
const anchorElements = [];
|
|
30892
|
-
|
|
30934
|
+
const hasSimplePos = attrs.simplePos || attrs.originalAttributes?.simplePos;
|
|
30935
|
+
if (hasSimplePos) {
|
|
30893
30936
|
anchorElements.push({
|
|
30894
30937
|
name: "wp:simplePos",
|
|
30895
30938
|
attributes: {
|
|
30896
|
-
x: 0,
|
|
30897
|
-
y: 0
|
|
30939
|
+
x: attrs.simplePos?.x ?? 0,
|
|
30940
|
+
y: attrs.simplePos?.y ?? 0
|
|
30898
30941
|
}
|
|
30899
30942
|
});
|
|
30900
30943
|
}
|
|
@@ -30946,8 +30989,8 @@ function translateAnchorNode(params) {
|
|
|
30946
30989
|
}
|
|
30947
30990
|
if (attrs.originalAttributes?.simplePos !== void 0) {
|
|
30948
30991
|
inlineAttrs.simplePos = attrs.originalAttributes.simplePos;
|
|
30949
|
-
} else if (
|
|
30950
|
-
inlineAttrs.simplePos =
|
|
30992
|
+
} else if (hasSimplePos) {
|
|
30993
|
+
inlineAttrs.simplePos = "1";
|
|
30951
30994
|
}
|
|
30952
30995
|
if (attrs.originalAttributes?.locked !== void 0) {
|
|
30953
30996
|
inlineAttrs.locked = attrs.originalAttributes.locked;
|
|
@@ -33712,7 +33755,7 @@ const handlePassthroughNode = (params) => {
|
|
|
33712
33755
|
const { nodes = [] } = params;
|
|
33713
33756
|
const node = nodes[0];
|
|
33714
33757
|
if (!node) return { nodes: [], consumed: 0 };
|
|
33715
|
-
if (registeredHandlers[node.name]) {
|
|
33758
|
+
if (registeredHandlers[node.name] || node.name === "w:commentReference") {
|
|
33716
33759
|
return { nodes: [], consumed: 0 };
|
|
33717
33760
|
}
|
|
33718
33761
|
const originalXml = carbonCopy(node) || {};
|
|
@@ -34012,7 +34055,11 @@ function importCommentData({ docx, editor, converter }) {
|
|
|
34012
34055
|
const generateCommentsWithExtendedData = ({ docx, comments }) => {
|
|
34013
34056
|
if (!comments?.length) return [];
|
|
34014
34057
|
const commentsExtended = docx["word/commentsExtended.xml"];
|
|
34015
|
-
if (!commentsExtended)
|
|
34058
|
+
if (!commentsExtended) {
|
|
34059
|
+
const commentRanges = extractCommentRangesFromDocument(docx);
|
|
34060
|
+
const commentsWithThreading = detectThreadingFromRanges(comments, commentRanges);
|
|
34061
|
+
return commentsWithThreading.map((comment) => ({ ...comment, isDone: comment.isDone ?? false }));
|
|
34062
|
+
}
|
|
34016
34063
|
const { elements: initialElements = [] } = commentsExtended;
|
|
34017
34064
|
if (!initialElements?.length) return comments.map((comment) => ({ ...comment, isDone: comment.isDone ?? false }));
|
|
34018
34065
|
const { elements = [] } = initialElements[0] ?? {};
|
|
@@ -34038,6 +34085,79 @@ const getExtendedDetails = (commentEx) => {
|
|
|
34038
34085
|
const paraIdParent = attributes["w15:paraIdParent"];
|
|
34039
34086
|
return { paraId, isDone, paraIdParent };
|
|
34040
34087
|
};
|
|
34088
|
+
const extractCommentRangesFromDocument = (docx) => {
|
|
34089
|
+
const documentXml = docx["word/document.xml"];
|
|
34090
|
+
if (!documentXml) {
|
|
34091
|
+
return [];
|
|
34092
|
+
}
|
|
34093
|
+
const pendingComments = [];
|
|
34094
|
+
const walkElements = (elements) => {
|
|
34095
|
+
if (!elements || !Array.isArray(elements)) return;
|
|
34096
|
+
elements.forEach((element) => {
|
|
34097
|
+
if (element.name === "w:commentRangeStart") {
|
|
34098
|
+
const commentId = element.attributes?.["w:id"];
|
|
34099
|
+
if (commentId !== void 0) {
|
|
34100
|
+
pendingComments.push({
|
|
34101
|
+
type: "start",
|
|
34102
|
+
commentId: String(commentId)
|
|
34103
|
+
});
|
|
34104
|
+
}
|
|
34105
|
+
} else if (element.name === "w:commentRangeEnd") {
|
|
34106
|
+
const commentId = element.attributes?.["w:id"];
|
|
34107
|
+
if (commentId !== void 0) {
|
|
34108
|
+
pendingComments.push({
|
|
34109
|
+
type: "end",
|
|
34110
|
+
commentId: String(commentId)
|
|
34111
|
+
});
|
|
34112
|
+
}
|
|
34113
|
+
}
|
|
34114
|
+
if (element.elements && Array.isArray(element.elements)) {
|
|
34115
|
+
walkElements(element.elements);
|
|
34116
|
+
}
|
|
34117
|
+
});
|
|
34118
|
+
};
|
|
34119
|
+
if (documentXml.elements && documentXml.elements.length > 0) {
|
|
34120
|
+
const body = documentXml.elements[0];
|
|
34121
|
+
if (body.elements) {
|
|
34122
|
+
walkElements(body.elements);
|
|
34123
|
+
}
|
|
34124
|
+
}
|
|
34125
|
+
return pendingComments;
|
|
34126
|
+
};
|
|
34127
|
+
const detectThreadingFromRanges = (comments, rangeEvents) => {
|
|
34128
|
+
if (!rangeEvents || rangeEvents.length === 0) {
|
|
34129
|
+
return comments;
|
|
34130
|
+
}
|
|
34131
|
+
const openRanges = [];
|
|
34132
|
+
const parentMap = /* @__PURE__ */ new Map();
|
|
34133
|
+
rangeEvents.forEach((event) => {
|
|
34134
|
+
if (event.type === "start") {
|
|
34135
|
+
if (openRanges.length > 0) {
|
|
34136
|
+
const parentCommentId = openRanges[openRanges.length - 1];
|
|
34137
|
+
parentMap.set(event.commentId, parentCommentId);
|
|
34138
|
+
}
|
|
34139
|
+
openRanges.push(event.commentId);
|
|
34140
|
+
} else if (event.type === "end") {
|
|
34141
|
+
const index2 = openRanges.lastIndexOf(event.commentId);
|
|
34142
|
+
if (index2 !== -1) {
|
|
34143
|
+
openRanges.splice(index2, 1);
|
|
34144
|
+
}
|
|
34145
|
+
}
|
|
34146
|
+
});
|
|
34147
|
+
return comments.map((comment) => {
|
|
34148
|
+
const parentCommentId = parentMap.get(comment.importedId);
|
|
34149
|
+
if (parentCommentId) {
|
|
34150
|
+
const parentComment = comments.find((c) => c.importedId === parentCommentId);
|
|
34151
|
+
if (parentComment) {
|
|
34152
|
+
return {
|
|
34153
|
+
...comment,
|
|
34154
|
+
parentCommentId: parentComment.commentId
|
|
34155
|
+
};
|
|
34156
|
+
}
|
|
34157
|
+
}
|
|
34158
|
+
return comment;
|
|
34159
|
+
});
|
|
34160
|
+
};
|
|
34041
34161
|
const RELATIONSHIP_TYPES = (
|
|
34042
34162
|
/** @type {const} */
|
|
34043
34163
|
{
|
|
@@ -36153,10 +36273,12 @@ const toIsoNoFractional = (unixMillis) => {
|
|
|
36153
36273
|
const updateCommentsXml = (commentDefs = [], commentsXml) => {
|
|
36154
36274
|
const newCommentsXml = carbonCopy(commentsXml);
|
|
36155
36275
|
commentDefs.forEach((commentDef) => {
|
|
36156
|
-
const
|
|
36276
|
+
const paraNode = commentDef.elements[0];
|
|
36277
|
+
if (!paraNode.attributes) paraNode.attributes = {};
|
|
36278
|
+
const elements = paraNode.elements;
|
|
36157
36279
|
elements.unshift(COMMENT_REF);
|
|
36158
36280
|
const paraId = commentDef.attributes["w15:paraId"];
|
|
36159
|
-
|
|
36281
|
+
paraNode.attributes["w14:paraId"] = paraId;
|
|
36160
36282
|
commentDef.attributes = {
|
|
36161
36283
|
"w:id": commentDef.attributes["w:id"],
|
|
36162
36284
|
"w:author": commentDef.attributes["w:author"],
|
|
@@ -36530,7 +36652,7 @@ const _SuperConverter = class _SuperConverter {
|
|
|
36530
36652
|
static getStoredSuperdocVersion(docx) {
|
|
36531
36653
|
return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
36532
36654
|
}
|
|
36533
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.
|
|
36655
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.18") {
|
|
36534
36656
|
return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
36535
36657
|
}
|
|
36536
36658
|
/**
|
|
@@ -36871,6 +36993,112 @@ const _SuperConverter = class _SuperConverter {
|
|
|
36871
36993
|
});
|
|
36872
36994
|
return { result, params };
|
|
36873
36995
|
}
|
|
36996
|
+
/**
|
|
36997
|
+
* Creates a default empty header for the specified variant.
|
|
36998
|
+
*
|
|
36999
|
+
* This method programmatically creates a new header section with an empty ProseMirror
|
|
37000
|
+
* document. The header is added to the converter's data structures and will be included
|
|
37001
|
+
* in subsequent DOCX exports.
|
|
37002
|
+
*
|
|
37003
|
+
* @param {('default' | 'first' | 'even' | 'odd')} variant - The header variant to create
|
|
37004
|
+
* @returns {string} The relationship ID of the created header
|
|
37005
|
+
*
|
|
37006
|
+
* @throws {Error} If variant is invalid or header already exists for this variant
|
|
37007
|
+
*
|
|
37008
|
+
* @example
|
|
37009
|
+
* ```javascript
|
|
37010
|
+
* const headerId = converter.createDefaultHeader('default');
|
|
37011
|
+
* // headerId: 'rId-header-default'
|
|
37012
|
+
* // converter.headers['rId-header-default'] contains empty PM doc
|
|
37013
|
+
* // converter.headerIds.default === 'rId-header-default'
|
|
37014
|
+
* ```
|
|
37015
|
+
*/
|
|
37016
|
+
createDefaultHeader(variant = "default") {
|
|
37017
|
+
if (typeof variant !== "string") {
|
|
37018
|
+
throw new TypeError(`variant must be a string, received ${typeof variant}`);
|
|
37019
|
+
}
|
|
37020
|
+
const validVariants = ["default", "first", "even", "odd"];
|
|
37021
|
+
if (!validVariants.includes(variant)) {
|
|
37022
|
+
throw new Error(`Invalid header variant: ${variant}. Must be one of: ${validVariants.join(", ")}`);
|
|
37023
|
+
}
|
|
37024
|
+
if (this.headerIds[variant]) {
|
|
37025
|
+
console.warn(`[SuperConverter] Header already exists for variant '${variant}': ${this.headerIds[variant]}`);
|
|
37026
|
+
return this.headerIds[variant];
|
|
37027
|
+
}
|
|
37028
|
+
const rId = `rId-header-${variant}`;
|
|
37029
|
+
const emptyDoc = {
|
|
37030
|
+
type: "doc",
|
|
37031
|
+
content: [
|
|
37032
|
+
{
|
|
37033
|
+
type: "paragraph",
|
|
37034
|
+
content: []
|
|
37035
|
+
}
|
|
37036
|
+
]
|
|
37037
|
+
};
|
|
37038
|
+
this.headers[rId] = emptyDoc;
|
|
37039
|
+
this.headerIds[variant] = rId;
|
|
37040
|
+
if (!this.headerIds.ids) {
|
|
37041
|
+
this.headerIds.ids = [];
|
|
37042
|
+
}
|
|
37043
|
+
if (!this.headerIds.ids.includes(rId)) {
|
|
37044
|
+
this.headerIds.ids.push(rId);
|
|
37045
|
+
}
|
|
37046
|
+
this.documentModified = true;
|
|
37047
|
+
return rId;
|
|
37048
|
+
}
|
|
37049
|
+
/**
|
|
37050
|
+
* Creates a default empty footer for the specified variant.
|
|
37051
|
+
*
|
|
37052
|
+
* This method programmatically creates a new footer section with an empty ProseMirror
|
|
37053
|
+
* document. The footer is added to the converter's data structures and will be included
|
|
37054
|
+
* in subsequent DOCX exports.
|
|
37055
|
+
*
|
|
37056
|
+
* @param {('default' | 'first' | 'even' | 'odd')} variant - The footer variant to create
|
|
37057
|
+
* @returns {string} The relationship ID of the created footer
|
|
37058
|
+
*
|
|
37059
|
+
* @throws {Error} If variant is invalid or footer already exists for this variant
|
|
37060
|
+
*
|
|
37061
|
+
* @example
|
|
37062
|
+
* ```javascript
|
|
37063
|
+
* const footerId = converter.createDefaultFooter('default');
|
|
37064
|
+
* // footerId: 'rId-footer-default'
|
|
37065
|
+
* // converter.footers['rId-footer-default'] contains empty PM doc
|
|
37066
|
+
* // converter.footerIds.default === 'rId-footer-default'
|
|
37067
|
+
* ```
|
|
37068
|
+
*/
|
|
37069
|
+
createDefaultFooter(variant = "default") {
|
|
37070
|
+
if (typeof variant !== "string") {
|
|
37071
|
+
throw new TypeError(`variant must be a string, received ${typeof variant}`);
|
|
37072
|
+
}
|
|
37073
|
+
const validVariants = ["default", "first", "even", "odd"];
|
|
37074
|
+
if (!validVariants.includes(variant)) {
|
|
37075
|
+
throw new Error(`Invalid footer variant: ${variant}. Must be one of: ${validVariants.join(", ")}`);
|
|
37076
|
+
}
|
|
37077
|
+
if (this.footerIds[variant]) {
|
|
37078
|
+
console.warn(`[SuperConverter] Footer already exists for variant '${variant}': ${this.footerIds[variant]}`);
|
|
37079
|
+
return this.footerIds[variant];
|
|
37080
|
+
}
|
|
37081
|
+
const rId = `rId-footer-${variant}`;
|
|
37082
|
+
const emptyDoc = {
|
|
37083
|
+
type: "doc",
|
|
37084
|
+
content: [
|
|
37085
|
+
{
|
|
37086
|
+
type: "paragraph",
|
|
37087
|
+
content: []
|
|
37088
|
+
}
|
|
37089
|
+
]
|
|
37090
|
+
};
|
|
37091
|
+
this.footers[rId] = emptyDoc;
|
|
37092
|
+
this.footerIds[variant] = rId;
|
|
37093
|
+
if (!this.footerIds.ids) {
|
|
37094
|
+
this.footerIds.ids = [];
|
|
37095
|
+
}
|
|
37096
|
+
if (!this.footerIds.ids.includes(rId)) {
|
|
37097
|
+
this.footerIds.ids.push(rId);
|
|
37098
|
+
}
|
|
37099
|
+
this.documentModified = true;
|
|
37100
|
+
return rId;
|
|
37101
|
+
}
|
|
36874
37102
|
// Deprecated methods for backward compatibility
|
|
36875
37103
|
static getStoredSuperdocId(docx) {
|
|
36876
37104
|
console.warn("getStoredSuperdocId is deprecated, use getDocumentGuid instead");
|
|
@@ -37154,22 +37382,23 @@ export {
|
|
|
37154
37382
|
twipsToLines as a7,
|
|
37155
37383
|
pixelsToTwips as a8,
|
|
37156
37384
|
helpers as a9,
|
|
37157
|
-
|
|
37158
|
-
|
|
37159
|
-
|
|
37160
|
-
|
|
37161
|
-
|
|
37162
|
-
|
|
37163
|
-
|
|
37164
|
-
|
|
37165
|
-
|
|
37166
|
-
|
|
37167
|
-
|
|
37168
|
-
|
|
37169
|
-
|
|
37170
|
-
|
|
37171
|
-
|
|
37172
|
-
|
|
37385
|
+
SelectionRange as aA,
|
|
37386
|
+
Transform as aB,
|
|
37387
|
+
findParentNodeClosestToPos as aC,
|
|
37388
|
+
isInTable as aD,
|
|
37389
|
+
generateDocxRandomId as aE,
|
|
37390
|
+
insertNewRelationship as aF,
|
|
37391
|
+
inchesToPixels as aG,
|
|
37392
|
+
kebabCase as aH,
|
|
37393
|
+
getUnderlineCssString as aI,
|
|
37394
|
+
commonjsGlobal as aJ,
|
|
37395
|
+
getDefaultExportFromCjs$2 as aK,
|
|
37396
|
+
getContentTypesFromXml as aL,
|
|
37397
|
+
xmljs as aM,
|
|
37398
|
+
vClickOutside as aN,
|
|
37399
|
+
getActiveFormatting as aO,
|
|
37400
|
+
getFileObject as aP,
|
|
37401
|
+
registeredHandlers as aQ,
|
|
37173
37402
|
posToDOMRect as aa,
|
|
37174
37403
|
CommandService as ab,
|
|
37175
37404
|
SuperConverter as ac,
|
|
@@ -37186,16 +37415,16 @@ export {
|
|
|
37186
37415
|
updateDOMAttributes as an,
|
|
37187
37416
|
findChildren as ao,
|
|
37188
37417
|
generateRandomSigned32BitIntStrId as ap,
|
|
37189
|
-
|
|
37190
|
-
|
|
37191
|
-
|
|
37192
|
-
|
|
37193
|
-
|
|
37194
|
-
|
|
37195
|
-
|
|
37196
|
-
|
|
37197
|
-
|
|
37198
|
-
|
|
37418
|
+
decodeRPrFromMarks as aq,
|
|
37419
|
+
calculateResolvedParagraphProperties as ar,
|
|
37420
|
+
encodeCSSFromPPr as as,
|
|
37421
|
+
twipsToPixels as at,
|
|
37422
|
+
resolveRunProperties as au,
|
|
37423
|
+
encodeCSSFromRPr as av,
|
|
37424
|
+
generateOrderedListIndex as aw,
|
|
37425
|
+
docxNumberingHelpers as ax,
|
|
37426
|
+
InputRule as ay,
|
|
37427
|
+
convertSizeToCSS as az,
|
|
37199
37428
|
Slice as b,
|
|
37200
37429
|
DOMParser$1 as c,
|
|
37201
37430
|
Mark as d,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as process$1,
|
|
1
|
+
import { p as process$1, aJ as commonjsGlobal, B as Buffer, aK as getDefaultExportFromCjs, aL as getContentTypesFromXml, aM as xmljs } from "./converter-Cz21HA_9.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
|
}
|