chore(react/ribbon): load current attributes in editor

This commit is contained in:
Elian Doran
2025-08-23 12:39:49 +03:00
parent befc5a9530
commit e5caf37697
4 changed files with 35 additions and 18 deletions

View File

@@ -289,22 +289,7 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget implem
$el.text(title);
}
async refreshWithNote(note: FNote) {
await this.renderOwnedAttributes(note.getOwnedAttributes(), true);
}
async renderOwnedAttributes(ownedAttributes: FAttribute[], saved: boolean) {
// attrs are not resorted if position changes after the initial load
ownedAttributes.sort((a, b) => a.position - b.position);
let htmlAttrs = (await attributeRenderer.renderAttributes(ownedAttributes, true)).html();
if (htmlAttrs.length > 0) {
htmlAttrs += " ";
}
this.textEditor.setData(htmlAttrs);
if (saved) {
this.lastSavedContent = this.textEditor.getData();