ooxml-core 1.24.0 → 1.24.2
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/README.md +2 -2
- package/dist/{PptxHandler-FSKKPZZC.mjs → PptxHandler-5TWAQWPK.mjs} +2 -2
- package/dist/{PptxHandler-H7MEWJJJ.mjs → PptxHandler-KBJ4TN3T.mjs} +1 -1
- package/dist/{PptxHandler-DNSXWTQV.cjs → PptxHandler-KFEE7O7W.cjs} +2 -2
- package/dist/{PresentationBuilder-7TSENZTX.mjs → PresentationBuilder-SCT5AQBP.mjs} +1 -1
- package/dist/{PresentationBuilder-RIJWQSEU.mjs → PresentationBuilder-SVHIKT4C.mjs} +2 -2
- package/dist/{PresentationBuilder-A5NI35VN.cjs → PresentationBuilder-SXLRXYDI.cjs} +4 -4
- package/dist/automation/index.cjs +24 -1
- package/dist/automation/index.mjs +24 -1
- package/dist/{chunk-4QPOJCJG.mjs → chunk-7N7C5BNM.mjs} +1 -1
- package/dist/{chunk-DLFMCZZT.mjs → chunk-CWCDFPKN.mjs} +1 -1
- package/dist/{chunk-LF5E5ZOH.mjs → chunk-GVP262WE.mjs} +25 -62
- package/dist/{chunk-VQF6HQEE.mjs → chunk-KVKTHGIY.mjs} +1 -1
- package/dist/{chunk-BA7Z6ATM.mjs → chunk-NE7626A4.mjs} +4 -4
- package/dist/{chunk-Q5PKBQXH.mjs → chunk-ON7XVRHQ.mjs} +26 -63
- package/dist/{chunk-HL3FBJ6X.cjs → chunk-XK55DEUD.cjs} +25 -62
- package/dist/docx/embedded.cjs +24 -1
- package/dist/docx/embedded.mjs +24 -1
- package/dist/docx/index.cjs +24 -1
- package/dist/docx/index.mjs +24 -1
- package/dist/docx/load/index.cjs +24 -1
- package/dist/docx/load/index.mjs +24 -1
- package/dist/docx/ui/content-control-commands.d.ts +1 -1
- package/dist/docx/ui/content-control-commands.d.ts.map +1 -1
- package/dist/docx/ui/content-control-guard.d.ts.map +1 -1
- package/dist/docx/ui/content-control-occurrences.d.ts +17 -0
- package/dist/docx/ui/content-control-occurrences.d.ts.map +1 -0
- package/dist/docx/ui/content-control-temporary.d.ts +1 -4
- package/dist/docx/ui/content-control-temporary.d.ts.map +1 -1
- package/dist/docx/ui/form-field-guard.d.ts +10 -4
- package/dist/docx/ui/form-field-guard.d.ts.map +1 -1
- package/dist/docx/ui/form-protection-sections.d.ts +26 -0
- package/dist/docx/ui/form-protection-sections.d.ts.map +1 -0
- package/dist/docx/ui/form-text-paste.d.ts +35 -0
- package/dist/docx/ui/form-text-paste.d.ts.map +1 -0
- package/dist/docx/ui/index.cjs +266 -108
- package/dist/docx/ui/index.mjs +266 -108
- package/dist/docx/write-table-controls.d.ts +2 -1
- package/dist/docx/write-table-controls.d.ts.map +1 -1
- package/dist/pptx/automation/index.cjs +25 -67
- package/dist/pptx/automation/index.d.ts +3 -2
- package/dist/pptx/automation/index.d.ts.map +1 -1
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-Q5mM8kIR.d.ts → index-4FmgJajb.d.ts} +3 -2
- package/dist/pptx/chunks/index-4FmgJajb.d.ts.map +1 -0
- package/dist/pptx/chunks/index-C3xhAMSa.d.ts +837 -0
- package/dist/pptx/chunks/index-C3xhAMSa.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CPhsd7Df.d.ts → index-nKQ4s7FA.d.ts} +24 -834
- package/dist/pptx/chunks/index-nKQ4s7FA.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +25 -67
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.d.ts +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +1 -1
- package/dist/pptx/editor/render/slide-operations.mjs +1 -1
- package/dist/pptx/index.cjs +25 -67
- package/dist/pptx/index.d.ts +4 -3
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.cjs +40 -0
- package/dist/pptx/node/index.d.ts +13 -0
- package/dist/pptx/node/index.d.ts.map +1 -0
- package/dist/pptx/node/index.mjs +40 -0
- package/package.json +6 -1
- package/dist/pptx/chunks/index-CPhsd7Df.d.ts.map +0 -1
- package/dist/pptx/chunks/index-Q5mM8kIR.d.ts.map +0 -1
|
@@ -48148,52 +48148,6 @@ async function buildDeckMasterRoundTripsFromPptx(pptxBytes) {
|
|
|
48148
48148
|
};
|
|
48149
48149
|
}
|
|
48150
48150
|
|
|
48151
|
-
// pptx/core/ppt/writer/svg-rasterize-node.ts
|
|
48152
|
-
var NODE_CANVAS_SPECIFIER = ["@napi-rs", "canvas"].join("/");
|
|
48153
|
-
var nodeCanvas;
|
|
48154
|
-
function isNodeCanvasModule(value) {
|
|
48155
|
-
const candidate = value;
|
|
48156
|
-
return typeof candidate?.createCanvas === "function" && typeof candidate.loadImage === "function";
|
|
48157
|
-
}
|
|
48158
|
-
function loadNodeCanvas() {
|
|
48159
|
-
nodeCanvas ??= (async () => {
|
|
48160
|
-
const runtime = globalThis.process;
|
|
48161
|
-
if (!runtime?.versions?.node) {
|
|
48162
|
-
return void 0;
|
|
48163
|
-
}
|
|
48164
|
-
try {
|
|
48165
|
-
const imported = await import(
|
|
48166
|
-
/* webpackIgnore: true */
|
|
48167
|
-
/* @vite-ignore */
|
|
48168
|
-
NODE_CANVAS_SPECIFIER
|
|
48169
|
-
);
|
|
48170
|
-
const withDefault = imported;
|
|
48171
|
-
if (isNodeCanvasModule(imported)) {
|
|
48172
|
-
return imported;
|
|
48173
|
-
}
|
|
48174
|
-
return isNodeCanvasModule(withDefault.default) ? withDefault.default : void 0;
|
|
48175
|
-
} catch {
|
|
48176
|
-
return void 0;
|
|
48177
|
-
}
|
|
48178
|
-
})();
|
|
48179
|
-
return nodeCanvas;
|
|
48180
|
-
}
|
|
48181
|
-
async function rasterizeSvgInNode(svg, sizeFor) {
|
|
48182
|
-
const canvasModule = await loadNodeCanvas();
|
|
48183
|
-
if (!canvasModule) {
|
|
48184
|
-
return void 0;
|
|
48185
|
-
}
|
|
48186
|
-
try {
|
|
48187
|
-
const image = await canvasModule.loadImage(svg);
|
|
48188
|
-
const { width, height } = sizeFor(image.width, image.height);
|
|
48189
|
-
const canvas = canvasModule.createCanvas(width, height);
|
|
48190
|
-
canvas.getContext("2d").drawImage(image, 0, 0, width, height);
|
|
48191
|
-
return new Uint8Array(canvas.toBuffer("image/png"));
|
|
48192
|
-
} catch {
|
|
48193
|
-
return void 0;
|
|
48194
|
-
}
|
|
48195
|
-
}
|
|
48196
|
-
|
|
48197
48151
|
// pptx/core/ppt/writer/svg-rasterize.ts
|
|
48198
48152
|
var MAX_EDGE_PX = 2048;
|
|
48199
48153
|
function hasDomRasteriser() {
|
|
@@ -48242,11 +48196,18 @@ async function rasterizeSvgInDom(svg, fallbackW, fallbackH) {
|
|
|
48242
48196
|
URL.revokeObjectURL(url);
|
|
48243
48197
|
}
|
|
48244
48198
|
}
|
|
48245
|
-
async function rasterizeSvg(svg, fallbackWidthPx, fallbackHeightPx) {
|
|
48246
|
-
|
|
48247
|
-
|
|
48248
|
-
(w, h) => svgRasterSize(w, h, fallbackWidthPx, fallbackHeightPx)
|
|
48249
|
-
|
|
48199
|
+
async function rasterizeSvg(svg, fallbackWidthPx, fallbackHeightPx, rasterize) {
|
|
48200
|
+
let png;
|
|
48201
|
+
if (rasterize) {
|
|
48202
|
+
const sizeFor = (w, h) => svgRasterSize(w, h, fallbackWidthPx, fallbackHeightPx);
|
|
48203
|
+
try {
|
|
48204
|
+
png = await rasterize(svg, sizeFor);
|
|
48205
|
+
} catch {
|
|
48206
|
+
png = void 0;
|
|
48207
|
+
}
|
|
48208
|
+
} else if (hasDomRasteriser()) {
|
|
48209
|
+
png = await rasterizeSvgInDom(svg, fallbackWidthPx, fallbackHeightPx);
|
|
48210
|
+
}
|
|
48250
48211
|
return png ? { extension: "png", bytes: png } : void 0;
|
|
48251
48212
|
}
|
|
48252
48213
|
|
|
@@ -48288,25 +48249,25 @@ function pathFormat(path2) {
|
|
|
48288
48249
|
const ext = /\.([^./\\]+)$/u.exec(path2)?.[1]?.toLowerCase();
|
|
48289
48250
|
return ext === "jpg" ? "jpeg" : ext === "tif" ? "tiff" : ext;
|
|
48290
48251
|
}
|
|
48291
|
-
async function toPicture(bytes, el) {
|
|
48252
|
+
async function toPicture(bytes, el, options) {
|
|
48292
48253
|
const format = sniffImageFormat(bytes);
|
|
48293
48254
|
if (format === "tiff") {
|
|
48294
48255
|
return tiffToPicture(bytes);
|
|
48295
48256
|
}
|
|
48296
48257
|
if (format === "svg") {
|
|
48297
|
-
return rasterizeSvg(bytes, el.width || 1, el.height || 1);
|
|
48258
|
+
return rasterizeSvg(bytes, el.width || 1, el.height || 1, options.rasterizeSvg);
|
|
48298
48259
|
}
|
|
48299
48260
|
return bytesToPicture(bytes);
|
|
48300
48261
|
}
|
|
48301
|
-
async function resolveOne(el, source, readPart) {
|
|
48262
|
+
async function resolveOne(el, source, readPart, options) {
|
|
48302
48263
|
const inline = decodeBase64DataUrl(source.inline);
|
|
48303
48264
|
const inlineFormat = inline ? sniffImageFormat(inline) : void 0;
|
|
48304
48265
|
const partFormat = source.partPath ? pathFormat(source.partPath) : void 0;
|
|
48305
48266
|
if (inline && (!partFormat || partFormat === inlineFormat)) {
|
|
48306
|
-
return inlineFormat === "tiff" || inlineFormat === "svg" ? toPicture(inline, el) : void 0;
|
|
48267
|
+
return inlineFormat === "tiff" || inlineFormat === "svg" ? toPicture(inline, el, options) : void 0;
|
|
48307
48268
|
}
|
|
48308
48269
|
const part = source.partPath ? await readPart(source.partPath) : void 0;
|
|
48309
|
-
const fromPart = part ? await toPicture(part, el) : void 0;
|
|
48270
|
+
const fromPart = part ? await toPicture(part, el, options) : void 0;
|
|
48310
48271
|
if (fromPart) {
|
|
48311
48272
|
return fromPart;
|
|
48312
48273
|
}
|
|
@@ -48314,14 +48275,14 @@ async function resolveOne(el, source, readPart) {
|
|
|
48314
48275
|
return void 0;
|
|
48315
48276
|
}
|
|
48316
48277
|
const fetched = await fetchBlobUrl(source.inline);
|
|
48317
|
-
const fromFetch = fetched ? await toPicture(fetched, el) : void 0;
|
|
48278
|
+
const fromFetch = fetched ? await toPicture(fetched, el, options) : void 0;
|
|
48318
48279
|
if (fromFetch || !source.svgPath) {
|
|
48319
48280
|
return fromFetch;
|
|
48320
48281
|
}
|
|
48321
48282
|
const svg = await readPart(source.svgPath);
|
|
48322
|
-
return svg ? rasterizeSvg(svg, el.width || 1, el.height || 1) : void 0;
|
|
48283
|
+
return svg ? rasterizeSvg(svg, el.width || 1, el.height || 1, options.rasterizeSvg) : void 0;
|
|
48323
48284
|
}
|
|
48324
|
-
async function resolvePictureSources(slides, readPart) {
|
|
48285
|
+
async function resolvePictureSources(slides, readPart, options = {}) {
|
|
48325
48286
|
const pending = [];
|
|
48326
48287
|
const walk = (elements2) => {
|
|
48327
48288
|
for (const el of elements2) {
|
|
@@ -48339,7 +48300,7 @@ async function resolvePictureSources(slides, readPart) {
|
|
|
48339
48300
|
const resolved = /* @__PURE__ */ new Map();
|
|
48340
48301
|
await Promise.all(
|
|
48341
48302
|
pending.map(async ([el, source]) => {
|
|
48342
|
-
const picture = await resolveOne(el, source, readPart);
|
|
48303
|
+
const picture = await resolveOne(el, source, readPart, options);
|
|
48343
48304
|
if (picture) {
|
|
48344
48305
|
resolved.set(el, picture);
|
|
48345
48306
|
}
|
|
@@ -72933,7 +72894,8 @@ var PptxHandlerRuntime52 = class extends PptxHandlerRuntime51 {
|
|
|
72933
72894
|
* Serialise `slides` to a legacy binary PowerPoint 97-2003 (`.ppt`) file.
|
|
72934
72895
|
*
|
|
72935
72896
|
* @param slides - The (possibly mutated) live slide array.
|
|
72936
|
-
* @param options -
|
|
72897
|
+
* @param options - `pptPassword` and `rasterizeSvg` (the `.ppt`-only
|
|
72898
|
+
* options), `customShows` and `slideMasters`; every OOXML-specific
|
|
72937
72899
|
* option (conformance, embedded fonts, table styles, ...) has no binary
|
|
72938
72900
|
* `.ppt` counterpart and is ignored.
|
|
72939
72901
|
* @param saveAsPptx - Serialises the same slides as a Transitional `.pptx`
|
|
@@ -72949,7 +72911,8 @@ var PptxHandlerRuntime52 = class extends PptxHandlerRuntime51 {
|
|
|
72949
72911
|
const resolvedMedia = await this.resolveAudioMediaBytes(slides);
|
|
72950
72912
|
const resolvedPictures = await resolvePictureSources(
|
|
72951
72913
|
slides,
|
|
72952
|
-
async (path2) => this.zip.file(path2)?.async("uint8array")
|
|
72914
|
+
async (path2) => this.zip.file(path2)?.async("uint8array"),
|
|
72915
|
+
{ rasterizeSvg: options?.rasterizeSvg }
|
|
72953
72916
|
);
|
|
72954
72917
|
const deck = convertDeckToWriteModel(
|
|
72955
72918
|
slides,
|
package/dist/docx/embedded.cjs
CHANGED
|
@@ -3150,7 +3150,24 @@ function controlIds(doc) {
|
|
|
3150
3150
|
}
|
|
3151
3151
|
var unusedControlId = (doc) => freshControlId(controlIds(doc));
|
|
3152
3152
|
var holdsRowsOrCells = (node) => node?.nodeType === 1 && ["tr", "tc", "sdt", "customXml"].some((name) => named2(node, name));
|
|
3153
|
+
function markersIntoContent(sdt) {
|
|
3154
|
+
const content = sdtContent(sdt);
|
|
3155
|
+
if (!content) return;
|
|
3156
|
+
const anchor = content.firstChild;
|
|
3157
|
+
let after = false;
|
|
3158
|
+
for (const child4 of Array.from(sdt.childNodes)) {
|
|
3159
|
+
if (child4 === content) {
|
|
3160
|
+
after = true;
|
|
3161
|
+
continue;
|
|
3162
|
+
}
|
|
3163
|
+
const element2 = child4;
|
|
3164
|
+
if (child4.nodeType !== 1 || named2(element2, "sdtPr") || named2(element2, "sdtEndPr")) continue;
|
|
3165
|
+
if (after) content.appendChild(child4);
|
|
3166
|
+
else content.insertBefore(child4, anchor);
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3153
3169
|
function takeOut(doc, element2, sdt) {
|
|
3170
|
+
markersIntoContent(sdt);
|
|
3154
3171
|
const content = element2.parentNode;
|
|
3155
3172
|
const parent = sdt.parentNode;
|
|
3156
3173
|
const siblings = (from, step) => {
|
|
@@ -3205,7 +3222,9 @@ function placeTableControl(doc, element2, next, base) {
|
|
|
3205
3222
|
}
|
|
3206
3223
|
const shared = isSdt(before) && sdtContent(before);
|
|
3207
3224
|
const { id } = next;
|
|
3208
|
-
|
|
3225
|
+
const joins = shared && typeof id === "string" && (createdFor.get(before) ?? idOf(before)) === id;
|
|
3226
|
+
if (joins) {
|
|
3227
|
+
markersIntoContent(before);
|
|
3209
3228
|
for (const node of [...between, element2]) shared.appendChild(node);
|
|
3210
3229
|
return;
|
|
3211
3230
|
}
|
|
@@ -3222,6 +3241,10 @@ function unwrapDroppedControls(elements2, next) {
|
|
|
3222
3241
|
if (sdt) kept.set(sdt, Boolean(kept.get(sdt)) || next[index] !== void 0);
|
|
3223
3242
|
});
|
|
3224
3243
|
for (const [sdt, keep] of kept) if (!keep) unwrapContentControl(sdt);
|
|
3244
|
+
elements2.forEach((element2, index) => {
|
|
3245
|
+
const sdt = next[index] === void 0 ? enclosingSdt(element2) : void 0;
|
|
3246
|
+
if (sdt) takeOut(element2.ownerDocument, element2, sdt);
|
|
3247
|
+
});
|
|
3225
3248
|
}
|
|
3226
3249
|
|
|
3227
3250
|
// docx/write-table.ts
|
package/dist/docx/embedded.mjs
CHANGED
|
@@ -3144,7 +3144,24 @@ function controlIds(doc) {
|
|
|
3144
3144
|
}
|
|
3145
3145
|
var unusedControlId = (doc) => freshControlId(controlIds(doc));
|
|
3146
3146
|
var holdsRowsOrCells = (node) => node?.nodeType === 1 && ["tr", "tc", "sdt", "customXml"].some((name) => named2(node, name));
|
|
3147
|
+
function markersIntoContent(sdt) {
|
|
3148
|
+
const content = sdtContent(sdt);
|
|
3149
|
+
if (!content) return;
|
|
3150
|
+
const anchor = content.firstChild;
|
|
3151
|
+
let after = false;
|
|
3152
|
+
for (const child4 of Array.from(sdt.childNodes)) {
|
|
3153
|
+
if (child4 === content) {
|
|
3154
|
+
after = true;
|
|
3155
|
+
continue;
|
|
3156
|
+
}
|
|
3157
|
+
const element2 = child4;
|
|
3158
|
+
if (child4.nodeType !== 1 || named2(element2, "sdtPr") || named2(element2, "sdtEndPr")) continue;
|
|
3159
|
+
if (after) content.appendChild(child4);
|
|
3160
|
+
else content.insertBefore(child4, anchor);
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3147
3163
|
function takeOut(doc, element2, sdt) {
|
|
3164
|
+
markersIntoContent(sdt);
|
|
3148
3165
|
const content = element2.parentNode;
|
|
3149
3166
|
const parent = sdt.parentNode;
|
|
3150
3167
|
const siblings = (from, step) => {
|
|
@@ -3199,7 +3216,9 @@ function placeTableControl(doc, element2, next, base) {
|
|
|
3199
3216
|
}
|
|
3200
3217
|
const shared = isSdt(before) && sdtContent(before);
|
|
3201
3218
|
const { id } = next;
|
|
3202
|
-
|
|
3219
|
+
const joins = shared && typeof id === "string" && (createdFor.get(before) ?? idOf(before)) === id;
|
|
3220
|
+
if (joins) {
|
|
3221
|
+
markersIntoContent(before);
|
|
3203
3222
|
for (const node of [...between, element2]) shared.appendChild(node);
|
|
3204
3223
|
return;
|
|
3205
3224
|
}
|
|
@@ -3216,6 +3235,10 @@ function unwrapDroppedControls(elements2, next) {
|
|
|
3216
3235
|
if (sdt) kept.set(sdt, Boolean(kept.get(sdt)) || next[index] !== void 0);
|
|
3217
3236
|
});
|
|
3218
3237
|
for (const [sdt, keep] of kept) if (!keep) unwrapContentControl(sdt);
|
|
3238
|
+
elements2.forEach((element2, index) => {
|
|
3239
|
+
const sdt = next[index] === void 0 ? enclosingSdt(element2) : void 0;
|
|
3240
|
+
if (sdt) takeOut(element2.ownerDocument, element2, sdt);
|
|
3241
|
+
});
|
|
3219
3242
|
}
|
|
3220
3243
|
|
|
3221
3244
|
// docx/write-table.ts
|
package/dist/docx/index.cjs
CHANGED
|
@@ -4264,7 +4264,24 @@ function controlIds(doc) {
|
|
|
4264
4264
|
}
|
|
4265
4265
|
var unusedControlId = (doc) => freshControlId(controlIds(doc));
|
|
4266
4266
|
var holdsRowsOrCells = (node) => node?.nodeType === 1 && ["tr", "tc", "sdt", "customXml"].some((name) => named2(node, name));
|
|
4267
|
+
function markersIntoContent(sdt) {
|
|
4268
|
+
const content = sdtContent(sdt);
|
|
4269
|
+
if (!content) return;
|
|
4270
|
+
const anchor = content.firstChild;
|
|
4271
|
+
let after = false;
|
|
4272
|
+
for (const child4 of Array.from(sdt.childNodes)) {
|
|
4273
|
+
if (child4 === content) {
|
|
4274
|
+
after = true;
|
|
4275
|
+
continue;
|
|
4276
|
+
}
|
|
4277
|
+
const element2 = child4;
|
|
4278
|
+
if (child4.nodeType !== 1 || named2(element2, "sdtPr") || named2(element2, "sdtEndPr")) continue;
|
|
4279
|
+
if (after) content.appendChild(child4);
|
|
4280
|
+
else content.insertBefore(child4, anchor);
|
|
4281
|
+
}
|
|
4282
|
+
}
|
|
4267
4283
|
function takeOut(doc, element2, sdt) {
|
|
4284
|
+
markersIntoContent(sdt);
|
|
4268
4285
|
const content = element2.parentNode;
|
|
4269
4286
|
const parent = sdt.parentNode;
|
|
4270
4287
|
const siblings = (from, step) => {
|
|
@@ -4319,7 +4336,9 @@ function placeTableControl(doc, element2, next, base) {
|
|
|
4319
4336
|
}
|
|
4320
4337
|
const shared = isSdt(before) && sdtContent(before);
|
|
4321
4338
|
const { id } = next;
|
|
4322
|
-
|
|
4339
|
+
const joins = shared && typeof id === "string" && (createdFor.get(before) ?? idOf(before)) === id;
|
|
4340
|
+
if (joins) {
|
|
4341
|
+
markersIntoContent(before);
|
|
4323
4342
|
for (const node of [...between, element2]) shared.appendChild(node);
|
|
4324
4343
|
return;
|
|
4325
4344
|
}
|
|
@@ -4336,6 +4355,10 @@ function unwrapDroppedControls(elements2, next) {
|
|
|
4336
4355
|
if (sdt) kept.set(sdt, Boolean(kept.get(sdt)) || next[index] !== void 0);
|
|
4337
4356
|
});
|
|
4338
4357
|
for (const [sdt, keep] of kept) if (!keep) unwrapContentControl(sdt);
|
|
4358
|
+
elements2.forEach((element2, index) => {
|
|
4359
|
+
const sdt = next[index] === void 0 ? enclosingSdt(element2) : void 0;
|
|
4360
|
+
if (sdt) takeOut(element2.ownerDocument, element2, sdt);
|
|
4361
|
+
});
|
|
4339
4362
|
}
|
|
4340
4363
|
|
|
4341
4364
|
// docx/write-table.ts
|
package/dist/docx/index.mjs
CHANGED
|
@@ -4258,7 +4258,24 @@ function controlIds(doc) {
|
|
|
4258
4258
|
}
|
|
4259
4259
|
var unusedControlId = (doc) => freshControlId(controlIds(doc));
|
|
4260
4260
|
var holdsRowsOrCells = (node) => node?.nodeType === 1 && ["tr", "tc", "sdt", "customXml"].some((name) => named2(node, name));
|
|
4261
|
+
function markersIntoContent(sdt) {
|
|
4262
|
+
const content = sdtContent(sdt);
|
|
4263
|
+
if (!content) return;
|
|
4264
|
+
const anchor = content.firstChild;
|
|
4265
|
+
let after = false;
|
|
4266
|
+
for (const child4 of Array.from(sdt.childNodes)) {
|
|
4267
|
+
if (child4 === content) {
|
|
4268
|
+
after = true;
|
|
4269
|
+
continue;
|
|
4270
|
+
}
|
|
4271
|
+
const element2 = child4;
|
|
4272
|
+
if (child4.nodeType !== 1 || named2(element2, "sdtPr") || named2(element2, "sdtEndPr")) continue;
|
|
4273
|
+
if (after) content.appendChild(child4);
|
|
4274
|
+
else content.insertBefore(child4, anchor);
|
|
4275
|
+
}
|
|
4276
|
+
}
|
|
4261
4277
|
function takeOut(doc, element2, sdt) {
|
|
4278
|
+
markersIntoContent(sdt);
|
|
4262
4279
|
const content = element2.parentNode;
|
|
4263
4280
|
const parent = sdt.parentNode;
|
|
4264
4281
|
const siblings = (from, step) => {
|
|
@@ -4313,7 +4330,9 @@ function placeTableControl(doc, element2, next, base) {
|
|
|
4313
4330
|
}
|
|
4314
4331
|
const shared = isSdt(before) && sdtContent(before);
|
|
4315
4332
|
const { id } = next;
|
|
4316
|
-
|
|
4333
|
+
const joins = shared && typeof id === "string" && (createdFor.get(before) ?? idOf(before)) === id;
|
|
4334
|
+
if (joins) {
|
|
4335
|
+
markersIntoContent(before);
|
|
4317
4336
|
for (const node of [...between, element2]) shared.appendChild(node);
|
|
4318
4337
|
return;
|
|
4319
4338
|
}
|
|
@@ -4330,6 +4349,10 @@ function unwrapDroppedControls(elements2, next) {
|
|
|
4330
4349
|
if (sdt) kept.set(sdt, Boolean(kept.get(sdt)) || next[index] !== void 0);
|
|
4331
4350
|
});
|
|
4332
4351
|
for (const [sdt, keep] of kept) if (!keep) unwrapContentControl(sdt);
|
|
4352
|
+
elements2.forEach((element2, index) => {
|
|
4353
|
+
const sdt = next[index] === void 0 ? enclosingSdt(element2) : void 0;
|
|
4354
|
+
if (sdt) takeOut(element2.ownerDocument, element2, sdt);
|
|
4355
|
+
});
|
|
4333
4356
|
}
|
|
4334
4357
|
|
|
4335
4358
|
// docx/write-table.ts
|
package/dist/docx/load/index.cjs
CHANGED
|
@@ -5613,7 +5613,24 @@ function controlIds(doc) {
|
|
|
5613
5613
|
}
|
|
5614
5614
|
var unusedControlId = (doc) => freshControlId(controlIds(doc));
|
|
5615
5615
|
var holdsRowsOrCells = (node) => node?.nodeType === 1 && ["tr", "tc", "sdt", "customXml"].some((name) => named2(node, name));
|
|
5616
|
+
function markersIntoContent(sdt) {
|
|
5617
|
+
const content = sdtContent(sdt);
|
|
5618
|
+
if (!content) return;
|
|
5619
|
+
const anchor = content.firstChild;
|
|
5620
|
+
let after = false;
|
|
5621
|
+
for (const child5 of Array.from(sdt.childNodes)) {
|
|
5622
|
+
if (child5 === content) {
|
|
5623
|
+
after = true;
|
|
5624
|
+
continue;
|
|
5625
|
+
}
|
|
5626
|
+
const element2 = child5;
|
|
5627
|
+
if (child5.nodeType !== 1 || named2(element2, "sdtPr") || named2(element2, "sdtEndPr")) continue;
|
|
5628
|
+
if (after) content.appendChild(child5);
|
|
5629
|
+
else content.insertBefore(child5, anchor);
|
|
5630
|
+
}
|
|
5631
|
+
}
|
|
5616
5632
|
function takeOut(doc, element2, sdt) {
|
|
5633
|
+
markersIntoContent(sdt);
|
|
5617
5634
|
const content = element2.parentNode;
|
|
5618
5635
|
const parent = sdt.parentNode;
|
|
5619
5636
|
const siblings = (from, step) => {
|
|
@@ -5668,7 +5685,9 @@ function placeTableControl(doc, element2, next, base) {
|
|
|
5668
5685
|
}
|
|
5669
5686
|
const shared = isSdt(before) && sdtContent(before);
|
|
5670
5687
|
const { id } = next;
|
|
5671
|
-
|
|
5688
|
+
const joins = shared && typeof id === "string" && (createdFor.get(before) ?? idOf(before)) === id;
|
|
5689
|
+
if (joins) {
|
|
5690
|
+
markersIntoContent(before);
|
|
5672
5691
|
for (const node of [...between, element2]) shared.appendChild(node);
|
|
5673
5692
|
return;
|
|
5674
5693
|
}
|
|
@@ -5685,6 +5704,10 @@ function unwrapDroppedControls(elements2, next) {
|
|
|
5685
5704
|
if (sdt) kept.set(sdt, Boolean(kept.get(sdt)) || next[index] !== void 0);
|
|
5686
5705
|
});
|
|
5687
5706
|
for (const [sdt, keep] of kept) if (!keep) unwrapContentControl(sdt);
|
|
5707
|
+
elements2.forEach((element2, index) => {
|
|
5708
|
+
const sdt = next[index] === void 0 ? enclosingSdt(element2) : void 0;
|
|
5709
|
+
if (sdt) takeOut(element2.ownerDocument, element2, sdt);
|
|
5710
|
+
});
|
|
5688
5711
|
}
|
|
5689
5712
|
|
|
5690
5713
|
// docx/write-table.ts
|
package/dist/docx/load/index.mjs
CHANGED
|
@@ -5607,7 +5607,24 @@ function controlIds(doc) {
|
|
|
5607
5607
|
}
|
|
5608
5608
|
var unusedControlId = (doc) => freshControlId(controlIds(doc));
|
|
5609
5609
|
var holdsRowsOrCells = (node) => node?.nodeType === 1 && ["tr", "tc", "sdt", "customXml"].some((name) => named2(node, name));
|
|
5610
|
+
function markersIntoContent(sdt) {
|
|
5611
|
+
const content = sdtContent(sdt);
|
|
5612
|
+
if (!content) return;
|
|
5613
|
+
const anchor = content.firstChild;
|
|
5614
|
+
let after = false;
|
|
5615
|
+
for (const child5 of Array.from(sdt.childNodes)) {
|
|
5616
|
+
if (child5 === content) {
|
|
5617
|
+
after = true;
|
|
5618
|
+
continue;
|
|
5619
|
+
}
|
|
5620
|
+
const element2 = child5;
|
|
5621
|
+
if (child5.nodeType !== 1 || named2(element2, "sdtPr") || named2(element2, "sdtEndPr")) continue;
|
|
5622
|
+
if (after) content.appendChild(child5);
|
|
5623
|
+
else content.insertBefore(child5, anchor);
|
|
5624
|
+
}
|
|
5625
|
+
}
|
|
5610
5626
|
function takeOut(doc, element2, sdt) {
|
|
5627
|
+
markersIntoContent(sdt);
|
|
5611
5628
|
const content = element2.parentNode;
|
|
5612
5629
|
const parent = sdt.parentNode;
|
|
5613
5630
|
const siblings = (from, step) => {
|
|
@@ -5662,7 +5679,9 @@ function placeTableControl(doc, element2, next, base) {
|
|
|
5662
5679
|
}
|
|
5663
5680
|
const shared = isSdt(before) && sdtContent(before);
|
|
5664
5681
|
const { id } = next;
|
|
5665
|
-
|
|
5682
|
+
const joins = shared && typeof id === "string" && (createdFor.get(before) ?? idOf(before)) === id;
|
|
5683
|
+
if (joins) {
|
|
5684
|
+
markersIntoContent(before);
|
|
5666
5685
|
for (const node of [...between, element2]) shared.appendChild(node);
|
|
5667
5686
|
return;
|
|
5668
5687
|
}
|
|
@@ -5679,6 +5698,10 @@ function unwrapDroppedControls(elements2, next) {
|
|
|
5679
5698
|
if (sdt) kept.set(sdt, Boolean(kept.get(sdt)) || next[index] !== void 0);
|
|
5680
5699
|
});
|
|
5681
5700
|
for (const [sdt, keep] of kept) if (!keep) unwrapContentControl(sdt);
|
|
5701
|
+
elements2.forEach((element2, index) => {
|
|
5702
|
+
const sdt = next[index] === void 0 ? enclosingSdt(element2) : void 0;
|
|
5703
|
+
if (sdt) takeOut(element2.ownerDocument, element2, sdt);
|
|
5704
|
+
});
|
|
5682
5705
|
}
|
|
5683
5706
|
|
|
5684
5707
|
// docx/write-table.ts
|
|
@@ -7,7 +7,7 @@ import { type ControlSpan } from './content-control-spans.js';
|
|
|
7
7
|
export declare const CONTROL_EDIT_META = "dve-content-control";
|
|
8
8
|
/**
|
|
9
9
|
* Replaces a control's content (and its state) as one edit. An inline control's text is replaced;
|
|
10
|
-
* a cell control's cell
|
|
10
|
+
* a cell control's cell holds the new text in its first paragraph (`cellContent`).
|
|
11
11
|
*/
|
|
12
12
|
export declare function replaceControlContent(state: EditorState, span: ControlSpan, edit: ControlChange): Transaction;
|
|
13
13
|
/** Stores new properties on every run or paragraph of the control. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-control-commands.d.ts","sourceRoot":"","sources":["../../../docx/ui/content-control-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,EAAa,KAAK,IAAI,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAiB,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAWN,KAAK,aAAa,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEN,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAIN,KAAK,WAAW,EAChB,MAAM,yBAAyB,CAAC;AAEjC,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"content-control-commands.d.ts","sourceRoot":"","sources":["../../../docx/ui/content-control-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,EAAa,KAAK,IAAI,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAiB,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAWN,KAAK,aAAa,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEN,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAIN,KAAK,WAAW,EAChB,MAAM,yBAAyB,CAAC;AAEjC,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAsHvD;;;GAGG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,aAAa,GACjB,WAAW,CAyBb;AAmCD,sEAAsE;AACtE,wBAAgB,uBAAuB,CACtC,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,cAAc,GACrB,WAAW,CAiBb;AAgBD,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,WAAW,EAClB,EAAE,EAAE,MAAM,EACV,EAAE,CAAC,EAAE,MAAM,GACT,WAAW,GAAG,SAAS,CAUzB;AAED,wBAAgB,cAAc,CAC7B,KAAK,EAAE,WAAW,EAClB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,EACb,EAAE,CAAC,EAAE,MAAM,GACT,WAAW,GAAG,SAAS,CAKzB;AAED,wBAAgB,UAAU,CACzB,KAAK,EAAE,WAAW,EAClB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,IAAI,EACV,EAAE,CAAC,EAAE,MAAM,GACT,WAAW,GAAG,SAAS,CAKzB;AAaD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,EAAE,SAAO,GACP,WAAW,GAAG,SAAS,GAAG,SAAS,CAiBrC;AAoCD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,CAoBjG;AAED,mGAAmG;AACnG,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,UAAU,GAAG,SAAS,GAC/B,WAAW,GAAG,SAAS,CAyBzB;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAS,eAAe,KAAG,MAC0B,CAAC;AAE/E,MAAM,WAAW,iBAAiB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,mGAAmG;AACnG,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,kBAAkB,EACxB,OAAO,GAAE,iBAAsB,GAC7B,WAAW,GAAG,SAAS,CAoCzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-control-guard.d.ts","sourceRoot":"","sources":["../../../docx/ui/content-control-guard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"content-control-guard.d.ts","sourceRoot":"","sources":["../../../docx/ui/content-control-guard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAgJ/E;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,UAAQ,GAAG,OAAO,CAgDjG;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAsD7C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Node as ProseMirrorNode } from 'prosemirror-model';
|
|
2
|
+
import type { RowControlSpan } from './content-control-rows.js';
|
|
3
|
+
import type { ControlSpan } from './content-control-spans.js';
|
|
4
|
+
export type Span = ControlSpan | RowControlSpan;
|
|
5
|
+
/** One control and its range: its spans, more than one when it holds what splits them. */
|
|
6
|
+
export interface Occurrence<S extends Span = Span> {
|
|
7
|
+
key: string;
|
|
8
|
+
spans: S[];
|
|
9
|
+
from: number;
|
|
10
|
+
to: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The occurrences of the controls `spans` hold, in document order: the spans of one level and id
|
|
14
|
+
* that go on with each other are one. `inline` is every inline span of `doc`, which can split one.
|
|
15
|
+
*/
|
|
16
|
+
export declare function controlOccurrences<S extends Span>(doc: ProseMirrorNode, spans: readonly S[], inline: readonly Span[]): Occurrence<S>[];
|
|
17
|
+
//# sourceMappingURL=content-control-occurrences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-control-occurrences.d.ts","sourceRoot":"","sources":["../../../docx/ui/content-control-occurrences.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,MAAM,IAAI,GAAG,WAAW,GAAG,cAAc,CAAC;AAEhD,0FAA0F;AAC1F,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACX;AAgCD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,IAAI,EAChD,GAAG,EAAE,eAAe,EACpB,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,MAAM,EAAE,SAAS,IAAI,EAAE,GACrB,UAAU,CAAC,CAAC,CAAC,EAAE,CAgBjB"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { EditorState, Transaction } from 'prosemirror-state';
|
|
2
|
-
import { type
|
|
3
|
-
import { type ControlSpan } from './content-control-spans.js';
|
|
4
|
-
type Span = ControlSpan | RowControlSpan;
|
|
2
|
+
import { type Span } from './content-control-occurrences.js';
|
|
5
3
|
/** Takes the control of `span` off its text, paragraphs, table, cell or row; its content stays. */
|
|
6
4
|
export declare function removeControl(tr: Transaction, span: Span): Transaction;
|
|
7
5
|
/** The transaction removing every temporary control whose content `transactions` changed. */
|
|
8
6
|
export declare function removeEditedTemporaryControls(transactions: readonly Transaction[], before: EditorState, after: EditorState): Transaction | null;
|
|
9
|
-
export {};
|
|
10
7
|
//# sourceMappingURL=content-control-temporary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-control-temporary.d.ts","sourceRoot":"","sources":["../../../docx/ui/content-control-temporary.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIlE,OAAO,
|
|
1
|
+
{"version":3,"file":"content-control-temporary.d.ts","sourceRoot":"","sources":["../../../docx/ui/content-control-temporary.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIlE,OAAO,EAAuC,KAAK,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAgB/F,mGAAmG;AACnG,wBAAgB,aAAa,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,GAAG,WAAW,CA4BtE;AAoBD,6FAA6F;AAC7F,wBAAgB,6BAA6B,CAC5C,YAAY,EAAE,SAAS,WAAW,EAAE,EACpC,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,WAAW,GAChB,WAAW,GAAG,IAAI,CAmDpB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Mark } from 'prosemirror-model';
|
|
1
2
|
import { Plugin, type Transaction } from 'prosemirror-state';
|
|
2
3
|
import type { DocumentProtection } from '../model.js';
|
|
3
4
|
/**
|
|
@@ -13,12 +14,17 @@ export declare const isFormsProtected: (protection: DocumentProtection | undefin
|
|
|
13
14
|
export declare function exceedsFormTextLength(tr: Transaction): boolean;
|
|
14
15
|
/**
|
|
15
16
|
* Whether every step of a transaction stays inside a form field, a content control or a section
|
|
16
|
-
* the protection leaves editable.
|
|
17
|
+
* the protection leaves editable. `kept` are the marks the state keeps for the text typed next at
|
|
18
|
+
* its caret, `at`.
|
|
17
19
|
*/
|
|
18
|
-
export declare function staysInFormFields(tr: Transaction
|
|
20
|
+
export declare function staysInFormFields(tr: Transaction, kept?: {
|
|
21
|
+
marks: readonly Mark[];
|
|
22
|
+
at: number;
|
|
23
|
+
} | null): boolean;
|
|
19
24
|
/**
|
|
20
|
-
* Rejects local edits that a field's maximum length or the document's protection forbids,
|
|
21
|
-
*
|
|
25
|
+
* Rejects local edits that a field's maximum length or the document's protection forbids, removes
|
|
26
|
+
* the en spaces of a blank text field that text was typed into, and pastes into a protected text
|
|
27
|
+
* field's value as text in the formatting where it lands.
|
|
22
28
|
*/
|
|
23
29
|
export declare function formFieldGuardPlugin(protection: () => DocumentProtection | undefined): Plugin;
|
|
24
30
|
//# sourceMappingURL=form-field-guard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-field-guard.d.ts","sourceRoot":"","sources":["../../../docx/ui/form-field-guard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form-field-guard.d.ts","sourceRoot":"","sources":["../../../docx/ui/form-field-guard.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAa,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAa,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AASxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAmBnD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,eAAgB,kBAAkB,GAAG,SAAS,KAAG,OAChB,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAkB9D;AAID;;;;GAIG;AACH,wBAAgB,iBAAiB,CAChC,EAAE,EAAE,WAAW,EACf,IAAI,CAAC,EAAE;IAAE,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAClD,OAAO,CAiFT;AAiCD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,kBAAkB,GAAG,SAAS,GAAG,MAAM,CAiD7F"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Node } from 'prosemirror-model';
|
|
2
|
+
import { type Step } from 'prosemirror-transform';
|
|
3
|
+
type Range = {
|
|
4
|
+
from: number;
|
|
5
|
+
to: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The sections a document protected for forms leaves editable (`w:formProt w:val="0"`), placed as
|
|
9
|
+
* Print Layout and the saved document place them: a section ends after the first block with its
|
|
10
|
+
* end id, the last section runs to the end of the document, and a section whose last block is
|
|
11
|
+
* gone is empty, its blocks falling to the next one (deleting a break merges sections).
|
|
12
|
+
*/
|
|
13
|
+
export declare function unprotectedSections(doc: Node): Range[];
|
|
14
|
+
/**
|
|
15
|
+
* Whether a step leaves the unprotected sections where they were, mapped through it: no block
|
|
16
|
+
* moves into one of them or out of one. Content written at a section's start joins it, and at its
|
|
17
|
+
* end (but for the last section) the next one, as the sections are placed.
|
|
18
|
+
*/
|
|
19
|
+
export declare function keepsSections(step: Step, before: Node, after: Node): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the step only gives a paragraph or table another id, as the editor does to the copy a
|
|
22
|
+
* split makes of a paragraph: bookkeeping, not an edit, as long as no section moves with it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function renamesBlock(step: Step, before: Node | undefined, after: Node): boolean;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=form-protection-sections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-protection-sections.d.ts","sourceRoot":"","sources":["../../../docx/ui/form-protection-sections.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAA+B,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE/E,KAAK,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,IAAI,GAAG,KAAK,EAAE,CAiCtD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,OAAO,CAQ5E;AAKD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAG,SAAS,EAAE,KAAK,EAAE,IAAI,GAAG,OAAO,CAiBvF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Mark, Slice, type Node } from 'prosemirror-model';
|
|
2
|
+
import type { Transaction } from 'prosemirror-state';
|
|
3
|
+
import type { ReplaceStep } from 'prosemirror-transform';
|
|
4
|
+
import type { EditorView } from 'prosemirror-view';
|
|
5
|
+
type Range = {
|
|
6
|
+
from: number;
|
|
7
|
+
to: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Whether `from`..`to` lies in the value of an enabled text field outside `free` (the sections the
|
|
11
|
+
* protection leaves editable), its edges included.
|
|
12
|
+
*/
|
|
13
|
+
export declare function inProtectedFormText(doc: Node, from: number, to: number, free: readonly Range[]): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Pastes `slice` as text in the formatting where it lands when the selection is in a protected
|
|
16
|
+
* text field's value, as ProseMirror pastes otherwise; false, and nothing done, elsewhere or when
|
|
17
|
+
* the clipboard held nothing the editor reads.
|
|
18
|
+
*/
|
|
19
|
+
export declare function pasteIntoFormText(view: EditorView, slice: Slice, free: readonly Range[]): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether `step` writes text with formatting that neither the text it replaces nor the text beside
|
|
22
|
+
* it has, nor `stored` (the marks a deletion kept for the text typed next at the caret, given only
|
|
23
|
+
* for a step there): as text dropped into the value with formatting of its own does. Typed text
|
|
24
|
+
* takes the formatting where it lands.
|
|
25
|
+
*/
|
|
26
|
+
export declare function writesFormatting(step: ReplaceStep, doc: Node, stored: readonly Mark[] | null): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Whether `tr`, changing nothing else, sets formatting for the text typed next (stored marks other
|
|
29
|
+
* than those at the caret) while the caret is in a protected text field's value, as Bold with no
|
|
30
|
+
* selection does. A deletion that keeps the marks of what it deleted for the text typed next is no
|
|
31
|
+
* such change.
|
|
32
|
+
*/
|
|
33
|
+
export declare function storesFormatting(tr: Transaction, free: () => readonly Range[]): boolean;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=form-text-paste.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-text-paste.d.ts","sourceRoot":"","sources":["../../../docx/ui/form-text-paste.ts"],"names":[],"mappings":"AAGA,OAAO,EAAY,IAAI,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,KAAK,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C;;;GAGG;AACH,wBAAgB,mBAAmB,CAClC,GAAG,EAAE,IAAI,EACT,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,KAAK,EAAE,GACpB,OAAO,CAQT;AAwBD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,KAAK,EAAE,GAAG,OAAO,CAiBjG;AAMD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,SAAS,IAAI,EAAE,GAAG,IAAI,GAC5B,OAAO,CAcT;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,SAAS,KAAK,EAAE,GAAG,OAAO,CAKvF"}
|