Skip to content

Commit

Permalink
add more logging to paragraph normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas-C committed Feb 4, 2025
1 parent bec5aef commit b736490
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/editor/src/plugins/paragraph/paragraphPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const paragraphPlugin = createPlugin<ParagraphElementType, ParagraphPlugi
!opts.nonSerializableParents?.includes(parentNode.type) &&
node.serializeAsText
) {
logger.log("Paragraph is not in a non-serializable parent, unsetting serializeAsText.");
Transforms.unsetNodes(editor, "serializeAsText", { at: path });
return true;
}
Expand All @@ -41,6 +42,7 @@ export const paragraphPlugin = createPlugin<ParagraphElementType, ParagraphPlugi
if (Path.hasPrevious(path)) {
const [previousNode] = editor.node(Path.previous(path));
if (isParagraphElement(previousNode) && (previousNode.serializeAsText || node.serializeAsText)) {
logger.log("Paragraph is direct sibling of another paragraph, unsetting serializeAsText.");
Transforms.unsetNodes(editor, "serializeAsText", {
at: Path.parent(path),
mode: "all",
Expand All @@ -52,6 +54,7 @@ export const paragraphPlugin = createPlugin<ParagraphElementType, ParagraphPlugi
if (editor.hasPath(Path.next(path))) {
const [nextNode] = editor.node(Path.next(path));
if (isParagraphElement(nextNode) && (nextNode.serializeAsText || node.serializeAsText)) {
logger.log("Paragraph is direct sibling of another paragraph, unsetting serializeAsText.");
Transforms.unsetNodes(editor, "serializeAsText", {
at: Path.parent(path),
mode: "all",
Expand Down

0 comments on commit b736490

Please sign in to comment.