fix(launch_bar): escaped HTML in tooltip

This commit is contained in:
Elian Doran 2025-12-24 12:28:31 +02:00
parent f67e06c8b2
commit 81c55aab72
No known key found for this signature in database
2 changed files with 11 additions and 10 deletions

View File

@ -1,8 +1,9 @@
import { useCallback } from "preact/hooks";
import appContext from "../../components/app_context";
import FNote from "../../entities/fnote";
import link_context_menu from "../../menus/link_context_menu";
import { escapeHtml, isCtrlKey } from "../../services/utils";
import { isCtrlKey } from "../../services/utils";
import { useGlobalShortcut, useNoteLabel } from "../react/hooks";
import { LaunchBarActionButton, useLauncherIconAndTitle } from "./launch_bar_widgets";
@ -26,7 +27,7 @@ export function CustomNoteLauncher({ launcherNote, getTargetNoteId, getHoistedNo
const ctrlKey = isCtrlKey(evt);
if ((evt.which === 1 && ctrlKey) || evt.which === 2) {
const activate = evt.shiftKey ? true : false;
const activate = !!evt.shiftKey;
await appContext.tabManager.openInNewTab(targetNoteId, hoistedNoteIdWithDefault, activate);
} else {
await appContext.tabManager.openInSameTab(targetNoteId);
@ -40,7 +41,7 @@ export function CustomNoteLauncher({ launcherNote, getTargetNoteId, getHoistedNo
return (
<LaunchBarActionButton
icon={icon}
text={escapeHtml(title)}
text={title}
onClick={launch}
onAuxClick={launch}
onContextMenu={async evt => {
@ -51,5 +52,5 @@ export function CustomNoteLauncher({ launcherNote, getTargetNoteId, getHoistedNo
}
}}
/>
)
);
}

View File

@ -1,17 +1,17 @@
import { createContext } from "preact";
import { useContext } from "preact/hooks";
import FNote from "../../entities/fnote";
import { escapeHtml } from "../../services/utils";
import ActionButton, { ActionButtonProps } from "../react/ActionButton";
import Dropdown, { DropdownProps } from "../react/Dropdown";
import { useNoteLabel, useNoteProperty } from "../react/hooks";
import Icon from "../react/Icon";
import { useContext } from "preact/hooks";
export const LaunchBarContext = createContext<{
isHorizontalLayout: boolean;
}>({
isHorizontalLayout: false
})
});
export interface LauncherNoteProps {
/** The corresponding {@link FNote} of type {@code launcher} in the hidden subtree of this launcher. Generally this launcher note holds information about the launcher via labels and relations, but also the title and the icon of the launcher. Not to be confused with the target note, which is specific to some launchers. */
@ -28,7 +28,7 @@ export function LaunchBarActionButton(props: Omit<ActionButtonProps, "className"
titlePosition={isHorizontalLayout ? "bottom" : "right"}
{...props}
/>
)
);
}
export function LaunchBarDropdownButton({ children, icon, dropdownOptions, ...props }: Pick<DropdownProps, "title" | "children" | "onShown" | "dropdownOptions" | "dropdownRef"> & { icon: string }) {
@ -50,7 +50,7 @@ export function LaunchBarDropdownButton({ children, icon, dropdownOptions, ...pr
}}
{...props}
>{children}</Dropdown>
)
);
}
export function useLauncherIconAndTitle(note: FNote) {
@ -62,6 +62,6 @@ export function useLauncherIconAndTitle(note: FNote) {
return {
icon: note.getIcon(),
title: escapeHtml(title ?? "")
title: title ?? ""
};
}