mirror of
https://github.com/zadam/trilium.git
synced 2025-11-16 21:44:31 +01:00
fix(text): insert link sometimes occurs in the wrong tab
This commit is contained in:
parent
754a06343f
commit
398329a219
@ -29,6 +29,8 @@ async function getActionsForScope(scope: string) {
|
||||
}
|
||||
|
||||
async function setupActionsForElement(scope: string, $el: JQuery<HTMLElement>, component: Component) {
|
||||
if (!$el[0]) return;
|
||||
|
||||
const actions = await getActionsForScope(scope);
|
||||
const bindings: ShortcutBinding[] = [];
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { HTMLProps, RefObject, useEffect, useImperativeHandle, useRef, useState } from "preact/compat";
|
||||
import { PopupEditor, ClassicEditor, EditorWatchdog, type WatchdogConfig, CKTextEditor, TemplateDefinition } from "@triliumnext/ckeditor5";
|
||||
import { buildConfig, BuildEditorOptions } from "./config";
|
||||
import { useLegacyImperativeHandlers, useSyncedRef } from "../../react/hooks";
|
||||
import { useKeyboardShortcuts, useLegacyImperativeHandlers, useNoteContext, useSyncedRef } from "../../react/hooks";
|
||||
import link from "../../../services/link";
|
||||
import froca from "../../../services/froca";
|
||||
|
||||
@ -38,6 +38,9 @@ export default function CKEditorWithWatchdog({ containerRef: externalContainerRe
|
||||
const containerRef = useSyncedRef<HTMLDivElement>(externalContainerRef, null);
|
||||
const watchdogRef = useRef<EditorWatchdog>(null);
|
||||
const [ editor, setEditor ] = useState<CKTextEditor>();
|
||||
const { parentComponent } = useNoteContext();
|
||||
|
||||
useKeyboardShortcuts("text-detail", containerRef, parentComponent);
|
||||
|
||||
useImperativeHandle(editorApi, () => ({
|
||||
hasSelection() {
|
||||
|
||||
@ -196,7 +196,6 @@ export default function EditableText({ note, parentComponent, ntxId, noteContext
|
||||
});
|
||||
}
|
||||
|
||||
useKeyboardShortcuts("text-detail", containerRef, parentComponent);
|
||||
useTriliumEvent("insertDateTimeToText", ({ ntxId: eventNtxId }) => {
|
||||
if (eventNtxId !== ntxId) return;
|
||||
const date = new Date();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user