reset for example patterns
This commit is contained in:
parent
e01c6dc18d
commit
78f6fdf169
3 changed files with 14 additions and 66 deletions
|
|
@ -51,14 +51,14 @@ export function PatternsTab({ context }) {
|
|||
const examplePatterns = useMemo(() => examplePattern.getAll(), []);
|
||||
const activePattern = useActivePattern();
|
||||
const viewingPattern = useViewingPattern();
|
||||
const updateCodeWindow = (id, code) => {
|
||||
context.handleUpdate(id, code);
|
||||
const updateCodeWindow = (id, code, reset = false) => {
|
||||
context.handleUpdate(id, code, reset);
|
||||
};
|
||||
const onPatternBtnClick = (id, isExample = false) => {
|
||||
const code = isExample ? examplePatterns[id].code : userPatterns[id].code;
|
||||
|
||||
// display selected pattern code in the window
|
||||
updateCodeWindow(id, code);
|
||||
updateCodeWindow(id, code, isExample);
|
||||
};
|
||||
|
||||
const isExample = examplePatterns[viewingPattern] != null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue