mirror of
https://github.com/docmost/docmost.git
synced 2026-08-27 08:47:06 +08:00
@@ -416,7 +416,9 @@ const TEMPLATE_EXCLUDED_SLASH_ITEMS = new Set([
|
||||
"Video",
|
||||
"File attachment",
|
||||
"Draw.io (diagrams.net)",
|
||||
"Excalidraw diagram",
|
||||
"Excalidraw (Whiteboard)",
|
||||
"Audio",
|
||||
"Synced block"
|
||||
]);
|
||||
|
||||
const TemplateSlashCommand = Command.configure({
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
IconSettings,
|
||||
IconStar,
|
||||
IconStarFilled,
|
||||
IconTemplate,
|
||||
IconTrash,
|
||||
} from "@tabler/icons-react";
|
||||
import {
|
||||
@@ -53,6 +54,10 @@ import {
|
||||
import { mobileSidebarAtom } from "@/components/layouts/global/hooks/atoms/sidebar-atom.ts";
|
||||
import { useToggleSidebar } from "@/components/layouts/global/hooks/hooks/use-toggle-sidebar.ts";
|
||||
import { searchSpotlight } from "@/features/search/constants";
|
||||
import TemplatePickerModal from "@/ee/template/components/template-picker-modal";
|
||||
import { useHasFeature } from "@/ee/hooks/use-feature";
|
||||
import { Feature } from "@/ee/features";
|
||||
import { ErrorBoundary } from "react-error-boundary";
|
||||
|
||||
export function SpaceSidebar() {
|
||||
const { t } = useTranslation();
|
||||
@@ -246,6 +251,11 @@ function SpaceMenu({
|
||||
useDisclosure(false);
|
||||
const [exportOpened, { open: openExportModal, close: closeExportModal }] =
|
||||
useDisclosure(false);
|
||||
const [
|
||||
templatePickerOpened,
|
||||
{ open: openTemplatePicker, close: closeTemplatePicker },
|
||||
] = useDisclosure(false);
|
||||
const hasTemplates = useHasFeature(Feature.TEMPLATES);
|
||||
|
||||
const { data: watchStatus } = useSpaceWatchStatusQuery(spaceId);
|
||||
const watchMutation = useWatchSpaceMutation();
|
||||
@@ -315,6 +325,18 @@ function SpaceMenu({
|
||||
{isWatching ? t("Stop watching space") : t("Watch space")}
|
||||
</Menu.Item>
|
||||
|
||||
{hasTemplates && canManagePages && (
|
||||
<>
|
||||
<Menu.Divider />
|
||||
<Menu.Item
|
||||
onClick={openTemplatePicker}
|
||||
leftSection={<IconTemplate size={16} />}
|
||||
>
|
||||
{t("Templates")}
|
||||
</Menu.Item>
|
||||
</>
|
||||
)}
|
||||
|
||||
{canManagePages && (
|
||||
<>
|
||||
<Menu.Divider />
|
||||
@@ -370,6 +392,16 @@ function SpaceMenu({
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
{hasTemplates && templatePickerOpened && (
|
||||
<ErrorBoundary fallbackRender={() => null}>
|
||||
<TemplatePickerModal
|
||||
opened={templatePickerOpened}
|
||||
onClose={closeTemplatePicker}
|
||||
initialSpaceId={spaceId}
|
||||
/>
|
||||
</ErrorBoundary>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user