chore(quick_edit): bring back focus

This commit is contained in:
Elian Doran 2025-11-22 19:34:14 +02:00
parent bb9cb2fb75
commit 2f440eba37
No known key found for this signature in database
3 changed files with 4 additions and 2 deletions

View File

@ -12,6 +12,7 @@ const noteContext = new NoteContext("_popup-editor");
export default function PopupEditor() {
const [ shown, setShown ] = useState(false);
const parentComponent = useContext(ParentComponent);
useTriliumEvent("openInPopup", async ({ noteIdOrPath }) => {
await noteContext.setNote(noteIdOrPath, {
@ -30,6 +31,9 @@ export default function PopupEditor() {
className="popup-editor-dialog"
size="lg"
show={shown}
onShown={() => {
parentComponent?.handleEvent("focusOnDetail", { ntxId: noteContext.ntxId });
}}
onHidden={() => setShown(false)}
>
<NoteDetail />

View File

@ -58,7 +58,6 @@ export default class PopupEditorDialog extends Container<BasicWidget> {
$dialog.on("shown.bs.modal", async () => {
this.setVisibility(true);
await this.handleEventInChildren("focusOnDetail", { ntxId: this.noteContext.ntxId });
});
$dialog.on("hidden.bs.modal", () => {
const $typeWidgetEl = $dialog.find(".note-detail-printable");

View File

@ -41,7 +41,6 @@ export default function CKEditorWithWatchdog({ containerRef: externalContainerRe
const [ editor, setEditor ] = useState<CKTextEditor>();
const { parentComponent, ntxId } = useNoteContext();
console.log("Register with ntxId", ntxId);
useKeyboardShortcuts("text-detail", containerRef, parentComponent, ntxId);
useImperativeHandle(editorApi, () => ({