2024-08-08 13:51:50 +05:30
|
|
|
// editor
|
|
|
|
|
import { TExtensions } from "@plane/editor";
|
|
|
|
|
// plane web hooks
|
|
|
|
|
import { useFlag } from "@/plane-web/hooks/store";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @description extensions disabled in various editors
|
|
|
|
|
*/
|
2024-08-11 11:47:26 +05:30
|
|
|
export const useEditorFlagging = (
|
|
|
|
|
workspaceSlug: string
|
|
|
|
|
): {
|
2024-08-08 13:51:50 +05:30
|
|
|
documentEditor: TExtensions[];
|
2024-11-27 14:08:27 +05:30
|
|
|
liteTextEditor: TExtensions[];
|
2024-08-08 13:51:50 +05:30
|
|
|
richTextEditor: TExtensions[];
|
|
|
|
|
} => {
|
2024-08-11 11:47:26 +05:30
|
|
|
const isIssueEmbedEnabled = useFlag(workspaceSlug, "PAGE_ISSUE_EMBEDS");
|
2024-08-21 13:35:55 +05:30
|
|
|
const isEditorAIOpsEnabled = useFlag(workspaceSlug, "EDITOR_AI_OPS");
|
2024-09-03 18:51:24 +05:30
|
|
|
const isCollaborationCursorEnabled = useFlag(workspaceSlug, "COLLABORATION_CURSOR");
|
2024-11-27 14:08:27 +05:30
|
|
|
const isCalloutComponentEnabled = useFlag(workspaceSlug, "EDITOR_CALLOUT_COMPONENT");
|
2024-08-08 13:51:50 +05:30
|
|
|
// extensions disabled in the document editor
|
|
|
|
|
const documentEditor: TExtensions[] = [];
|
2024-11-27 14:08:27 +05:30
|
|
|
const liteTextEditor: TExtensions[] = [];
|
|
|
|
|
const richTextEditor: TExtensions[] = [];
|
2024-08-08 13:51:50 +05:30
|
|
|
if (!isIssueEmbedEnabled) documentEditor.push("issue-embed");
|
2024-08-21 13:35:55 +05:30
|
|
|
if (!isEditorAIOpsEnabled) documentEditor.push("ai");
|
2024-09-03 18:51:24 +05:30
|
|
|
if (!isCollaborationCursorEnabled) documentEditor.push("collaboration-cursor");
|
2024-11-27 14:08:27 +05:30
|
|
|
if (!isCalloutComponentEnabled) {
|
|
|
|
|
documentEditor.push("callout");
|
|
|
|
|
liteTextEditor.push("callout");
|
|
|
|
|
richTextEditor.push("callout");
|
|
|
|
|
}
|
2024-08-08 13:51:50 +05:30
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
documentEditor,
|
2024-11-27 14:08:27 +05:30
|
|
|
liteTextEditor,
|
|
|
|
|
richTextEditor,
|
2024-08-08 13:51:50 +05:30
|
|
|
};
|
|
|
|
|
};
|