Browse Source

Fix page duplication when calling init.

master
Kevin Baensch 9 months ago
parent
commit
742a51b674
Signed by: derped GPG Key ID: C0F1D326C7626543
  1. 4
      berichtsheft/assets/js/notebook.js
  2. 2
      berichtsheft/index.html

4
berichtsheft/assets/js/notebook.js

@ -31,13 +31,14 @@ async function init() {
[...app.children].forEach(child => app.removeChild(child))
userdata.pages.forEach((e,i) => {
pageAdd(e.type);
pageNew(e.type);
populate(i+1);
})
}
function pageAdd(template) {
pageNew(template);
userdata.pages.push(emptyPages[template]);
populate(app.children.length);
}
@ -46,7 +47,6 @@ function pageNew(template) {
node.children[0].id = `Page-${app.children.length+1}`;
app.appendChild(node);
fixPageCount();
userdata.pages.push(emptyPages[template])
}
function populate(pnum) {

2
berichtsheft/index.html

@ -8,7 +8,7 @@
<title>Mein Berichtsheft</title>
</head>
<body>
<div id="overlay" onclick="hideOverlay();">
<div id="overlay" onclick="hideOverlay();" ondrop="ignoreData(event);" ondragover="ignoreData(event);">
<div class="box" onclick="ignoreData(event)">
<div id="import" ondrop="importData(event);" ondragover="ignoreData(event);"></div>
</div>

Loading…
Cancel
Save