Skip to content

Commit fd84422

Browse files
fix: clarify raw field output policy
1 parent c1943f1 commit fd84422

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

packages/super-editor/src/editors/v1/core/super-converter/field-references/preProcessNodesForFldChar.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,17 @@ export const preProcessNodesForFldChar = (nodes = [], docx) => {
5151
const rawCollectedNodes = rawCollectedNodesStack.pop().filter((n) => n !== null);
5252
const fieldRunRPr = fieldRunRPrStack.pop() ?? null;
5353
const currentField = currentFieldStack.pop();
54-
const combinedResult = currentField.preserveRaw
55-
? { nodes: rawCollectedNodes, handled: false }
56-
: _processCombinedNodesForFldChar(
57-
collectedNodes,
58-
currentField.instrText.trim(),
59-
docx,
60-
currentField.instructionTokens,
61-
fieldRunRPr,
62-
);
63-
const outputNodes = combinedResult.handled ? combinedResult.nodes : rawCollectedNodes;
54+
let outputNodes = rawCollectedNodes;
55+
if (!currentField.preserveRaw) {
56+
const combinedResult = _processCombinedNodesForFldChar(
57+
collectedNodes,
58+
currentField.instrText.trim(),
59+
docx,
60+
currentField.instructionTokens,
61+
fieldRunRPr,
62+
);
63+
outputNodes = combinedResult.handled ? combinedResult.nodes : rawCollectedNodes;
64+
}
6465
if (collectedNodesStack.length === 0) {
6566
// We have completed a top-level field, add the combined nodes to the output.
6667
processedNodes.push(...outputNodes);

0 commit comments

Comments
 (0)