Skip to content

Build your personal knowledge base with Trilium Notes

client/refactor: rename the "text editor tooltip manager" to "content hint manager"

Adorian Doran3876a0c436f4
diff --git a/packages/ckeditor5-collapsible/src/collapsible-editing.ts b/packages/ckeditor5-collapsible/src/collapsible-editing.ts
index 5b6a6fcdf1..9a7b97deed 100644
--- a/packages/ckeditor5-collapsible/src/collapsible-editing.ts
+++ b/packages/ckeditor5-collapsible/src/collapsible-editing.ts
@@ -1,23 +1,23 @@
import { Plugin, Enter, Delete, enableViewPlaceholder, getEnvKeystrokeText, type ViewDocumentEnterEvent, type ViewDocumentDeleteEvent, type ViewDocumentArrowKeyEvent } from "ckeditor5";
-import { EditorTooltipManager, type TooltipHandle } from "@triliumnext/ckeditor5-utils";
+import { ContentHintManager, type HintHandle } from "@triliumnext/ckeditor5-utils";
import BlockDragHandle from "./block-drag-handle.js";
import CollapsibleCommand from "./collapsible-command.js";
type TranslateFn = (key: string, params?: Record<string, unknown>) => string;
/**
- * Dwell delay before hover or a stationary caret pops a summary/handle tooltip.
+ * Dwell delay before hover or a stationary caret pops a summary/handle hint.
* Long enough that mouse flyovers don't spawn a popup, short enough that
* intentional attention still produces one.
*/
-const TOOLTIP_DWELL_MS = 200;
+const HINT_DWELL_MS = 200;
/**
- * How long a tooltip stays visible without any new event (push, content
- * refresh, caret movement) before it fades itself out. Matches the todo-list
- * multistate plugin's cadence so the two feel consistent.
+ * How long a hint stays visible without any new event (push, content refresh,
+ * caret movement) before it fades itself out. Matches the todo-list multistate
+ * plugin's cadence so the two feel consistent.
*/
-const TOOLTIP_AUTO_HIDE_MS = 2000;
+const HINT_AUTO_HIDE_MS = 2000;
/**
* Schema, conversion and key handling for collapsible blocks.
@@ -52,26 +52,26 @@ export default class CollapsibleEditing extends Plugin {
*/
private readonly preserveOpenOnNextInsert = new Map<any, boolean>();
/**
- * Shared visibility stack for the summary tooltips (screen-corner hint on
+ * Shared visibility stack for the summary hints (screen-corner popup on
* each <summary>). One hover handle per rendered summary plus one caret
* handle push/pop against it — only the top of the stack is on screen at a
- * time. See {@link EditorTooltipManager} for the rationale.
+ * time. See {@link ContentHintManager} for the rationale.
*/
- private summaryTooltipManager?: EditorTooltipManager;
+ private summaryHintManager?: ContentHintManager;
/** Hover-driven handle per rendered <summary>. Disposed when the summary detaches. */
- private readonly summaryHoverHandles = new Map<HTMLElement, TooltipHandle>();
+ private readonly summaryHoverHandles = new Map<HTMLElement, HintHandle>();
/** Caret-driven handle, if the caret is currently inside a <summary>. */
- private summaryCaretHandle?: TooltipHandle;
+ private summaryCaretHandle?: HintHandle;
/** DOM <summary> the caret handle is currently attached to. */
private summaryCaretDom?: HTMLElement;
/**
- * Shared visibility stack for the drag-handle tooltips. Handles use default
- * near-element placement (no `text-editor-content-tooltip` class), so they
- * live in their own manager with its own `tooltipOptions`.
+ * Shared visibility stack for the drag-handle hints. Drag handles use
+ * default near-element placement (no `text-editor-content-tooltip` class),
+ * so they live in their own manager with plain `tooltipOptions`.
*/
- private handleTooltipManager?: EditorTooltipManager;
+ private handleHintManager?: ContentHintManager;
/** Hover-driven handle per rendered drag-handle. Disposed when the handle detaches. */
- private readonly handleHoverHandles = new Map<HTMLElement, TooltipHandle>();
+ private readonly handleHoverHandles = new Map<HTMLElement, HintHandle>();
public init(): void {
this.editor.commands.add("collapsible", new CollapsibleCommand(this.editor));
@@ -105,8 +105,8 @@ export default class CollapsibleEditing extends Plugin {
this.registerDomListeners();
this.registerAutoOpenNewDetails();
this.registerPostFixers();
- this.registerSummaryTooltips();
- this.registerHandleTooltips();
+ this.registerSummaryHints();
+ this.registerHandleHints();
}
public override destroy(): void {
@@ -129,14 +129,14 @@ export default class CollapsibleEditing extends Plugin {
this.summaryCaretHandle?.dispose();
this.summaryCaretHandle = undefined;
this.summaryCaretDom = undefined;
- this.summaryTooltipManager?.destroy();
- this.summaryTooltipManager = undefined;
+ this.summaryHintManager?.destroy();
+ this.summaryHintManager = undefined;
for (const handle of this.handleHoverHandles.values()) {
handle.dispose();
}
this.handleHoverHandles.clear();
- this.handleTooltipManager?.destroy();
- this.handleTooltipManager = undefined;
+ this.handleHintManager?.destroy();
+ this.handleHintManager = undefined;
this.dragHandle?.cancel();
this.preserveOpenOnNextInsert.clear();
super.destroy();
@@ -825,27 +825,27 @@ export default class CollapsibleEditing extends Plugin {
}
// -----------------------------------------------------------------
- // Summary tooltip (screen-corner hint) — driven by EditorTooltipManager
+ // Summary hint (screen-corner popup) — driven by ContentHintManager
// -----------------------------------------------------------------
/**
- * Attach a manager-mediated hover tooltip to every <summary> DOM element,
+ * Attach a manager-mediated hover hint to every <summary> DOM element,
* plus a caret-driven handle that follows the model selection into and
* out of summaries. Hover on the summary the caret currently owns is a
* no-op (same coordination rule as the todo-list multistate plugin), so
* the two flows can never race the same popup.
*/
- private registerSummaryTooltips() {
+ private registerSummaryHints() {
const editor = this.editor;
const t = this.translate();
const title = t("text-editor.collapsible-tooltip", {
shortcut: getEnvKeystrokeText("Ctrl+Enter")
});
- const manager = new EditorTooltipManager({
+ const manager = new ContentHintManager({
tooltipOptions: { customClass: "text-editor-content-tooltip" },
- autoHideAfterMs: TOOLTIP_AUTO_HIDE_MS
+ autoHideAfterMs: HINT_AUTO_HIDE_MS
});
- this.summaryTooltipManager = manager;
+ this.summaryHintManager = manager;
this.listenTo(editor.editing.view, "render", () => {
// Reap handles whose <summary> CKEditor has detached.
@@ -873,7 +873,7 @@ export default class CollapsibleEditing extends Plugin {
const ownedByCaret = () => this.summaryCaretDom === summary;
summary.addEventListener("mouseenter", () => {
if (ownedByCaret()) return;
- handle.showAfter(TOOLTIP_DWELL_MS);
+ handle.showAfter(HINT_DWELL_MS);
});
summary.addEventListener("mouseleave", () => {
if (ownedByCaret()) return;
@@ -884,7 +884,7 @@ export default class CollapsibleEditing extends Plugin {
});
// The caret moving into a <summary> doesn't fire DOM focus (the editable
- // root keeps focus), so a hover-only tooltip would miss keyboard-into-summary
+ // root keeps focus), so a hover-only hint would miss keyboard-into-summary
// navigation. Push a caret handle on selection changes to cover it.
this.listenTo(editor.model.document.selection, "change:range", () => {
const summaryModel = editor.model.document.selection.getFirstPosition()?.findAncestor("summary");
@@ -906,18 +906,18 @@ export default class CollapsibleEditing extends Plugin {
}
/**
- * Attach a manager-mediated hover tooltip to each drag handle. Handles
+ * Attach a manager-mediated hover hint to each drag handle. Drag handles
* use default near-element Bootstrap placement (no screen-corner CSS),
* so they live in their own manager with plain `tooltipOptions`.
*/
- private registerHandleTooltips() {
+ private registerHandleHints() {
const editor = this.editor;
const t = this.translate();
const title = t("text-editor.collapsible-handle-tooltip");
- const manager = new EditorTooltipManager({
- autoHideAfterMs: TOOLTIP_AUTO_HIDE_MS
+ const manager = new ContentHintManager({
+ autoHideAfterMs: HINT_AUTO_HIDE_MS
});
- this.handleTooltipManager = manager;
+ this.handleHintManager = manager;
this.listenTo(editor.editing.view, "render", () => {
for (const [dragHandle, handle] of this.handleHoverHandles) {
@@ -932,7 +932,7 @@ export default class CollapsibleEditing extends Plugin {
if (this.handleHoverHandles.has(dragHandle)) continue;
const handle = manager.createHandle(dragHandle, title);
this.handleHoverHandles.set(dragHandle, handle);
- dragHandle.addEventListener("mouseenter", () => handle.showAfter(TOOLTIP_DWELL_MS));
+ dragHandle.addEventListener("mouseenter", () => handle.showAfter(HINT_DWELL_MS));
dragHandle.addEventListener("mouseleave", () => handle.hide());
}
});
diff --git a/packages/ckeditor5-utils/src/editor_tooltip_manager.spec.ts b/packages/ckeditor5-utils/src/content_hint_manager.spec.ts
similarity index 95%
rename from packages/ckeditor5-utils/src/editor_tooltip_manager.spec.ts
rename to packages/ckeditor5-utils/src/content_hint_manager.spec.ts
index d156774bea..840e46abba 100644
--- a/packages/ckeditor5-utils/src/editor_tooltip_manager.spec.ts
+++ b/packages/ckeditor5-utils/src/content_hint_manager.spec.ts
@@ -1,7 +1,7 @@
import { Tooltip } from "bootstrap";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
-import { EditorTooltipManager, type TooltipHandle } from "./editor_tooltip_manager.js";
+import { ContentHintManager, type HintHandle } from "./content_hint_manager.js";
/**
* The visible `.tooltip` popup that Bootstrap adds to the body when a tooltip
@@ -17,11 +17,11 @@ function livePopupText(): string | null {
return livePopup()?.textContent?.trim() ?? null;
}
-describe("EditorTooltipManager", () => {
+describe("ContentHintManager", () => {
let host: HTMLDivElement;
let a: HTMLButtonElement;
let b: HTMLButtonElement;
- let manager: EditorTooltipManager;
+ let manager: ContentHintManager;
beforeEach(() => {
host = document.createElement("div");
@@ -32,7 +32,7 @@ describe("EditorTooltipManager", () => {
host.appendChild(a);
host.appendChild(b);
document.body.appendChild(host);
- manager = new EditorTooltipManager();
+ manager = new ContentHintManager();
});
afterEach(() => {
@@ -220,7 +220,7 @@ describe("EditorTooltipManager", () => {
describe("tooltip options", () => {
it("applies the base options to every popup", () => {
- const scoped = new EditorTooltipManager({
+ const scoped = new ContentHintManager({
tooltipOptions: { customClass: "test-scope" }
});
const handle = scoped.createHandle(a, "hello");
@@ -230,7 +230,7 @@ describe("EditorTooltipManager", () => {
});
it("uses `manual` trigger regardless of what the caller passes", () => {
- const scoped = new EditorTooltipManager({
+ const scoped = new ContentHintManager({
tooltipOptions: { trigger: "hover" as Tooltip.Options["trigger"] }
});
const handle = scoped.createHandle(a, "hello");
@@ -257,8 +257,8 @@ describe("EditorTooltipManager", () => {
describe("handle usage patterns", () => {
it("supports independent hover + caret handles on the same element without flicker", () => {
// Simulate the multistate plugin's hover + caret pair on one checkbox.
- const hover: TooltipHandle = manager.createHandle(a, "content");
- const caret: TooltipHandle = manager.createHandle(a, "content");
+ const hover: HintHandle = manager.createHandle(a, "content");
+ const caret: HintHandle = manager.createHandle(a, "content");
caret.show();
expect(livePopupText()).toBe("content");
@@ -277,11 +277,11 @@ describe("EditorTooltipManager", () => {
describe("autoHideAfterMs", () => {
// Each test manages its own manager instance so the outer `manager`
// (no auto-hide) isn't polluted with a timer that could interfere.
- let autoManager: EditorTooltipManager;
+ let autoManager: ContentHintManager;
beforeEach(() => {
vi.useFakeTimers();
- autoManager = new EditorTooltipManager({ autoHideAfterMs: 1000 });
+ autoManager = new ContentHintManager({ autoHideAfterMs: 1000 });
});
afterEach(() => {
diff --git a/packages/ckeditor5-utils/src/editor_tooltip_manager.ts b/packages/ckeditor5-utils/src/content_hint_manager.ts
similarity index 88%
rename from packages/ckeditor5-utils/src/editor_tooltip_manager.ts
rename to packages/ckeditor5-utils/src/content_hint_manager.ts
index def2e906fc..149c0d381b 100644
--- a/packages/ckeditor5-utils/src/editor_tooltip_manager.ts
+++ b/packages/ckeditor5-utils/src/content_hint_manager.ts
@@ -7,7 +7,7 @@ import { Tooltip } from "bootstrap";
* but a fade transition disposed mid-flight will still fire its scheduled
* transitionend handler, which walks into `_isWithActiveTrigger` and crashes
* with `TypeError: Cannot convert undefined or null to object`. We hit this
- * whenever the manager disposes the current tooltip before an in-progress
+ * whenever the manager disposes the current popup before an in-progress
* fade completes (e.g. a fresh push targets a different element, or the
* manager is destroyed with a fade queued).
*
@@ -19,13 +19,13 @@ import { Tooltip } from "bootstrap";
{
const proto = Tooltip.prototype as unknown as {
dispose(): void;
- __editorTooltipManagerDisposePatched?: true;
+ __contentHintManagerDisposePatched?: true;
};
/* v8 ignore next -- the "already-patched" branch is unreachable in a
single-process test run: the module loads exactly once and the flag is
unset. The guard exists so the client's own copy of the patch (see
`apps/client/src/widgets/react/hooks.tsx`) can co-exist with this one. */
- if (!proto.__editorTooltipManagerDisposePatched) {
+ if (!proto.__contentHintManagerDisposePatched) {
const originalDispose = proto.dispose;
const disposedPlaceholder = {
activeTrigger: {} as Record<string, boolean>,
@@ -47,20 +47,20 @@ import { Tooltip } from "bootstrap";
self._element = disposedPlaceholder.element;
self._config = disposedPlaceholder.config;
};
- proto.__editorTooltipManagerDisposePatched = true;
+ proto.__contentHintManagerDisposePatched = true;
}
}
/**
- * A tooltip request registered with an {@link EditorTooltipManager}. Any number
- * of independent handles (hover, caret, keyboard-focus …) can be created and
- * pushed onto the manager's visibility stack independently; only the top of the
- * stack is actually rendered, and popping it reveals whatever was pushed
+ * A hint request registered with a {@link ContentHintManager}. Any number of
+ * independent handles (hover, caret, keyboard-focus …) can be created and
+ * pushed onto the manager's visibility stack independently; only the top of
+ * the stack is actually rendered, and popping it reveals whatever was pushed
* underneath.
*
* All methods are safe to call after {@link dispose}, in any order.
*/
-export interface TooltipHandle {
+export interface HintHandle {
/**
* Push this handle onto the visibility stack. If it's already on the stack,
* move it to the top. Cancels any pending {@link showAfter}. No-op if the
@@ -72,7 +72,7 @@ export interface TooltipHandle {
* {@link dispose}, or {@link show} before the timer fires, the pending
* timer is cancelled. Calling {@link showAfter} again resets the timer.
* Used for the hover / caret dwell delay so brief flyovers don't pop the
- * tooltip.
+ * hint.
*/
showAfter(ms: number): void;
/**
@@ -92,18 +92,18 @@ export interface TooltipHandle {
dispose(): void;
}
-export interface EditorTooltipManagerOptions {
+export interface ContentHintManagerOptions {
/**
- * Bootstrap Tooltip config applied to every popup this manager creates.
- * `trigger` is always forced to `"manual"` because the stack, not Bootstrap's
- * hover/focus event bindings, decides when a tooltip is visible. `html` is
- * always forced to `true`.
+ * Bootstrap Tooltip config applied to the popup this manager renders each
+ * hint into. `trigger` is always forced to `"manual"` because the stack,
+ * not Bootstrap's hover/focus event bindings, decides when a hint is
+ * visible. `html` is always forced to `true`.
*/
tooltipOptions?: Partial<Tooltip.Options>;
/**
- * If set, the visible tooltip is auto-popped after this many milliseconds
- * of manager inactivity. Every push, content update, or top-change resets
- * the timer, so the tooltip stays up as long as *something* is happening;
+ * If set, the visible hint is auto-popped after this many milliseconds of
+ * manager inactivity. Every push, content update, or top-change resets
+ * the timer, so the hint stays up as long as *something* is happening;
* once events stop, it dismisses itself. When it pops, whatever was
* underneath in the stack becomes visible (and starts its own timer).
* `null` / `undefined` disables auto-hide.
@@ -112,19 +112,23 @@ export interface EditorTooltipManagerOptions {
}
interface StackEntry {
- handle: TooltipHandle;
+ handle: HintHandle;
element: HTMLElement;
content: string;
}
/**
- * Stack-based coordinator for tooltips in an editor. Solves two long-standing
- * problems the per-source event-binding approach has:
+ * Stack-based coordinator for content-area hints in an editor — the popup
+ * bubbles that document the affordance under the caret or pointer (task
+ * state, collapsible-summary shortcut, drag-handle hint, …). Scoped to the
+ * editor's content; toolbar/status tooltips are unrelated.
*
- * - **Overlap**: hover and caret sources racing to show/hide the same tooltip
+ * Solves two long-standing problems the per-source event-binding approach has:
+ *
+ * - **Overlap**: hover and caret sources racing to show/hide the same hint
* end up flickering as each source's Bootstrap listeners fight the other's
* manual `show()`/`hide()` calls.
- * - **Unwanted teardown**: a source hiding "its" tooltip while a different
+ * - **Unwanted teardown**: a source hiding "its" hint while a different
* source still wants it visible (mouse leaves the checkbox while the caret
* is still inside its item) blanks the popup unnecessarily.
*
@@ -132,7 +136,7 @@ interface StackEntry {
* every push/pop through {@link _render}, so exactly one popup is on screen at
* a time and switches are atomic.
*/
-export class EditorTooltipManager {
+export class ContentHintManager {
private _stack: StackEntry[] = [];
private _currentElement: HTMLElement | null = null;
@@ -151,18 +155,18 @@ export class EditorTooltipManager {
*/
private _destroyed = false;
- constructor(options: EditorTooltipManagerOptions = {}) {
+ constructor(options: ContentHintManagerOptions = {}) {
this._baseOptions = options.tooltipOptions ?? {};
this._autoHideAfterMs = options.autoHideAfterMs ?? null;
}
/**
- * Register a tooltip on `element`. The returned handle is persistent — the
+ * Register a hint on `element`. The returned handle is persistent — the
* caller pushes it on/off the visibility stack at will via `show()`/`hide()`.
* Call `dispose()` when the source is done with it (e.g. the element was
* removed from the DOM).
*/
- createHandle(element: HTMLElement, initialContent: string): TooltipHandle {
+ createHandle(element: HTMLElement, initialContent: string): HintHandle {
// Content lives in the closure so `setContent` can update it lazily —
// the stack entry (if any) will pick up the new value from the closure
// through `_render()`'s next content sync.
@@ -176,7 +180,7 @@ export class EditorTooltipManager {
}
};
const self = this;
- const handle: TooltipHandle = {
+ const handle: HintHandle = {
show(): void {
cancelPending();
if (!currentElement.isConnected) {
@@ -231,7 +235,7 @@ export class EditorTooltipManager {
this._stack.length = 0;
}
- private _pushOrMoveTop(handle: TooltipHandle, element: HTMLElement, content: string): void {
+ private _pushOrMoveTop(handle: HintHandle, element: HTMLElement, content: string): void {
// The choke point for every path that could add or resurface an entry —
// fresh `show()`, `showAfter` timer fire, `show()` on a re-used handle.
// Gating here keeps handles inert after {@link destroy}.
@@ -250,7 +254,7 @@ export class EditorTooltipManager {
this._render();
}
- private _removeEntry(handle: TooltipHandle): void {
+ private _removeEntry(handle: HintHandle): void {
const idx = this._stack.findIndex(e => e.handle === handle);
if (idx < 0) {
return;
@@ -326,7 +330,7 @@ export class EditorTooltipManager {
/**
* (Re)start the auto-hide countdown. Called after every `_render` that
* leaves state stable, so any push / setContent / re-order effectively
- * "keeps the tooltip alive" for another `_autoHideAfterMs` ms. When the
+ * "keeps the hint alive" for another `_autoHideAfterMs` ms. When the
* countdown fires it pops the current top; if nothing else is on the
* stack it fades the popup out (via {@link _hideWithTransition}),
* otherwise it delegates to `_render` for the swap.
@@ -370,7 +374,7 @@ export class EditorTooltipManager {
}
/**
- * Play Bootstrap's built-in fade-out transition on the current tooltip and
+ * Play Bootstrap's built-in fade-out transition on the current popup and
* dispose it once the fade completes. Interruption-safe: a push arriving
* mid-fade cancels the cleanup via {@link _cancelPendingHide}, so the
* partly-faded popup can be re-shown in place instead of blinked out.
@@ -390,7 +394,7 @@ export class EditorTooltipManager {
const onHidden = () => {
element.removeEventListener("hidden.bs.tooltip", onHidden);
this._pendingHideCleanup = null;
- // If we're still the current tooltip (no interrupting push landed)
+ // If we're still the current popup (no interrupting push landed)
// then dispose ourselves and reset state.
/* v8 ignore next -- the false branch (currentTooltip changed while
the fade was in flight) is defensively unreachable: every
@@ -415,7 +419,7 @@ export class EditorTooltipManager {
/**
* Cancel a pending fade-out (if any). Returns `true` if a fade was actually
- * cancelled — callers use that to re-`show()` the tooltip so it isn't left
+ * cancelled — callers use that to re-`show()` the popup so it isn't left
* mid-transition with the `show` class removed.
*/
private _cancelPendingHide(): boolean {
diff --git a/packages/ckeditor5-utils/src/index.ts b/packages/ckeditor5-utils/src/index.ts
index a3620b428d..c2f564fb0d 100644
--- a/packages/ckeditor5-utils/src/index.ts
+++ b/packages/ckeditor5-utils/src/index.ts
@@ -1 +1 @@
-export { EditorTooltipManager, type EditorTooltipManagerOptions, type TooltipHandle } from "./editor_tooltip_manager.js";
+export { ContentHintManager, type ContentHintManagerOptions, type HintHandle } from "./content_hint_manager.js";
diff --git a/packages/ckeditor5/src/plugins/todo_list_multistate/todo_list_multistate_editing.ts b/packages/ckeditor5/src/plugins/todo_list_multistate/todo_list_multistate_editing.ts
index 29a79bdd9e..9dd270569c 100644
--- a/packages/ckeditor5/src/plugins/todo_list_multistate/todo_list_multistate_editing.ts
+++ b/packages/ckeditor5/src/plugins/todo_list_multistate/todo_list_multistate_editing.ts
@@ -2,7 +2,7 @@ import { DEFAULT_TASK_STATES, DONE_STATE_NAME, formatShortcut, isAnchorState, jo
import { Command, env, ListEditing, Plugin, TodoList, type Editor, type ModelElement, type ViewElement } from "ckeditor5";
import { onTodoRowSplit } from "../todo_list_uncheck_on_enter.js";
-import { EditorTooltipManager, type TooltipHandle } from "@triliumnext/ckeditor5-utils";
+import { ContentHintManager, type HintHandle } from "@triliumnext/ckeditor5-utils";
/**
* Dwell delay before a hover or a stationary caret pops the checkbox tooltip.
@@ -38,15 +38,15 @@ export default class TodoListMultistateEditing extends Plugin {
}
/**
- * Shared tooltip stack. One hover handle per rendered checkbox plus one
- * caret handle (moved between checkboxes as the caret does) push/pop
+ * Shared content-hint stack. One hover handle per rendered checkbox plus
+ * one caret handle (moved between checkboxes as the caret does) push/pop
* against it — only the top of the stack is on screen at a time. See
- * {@link EditorTooltipManager} for the rationale.
+ * {@link ContentHintManager} for the rationale.
*/
- private _tooltipManager!: EditorTooltipManager;
+ private _hintManager!: ContentHintManager;
/** Hover-driven handle per rendered checkbox. Disposed when the checkbox detaches. */
- private readonly _hoverHandles = new Map<HTMLInputElement, TooltipHandle>();
+ private readonly _hoverHandles = new Map<HTMLInputElement, HintHandle>();
/**
* Last known task state per rendered checkbox — used to detect content-changing
@@ -56,7 +56,7 @@ export default class TodoListMultistateEditing extends Plugin {
private readonly _knownState = new Map<HTMLInputElement, string | null>();
/** Caret-driven handle, if the caret is currently inside a todo item. */
- private _caretHandle: TooltipHandle | null = null;
+ private _caretHandle: HintHandle | null = null;
/** DOM checkbox the caret handle is currently attached to. */
private _caretInput: HTMLInputElement | null = null;
@@ -83,7 +83,7 @@ export default class TodoListMultistateEditing extends Plugin {
this._translate = (editor.config.get("translate") as TranslateFn | undefined)
?? ((key: string) => key);
const stateByName = this._stateByName;
- this._tooltipManager = new EditorTooltipManager({
+ this._hintManager = new ContentHintManager({
tooltipOptions: {
// Bootstrap's default sanitizer strips `data-*` attributes, which
// the state-icon span in the tooltip relies on to render the
@@ -267,7 +267,7 @@ export default class TodoListMultistateEditing extends Plugin {
}
this._hoverHandles.clear();
this._knownState.clear();
- this._tooltipManager?.destroy();
+ this._hintManager?.destroy();
super.destroy();
}
@@ -308,7 +308,7 @@ export default class TodoListMultistateEditing extends Plugin {
this._knownState.set(input, currentState);
if (isNew) {
- const handle = this._tooltipManager.createHandle(input, this._computeContent(input));
+ const handle = this._hintManager.createHandle(input, this._computeContent(input));
this._hoverHandles.set(input, handle);
// Cache the enclosing item's id — stable for this input's life, and we
// need it on every hover event to decide whether to yield to the caret.
@@ -386,7 +386,7 @@ export default class TodoListMultistateEditing extends Plugin {
but then `_caretInput` was null too, so `inputChanged`
would be false and we wouldn't be in this branch. */
if (target) {
- this._caretHandle = this._tooltipManager.createHandle(target, this._computeContent(target));
+ this._caretHandle = this._hintManager.createHandle(target, this._computeContent(target));
this._caretHandle.show();
}
/* v8 ignore start -- reachable only when `forceShowIfSameTarget`
@@ -407,7 +407,7 @@ export default class TodoListMultistateEditing extends Plugin {
this._caretInput = target;
this._caretItemId = targetItemId;
if (target) {
- this._caretHandle = this._tooltipManager.createHandle(target, this._computeContent(target));
+ this._caretHandle = this._hintManager.createHandle(target, this._computeContent(target));
this._caretHandle.showAfter(TOOLTIP_DWELL_MS);
}
}