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

Olivier Hallot (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 19 16:53:12 UTC 2020


 help3/xhpeditor/snippets.js |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 14a98242ebba28662ca75d9d33bd958a267044d7
Author:     Olivier Hallot <olivier.hallot at libreoffice.org>
AuthorDate: Fri Jun 19 11:43:07 2020 -0300
Commit:     Olivier Hallot <olivier.hallot at libreoffice.org>
CommitDate: Fri Jun 19 18:52:43 2020 +0200

    Improve snippet for icon table and table cell
    
    Change-Id: I6bce115d3b6d041a4c08c2b79b7b17ec4dce762f
    Reviewed-on: https://gerrit.libreoffice.org/c/dev-tools/+/96742
    Tested-by: Olivier Hallot <olivier.hallot at libreoffice.org>
    Reviewed-by: Olivier Hallot <olivier.hallot at libreoffice.org>

diff --git a/help3/xhpeditor/snippets.js b/help3/xhpeditor/snippets.js
index b34fec9..82b3b4f 100644
--- a/help3/xhpeditor/snippets.js
+++ b/help3/xhpeditor/snippets.js
@@ -74,19 +74,21 @@ function image_par() {
 }
 // Tables
 // simple table cell
-function tCell (role){
-    return '       <tablecell>\n           <paragraph id="' + random('par') + '" role="' + role + '"></paragraph>\n       </tablecell>\n';
+function tCell (role,text){
+    var newtext = (text == '') ? 'CHANGE ME' : text;
+    return '       <tablecell>\n           <paragraph id="' + random('par') + '" role="' + role + '">'+ newtext +'</paragraph>\n       </tablecell>\n';
 }
 
 function iconTable() {
     var a1 = '<table id="' + random('tab') + '">\n    <tablerow>\n        <tablecell>\n            ';
-    var a2 = '<paragraph role="image" id="' + random('par') + '">\n<image src="media/CHANGE-ME" id="' + random('img') + '" width="" height=""><alt id="' + random('alt') +'">Icon</alt></image>\n            </paragraph>';
-    var a3 = '\n       </tablecell>\n' + tCell("paragraph") + '    </tablerow>\n</table>\n';
-    editor.replaceRange(a1 + a2 + a3, editor.doc.getCursor());
+    var a2 = '<paragraph role="paragraph" id="' + random('par') + '">\n<image src="media/CHANGE-ME" id="' + random('img') + '" width="1cm" height="1cm"><alt id="' + random('alt') +'">Icon ';
+    var a3 = '</alt></image>\n            </paragraph>\n       </tablecell>\n';
+    var a4 = tCell("paragraph", editor.doc.getSelection()) + '    </tablerow>\n</table>\n';
+    editor.replaceSelection(a1 + a2 + editor.doc.getSelection() + a3 + a4,'');
 }
 
 function tableCell() {
-    editor.replaceRange(tCell('tablecontent'), editor.doc.getCursor());
+    editor.replaceSelection(tCell('tablecontent',editor.doc.getSelection()), '');
 }
 
 function table2R3C() {


More information about the Libreoffice-commits mailing list