[Libreoffice-commits] dev-tools.git: help3/xhpeditor

Olivier Hallot (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 16 02:06:59 UTC 2020


 help3/xhpeditor/favicon.ico   |binary
 help3/xhpeditor/index.php     |   13 ++++-----
 help3/xhpeditor/menu.php      |    2 -
 help3/xhpeditor/xhp2html.js   |   51 ++++++++++++++++++++++--------------
 help3/xhpeditor/xhpeditor.css |   59 ++++++++++++++++++++----------------------
 5 files changed, 68 insertions(+), 57 deletions(-)

New commits:
commit 3daeb789ecd347e128b6c11682f1d6d174651534
Author:     Olivier Hallot <olivier.hallot at libreoffice.org>
AuthorDate: Wed Jan 15 22:59:58 2020 -0300
Commit:     Olivier Hallot <olivier.hallot at libreoffice.org>
CommitDate: Thu Jan 16 03:06:40 2020 +0100

    xhpeditor: clear CSS and refactor
    
    Change-Id: I45da5bda3bd2e51367cb0cd7f61610174ba0317b
    Reviewed-on: https://gerrit.libreoffice.org/c/dev-tools/+/86898
    Reviewed-by: Olivier Hallot <olivier.hallot at libreoffice.org>
    Tested-by: Olivier Hallot <olivier.hallot at libreoffice.org>

diff --git a/help3/xhpeditor/favicon.ico b/help3/xhpeditor/favicon.ico
new file mode 100644
index 0000000..ee6560b
Binary files /dev/null and b/help3/xhpeditor/favicon.ico differ
diff --git a/help3/xhpeditor/index.php b/help3/xhpeditor/index.php
index 7e063e5..a174c6b 100644
--- a/help3/xhpeditor/index.php
+++ b/help3/xhpeditor/index.php
@@ -15,6 +15,7 @@ $xhp = $_POST["xhpdoc"];
 <head>
 <meta charset="utf-8"/>
     <title>LibreOffice Documentation XHP Editor</title>
+    <link rel="shortcut icon" href="favicon.ico"/>
     <link type="text/css" rel="stylesheet" href="xhpeditor.css">
     <link type="text/css" rel="stylesheet" href="lib/codemirror.css">
     <link type="text/css" rel="stylesheet" href="addon/hint/show-hint.css">
@@ -22,26 +23,26 @@ $xhp = $_POST["xhpdoc"];
     <link type="text/css" rel="stylesheet" href="helpcontent2/help3xsl/prism.css">
 
     <script type="application/javascript" src="lib/codemirror.js"></script>
+    <script type="application/javascript" src="mode/xml/xml.js"></script>
     <script type="application/javascript" src="addon/hint/show-hint.js"></script>
     <script type="application/javascript" src="addon/hint/xml-hint.js"></script>
     <script type="application/javascript" src="addon/edit/matchtags.js"></script>
-    <script type="application/javascript" src="addon/edit/closetags.js"></script>
-    <script type="application/javascript" src="mode/xml/xml.js"></script>
+    <script type="application/javascript" src="addon/edit/closetag.js"></script>
     <script type="application/javascript" src="addon/fold/xml-fold.js"></script>
     <script type="application/javascript" src="addon/fold/foldcode.js"></script>
     
     <script type="application/javascript" src="helpcontent2/help3xsl/prism.js"></script>
-    <script type="application/javascript" src="autocomplete.js" defer=""></script>
-    <script type="application/javascript" src="xhp2html.js" defer></script>
-    <script type="application/javascript" src="snippets.js" defer=""></script>
+    <script type="application/javascript" src="autocomplete.js"></script>
+    <script type="application/javascript" src="snippets.js"></script>
     <script type="application/javascript" src="DisplayArea.js"></script>
+    <script type="application/javascript" src="xhp2html.js" defer></script>
 </head>
 
 <body style="font-family:sans-serif;">
 <div id="leftside">
     <div id="editorpageheader">
         <h2>LibreOffice Documentation XHP Editor</h2>
-        <?php include './buttons.php';?>
+        <?php include './menu.php';?>
     </div>
     <div id="editortextarea">
         <form id="CMtextarea" method="post" action="index.php">
diff --git a/help3/xhpeditor/buttons.php b/help3/xhpeditor/menu.php
similarity index 98%
rename from help3/xhpeditor/buttons.php
rename to help3/xhpeditor/menu.php
index cd90f4e..ed6d4ac 100644
--- a/help3/xhpeditor/buttons.php
+++ b/help3/xhpeditor/menu.php
@@ -3,7 +3,7 @@
     <button class="dropbtn">File</button>
     <div class="dropdown-content">
     <input type="file" id="file-input" accept=".xhp" value="Open"/>
-    <a href="#" onclick="download(editor.getValue(),getFileNameFromXML(),'text/xml')">Save</a>
+    <a href="#" onclick="downloadFile(editor.getValue(),getFileNameFromXML(),'text/xml')">Save</a>
     </div>
   </div>
     <div class="dropdown">
diff --git a/help3/xhpeditor/xhp2html.js b/help3/xhpeditor/xhp2html.js
index 170b846..667ea06 100644
--- a/help3/xhpeditor/xhp2html.js
+++ b/help3/xhpeditor/xhp2html.js
@@ -9,6 +9,36 @@
 
 /* change these parameters to fit your installation */
 
+// Codemirror configuration 
+var editor = CodeMirror.fromTextArea(document.getElementById("xhpeditor"), {
+    lineNumbers: true,
+    theme: "default",
+    mode: "xml",
+    extraKeys: {
+        "'<'": completeAfter,
+        "'/'": completeIfAfterLt,
+        "' '": completeIfInTag,
+        "'='": completeIfInTag,
+        "Ctrl-Space": "autocomplete"
+    }
+});
+/*
+    indentUnit: 4,
+    indentWithTabs: false,
+    
+    matchBrackets: true,
+    
+    lineWrapping: true,
+    viewportMargin: Infinity,
+    extraKeys: {
+        "'<'": completeAfter,
+        "'/'": completeIfAfterLt,
+        "' '": completeIfInTag,
+        "'='": completeIfInTag,
+        "Ctrl-Space": "autocomplete"
+    }
+*/
+
 function readSingleFile(e) {
   var file = e.target.files[0];
 
@@ -36,7 +66,7 @@ function getFileNameFromXML(){
 
 // Function to download data to a file
 // source: https://stackoverflow.com/questions/13405129/javascript-create-and-save-file
-function download(data, filename, type) {
+function downloadFile(data, filename, type) {
     var file = new Blob([data], {type: type});
     if (window.navigator.msSaveOrOpenBlob) // IE10+
         window.navigator.msSaveOrOpenBlob(file, filename);
@@ -53,22 +83,3 @@ function download(data, filename, type) {
         }, 0); 
     }
 }
-
-// Codemirror configuration 
-var editor = CodeMirror.fromTextArea(document.getElementById("xhpeditor"), {
-    lineNumbers: true,
-    viewportMargin: Infinity,
-    indentUnit: 4,
-    indentWithTabs: false,
-    mode: "xml",
-    matchBrackets: true,
-    theme: "default",
-    lineWrapping: true,
-    extraKeys: {
-        "'<'": completeAfter,
-        "'/'": completeIfAfterLt,
-        "' '": completeIfInTag,
-        "'='": completeIfInTag,
-        "Ctrl-Space": "autocomplete"
-    }
-});
diff --git a/help3/xhpeditor/xhpeditor.css b/help3/xhpeditor/xhpeditor.css
index 251672e..273eaa9 100644
--- a/help3/xhpeditor/xhpeditor.css
+++ b/help3/xhpeditor/xhpeditor.css
@@ -90,40 +90,39 @@
 }
 
 #leftside{
-    top: 0%;
-    bottom:0%;
-    left:0%;
+    top: 0px;
+    bottom:0px;
+    left:0px;
     right:50%;
     position: absolute;
     background: Beige;
-    display:block;
     border:1px solid grey;
-    overflow: auto;
 }
 #editorpageheader{
-    top: 0%;
-    left: 0%;
+    top: 0px;
+    left: 0px;
+    right: 0px;
     position:absolute;
-    margin: 0px 10px 10px 10px;
+    margin: 0px 5px 5px 5px;
     z-index:100;
 }
 #editortextarea{
-    margin: 170px 10px 10px 10px;
-    left:0%;
-    right: 50%;
-    line-height: normal;
-    clear:right;
-    overflow: auto;
+    margin: 5px 5px 5px 5px;
+    left:0px;
+    right: 0px;
+    bottom:0px;
+    top:170px;
+    position:absolute;
 }
 #rightside{
-    top: 0%;
-    bottom:0%;
-    right:0%;
+    top: 0px;
+    bottom:0px;
+    right:0px;
     left: 50%;
     position:absolute;
     background: AliceBlue;
     border:1px solid grey;
-    overflow:auto;
+    overflow:hidden;
 }
 .systembuttons{
     float:left;
@@ -132,21 +131,21 @@
     float:right;
 }
 #renderedpageheader{
-    top: 0%;
-    right:0%;
-    left: 50%;
-    position:fixed;
-    margin: 0px 10px 10px 10px;
+    top: 0px;
+    right:0px;
+    left: 0px;
+    position:absolute;
+    margin: 5px 5px 5px 5px;
     background: AliceBlue;
 }
 #renderedpage {
-    background-color: gray;
-    margin: 100px 10px 10px 10px;
-    right:0%;
-    left: 50%;
-    line-height: normal;
-    clear:left;
-    overflow: auto;
+    margin: 5px 5px 5px 5px;
+    right:0px;
+    left: 0px;
+    top:120px;
+    bottom:0px;
+    position:absolute;
+    overflow-y:auto;
 }
 
 /* Imported from default css for DisplayArea */


More information about the Libreoffice-commits mailing list