Editor: Extract Config to New Theme as a third Config action

This commit is contained in:
2026-06-12 18:16:15 +03:00
parent b193464f55
commit 0baac3c64b
4 changed files with 72 additions and 5 deletions
+8 -1
View File
@@ -28,6 +28,7 @@ import { openModal } from '../modals/ModalCoordinator';
import {
installSpecConfigActions,
runExtractConfig,
runExtractConfigToTheme,
runMergeChartTheme,
} from '../services/spec-config-actions';
import { useAppStore } from '../stores/AppStore';
@@ -160,6 +161,11 @@ const CONFIG_ACTIONS = [
label: 'Extract config from spec',
detail: 'Remove the config block and copy it to the clipboard',
},
{
value: 'extract-theme',
label: 'Extract config to new theme',
detail: 'Save the config block as a custom chart theme and select it',
},
] as const;
type ConfigActionId = (typeof CONFIG_ACTIONS)[number]['value'];
@@ -194,7 +200,8 @@ function EditorToolbar({
const editor = editorRef.current;
if (!editor) return;
if (action === 'merge') runMergeChartTheme(editor);
else void runExtractConfig(editor);
else if (action === 'extract') void runExtractConfig(editor);
else runExtractConfigToTheme(editor);
};
const handleRevert = async () => {