Prevent modification of notes directly
This commit is contained in:
parent
815e88cf18
commit
0ba0fa65f4
3 changed files with 51 additions and 19 deletions
|
|
@ -18,7 +18,7 @@ const ui = useUiStore();
|
|||
|
||||
function mkNote(text: string, ...children: string[]): Note {
|
||||
const note = notes.createNote(text);
|
||||
children.forEach((it) => note.children.push(it));
|
||||
for (const child of children) notes.addChild(note.id, child, -1);
|
||||
return note;
|
||||
}
|
||||
|
||||
|
|
@ -40,10 +40,13 @@ function createSomeNotes(): void {
|
|||
ui.pushAnchorId(root.id);
|
||||
|
||||
// Shuffle children of root
|
||||
root.children = root.children
|
||||
.map((it) => ({ it, rand: Math.random() }))
|
||||
.sort((a, b) => a.rand - b.rand)
|
||||
.map(({ it }) => it);
|
||||
notes.setChildren(
|
||||
root.id,
|
||||
root.children
|
||||
.map((it) => ({ it, rand: Math.random() }))
|
||||
.sort((a, b) => a.rand - b.rand)
|
||||
.map(({ it }) => it),
|
||||
);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue