Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

refactor: use toolbar presets from notesnook-editor

thecodrr70d3a3d08805
diff --git a/apps/web/src/common/toolbar-config.ts b/apps/web/src/common/toolbar-config.ts
index fd4f961ff..c421431a3 100644
--- a/apps/web/src/common/toolbar-config.ts
+++ b/apps/web/src/common/toolbar-config.ts
@@ -1,6 +1,8 @@
-import { DEFAULT_TOOLS, ToolbarGroupDefinition } from "notesnook-editor";
+import { getDefaultPresets, ToolbarGroupDefinition } from "notesnook-editor";
import { db } from "./db";
+const defaultPresets = getDefaultPresets();
+export const DEFAULT_TOOLS = defaultPresets.default;
export type PresetId = "default" | "minimal" | "custom";
export type Preset = {
id: PresetId;
@@ -9,21 +11,11 @@ export type Preset = {
editable?: boolean;
};
const presets: Record<PresetId, Preset> = {
- default: { id: "default", title: "Default", tools: DEFAULT_TOOLS },
+ default: { id: "default", title: "Default", tools: defaultPresets.default },
minimal: {
id: "minimal",
title: "Minimal",
- tools: [
- [
- "bold",
- "italic",
- "underline",
- "strikethrough",
- "code",
- "highlight",
- "textColor",
- ],
- ],
+ tools: defaultPresets.minimal,
},
custom: { id: "custom", title: "Custom", tools: [], editable: true },
};
diff --git a/apps/web/src/components/dialogs/toolbar-config-dialog.tsx b/apps/web/src/components/dialogs/toolbar-config-dialog.tsx
index 501c40a6c..6c84c538c 100644
--- a/apps/web/src/components/dialogs/toolbar-config-dialog.tsx
+++ b/apps/web/src/components/dialogs/toolbar-config-dialog.tsx
@@ -2,7 +2,6 @@ import { Button, Flex, FlexProps, Text } from "rebass";
import { Perform } from "../../common/dialog-controller";
import Dialog from "./dialog";
import {
- DEFAULT_TOOLS,
getAllTools,
getToolDefinition,
Icon,
@@ -36,6 +35,7 @@ import { Label, Radio } from "@rebass/forms";
import { db } from "../../common/db";
import { useToolbarConfig } from "../editor/context";
import {
+ DEFAULT_TOOLS,
getAllPresets,
getCurrentPreset,
getPreset,