mirror of
https://github.com/olehomelchenko/astrolabe.git
synced 2026-08-08 02:02:33 +00:00
Editor: Extract Config to New Theme as a third Config action
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user