chore(react/ribbon): add logic for displaying attribute detail

This commit is contained in:
Elian Doran
2025-08-23 12:55:48 +03:00
parent e5caf37697
commit 62372ed4c5
3 changed files with 104 additions and 105 deletions

View File

@@ -9,8 +9,8 @@ interface CKEditorOpts {
editor: typeof AttributeEditor;
disableNewlines?: boolean;
disableSpellcheck?: boolean;
onChange?: () => void;
onClick?: (pos?: ModelPosition | null) => void;
onChange?: (newValue?: string) => void;
onClick?: (e, pos?: ModelPosition | null) => void;
}
export default function CKEditor({ currentValue, className, tabIndex, editor, config, disableNewlines, disableSpellcheck, onChange, onClick }: CKEditorOpts) {
@@ -43,7 +43,9 @@ export default function CKEditor({ currentValue, className, tabIndex, editor, co
}
if (onChange) {
textEditor.model.document.on("change:data", onChange);
textEditor.model.document.on("change:data", () => {
onChange(textEditor.getData())
});
}
if (currentValue) {
@@ -62,10 +64,10 @@ export default function CKEditor({ currentValue, className, tabIndex, editor, co
ref={editorContainerRef}
className={className}
tabIndex={tabIndex}
onClick={() => {
onClick={(e) => {
if (onClick) {
const pos = textEditorRef.current?.model.document.selection.getFirstPosition();
onClick(pos);
onClick(e, pos);
}
}}
/>