전략편집기 템플릿 탭 추가,수정, 삭제 기능 적용
This commit is contained in:
@@ -65,6 +65,23 @@ export function deleteUserStrategyTemplate(id: string): UserStrategyTemplate[] {
|
||||
return templates;
|
||||
}
|
||||
|
||||
export function updateUserStrategyTemplate(
|
||||
id: string,
|
||||
patch: Partial<Pick<UserStrategyTemplate, 'label' | 'description' | 'signal' | 'editorState' | 'orphans'>>,
|
||||
): UserStrategyTemplate[] {
|
||||
const templates = loadUserStrategyTemplates().map(t => {
|
||||
if (t.id !== id) return t;
|
||||
return {
|
||||
...t,
|
||||
...patch,
|
||||
...(patch.editorState != null ? { editorState: cloneJson(patch.editorState) } : null),
|
||||
...(patch.orphans != null ? { orphans: cloneJson(patch.orphans) } : null),
|
||||
};
|
||||
});
|
||||
saveUserStrategyTemplates(templates);
|
||||
return templates;
|
||||
}
|
||||
|
||||
export function loadHiddenBuiltinTemplateIds(): string[] {
|
||||
const raw = getUiPreferences().strategyEditor?.hiddenBuiltinTemplateIds;
|
||||
if (!Array.isArray(raw)) return [];
|
||||
|
||||
Reference in New Issue
Block a user