word/edit: hide unset story or keep existing
[sheet.git] / writer.js
index 5d3ad5e782977c43e58213c03db6058f667a2015..6fc79ebcc19c8af97bd9e56164ff00154f0f49ee 100644 (file)
--- a/writer.js
+++ b/writer.js
@@ -40,8 +40,8 @@ document.addEventListener('DOMContentLoaded', () => {
                                // copy first paragraph to story
                                let wptext = json.parse.text['*'];
                                let storyinput = document.getElementById('story');
-                               if (storyinput && wptext) {
-                                       storyinput.innerHTML = wptext
+                               if (storyinput && !storyinput.value && wptext) {
+                                       storyinput.value = wptext
                                                .replace(/<h2.*/s, '') // prefix
                                                .replace(/<table.*?<\/table>/sg, '') // ignore infobox
                                                .match(/<p>(.*?)<\/p>/s)[0] // first paragraph