editor: make editor tools object a function

Required for string localization to work properly
This commit is contained in:
Ammar Ahmed
2026-04-10 12:27:54 +05:00
parent 74921ae1b3
commit 0535de9ae9

View File

@@ -21,7 +21,7 @@ import { ToolbarDefinition, ToolDefinition } from "./types.js";
import { ToolId } from "./tools/index.js";
import { strings } from "@notesnook/intl";
const tools: Record<ToolId, ToolDefinition> = {
const tools = (): Record<ToolId, ToolDefinition> => ({
none: {
icon: "none",
title: ""
@@ -356,14 +356,14 @@ const tools: Record<ToolId, ToolDefinition> = {
title: strings.exportCsv(),
conditional: true
}
};
});
export function getToolDefinition(id: ToolId) {
return tools[id];
return tools()[id];
}
export function getAllTools() {
return tools;
return tools();
}
export function getDefaultPresets() {