@stll/docx-core 0.45.0 → 0.46.0
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/{archive-yBR7X-Qc.js → archive-D5kFLipm.js} +1 -1
- package/dist/docx_kernel_bg.wasm +0 -0
- package/dist/{format-DXPXB02u.js → format-DKTCMfac.js} +36 -10
- package/dist/index.js +4 -141
- package/dist/ops/documentOps.d.ts +29 -2
- package/dist/ops/documentOps.js +214 -93
- package/dist/schemaAttributes-e8whSQjO.js +142 -0
- package/dist/zip/archive.js +2 -2
- package/dist/zip/stream.js +1 -1
- package/package.json +1 -1
|
@@ -1522,7 +1522,11 @@ export declare class DocumentOpRefusal extends DocumentOpRefusalBase<{
|
|
|
1522
1522
|
message: string;
|
|
1523
1523
|
reason: DocumentOpRefusalReason;
|
|
1524
1524
|
opType: DocumentOpType | undefined;
|
|
1525
|
-
/**
|
|
1525
|
+
/**
|
|
1526
|
+
* Paragraph-mark revision whose resolution the document blocks: it would
|
|
1527
|
+
* move text across a standing range boundary, or leave its container
|
|
1528
|
+
* without a final paragraph.
|
|
1529
|
+
*/
|
|
1526
1530
|
blockedParagraphMarkRevisionId?: number;
|
|
1527
1531
|
}> {}
|
|
1528
1532
|
/**
|
|
@@ -2018,13 +2022,18 @@ export declare const captureDocumentOp: (op: DocumentOp) => DocumentOp;
|
|
|
2018
2022
|
* one suggestion. A reply is removed with the comment it answers.
|
|
2019
2023
|
*/
|
|
2020
2024
|
export declare const suggestedCommentIds: (document: Document, suggestionId?: string) => number[];
|
|
2025
|
+
type PendingSuggestionProjectionOptions = {
|
|
2026
|
+
/** Host receipts also identify comments belonging to a pending proposal. */
|
|
2027
|
+
commentIds?: ReadonlySet<number>;
|
|
2028
|
+
onAbsorptions?: (story: OpStory, absorptions: readonly ParagraphAbsorption[]) => void;
|
|
2029
|
+
};
|
|
2021
2030
|
/**
|
|
2022
2031
|
* The document as a save writes it: every pending suggestion rejected. A
|
|
2023
2032
|
* suggestion is a proposal the host holds, not a change in the file, so the
|
|
2024
2033
|
* file reads as if it had never been made; ordinary tracked changes stay. A
|
|
2025
2034
|
* comment a suggestion proposes is left out with it.
|
|
2026
2035
|
*/
|
|
2027
|
-
export declare const withoutPendingSuggestions: (document: Document) => Result<Document, DocumentOpRefusal>;
|
|
2036
|
+
export declare const withoutPendingSuggestions: (document: Document, { commentIds, onAbsorptions }?: PendingSuggestionProjectionOptions) => Result<Document, DocumentOpRefusal>;
|
|
2028
2037
|
/**
|
|
2029
2038
|
* The revisions of one pending suggestion in a story, one info per revision
|
|
2030
2039
|
* id, in document order.
|
|
@@ -2752,6 +2761,24 @@ type SequencedOpEffect = {
|
|
|
2752
2761
|
to: Gap;
|
|
2753
2762
|
keptMark?: Gap;
|
|
2754
2763
|
}[];
|
|
2764
|
+
} | {
|
|
2765
|
+
type: "insertBlocks";
|
|
2766
|
+
/**
|
|
2767
|
+
* For an insertion before or after a paragraph: the revisions of the
|
|
2768
|
+
* marks of that paragraph and of the paragraph before it in reading
|
|
2769
|
+
* order (the mark itself, a deletion it holds, and the mark it took
|
|
2770
|
+
* over), and of the table rows and cells holding it. Resolving one
|
|
2771
|
+
* joins or removes a paragraph beside the insertion, or the row or
|
|
2772
|
+
* cell around it, which comes out differently with and without the
|
|
2773
|
+
* inserted paragraphs; a concurrent decision naming none passes a
|
|
2774
|
+
* direct insertion.
|
|
2775
|
+
*
|
|
2776
|
+
* Compatibility: a journal sequenced before this effect recorded
|
|
2777
|
+
* {@link NO_SEQUENCED_EFFECT} for such an insertion, which still reads
|
|
2778
|
+
* and replays; a decision rebased over one is refused, since it names
|
|
2779
|
+
* no bordering revisions.
|
|
2780
|
+
*/
|
|
2781
|
+
borderingRevisionIds: readonly number[];
|
|
2755
2782
|
} | {
|
|
2756
2783
|
type: "touchedBlocks";
|
|
2757
2784
|
/** Paragraphs the operation changed, inserted or removed. */
|
package/dist/ops/documentOps.js
CHANGED
|
@@ -7253,18 +7253,44 @@ const coveredCommentIds = (document) => {
|
|
|
7253
7253
|
}
|
|
7254
7254
|
return covered;
|
|
7255
7255
|
};
|
|
7256
|
+
/** Read coverage once per anchor kind for the requested roots in a document. */
|
|
7257
|
+
const commentExhaustionIn = (document) => {
|
|
7258
|
+
let covered;
|
|
7259
|
+
let anchored;
|
|
7260
|
+
return ({ anchorKind, id, parentId }) => {
|
|
7261
|
+
if (parentId !== void 0) return false;
|
|
7262
|
+
switch (anchorKind) {
|
|
7263
|
+
case "range":
|
|
7264
|
+
covered ??= coveredCommentIds(document);
|
|
7265
|
+
return !covered.has(id);
|
|
7266
|
+
case "point":
|
|
7267
|
+
anchored ??= sourceCommentAnchorIds(document);
|
|
7268
|
+
return !anchored.has(id);
|
|
7269
|
+
default: return false;
|
|
7270
|
+
}
|
|
7271
|
+
};
|
|
7272
|
+
};
|
|
7256
7273
|
/** Whether a known range lost its content or a known point lost its anchor. */
|
|
7257
7274
|
const isCommentExhausted = (input) => {
|
|
7258
7275
|
if (input.type === "coverage") return input.anchorKind === "range" && !input.survivingNonCarrierContent;
|
|
7259
7276
|
const { document, id } = input;
|
|
7260
7277
|
const comment = document.package.document.comments?.find((entry) => entry.id === id);
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7278
|
+
return comment !== void 0 && commentExhaustionIn(document)(comment);
|
|
7279
|
+
};
|
|
7280
|
+
/** Root comment threads that still had coverage before an edit consumed it. */
|
|
7281
|
+
const newlyExhaustedCommentIds = (before, after) => {
|
|
7282
|
+
const previous = before.package.document.comments ?? [];
|
|
7283
|
+
if (previous.length === 0) return [];
|
|
7284
|
+
const current = new Map((after.package.document.comments ?? []).map((comment) => [comment.id, comment]));
|
|
7285
|
+
const wasExhausted = commentExhaustionIn(before);
|
|
7286
|
+
const isExhausted = commentExhaustionIn(after);
|
|
7287
|
+
const exhausted = [];
|
|
7288
|
+
for (const source of previous) {
|
|
7289
|
+
if (source.parentId !== void 0) continue;
|
|
7290
|
+
const target = current.get(source.id);
|
|
7291
|
+
if (target !== void 0 && isExhausted(target) && !wasExhausted(source)) exhausted.push(source.id);
|
|
7292
|
+
}
|
|
7293
|
+
return exhausted;
|
|
7268
7294
|
};
|
|
7269
7295
|
/**
|
|
7270
7296
|
* Hyperlinks that held nothing but markers of the threads a retirement
|
|
@@ -9230,15 +9256,7 @@ const paragraphMarkOutcome = ({ follows, holdsContent, markWasAdded, containerSt
|
|
|
9230
9256
|
* that still covered something `before` it.
|
|
9231
9257
|
*/
|
|
9232
9258
|
const withExhaustedCommentsRetired = ({ before, edit, applyOps }) => {
|
|
9233
|
-
const exhaustedCommentIds = (before.
|
|
9234
|
-
type: "document",
|
|
9235
|
-
document: before,
|
|
9236
|
-
id
|
|
9237
|
-
}) && isCommentExhausted({
|
|
9238
|
-
type: "document",
|
|
9239
|
-
document: edit.document,
|
|
9240
|
-
id
|
|
9241
|
-
}) ? [id] : []);
|
|
9259
|
+
const exhaustedCommentIds = newlyExhaustedCommentIds(before, edit.document);
|
|
9242
9260
|
if (exhaustedCommentIds.length === 0) return Result.ok({
|
|
9243
9261
|
edit,
|
|
9244
9262
|
modified: []
|
|
@@ -9303,6 +9321,19 @@ const breakRetiredBefore = (list, index) => {
|
|
|
9303
9321
|
return candidate !== index - 1 && list[candidate]?.type === "paragraph" ? candidate : index - 1;
|
|
9304
9322
|
};
|
|
9305
9323
|
/**
|
|
9324
|
+
* A table pending deletion still blocks a tracked paragraph join, but it
|
|
9325
|
+
* does not supply properties to the closing paragraph. Look past such
|
|
9326
|
+
* tables for the paragraph that supplies them in the accepted document.
|
|
9327
|
+
*/
|
|
9328
|
+
const terminalPropertySource = (list, index) => {
|
|
9329
|
+
let candidate = index;
|
|
9330
|
+
for (;;) {
|
|
9331
|
+
const block = list[candidate];
|
|
9332
|
+
if (block?.type !== "table" || block.rows.length === 0 || !block.rows.every((row) => row.structuralChange?.type === "tableRowDeletion")) return candidate;
|
|
9333
|
+
candidate = breakRetiredBefore(list, candidate);
|
|
9334
|
+
}
|
|
9335
|
+
};
|
|
9336
|
+
/**
|
|
9306
9337
|
* Whether accepting leaves nothing of `blocks`, a container's last blocks:
|
|
9307
9338
|
* paragraphs that keep no content once accepted, each before the last with
|
|
9308
9339
|
* its break pending deletion, and no section break among them.
|
|
@@ -9467,13 +9498,17 @@ const deleteBlocks = ({ document, op, applyOps }) => {
|
|
|
9467
9498
|
}]);
|
|
9468
9499
|
if (rejected.isErr()) return refuse(rejected.error.reason, rejected.error.message);
|
|
9469
9500
|
const { document: retracted, inverse, touched } = rejected.value;
|
|
9470
|
-
if ((broken.propertyChanges?.length ?? 0) === 0) return Result.ok({
|
|
9471
|
-
document: retracted,
|
|
9472
|
-
inverse,
|
|
9473
|
-
touched
|
|
9474
|
-
});
|
|
9475
9501
|
const survivor = storyParagraphs(storyBody$1(retracted, op.story)).find(({ paragraph }) => idKey(paragraph.paraId ?? "") === idKey(broken.paraId ?? ""))?.paragraph ?? panic("A taken-back insertion lost the paragraph it broke.");
|
|
9476
9502
|
const { pPrMark: _addedMark, ...restyle } = reviewFieldsOf(broken);
|
|
9503
|
+
if (!broken.propertyChanges?.length) {
|
|
9504
|
+
const recorded = last.paragraph.propertyChanges?.[0];
|
|
9505
|
+
if (!recorded || sameParagraphProperties(survivor.formatting, broken.formatting)) return Result.ok({
|
|
9506
|
+
document: retracted,
|
|
9507
|
+
inverse,
|
|
9508
|
+
touched
|
|
9509
|
+
});
|
|
9510
|
+
restyle.propertyChanges = [paragraphPropertyChange$1(recorded.info, survivor, restyle.formatting)];
|
|
9511
|
+
}
|
|
9477
9512
|
const kept = applyOps(retracted, [{
|
|
9478
9513
|
type: DOCUMENT_OP_TYPES.SET_PARAGRAPH_REVIEW,
|
|
9479
9514
|
story: op.story,
|
|
@@ -9566,8 +9601,10 @@ const deleteBlocks = ({ document, op, applyOps }) => {
|
|
|
9566
9601
|
...sectionBoundaries
|
|
9567
9602
|
};
|
|
9568
9603
|
const finalReview = reviewFieldsOf(last.paragraph);
|
|
9569
|
-
|
|
9570
|
-
|
|
9604
|
+
const formattingSourceIndex = terminal && op.revision !== void 0 ? terminalPropertySource(list, previousIndex) : previousIndex;
|
|
9605
|
+
const formattingSource = list[formattingSourceIndex];
|
|
9606
|
+
if (terminal && formattingSource?.type === "paragraph" && givesProperties(list, formattingSourceIndex)) {
|
|
9607
|
+
const formatting = withMarkFormatting(paragraphPropertiesOf(formattingSource.formatting), last.paragraph.formatting);
|
|
9571
9608
|
delete finalReview.formatting;
|
|
9572
9609
|
if (formatting !== void 0) finalReview.formatting = formatting;
|
|
9573
9610
|
}
|
|
@@ -17584,7 +17621,11 @@ const resolveList = ({ nodes: listed, resolution, path }) => {
|
|
|
17584
17621
|
});
|
|
17585
17622
|
} else {
|
|
17586
17623
|
const around = floating.has(out.length) ? enclosingRecordCut(node, index) : void 0;
|
|
17587
|
-
const
|
|
17624
|
+
const after = pending.at(index + 1);
|
|
17625
|
+
const before = itemBefore(out, keptStart)?.node;
|
|
17626
|
+
const crossesKeptCut = before !== void 0 && standsInKeptCut(before) || after !== void 0 && standsInKeptCut(after);
|
|
17627
|
+
const carriedJoin = (path.length > 0 && before === void 0 !== (after === void 0) || crossesKeptCut) && joins !== void 0 && joins.remove === 0 && kept.length === 0 && resolution.decision === REVISION_DECISIONS.REJECT && isAddedRevision(node) ? Math.min(recordJoin(joins, "before"), recordJoin(joins, "after")) : 0;
|
|
17628
|
+
const removalCut = Math.max(cutLevelsOnceResolved(node, index), carriedJoin, around?.side === void 0 ? around?.depth ?? 0 : 0);
|
|
17588
17629
|
if (around?.side !== void 0) folds.push(out.length);
|
|
17589
17630
|
recordSourceSeam(out.length, removalCut);
|
|
17590
17631
|
if (removalCut > 0) removalSeams.add(out.length);
|
|
@@ -17595,7 +17636,8 @@ const resolveList = ({ nodes: listed, resolution, path }) => {
|
|
|
17595
17636
|
if (known === void 0 || made < known) removalDates.set(out.length, made);
|
|
17596
17637
|
if (joins !== void 0) removalJoins.set(out.length, {
|
|
17597
17638
|
before: recordJoin(joins, "before"),
|
|
17598
|
-
after: recordJoin(joins, "after")
|
|
17639
|
+
after: recordJoin(joins, "after"),
|
|
17640
|
+
type: carriedJoin > 0 ? "carriedJoin" : "cut"
|
|
17599
17641
|
});
|
|
17600
17642
|
}
|
|
17601
17643
|
const faced = removalCut === 0 ? facedAcross : {
|
|
@@ -18138,7 +18180,8 @@ const resolveList = ({ nodes: listed, resolution, path }) => {
|
|
|
18138
18180
|
const pieceOnly = kept?.piece !== void 0 && (kept.piece === "after" ? right : left) !== void 0;
|
|
18139
18181
|
if (count === 0 || (left === void 0 || right === void 0) && !pieceOnly) continue;
|
|
18140
18182
|
if (kept === void 0 && resolution.decision === REVISION_DECISIONS.ACCEPT && keptJoinSeams.has(recorded) && passesJoinOn(seam, seam - count - 1, depth)) continue;
|
|
18141
|
-
|
|
18183
|
+
const carriedJoinMeetsPiece = removalJoins.get(recorded)?.type === "carriedJoin" && alikeDepth(recordAt(left?.node, "end"), recordAt(right?.node, "start")) > 0;
|
|
18184
|
+
if (kept === void 0 && (left === void 0 || right === void 0 || !sameOwnFields(left.node, right.node) && !carriedJoinMeetsPiece)) continue;
|
|
18142
18185
|
exactSeams.delete(recorded);
|
|
18143
18186
|
exactSeams.set(seam, Math.max(exactSeams.get(seam) ?? 0, depth));
|
|
18144
18187
|
if (floating.has(seam)) continue;
|
|
@@ -18728,7 +18771,7 @@ const deferSplitSeam = ({ left, right, depth }) => {
|
|
|
18728
18771
|
};
|
|
18729
18772
|
/**
|
|
18730
18773
|
* Whether the paragraph stands only for its pending insertions: rejecting
|
|
18731
|
-
* its added mark
|
|
18774
|
+
* its added mark left it in place until its content is resolved.
|
|
18732
18775
|
*/
|
|
18733
18776
|
const standsForInsertions = (paragraph) => paragraph.content.some((node) => node.type === "insertion" && node.resolutionJoins?.holdsParagraph !== void 0);
|
|
18734
18777
|
/**
|
|
@@ -18882,6 +18925,17 @@ const cutGoesOn = ({ mark, depth, onto }) => {
|
|
|
18882
18925
|
const laterAt = splitDateOf(onto);
|
|
18883
18926
|
return madeAt !== void 0 && laterAt !== void 0 && laterAt > madeAt && depth !== void 0 && depth > (onto.resolutionJoin ?? 0);
|
|
18884
18927
|
};
|
|
18928
|
+
/**
|
|
18929
|
+
* An added paragraph that opens a section before trailing range boundaries
|
|
18930
|
+
* can disappear on rejection. The original section break and the trailing
|
|
18931
|
+
* boundaries keep the same placement.
|
|
18932
|
+
*/
|
|
18933
|
+
const opensSectionBeforeTrailingBoundaries = (blocks, index) => {
|
|
18934
|
+
const follower = blockFollower(blocks, index);
|
|
18935
|
+
if (follower.block !== void 0 || follower.standing.length === 0) return false;
|
|
18936
|
+
const before = blocks.findLast((block, at) => at < index && !isBlockBoundary(block));
|
|
18937
|
+
return before?.type === "paragraph" && before.sectionProperties !== void 0;
|
|
18938
|
+
};
|
|
18885
18939
|
const joinOps = (document, { op, story, paraId, revisionId, added, depth, holders }, ends, ranInto = /* @__PURE__ */ new Set(), joinsBefore = /* @__PURE__ */ new Set(), rejoined = /* @__PURE__ */ new Map()) => {
|
|
18886
18940
|
const body = storyBody$1(document, story);
|
|
18887
18941
|
const location = findStoryParagraph(body, paraId);
|
|
@@ -19029,6 +19083,7 @@ const joinOps = (document, { op, story, paraId, revisionId, added, depth, holder
|
|
|
19029
19083
|
}));
|
|
19030
19084
|
const followsBlock = isOpaqueFollower(next);
|
|
19031
19085
|
const containerFinal = endsItsContainer(body, location);
|
|
19086
|
+
const endsBeforeBoundaries = added && next === void 0 && standing.length > 0 && opensSectionBeforeTrailingBoundaries(blocks, location.index);
|
|
19032
19087
|
const tableBoundary = next?.type === "table" ? paragraphTableRunInBoundary(paragraph, next) : void 0;
|
|
19033
19088
|
const tableTarget = tableBoundary?.type === "receiver" ? tableBoundary.target : void 0;
|
|
19034
19089
|
const blockTarget = next !== void 0 && followsBlock ? paragraphBlockRunInTarget(paragraph, next) : void 0;
|
|
@@ -19052,12 +19107,12 @@ const joinOps = (document, { op, story, paraId, revisionId, added, depth, holder
|
|
|
19052
19107
|
...paragraph,
|
|
19053
19108
|
content: [...joining, paragraph].flatMap(({ content }) => content)
|
|
19054
19109
|
};
|
|
19055
|
-
const goesBeforeBlock = follows === "block" && added &&
|
|
19110
|
+
const goesBeforeBlock = follows === "block" && added && blocks.some((block) => block.type === "paragraph" && block !== paragraph && !joining.includes(block));
|
|
19056
19111
|
const outcome = paragraphMarkOutcome({
|
|
19057
19112
|
follows,
|
|
19058
19113
|
holdsContent: paragraphHoldsContent(chained),
|
|
19059
19114
|
markWasAdded: added,
|
|
19060
|
-
containerStillEndsWithParagraph: follows !== "nothing" ? follows === "table" && blockListEndsInParagraph(blocks) || goesBeforeBlock || lastBlockPastBoundaries(blocks)?.type === "paragraph" : containerFinal && itemBefore(blocks, location.index)?.type === "paragraph" || endsControl && standsAfterBlock,
|
|
19115
|
+
containerStillEndsWithParagraph: follows !== "nothing" ? follows === "table" && blockListEndsInParagraph(blocks) || goesBeforeBlock || lastBlockPastBoundaries(blocks)?.type === "paragraph" : containerFinal && itemBefore(blocks, location.index)?.type === "paragraph" || endsBeforeBoundaries || endsControl && standsAfterBlock,
|
|
19061
19116
|
followingTableCanReceiveRunIn: tableTarget !== void 0,
|
|
19062
19117
|
holdsContentOnceAccepted: paragraphHoldsContentOnceAccepted(chained),
|
|
19063
19118
|
followingBlockCanReceiveRunIn: blockTarget !== void 0,
|
|
@@ -19069,7 +19124,12 @@ const joinOps = (document, { op, story, paraId, revisionId, added, depth, holder
|
|
|
19069
19124
|
emptyInsertedTableBoundary: tableBoundary?.type === "blocked" && tableBoundary.reason === "review" ? "pendingReview" : "unavailable",
|
|
19070
19125
|
precededByBlock: location.index > 0
|
|
19071
19126
|
});
|
|
19072
|
-
if (outcome.kind === "refuse") return Result.err(
|
|
19127
|
+
if (outcome.kind === "refuse") return Result.err(new DocumentOpRefusal({
|
|
19128
|
+
opType: op.type,
|
|
19129
|
+
reason: outcome.reason,
|
|
19130
|
+
message: `Resolving the mark of ${paraId} would leave its container without a final paragraph.`,
|
|
19131
|
+
blockedParagraphMarkRevisionId: revisionId
|
|
19132
|
+
}));
|
|
19073
19133
|
const tableOutcome = outcome.kind === "remove" && runInReceiver !== void 0 && paragraph.content.length > 0 && ranInto.has(idKey(runInReceiver.paraId ?? "")) ? "run-in" : outcome.kind;
|
|
19074
19134
|
if (standing.length > 0 && tableOutcome === "run-in" && !followsBlock) return Result.err(new DocumentOpRefusal({
|
|
19075
19135
|
opType: op.type,
|
|
@@ -19168,7 +19228,7 @@ const joinOps = (document, { op, story, paraId, revisionId, added, depth, holder
|
|
|
19168
19228
|
expected: reviewFieldsOf(paragraph),
|
|
19169
19229
|
review
|
|
19170
19230
|
}];
|
|
19171
|
-
const leavesHolder = added && op.decision === REVISION_DECISIONS.REJECT && (endsControl && standsAfterBlock || goesBeforeBlock);
|
|
19231
|
+
const leavesHolder = added && op.decision === REVISION_DECISIONS.REJECT && (endsControl && standsAfterBlock || goesBeforeBlock || endsBeforeBoundaries);
|
|
19172
19232
|
const held = leavesHolder ? holdingParagraph(paragraph.content) : void 0;
|
|
19173
19233
|
if (held !== void 0) markOps.push({
|
|
19174
19234
|
type: DOCUMENT_OP_TYPES.REPLACE_INLINE,
|
|
@@ -19234,7 +19294,8 @@ const absorbControlFollower = ({ document, story, paraId, applyOps }) => {
|
|
|
19234
19294
|
* them, as rejecting its mark with them at once does: only while it still
|
|
19235
19295
|
* ends its block content control short of the container's end, with a block
|
|
19236
19296
|
* before it, so the control keeps ending with that block, or still stands
|
|
19237
|
-
* before a block in a list that ends with a paragraph
|
|
19297
|
+
* before a block in a list that ends with a paragraph, or opens a section
|
|
19298
|
+
* before trailing range boundaries.
|
|
19238
19299
|
*/
|
|
19239
19300
|
const removeEmptiedHolder = ({ document, story, paraId, applyOps }) => {
|
|
19240
19301
|
const body = storyBody$1(document, story);
|
|
@@ -19245,8 +19306,8 @@ const removeEmptiedHolder = ({ document, story, paraId, applyOps }) => {
|
|
|
19245
19306
|
if (paragraph.content.length > 0 || paragraph.pPrMark !== void 0 || paragraph.sectionProperties !== void 0) return Result.ok(void 0);
|
|
19246
19307
|
const anchor = blocks.find((block, position) => position !== index && block.type === "paragraph");
|
|
19247
19308
|
const endsControl = index > 0 && index === blocks.length - 1 && list.at(-1)?.kind === "blockSdt" && !endsItsContainer(body, location);
|
|
19248
|
-
const standsBeforeBlock = anchor !== void 0 && isOpaqueFollower(blockFollower(blocks, index).block)
|
|
19249
|
-
if (!endsControl && !standsBeforeBlock) return Result.ok(void 0);
|
|
19309
|
+
const standsBeforeBlock = anchor !== void 0 && isOpaqueFollower(blockFollower(blocks, index).block);
|
|
19310
|
+
if (!endsControl && !standsBeforeBlock && !opensSectionBeforeTrailingBoundaries(blocks, index)) return Result.ok(void 0);
|
|
19250
19311
|
const removed = applyOps(document, [anchor === void 0 ? {
|
|
19251
19312
|
type: DOCUMENT_OP_TYPES.REPLACE_BLOCKS,
|
|
19252
19313
|
story,
|
|
@@ -20139,17 +20200,9 @@ const planSingleRecordResolution = ({ document, op, applyOps }, paragraphs) => {
|
|
|
20139
20200
|
current = restored.value.document;
|
|
20140
20201
|
}
|
|
20141
20202
|
}
|
|
20142
|
-
const exhausted = (document
|
|
20143
|
-
type: "document",
|
|
20144
|
-
document,
|
|
20145
|
-
id
|
|
20146
|
-
}) && isCommentExhausted({
|
|
20147
|
-
type: "document",
|
|
20148
|
-
document: current,
|
|
20149
|
-
id
|
|
20150
|
-
}));
|
|
20203
|
+
const exhausted = newlyExhaustedCommentIds(document, current);
|
|
20151
20204
|
const beforeRetirement = current;
|
|
20152
|
-
for (const
|
|
20205
|
+
for (const id of exhausted) {
|
|
20153
20206
|
const retired = applyOps(current, [{
|
|
20154
20207
|
type: DOCUMENT_OP_TYPES.DELETE_COMMENT,
|
|
20155
20208
|
id,
|
|
@@ -20163,7 +20216,7 @@ const planSingleRecordResolution = ({ document, op, applyOps }, paragraphs) => {
|
|
|
20163
20216
|
before: beforeRetirement,
|
|
20164
20217
|
after: current,
|
|
20165
20218
|
story: op.story,
|
|
20166
|
-
retired: new Set(exhausted
|
|
20219
|
+
retired: new Set(exhausted)
|
|
20167
20220
|
});
|
|
20168
20221
|
if (emptiedLinks.length > 0) {
|
|
20169
20222
|
const removed = applyOps(current, emptiedLinks);
|
|
@@ -25614,21 +25667,16 @@ const inspectDocumentOps = (document, ops) => applyDocumentOpsForPurpose({
|
|
|
25614
25667
|
purpose: "inspect-inverse"
|
|
25615
25668
|
});
|
|
25616
25669
|
// src/ops/suggestions.ts
|
|
25617
|
-
|
|
25618
|
-
* The ids of the revisions in a value that belong to a pending suggestion:
|
|
25619
|
-
* tracked insertions and deletions, moves, property changes and paragraph
|
|
25620
|
-
* mark revisions, at any depth.
|
|
25621
|
-
*/
|
|
25622
|
-
const suggestedRevisionIdsIn = (value, out) => {
|
|
25670
|
+
const visitSuggestionRevisions = (value, visit) => {
|
|
25623
25671
|
if (typeof value !== "object" || value === null) return;
|
|
25624
25672
|
if (Array.isArray(value)) {
|
|
25625
|
-
for (const item of value)
|
|
25673
|
+
for (const item of value) visitSuggestionRevisions(item, visit);
|
|
25626
25674
|
return;
|
|
25627
25675
|
}
|
|
25628
25676
|
const record = value;
|
|
25629
25677
|
const info = record["info"];
|
|
25630
|
-
if (typeof info === "object" && info !== null && typeof info
|
|
25631
|
-
for (const child of Object.values(record))
|
|
25678
|
+
if (typeof info === "object" && info !== null && typeof info.suggestionId === "string" && typeof info.id === "number") visit(info);
|
|
25679
|
+
for (const child of Object.values(record)) visitSuggestionRevisions(child, visit);
|
|
25632
25680
|
};
|
|
25633
25681
|
/**
|
|
25634
25682
|
* The ids of the comments pending suggestions propose: every one, or those of
|
|
@@ -25655,13 +25703,18 @@ const withoutSuggestedComments = (document, ids) => {
|
|
|
25655
25703
|
* file reads as if it had never been made; ordinary tracked changes stay. A
|
|
25656
25704
|
* comment a suggestion proposes is left out with it.
|
|
25657
25705
|
*/
|
|
25658
|
-
const withoutPendingSuggestions = (document) => {
|
|
25659
|
-
const
|
|
25706
|
+
const withoutPendingSuggestions = (document, { commentIds, onAbsorptions } = {}) => {
|
|
25707
|
+
const proposedComments = new Set(suggestedCommentIds(document));
|
|
25708
|
+
if (commentIds !== void 0) {
|
|
25709
|
+
for (const { id } of document.package.document.comments ?? []) if (commentIds.has(id)) proposedComments.add(id);
|
|
25710
|
+
}
|
|
25711
|
+
const uncommented = withoutSuggestedComments(document, [...proposedComments]);
|
|
25660
25712
|
if (uncommented.isErr()) return uncommented;
|
|
25661
25713
|
let current = uncommented.value;
|
|
25714
|
+
const receipts = [];
|
|
25662
25715
|
for (const story of documentStories(current)) {
|
|
25663
25716
|
const ids = /* @__PURE__ */ new Set();
|
|
25664
|
-
|
|
25717
|
+
visitSuggestionRevisions(storyBody$1(current, story), ({ id }) => ids.add(id));
|
|
25665
25718
|
if (ids.size === 0) continue;
|
|
25666
25719
|
const rejected = applyDocumentOp(current, {
|
|
25667
25720
|
type: DOCUMENT_OP_TYPES.RESOLVE_REVISION,
|
|
@@ -25670,8 +25723,14 @@ const withoutPendingSuggestions = (document) => {
|
|
|
25670
25723
|
decision: REVISION_DECISIONS.REJECT
|
|
25671
25724
|
});
|
|
25672
25725
|
if (rejected.isErr()) return Result.err(rejected.error);
|
|
25726
|
+
const absorbed = rejected.value.touched.absorbed;
|
|
25727
|
+
if (onAbsorptions !== void 0 && absorbed !== void 0 && absorbed.length > 0) receipts.push({
|
|
25728
|
+
story,
|
|
25729
|
+
absorbed
|
|
25730
|
+
});
|
|
25673
25731
|
current = rejected.value.document;
|
|
25674
25732
|
}
|
|
25733
|
+
for (const { story, absorbed } of receipts) onAbsorptions?.(story, absorbed);
|
|
25675
25734
|
return Result.ok(current);
|
|
25676
25735
|
};
|
|
25677
25736
|
/**
|
|
@@ -25680,20 +25739,12 @@ const withoutPendingSuggestions = (document) => {
|
|
|
25680
25739
|
*/
|
|
25681
25740
|
const suggestionRevisionInfos = (document, story, suggestionId) => {
|
|
25682
25741
|
const out = /* @__PURE__ */ new Map();
|
|
25683
|
-
const visit = (value) => {
|
|
25684
|
-
if (typeof value !== "object" || value === null) return;
|
|
25685
|
-
if (Array.isArray(value)) {
|
|
25686
|
-
for (const item of value) visit(item);
|
|
25687
|
-
return;
|
|
25688
|
-
}
|
|
25689
|
-
const record = value;
|
|
25690
|
-
const info = record["info"];
|
|
25691
|
-
if (typeof info === "object" && info !== null && info.suggestionId === suggestionId && typeof info.id === "number" && !out.has(info.id)) out.set(info.id, info);
|
|
25692
|
-
for (const child of Object.values(record)) visit(child);
|
|
25693
|
-
};
|
|
25694
25742
|
const body = storyBody$1(document, story);
|
|
25695
|
-
|
|
25696
|
-
|
|
25743
|
+
const add = (info) => {
|
|
25744
|
+
if (info.suggestionId === suggestionId && !out.has(info.id)) out.set(info.id, info);
|
|
25745
|
+
};
|
|
25746
|
+
visitSuggestionRevisions(body.content, add);
|
|
25747
|
+
for (const { info } of body.finalSectionProperties?.propertyChanges ?? []) add(info);
|
|
25697
25748
|
return [...out.values()];
|
|
25698
25749
|
};
|
|
25699
25750
|
/**
|
|
@@ -25703,20 +25754,9 @@ const suggestionRevisionInfos = (document, story, suggestionId) => {
|
|
|
25703
25754
|
const pendingSuggestionIdsIn = (document) => {
|
|
25704
25755
|
const out = /* @__PURE__ */ new Set();
|
|
25705
25756
|
for (const comment of document.package.document.comments ?? []) if (comment.suggestionId !== void 0) out.add(comment.suggestionId);
|
|
25706
|
-
const visit = (value) => {
|
|
25707
|
-
if (typeof value !== "object" || value === null) return;
|
|
25708
|
-
if (Array.isArray(value)) {
|
|
25709
|
-
for (const item of value) visit(item);
|
|
25710
|
-
return;
|
|
25711
|
-
}
|
|
25712
|
-
const record = value;
|
|
25713
|
-
const info = record["info"];
|
|
25714
|
-
if (typeof info === "object" && info !== null && typeof info.suggestionId === "string") out.add(info.suggestionId);
|
|
25715
|
-
for (const child of Object.values(record)) visit(child);
|
|
25716
|
-
};
|
|
25717
25757
|
for (const story of documentStories(document)) {
|
|
25718
25758
|
const body = storyBody$1(document, story);
|
|
25719
|
-
|
|
25759
|
+
visitSuggestionRevisions(body.content, ({ suggestionId }) => out.add(suggestionId));
|
|
25720
25760
|
for (const { info } of body.finalSectionProperties?.propertyChanges ?? []) if (info.suggestionId !== void 0) out.add(info.suggestionId);
|
|
25721
25761
|
}
|
|
25722
25762
|
return out;
|
|
@@ -28064,6 +28104,11 @@ const planTrackedReplacement = (document, options) => {
|
|
|
28064
28104
|
});
|
|
28065
28105
|
if (inserted.isErr()) return Result.err(inserted.error);
|
|
28066
28106
|
}
|
|
28107
|
+
if (plan.ops.some((op) => op.type === DOCUMENT_OP_TYPES.DELETE_RANGE && op.revision === void 0)) for (const id of newlyExhaustedCommentIds(document, plan.document())) plan.ops.push({
|
|
28108
|
+
type: DOCUMENT_OP_TYPES.DELETE_COMMENT,
|
|
28109
|
+
id,
|
|
28110
|
+
scope: "thread"
|
|
28111
|
+
});
|
|
28067
28112
|
return Result.ok(plan.ops);
|
|
28068
28113
|
};
|
|
28069
28114
|
/** Plan a same-list range deletion followed by tracked replacement insertions. */
|
|
@@ -32859,7 +32904,7 @@ const SEQUENCED_EFFECT_TYPES = Object.freeze({
|
|
|
32859
32904
|
deleteRange: "deleteRange",
|
|
32860
32905
|
setRunProps: "setRunProps",
|
|
32861
32906
|
setParagraphProps: NO_SEQUENCED_EFFECT,
|
|
32862
|
-
insertBlocks:
|
|
32907
|
+
insertBlocks: "insertBlocks",
|
|
32863
32908
|
splitBlock: "splitBlock",
|
|
32864
32909
|
joinBlocks: "joinBlocks",
|
|
32865
32910
|
resolveRevision: "touchedBlocks",
|
|
@@ -32907,7 +32952,7 @@ const SEQUENCED_EFFECT_TYPES = Object.freeze({
|
|
|
32907
32952
|
const sequencedEffectType = (op) => {
|
|
32908
32953
|
if (op.type === DOCUMENT_OP_TYPES.INSERT_BLOCKS) switch (op.at.type) {
|
|
32909
32954
|
case "before":
|
|
32910
|
-
case "after": return
|
|
32955
|
+
case "after": return DOCUMENT_OP_TYPES.INSERT_BLOCKS;
|
|
32911
32956
|
case "beforeTable":
|
|
32912
32957
|
case "afterTable":
|
|
32913
32958
|
case "containerStart": return "touchedBlocks";
|
|
@@ -32917,6 +32962,15 @@ const sequencedEffectType = (op) => {
|
|
|
32917
32962
|
}
|
|
32918
32963
|
return SEQUENCED_EFFECT_TYPES[op.type];
|
|
32919
32964
|
};
|
|
32965
|
+
/**
|
|
32966
|
+
* Whether a sequenced effect of `type` is one `op` may carry: the effect it
|
|
32967
|
+
* records, or the one a journal sequenced before that effect existed
|
|
32968
|
+
* recorded for it.
|
|
32969
|
+
*/
|
|
32970
|
+
const acceptsSequencedEffect = (op, type) => {
|
|
32971
|
+
const recorded = sequencedEffectType(op);
|
|
32972
|
+
return type === recorded || recorded === DOCUMENT_OP_TYPES.INSERT_BLOCKS && type === "none";
|
|
32973
|
+
};
|
|
32920
32974
|
const commonOperationFields = { undefinedFields: optional(array(array(nonemptyString))) };
|
|
32921
32975
|
const position = object({
|
|
32922
32976
|
story: isOpStory,
|
|
@@ -33457,6 +33511,10 @@ const isDocumentBatch = (value) => object({
|
|
|
33457
33511
|
type: literal("joinBlocks"),
|
|
33458
33512
|
firstLength: natural
|
|
33459
33513
|
})(effect);
|
|
33514
|
+
case "insertBlocks": return object({
|
|
33515
|
+
type: literal("insertBlocks"),
|
|
33516
|
+
borderingRevisionIds: array(natural)
|
|
33517
|
+
})(effect);
|
|
33460
33518
|
case "insertContent": return object({
|
|
33461
33519
|
type: literal("insertContent"),
|
|
33462
33520
|
cutIdentified: boolean
|
|
@@ -33546,7 +33604,7 @@ const decodeDocumentBatch = (value) => {
|
|
|
33546
33604
|
if (!natural(value.revision) || !Array.isArray(effects) || effects.length !== value.ops.length || !effects.every((effect, index) => {
|
|
33547
33605
|
if (!isRecord(effect)) return false;
|
|
33548
33606
|
const op = value.ops.at(index);
|
|
33549
|
-
return op !== void 0 && effect["type"]
|
|
33607
|
+
return op !== void 0 && acceptsSequencedEffect(op, effect["type"]);
|
|
33550
33608
|
})) return Result.err(new BatchRejection({
|
|
33551
33609
|
reason: BATCH_REJECTION_REASONS.INVALID_BATCH,
|
|
33552
33610
|
message: "Sequenced effects must match their operation indexes"
|
|
@@ -33978,6 +34036,11 @@ const transformCommentPair = ({ op, over, effect }) => {
|
|
|
33978
34036
|
}
|
|
33979
34037
|
return Result.ok([op]);
|
|
33980
34038
|
};
|
|
34039
|
+
// src/ops/sequencing/heldRevisions.ts
|
|
34040
|
+
/** The tracked changes a piece of content holds, by revision id. */
|
|
34041
|
+
const REVISION_KEY_PREFIX$1 = `${IDENTITY_SPACES.REVISION}:`;
|
|
34042
|
+
/** The ids of the revisions held in `content`, as the revisions part keys them. */
|
|
34043
|
+
const heldRevisionIds = (content) => identityKeysIn(content).flatMap((key) => key.startsWith(REVISION_KEY_PREFIX$1) ? [key.slice(REVISION_KEY_PREFIX$1.length)] : []);
|
|
33981
34044
|
// src/ops/sequencing/inlineTransform.ts
|
|
33982
34045
|
/**
|
|
33983
34046
|
* Sequencing of inline insertions and of inline record splits and joins.
|
|
@@ -34311,11 +34374,6 @@ const transformInlinePair = (pair) => {
|
|
|
34311
34374
|
}
|
|
34312
34375
|
}
|
|
34313
34376
|
};
|
|
34314
|
-
// src/ops/sequencing/heldRevisions.ts
|
|
34315
|
-
/** The tracked changes a piece of content holds, by revision id. */
|
|
34316
|
-
const REVISION_KEY_PREFIX$1 = `${IDENTITY_SPACES.REVISION}:`;
|
|
34317
|
-
/** The ids of the revisions held in `content`, as the revisions part keys them. */
|
|
34318
|
-
const heldRevisionIds = (content) => identityKeysIn(content).flatMap((key) => key.startsWith(REVISION_KEY_PREFIX$1) ? [key.slice(REVISION_KEY_PREFIX$1.length)] : []);
|
|
34319
34377
|
// src/ops/sequencing/restoreTransform.ts
|
|
34320
34378
|
/**
|
|
34321
34379
|
* Paragraph restorations against concurrent edits of the same paragraph.
|
|
@@ -35115,10 +35173,12 @@ const rejoinedOverFormat = ({ op, over, effect }) => {
|
|
|
35115
35173
|
* comment anchor: it decides the same revisions after the edit, unless the
|
|
35116
35174
|
* edit cut a revision record in two and gave its second half a new id, or is
|
|
35117
35175
|
* a tracked edit whose records may continue a decided revision: one order
|
|
35118
|
-
* decides those and the other does not, so the decision is refused.
|
|
35176
|
+
* decides those and the other does not, so the decision is refused. Over a
|
|
35177
|
+
* direct paragraph insertion it passes unless it decides a revision the
|
|
35178
|
+
* insertion's sequenced effect names as bordering it.
|
|
35119
35179
|
* Undefined for every other pair.
|
|
35120
35180
|
*/
|
|
35121
|
-
const decisionOverEdit = (op, over) => {
|
|
35181
|
+
const decisionOverEdit = (op, over, effect) => {
|
|
35122
35182
|
if (op.type !== DOCUMENT_OP_TYPES.RESOLVE_REVISION) return void 0;
|
|
35123
35183
|
switch (over.type) {
|
|
35124
35184
|
case DOCUMENT_OP_TYPES.INSERT_TEXT:
|
|
@@ -35137,6 +35197,13 @@ const decisionOverEdit = (op, over) => {
|
|
|
35137
35197
|
case DOCUMENT_OP_TYPES.CREATE_COMMENT:
|
|
35138
35198
|
if (!isAnchoredComment(over)) return void 0;
|
|
35139
35199
|
break;
|
|
35200
|
+
case DOCUMENT_OP_TYPES.INSERT_BLOCKS:
|
|
35201
|
+
if (over.at.type !== "before" && over.at.type !== "after") return void 0;
|
|
35202
|
+
if (over.revision !== void 0) break;
|
|
35203
|
+
if (effect?.type !== DOCUMENT_OP_TYPES.INSERT_BLOCKS) return refusal(op, over, "A concurrent paragraph insertion records no revisions it borders.");
|
|
35204
|
+
if (op.revisionIds.some((id) => effect.borderingRevisionIds.includes(id))) return refusal(op, over, "A concurrent paragraph insertion borders a paragraph mark this decision resolves.");
|
|
35205
|
+
if (heldRevisionIds(over.blocks).some((id) => op.revisionIds.some((decided) => String(decided) === id))) return refusal(op, over, "A concurrent paragraph insertion holds a copy of a revision this decision resolves.");
|
|
35206
|
+
return Result.ok([op]);
|
|
35140
35207
|
default: return;
|
|
35141
35208
|
}
|
|
35142
35209
|
if ("revision" in over && over.revision !== void 0) return refusal(op, over, "A concurrent tracked edit may continue a revision this decision resolves.");
|
|
@@ -35156,7 +35223,7 @@ const transformRestoredOp = ({ op, over, effect, order }) => {
|
|
|
35156
35223
|
if (story === void 0 || overStory === void 0) return refusal(op, over, "Package resources, numbering and section metadata require an exclusive edit.");
|
|
35157
35224
|
if (!sameStory$1(story, overStory)) return Result.ok([op]);
|
|
35158
35225
|
if (independent(op, over)) return Result.ok([op]);
|
|
35159
|
-
const decided = decisionOverEdit(op, over);
|
|
35226
|
+
const decided = decisionOverEdit(op, over, effect);
|
|
35160
35227
|
if (decided !== void 0) return decided;
|
|
35161
35228
|
if (isAnchoredComment(op)) return moveCommentAnchor({
|
|
35162
35229
|
op,
|
|
@@ -35665,6 +35732,56 @@ const inspectBatch = (document, ops) => batchWith(inspectDocumentOps, document,
|
|
|
35665
35732
|
document: left,
|
|
35666
35733
|
effects
|
|
35667
35734
|
}));
|
|
35735
|
+
/** The revisions a paragraph's mark records: the mark, its deletion, the one it took over. */
|
|
35736
|
+
const markRevisionIds = (paragraph) => {
|
|
35737
|
+
const mark = paragraph?.pPrMark;
|
|
35738
|
+
if (mark === void 0) return [];
|
|
35739
|
+
return [
|
|
35740
|
+
mark.info.id,
|
|
35741
|
+
...mark.deletion === void 0 ? [] : [mark.deletion.info.id],
|
|
35742
|
+
...mark.takenOverMark === void 0 ? [] : [mark.takenOverMark]
|
|
35743
|
+
];
|
|
35744
|
+
};
|
|
35745
|
+
/** The row and cell revisions of the tables on the way down to a paragraph. */
|
|
35746
|
+
const holdingTableRevisionIds = (blocks, location) => {
|
|
35747
|
+
const ids = [];
|
|
35748
|
+
const change = (info) => {
|
|
35749
|
+
if (info !== void 0) ids.push(info.info.id);
|
|
35750
|
+
};
|
|
35751
|
+
let list = blocks;
|
|
35752
|
+
for (const step of location.list) {
|
|
35753
|
+
const block = list.at(step.block);
|
|
35754
|
+
if (step.kind === "tableCell" && block?.type === "table") {
|
|
35755
|
+
const row = block.rows.at(step.row);
|
|
35756
|
+
const cell = row?.cells.at(step.cell);
|
|
35757
|
+
change(row?.structuralChange);
|
|
35758
|
+
change(cell?.structuralChange);
|
|
35759
|
+
list = cell?.content ?? [];
|
|
35760
|
+
} else if (step.kind === "blockSdt" && block?.type === "blockSdt" || step.kind === "blockCustomXml" && block?.type === "blockCustomXml") list = block.content;
|
|
35761
|
+
else return ids;
|
|
35762
|
+
}
|
|
35763
|
+
return ids;
|
|
35764
|
+
};
|
|
35765
|
+
/**
|
|
35766
|
+
* The revisions a direct insertion before or after a paragraph borders: see
|
|
35767
|
+
* the `insertBlocks` sequenced effect. A tracked insertion records them too;
|
|
35768
|
+
* its own revision refuses a concurrent decision first.
|
|
35769
|
+
*/
|
|
35770
|
+
const borderingRevisionIds = (document, op) => {
|
|
35771
|
+
if (op.at.type !== "before" && op.at.type !== "after") return [];
|
|
35772
|
+
const anchorId = idKey(op.at.blockId);
|
|
35773
|
+
const body = storyBody$1(document, op.story);
|
|
35774
|
+
const paragraphs = storyParagraphs(body);
|
|
35775
|
+
const index = paragraphs.findIndex(({ paragraph }) => paragraph.paraId !== void 0 && idKey(paragraph.paraId) === anchorId);
|
|
35776
|
+
const anchor = paragraphs.at(index);
|
|
35777
|
+
if (index < 0 || anchor === void 0) return [];
|
|
35778
|
+
const before = itemBefore(paragraphs, index)?.paragraph;
|
|
35779
|
+
return [.../* @__PURE__ */ new Set([
|
|
35780
|
+
...markRevisionIds(anchor.paragraph),
|
|
35781
|
+
...markRevisionIds(before),
|
|
35782
|
+
...holdingTableRevisionIds(body.content, anchor)
|
|
35783
|
+
])].sort((left, right) => left - right);
|
|
35784
|
+
};
|
|
35668
35785
|
const batchWith = (applyOps, document, ops) => {
|
|
35669
35786
|
let current = document;
|
|
35670
35787
|
const inverses = [];
|
|
@@ -35685,6 +35802,10 @@ const batchWith = (applyOps, document, ops) => {
|
|
|
35685
35802
|
firstLength: paragraphLength(paragraph)
|
|
35686
35803
|
};
|
|
35687
35804
|
}
|
|
35805
|
+
if (op.type === DOCUMENT_OP_TYPES.INSERT_BLOCKS && sequencedEffectType(op) === DOCUMENT_OP_TYPES.INSERT_BLOCKS) effect = {
|
|
35806
|
+
type: DOCUMENT_OP_TYPES.INSERT_BLOCKS,
|
|
35807
|
+
borderingRevisionIds: borderingRevisionIds(current, op)
|
|
35808
|
+
};
|
|
35688
35809
|
const applied = applyOps(current, [op]);
|
|
35689
35810
|
if (applied.isErr()) return Result.err(applied.error);
|
|
35690
35811
|
if (op.type === DOCUMENT_OP_TYPES.INSERT_CONTENT) effect = {
|