Fix page duplication when calling init.
This commit is contained in:
parent
bec6cf04dd
commit
742a51b674
2 changed files with 3 additions and 3 deletions
|
@ -31,13 +31,14 @@ async function init() {
|
||||||
[...app.children].forEach(child => app.removeChild(child))
|
[...app.children].forEach(child => app.removeChild(child))
|
||||||
|
|
||||||
userdata.pages.forEach((e,i) => {
|
userdata.pages.forEach((e,i) => {
|
||||||
pageAdd(e.type);
|
pageNew(e.type);
|
||||||
populate(i+1);
|
populate(i+1);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function pageAdd(template) {
|
function pageAdd(template) {
|
||||||
pageNew(template);
|
pageNew(template);
|
||||||
|
userdata.pages.push(emptyPages[template]);
|
||||||
populate(app.children.length);
|
populate(app.children.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +47,6 @@ function pageNew(template) {
|
||||||
node.children[0].id = `Page-${app.children.length+1}`;
|
node.children[0].id = `Page-${app.children.length+1}`;
|
||||||
app.appendChild(node);
|
app.appendChild(node);
|
||||||
fixPageCount();
|
fixPageCount();
|
||||||
userdata.pages.push(emptyPages[template])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function populate(pnum) {
|
function populate(pnum) {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<title>Mein Berichtsheft</title>
|
<title>Mein Berichtsheft</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="overlay" onclick="hideOverlay();">
|
<div id="overlay" onclick="hideOverlay();" ondrop="ignoreData(event);" ondragover="ignoreData(event);">
|
||||||
<div class="box" onclick="ignoreData(event)">
|
<div class="box" onclick="ignoreData(event)">
|
||||||
<div id="import" ondrop="importData(event);" ondragover="ignoreData(event);"></div>
|
<div id="import" ondrop="importData(event);" ondragover="ignoreData(event);"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue