mirror of
https://github.com/docmost/docmost.git
synced 2026-05-21 01:04:39 +08:00
hide columns menu when some nodes are focused
This commit is contained in:
@@ -67,10 +67,20 @@ export function ColumnsMenu({ editor }: EditorMenuProps) {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [isCountOpen, setIsCountOpen] = useState(false);
|
const [isCountOpen, setIsCountOpen] = useState(false);
|
||||||
|
|
||||||
|
const nodesWithMenus = [
|
||||||
|
"callout",
|
||||||
|
"image",
|
||||||
|
"video",
|
||||||
|
"drawio",
|
||||||
|
"excalidraw",
|
||||||
|
"table",
|
||||||
|
];
|
||||||
|
|
||||||
const shouldShow = useCallback(
|
const shouldShow = useCallback(
|
||||||
({ state }: ShouldShowProps) => {
|
({ state }: ShouldShowProps) => {
|
||||||
if (!state) return false;
|
if (!state) return false;
|
||||||
if (!editor.isActive("columns")) return false;
|
if (!editor.isActive("columns")) return false;
|
||||||
|
if (nodesWithMenus.some((name) => editor.isActive(name))) return false;
|
||||||
|
|
||||||
const parent = findParentNode(
|
const parent = findParentNode(
|
||||||
(node: PMNode) => node.type.name === "columns",
|
(node: PMNode) => node.type.name === "columns",
|
||||||
|
|||||||
Reference in New Issue
Block a user