Enhance delete button in context menu (#2591)
This commit is contained in:
parent
bfeb3c7dfd
commit
f919907855
@ -136,7 +136,7 @@ export const actionDeleteSelected = register({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
contextItemLabel: "labels.delete",
|
contextItemLabel: "labels.delete",
|
||||||
contextMenuOrder: 3,
|
contextMenuOrder: 999999,
|
||||||
keyTest: (event) => event.key === KEYS.BACKSPACE || event.key === KEYS.DELETE,
|
keyTest: (event) => event.key === KEYS.BACKSPACE || event.key === KEYS.DELETE,
|
||||||
PanelComponent: ({ elements, appState, updateData }) => (
|
PanelComponent: ({ elements, appState, updateData }) => (
|
||||||
<ToolButton
|
<ToolButton
|
||||||
|
@ -32,6 +32,13 @@
|
|||||||
|
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 0.2fr;
|
grid-template-columns: 1fr 0.2fr;
|
||||||
|
|
||||||
|
&.dangerous {
|
||||||
|
div:nth-child(1) {
|
||||||
|
color: $oc-red-7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
div:nth-child(1) {
|
div:nth-child(1) {
|
||||||
justify-self: start;
|
justify-self: start;
|
||||||
margin-inline-end: 20px;
|
margin-inline-end: 20px;
|
||||||
@ -46,6 +53,13 @@
|
|||||||
.context-menu-option:hover {
|
.context-menu-option:hover {
|
||||||
color: var(--popup-background-color);
|
color: var(--popup-background-color);
|
||||||
background-color: var(--select-highlight-color);
|
background-color: var(--select-highlight-color);
|
||||||
|
|
||||||
|
&.dangerous {
|
||||||
|
div:nth-child(1) {
|
||||||
|
color: var(--popup-background-color);
|
||||||
|
}
|
||||||
|
background-color: $oc-red-6;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.context-menu-option:focus {
|
.context-menu-option:focus {
|
||||||
|
@ -26,7 +26,6 @@ const ContextMenu = ({ options, onCloseRequest, top, left }: Props) => {
|
|||||||
const isDarkTheme = !!document
|
const isDarkTheme = !!document
|
||||||
.querySelector(".excalidraw")
|
.querySelector(".excalidraw")
|
||||||
?.classList.contains("Appearance_dark");
|
?.classList.contains("Appearance_dark");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={clsx("excalidraw", {
|
className={clsx("excalidraw", {
|
||||||
@ -45,7 +44,12 @@ const ContextMenu = ({ options, onCloseRequest, top, left }: Props) => {
|
|||||||
>
|
>
|
||||||
{options.map(({ action, shortcutName, label }, idx) => (
|
{options.map(({ action, shortcutName, label }, idx) => (
|
||||||
<li data-testid={shortcutName} key={idx} onClick={onCloseRequest}>
|
<li data-testid={shortcutName} key={idx} onClick={onCloseRequest}>
|
||||||
<button className="context-menu-option" onClick={action}>
|
<button
|
||||||
|
className={`context-menu-option ${
|
||||||
|
shortcutName === "delete" ? "dangerous" : ""
|
||||||
|
}`}
|
||||||
|
onClick={action}
|
||||||
|
>
|
||||||
<div>{label}</div>
|
<div>{label}</div>
|
||||||
<div>
|
<div>
|
||||||
{shortcutName
|
{shortcutName
|
||||||
|
Loading…
x
Reference in New Issue
Block a user