[Libreoffice-commits] dev-tools.git: help3/html
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sun Aug 5 18:18:27 UTC 2018
help3/html/index.html | 12 +++++++++++
help3/html/snippets.js | 53 ++++++++++++++++++++++++++++++-------------------
2 files changed, 45 insertions(+), 20 deletions(-)
New commits:
commit 3d57e63fd8fe72ad4cdb928f6d6d2bd3d533a530
Author: Olivier Hallot <olivier.hallot at libreoffice.org>
AuthorDate: Fri Aug 3 11:43:47 2018 -0300
Commit: Olivier Hallot <olivier.hallot at libreoffice.org>
CommitDate: Sun Aug 5 20:18:07 2018 +0200
XHP online editor enhancements (2)
Add more snippets
Ensure every paragaph is unique in table or doc
Change-Id: I280db274acec00fb27fe3b9dd581db6f8376632a
Reviewed-on: https://gerrit.libreoffice.org/58566
Reviewed-by: Olivier Hallot <olivier.hallot at libreoffice.org>
Tested-by: Olivier Hallot <olivier.hallot at libreoffice.org>
diff --git a/help3/html/index.html b/help3/html/index.html
index 49c0963..a4e806b 100644
--- a/help3/html/index.html
+++ b/help3/html/index.html
@@ -43,6 +43,7 @@
<button onclick="bookmarkValue()" class="snip_buttons">bookmark-value</button>
<button onclick="bookmarkBranch()" class="snip_buttons">bookmark-hid</button>
<button onclick="bookmarkIndex()" class="snip_buttons">bookmark-index</button>
+ <button onclick="bookmarkNoWidget()" class="snip_buttons">bookmark-nowidget</button>
</div>
<div style="margin-top:10px;"><div class="snip_div">Sections:</div>
<button onclick="related_topics()" class="snip_buttons">Related Topics</button>
@@ -80,6 +81,17 @@
<button onclick="switchInline('appl')" class="snip_buttons">Switchinline appl</button>
<button onclick="switchInline('sys')" class="snip_buttons">Switchinline sys</button>
</div>
+ <div style="margin-top:10px;"><div class="snip_div">Lists:</div>
+ <button onclick="tList('unordered')" class="snip_buttons">UL</button>
+ <button onclick="tList('ordered')" class="snip_buttons">OL</button>
+ <button onclick="listItem()" class="snip_buttons">List Item</button>
+ </div>
+ <div style="margin-top:10px;"><div class="snip_div">Links:</div>
+ <button onclick="tVariable()" class="snip_buttons">Variable</button>
+ <button onclick="tEmbed()" class="snip_buttons">Embed</button>
+ <button onclick="tEmbedvar()" class="snip_buttons">Embedvar</button>
+ <button onclick="tLink()" class="snip_buttons">Link</button>
+ </div>
</div>
<div class="rightside">
<!-- will put the xml transformed here -->
diff --git a/help3/html/snippets.js b/help3/html/snippets.js
index 93b3fc1..a9c647c 100644
--- a/help3/html/snippets.js
+++ b/help3/html/snippets.js
@@ -46,10 +46,11 @@ function bascode_par() {
// Tables
// simple table cell
-function tCell (){
- return ' <tablecell>\n <paragraph id="' + random('par') + '" role="tablecontent" xml-lang="en-US" ></paragraph>\n </tablecell>';
+function tCell (role){
+ return ' <tablecell>\n <paragraph id="' + random('par') + '" role="' + role + '" xml-lang="en-US" ></paragraph>\n </tablecell>';
}
+
function iconTable() {
var a1 = '<table id="' + random('tab') + '">\n <tablerow>\n <tablecell>\n ';
var a2 = '<paragraph id=" ' + random('par')+ '" lang="en-US" localize="false">\n ';
@@ -59,20 +60,19 @@ function iconTable() {
}
function tableCell() {
- editor.replaceRange(tCell(), editor.doc.getCursor());
+ editor.replaceRange(tCell('tablecontent'), editor.doc.getCursor());
}
function table2R3C() {
var a1 = '<table id="' + random('tab') + '">\n';
var a2 = ' <tablerow>\n';
- var a3 = ' <tablecell>\n <paragraph id="' + random('par') + '" role="tablehead" xml-lang="en-US" localize="false"></paragraph>\n </tablecell>\n';
var a4 = ' </tablerow>\n';
var a5 = a4 + '\n</table>';
- editor.replaceRange(a1 + a2 + a3 + a3 + a3 + a4 + a2 + tCell() + tCell() + tCell() + a5, editor.doc.getCursor());
+ editor.replaceRange(a1 + a2 + tCell('tablehead') + tCell('tablehead') + tCell('tablehead') + a4 + a2 + tCell('tablecontent') + tCell('tablecontent') + tCell('tablecontent') + a5, editor.doc.getCursor());
}
function tableRow() {
- editor.replaceRange('<tablerow>\n' + tCell() + '\n </tablerow>\n', editor.doc.getCursor());
+ editor.replaceRange(' <tablerow>\n' + tCell('tablecontent') + '\n </tablerow>\n', editor.doc.getCursor());
}
// Sections
@@ -109,7 +109,7 @@ function bookmarkNoWidget() {
}
function bookmarkIndex() {
- var a1 = '<bookmark xml-lang="en-US" branch="index" id="' + random('bm') + '">\n <bookmark_value>CHANGE ME;CHANGE ME TOO</bookmark_value>\n\n</bookmark>\n';
+ var a1 = '<bookmark xml-lang="en-US" branch="index" id="' + random('bm') + '">\n<bookmark_value>CHANGE ME;CHANGE ME TOO</bookmark_value>\n\n</bookmark>\n';
editor.replaceRange(a1, editor.doc.getCursor());
}
@@ -141,27 +141,40 @@ function switchInline(type) {
editor.replaceRange(a1 + a2 + a3 + a4, editor.doc.getCursor());
}
-function snippet16() {
- editor.replaceRange('', editor.doc.getCursor());
+// lists
+function tList(mode){
+ var a1 = '<list type="' + mode + '">\n\n</list>';
+ editor.replaceRange(a1, editor.doc.getCursor());
}
-function snippet17() {
- editor.replaceRange('', editor.doc.getCursor());
+function listItem(){
+ var a1 = ' <listitem>\n <paragraph id="' + random('par') + '" role="listitem" xml-lang="en-US">';
+ var a2 = '</paragraph>\n </listitem>';
+ editor.replaceSelection(a1+ editor.doc.getSelection() + a2,'');
}
-function snippet18() {
- editor.replaceRange('', editor.doc.getCursor());
-}
+// Variables, embeds, link
-function snippet19() {
- editor.replaceRange('', editor.doc.getCursor());
+function tVariable() {
+ var a1 = '<variable id="CHANGE ME">';
+ var a2 = '</variable>';
+ editor.replaceSelection(a1 + editor.doc.getSelection() + a2,'');
}
-
-function snippet20() {
- editor.replaceRange('', editor.doc.getCursor());
+function tEmbed(){
+ var a1 = '<embed href="text/CHANGE ME(path/to/xhp/file#select id)"/>';
+ editor.replaceRange(a1, editor.doc.getCursor());
+}
+function tEmbedvar(){
+ var a1 = '<embedvar href="text/CHANGE ME(path/to/xhp/file#select id)" markup="ignore/keep"/>';
+ editor.replaceRange(a1, editor.doc.getCursor());
+}
+ function tLink(){
+ var a1 ='<link href="text/CHANGE ME(path/to/xhp/file#select id)" name="CHANGE ME">';
+ var a2 = '</link>';
+ editor.replaceSelection(a1 + editor.doc.getSelection() + a2,'');
}
-/* javascript code for snippets (orignially for KDE kate)*/
+/* javascript code for snippets (originally for KDE kate)*/
function fileName() { return document.fileName(); }
function fileUrl() { return document.url(); }
function encoding() { return document.encoding(); }
More information about the Libreoffice-commits
mailing list