mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-18 14:56:59 +08:00
feat(workspace): add debug clear button
This commit is contained in:
@@ -7,6 +7,7 @@ export const useSettingFlags = () => {
|
||||
const booleanExportHtml = useFlag('BooleanExportHtml', false);
|
||||
const booleanExportPdf = useFlag('BooleanExportPdf', false);
|
||||
const booleanExportMarkdown = useFlag('BooleanExportMarkdown', false);
|
||||
const booleanClearWorkspace = useFlag('BooleanClearWorkspace', true);
|
||||
|
||||
return {
|
||||
booleanFullWidthChecked,
|
||||
@@ -15,6 +16,7 @@ export const useSettingFlags = () => {
|
||||
booleanExportHtml,
|
||||
booleanExportPdf,
|
||||
booleanExportMarkdown,
|
||||
booleanClearWorkspace,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
exportWorkspace,
|
||||
useWorkspaceAndPageId,
|
||||
useReadingMode,
|
||||
clearWorkspace,
|
||||
} from './util';
|
||||
|
||||
interface BaseSettingItem {
|
||||
@@ -134,6 +135,12 @@ export const useSettings = (): SettingItem[] => {
|
||||
onClick: () => exportWorkspace(),
|
||||
flag: 'booleanExportWorkspace',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
name: 'Clear Workspace',
|
||||
onClick: () => clearWorkspace(workspaceId),
|
||||
flag: 'booleanClearWorkspace',
|
||||
},
|
||||
];
|
||||
|
||||
return filterSettings(settings, settingFlags);
|
||||
|
||||
@@ -40,3 +40,12 @@ export const exportMarkdown = async ({
|
||||
const htmlContent = await clipboardParse.page2html();
|
||||
fileExporter.exportMarkdown(title, htmlContent);
|
||||
};
|
||||
|
||||
export const clearWorkspace = async ({
|
||||
workspaceId,
|
||||
rootBlockId,
|
||||
title,
|
||||
}: ExportHandlerProps) => {
|
||||
//@ts-ignore
|
||||
client.inspector().clear();
|
||||
};
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
export { duplicatePage } from './duplicate-page';
|
||||
export { exportHtml, exportMarkdown } from './handle-export';
|
||||
export { getPageTitle, usePageLastUpdated } from './get-page-info';
|
||||
export { importWorkspace, exportWorkspace } from './inspector-workspace';
|
||||
export {
|
||||
importWorkspace,
|
||||
exportWorkspace,
|
||||
clearWorkspace,
|
||||
} from './inspector-workspace';
|
||||
export { useWorkspaceAndPageId } from './use-workspace-page';
|
||||
export { useReadingMode } from './use-reading-mode';
|
||||
|
||||
Reference in New Issue
Block a user