[WEB-5449] fix: enhance content check for unique ID generation and update issue loader condition (#8132)

This commit is contained in:
Vipin Chaudhary 2025-11-18 15:27:01 +05:30 committed by GitHub
parent 2e6225a883
commit b73cf4f0e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 2 deletions

View file

@ -122,7 +122,7 @@ export const UniqueID = Extension.create<UniqueIDOptions>({
// If not synced, the listener will be registered in the plugin
// and handled there with proper cleanup
} else {
return createIdsForView(this.editor.view, this.options);
createIdsForView(this.editor.view, this.options);
}
},

View file

@ -10,6 +10,13 @@ export const createIdsForView = (view: EditorView, options: UniqueIDOptions) =>
const { state } = view;
const { tr, doc } = state;
const { types, attributeName, generateUniqueID } = options;
// size > 2 means more than just the default empty paragraph
const hasContent = doc.content.size > 2;
if (!hasContent) {
return;
}
const nodesWithoutId = findChildren(
doc,
(node) => types.includes(node.type.name) && node.attrs[attributeName] === null