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

Olivier Hallot (via logerrit) logerrit at kemper.freedesktop.org
Mon Jan 20 20:07:27 UTC 2020


 help3/xhpeditor/autocomplete.js |    4 ++--
 help3/xhpeditor/index.php       |   13 +++++++++++--
 help3/xhpeditor/xhp2html.js     |   15 ++++-----------
 3 files changed, 17 insertions(+), 15 deletions(-)

New commits:
commit b969ccfcd8d52b8ab30d6730f689f3f047fa0793
Author:     Olivier Hallot <olivier.hallot at libreoffice.org>
AuthorDate: Mon Jan 20 16:59:22 2020 -0300
Commit:     Olivier Hallot <olivier.hallot at libreoffice.org>
CommitDate: Mon Jan 20 21:07:09 2020 +0100

    Fix autocomplete and add codemirror niceties
    
    - Fix autocomplete
    - add search feature
    - Add closetags
    - add jumptoline ...
    
    Change-Id: I4c59dc05484ba60522235509586d2a187eeb4d37
    Reviewed-on: https://gerrit.libreoffice.org/c/dev-tools/+/87103
    Reviewed-by: Olivier Hallot <olivier.hallot at libreoffice.org>
    Tested-by: Olivier Hallot <olivier.hallot at libreoffice.org>

diff --git a/help3/xhpeditor/autocomplete.js b/help3/xhpeditor/autocomplete.js
index d6804bc..5477c06 100644
--- a/help3/xhpeditor/autocomplete.js
+++ b/help3/xhpeditor/autocomplete.js
@@ -10,7 +10,7 @@
 
 // Here we define the schema for XHP, for the auto-completion
 
-var tags = {
+var xhptags = {
     "!top": ["helpdocument"],
     helpdocument: {
         children: ["meta", "body"],
@@ -159,7 +159,7 @@ function completeIfInTag(cm) {
     return completeAfter(cm, function() {
         var tok = cm.getTokenAt(cm.getCursor());
         if (tok.type == "string" && (!/['"]/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1)) return false;
-                         var inner = CodeMirror.innerMode(cm.getMode(), tok.state).state;
+        var inner = CodeMirror.innerMode(cm.getMode(), tok.state).state;
         return inner.tagName;
     });
 }
diff --git a/help3/xhpeditor/index.php b/help3/xhpeditor/index.php
index a05cba9..9f4266e 100644
--- a/help3/xhpeditor/index.php
+++ b/help3/xhpeditor/index.php
@@ -16,21 +16,30 @@ $xhp = $_POST["xhpdoc"];
 <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="DisplayArea.css">
     <link type="text/css" rel="stylesheet" href="lib/codemirror.css">
     <link type="text/css" rel="stylesheet" href="addon/hint/show-hint.css">
+    <link type="text/css" rel="stylesheet" href="addon/dialog/dialog.css">
+    <link type="text/css" rel="stylesheet" href="xhpeditor.css">
     <link type="text/css" rel="stylesheet" href="helpcontent2/help3xsl/normalize.css">
     <link type="text/css" rel="stylesheet" href="helpcontent2/help3xsl/prism.css">
+    <link type="text/css" rel="stylesheet" href="DisplayArea.css">
+    <link type="text/css" rel="stylesheet" href="addon/search/matchesonscrollbar.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/dialog/dialog.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/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="addon/search/search.js"></script>
+    <script type="application/javascript" src="addon/search/searchcursor.js"></script>
+    <script type="application/javascript" src="addon/search/jump-to-line.js"></script>
+    <script type="application/javascript" src="addon/search/matchesonscrollbar.js"></script>
+    <script type="application/javascript" src="addon/search/jump-to-line.js"></script>
+    <script type="application/javascript" src="addon/scroll/annotatescrollbar.js"></script>
     
     <script type="application/javascript" src="helpcontent2/help3xsl/prism.js"></script>
     <script type="application/javascript" src="autocomplete.js"></script>
diff --git a/help3/xhpeditor/xhp2html.js b/help3/xhpeditor/xhp2html.js
index 472ebd1..ef10256 100644
--- a/help3/xhpeditor/xhp2html.js
+++ b/help3/xhpeditor/xhp2html.js
@@ -10,29 +10,22 @@
 /* change these parameters to fit your installation */
 
 // Codemirror configuration 
+
 var editor = CodeMirror.fromTextArea(document.getElementById("xhpeditor"), {
     lineNumbers: true,
     theme: "default",
     mode: "xml",
     lineWrapping: true,
+    autoCloseTags: true,
     extraKeys: {
         "'<'": completeAfter,
         "'/'": completeIfAfterLt,
         "' '": completeIfInTag,
         "'='": completeIfInTag,
         "Ctrl-Space": "autocomplete"
-    }
+    },
+    hintOptions: {schemaInfo: xhptags}
 });
-/*
-    indentUnit: 4,
-    indentWithTabs: false,
-    
-    matchBrackets: true,
-    
-    
-    viewportMargin: Infinity,
-
-*/
 
 function readSingleFile(e) {
   var file = e.target.files[0];


More information about the Libreoffice-commits mailing list