mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
enhance editor bubble menu
This commit is contained in:
@@ -355,6 +355,8 @@
|
|||||||
"Insert current date": "Insert current date",
|
"Insert current date": "Insert current date",
|
||||||
"Draw and sketch excalidraw diagrams": "Draw and sketch excalidraw diagrams",
|
"Draw and sketch excalidraw diagrams": "Draw and sketch excalidraw diagrams",
|
||||||
"Multiple": "Multiple",
|
"Multiple": "Multiple",
|
||||||
|
"Turn into": "Turn into",
|
||||||
|
"Text align": "Text align",
|
||||||
"Heading {{level}}": "Heading {{level}}",
|
"Heading {{level}}": "Heading {{level}}",
|
||||||
"Toggle title": "Toggle title",
|
"Toggle title": "Toggle title",
|
||||||
"Write anything. Enter \"/\" for commands": "Write anything. Enter \"/\" for commands",
|
"Write anything. Enter \"/\" for commands": "Write anything. Enter \"/\" for commands",
|
||||||
|
|||||||
@@ -8,6 +8,10 @@
|
|||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
border: 1px solid
|
border: 1px solid
|
||||||
light-dark(var(--mantine-color-gray-3), var(--mantine-color-gray-8));
|
light-dark(var(--mantine-color-gray-3), var(--mantine-color-gray-8));
|
||||||
|
background-color: light-dark(
|
||||||
|
var(--mantine-color-white),
|
||||||
|
var(--mantine-color-dark-6)
|
||||||
|
);
|
||||||
|
|
||||||
> * {
|
> * {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
@@ -36,3 +40,14 @@
|
|||||||
border-right: 1px solid
|
border-right: 1px solid
|
||||||
light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-4)) !important;
|
light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-4)) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.divider {
|
||||||
|
width: 1px;
|
||||||
|
height: 16px;
|
||||||
|
align-self: center;
|
||||||
|
margin: 0 4px;
|
||||||
|
background-color: light-dark(
|
||||||
|
var(--mantine-color-gray-3),
|
||||||
|
var(--mantine-color-dark-3)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -168,17 +168,20 @@ export const EditorBubbleMenu: FC<EditorBubbleMenuProps> = (props) => {
|
|||||||
>
|
>
|
||||||
<div className={classes.bubbleMenu}>
|
<div className={classes.bubbleMenu}>
|
||||||
{isGenerativeAiEnabled && (
|
{isGenerativeAiEnabled && (
|
||||||
<Button
|
<>
|
||||||
variant="default"
|
<Button
|
||||||
className={clsx(classes.buttonRoot)}
|
variant="default"
|
||||||
radius="0"
|
className={clsx(classes.buttonRoot)}
|
||||||
leftSection={<IconSparkles size={16} />}
|
radius="0"
|
||||||
onClick={() => {
|
leftSection={<IconSparkles size={16} />}
|
||||||
setShowAiMenu(true);
|
onClick={() => {
|
||||||
}}
|
setShowAiMenu(true);
|
||||||
>
|
}}
|
||||||
{t("Ask AI")}
|
>
|
||||||
</Button>
|
{t("Ask AI")}
|
||||||
|
</Button>
|
||||||
|
<div className={classes.divider} />
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
<NodeSelector
|
<NodeSelector
|
||||||
editor={props.editor}
|
editor={props.editor}
|
||||||
@@ -243,16 +246,18 @@ export const EditorBubbleMenu: FC<EditorBubbleMenuProps> = (props) => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ActionIcon
|
<Tooltip label={t(commentItem.name)} withArrow withinPortal={false}>
|
||||||
variant="default"
|
<ActionIcon
|
||||||
size="lg"
|
variant="default"
|
||||||
radius="6px"
|
size="lg"
|
||||||
aria-label={t(commentItem.name)}
|
radius="6px"
|
||||||
style={{ border: "none" }}
|
aria-label={t(commentItem.name)}
|
||||||
onClick={commentItem.command}
|
style={{ border: "none" }}
|
||||||
>
|
onClick={commentItem.command}
|
||||||
<IconMessage size={16} stroke={2} />
|
>
|
||||||
</ActionIcon>
|
<IconMessage size={16} stroke={2} />
|
||||||
|
</ActionIcon>
|
||||||
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
</BubbleMenu>
|
</BubbleMenu>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
IconListNumbers,
|
IconListNumbers,
|
||||||
IconTypography,
|
IconTypography,
|
||||||
} from "@tabler/icons-react";
|
} from "@tabler/icons-react";
|
||||||
import { Popover, Button, ScrollArea } from "@mantine/core";
|
import { Popover, Button, ScrollArea, Tooltip } from "@mantine/core";
|
||||||
import type { Editor } from "@tiptap/react";
|
import type { Editor } from "@tiptap/react";
|
||||||
import { useEditorState } from "@tiptap/react";
|
import { useEditorState } from "@tiptap/react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -133,16 +133,18 @@ export const NodeSelector: FC<NodeSelectorProps> = ({
|
|||||||
return (
|
return (
|
||||||
<Popover opened={isOpen} withArrow>
|
<Popover opened={isOpen} withArrow>
|
||||||
<Popover.Target>
|
<Popover.Target>
|
||||||
<Button
|
<Tooltip label={t("Turn into")} withArrow withinPortal={false} disabled={isOpen}>
|
||||||
className={classes.buttonRoot}
|
<Button
|
||||||
variant="default"
|
className={classes.buttonRoot}
|
||||||
style={{ border: "none", height: "34px" }}
|
variant="default"
|
||||||
radius="0"
|
style={{ border: "none", height: "34px" }}
|
||||||
rightSection={<IconChevronDown size={16} />}
|
radius="0"
|
||||||
onClick={() => setIsOpen(!isOpen)}
|
rightSection={<IconChevronDown size={16} />}
|
||||||
>
|
onClick={() => setIsOpen(!isOpen)}
|
||||||
{t(activeItem?.name)}
|
>
|
||||||
</Button>
|
{t(activeItem?.name)}
|
||||||
|
</Button>
|
||||||
|
</Tooltip>
|
||||||
</Popover.Target>
|
</Popover.Target>
|
||||||
|
|
||||||
<Popover.Dropdown>
|
<Popover.Dropdown>
|
||||||
|
|||||||
+13
-11
@@ -7,7 +7,7 @@ import {
|
|||||||
IconCheck,
|
IconCheck,
|
||||||
IconChevronDown,
|
IconChevronDown,
|
||||||
} from "@tabler/icons-react";
|
} from "@tabler/icons-react";
|
||||||
import { Popover, Button, ScrollArea, rem } from "@mantine/core";
|
import { Popover, Button, ScrollArea, Tooltip, rem } from "@mantine/core";
|
||||||
import type { Editor } from "@tiptap/react";
|
import type { Editor } from "@tiptap/react";
|
||||||
import { useEditorState } from "@tiptap/react";
|
import { useEditorState } from "@tiptap/react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -84,16 +84,18 @@ export const TextAlignmentSelector: FC<TextAlignmentProps> = ({
|
|||||||
return (
|
return (
|
||||||
<Popover opened={isOpen} withArrow>
|
<Popover opened={isOpen} withArrow>
|
||||||
<Popover.Target>
|
<Popover.Target>
|
||||||
<Button
|
<Tooltip label={t("Text align")} withArrow withinPortal={false} disabled={isOpen}>
|
||||||
variant="default"
|
<Button
|
||||||
style={{ border: "none", height: "34px" }}
|
variant="default"
|
||||||
px="5"
|
style={{ border: "none", height: "34px" }}
|
||||||
radius="0"
|
px="5"
|
||||||
rightSection={<IconChevronDown size={16} />}
|
radius="0"
|
||||||
onClick={() => setIsOpen(!isOpen)}
|
rightSection={<IconChevronDown size={16} />}
|
||||||
>
|
onClick={() => setIsOpen(!isOpen)}
|
||||||
<activeItem.icon style={{ width: rem(16) }} stroke={2} />
|
>
|
||||||
</Button>
|
<activeItem.icon style={{ width: rem(16) }} stroke={2} />
|
||||||
|
</Button>
|
||||||
|
</Tooltip>
|
||||||
</Popover.Target>
|
</Popover.Target>
|
||||||
|
|
||||||
<Popover.Dropdown>
|
<Popover.Dropdown>
|
||||||
|
|||||||
Reference in New Issue
Block a user