help3/xhpeditor/menu.php    |    2 +-
 help3/xhpeditor/xhp2html.js |    9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit e2748ae1560de92cd4502e574e5dc2521f43362a
Author:     Juan José González <juanjose...@libreoffice.org>
AuthorDate: Sat Nov 18 12:31:02 2023 -0600
Commit:     Olivier Hallot <olivier.hal...@libreoffice.org>
CommitDate: Thu Dec 21 22:32:12 2023 +0100

    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.hal...@libreoffice.org>
    Tested-by: Olivier Hallot <olivier.hal...@libreoffice.org>

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);
 }
 

Reply via email to