summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan José González <juanjosegzl@libreoffice.org>2023-11-18 12:31:02 -0600
committerOlivier Hallot <olivier.hallot@libreoffice.org>2023-12-21 22:32:12 +0100
commite2748ae1560de92cd4502e574e5dc2521f43362a (patch)
tree552b41a3d4151704ef9700bb8824602a7d3ad515
parent149aa9a75e9d6950e80ea64e479655e500fb91be (diff)
Increase the size of editor and refresh preview when loading a file
Change-Id: If36ea157bdb67923cae1237d97a416b9b8b10635 Reviewed-on: https://gerrit.libreoffice.org/c/dev-tools/+/159637 Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org> Tested-by: Olivier Hallot <olivier.hallot@libreoffice.org>
-rw-r--r--help3/xhpeditor/menu.php2
-rw-r--r--help3/xhpeditor/xhp2html.js9
2 files changed, 10 insertions, 1 deletions
diff --git a/help3/xhpeditor/menu.php b/help3/xhpeditor/menu.php
index f9153849..ecfb4d80 100644
--- a/help3/xhpeditor/menu.php
+++ b/help3/xhpeditor/menu.php
@@ -118,7 +118,7 @@
<div class="dropdown">
<button class="dropbtn">Tools</button>
<div class="dropdown-content">
- <input type="submit" form="CMtextarea" name="render_page" value="Render page"/>
+ <input type="submit" form="CMtextarea" id="render_page" name="render_page" value="Render page"/>
<input type="submit" form="CMtextarea" name="get_patch" value="Generate patch"/>
<input type="submit" form="CMtextarea" name="check_xhp" value="Check XHP"/>
<input type="submit" form="CMtextarea" name="open_master" value="Open Master"/>
diff --git a/help3/xhpeditor/xhp2html.js b/help3/xhpeditor/xhp2html.js
index d92fb14c..930b451b 100644
--- a/help3/xhpeditor/xhp2html.js
+++ b/help3/xhpeditor/xhp2html.js
@@ -37,6 +37,9 @@ var editor = CodeMirror.fromTextArea(document.getElementById("xhpeditor"), {
hintOptions: {schemaInfo: this.xhptags}
});
+const height = window.innerHeight - document.getElementById('editorpageheader').offsetHeight - 16;
+editor.setSize(null, height);
+
function readSingleFile(e) {
var file = e.target.files[0];
@@ -48,6 +51,12 @@ function readSingleFile(e) {
var contents = e.target.result;
editor.doc.setValue(contents);
};
+
+ // Refresh preview when load hasd ended
+ reader.onloadend = function(e) {
+ document.getElementById("render_page").click();
+ }
+
reader.readAsText(file);
}