summaryrefslogtreecommitdiff
path: root/help3
diff options
context:
space:
mode:
authorOlivier Hallot <olivier.hallot@libreoffice.org>2020-06-19 11:43:07 -0300
committerOlivier Hallot <olivier.hallot@libreoffice.org>2020-06-19 18:52:43 +0200
commit14a98242ebba28662ca75d9d33bd958a267044d7 (patch)
tree2d27af86c088d04f95fd5c6671f8eeb834cd4cff /help3
parent53d7d6165feab6e3fdb10cac0fde93e3a2a90f7b (diff)
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@libreoffice.org> Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Diffstat (limited to 'help3')
-rw-r--r--help3/xhpeditor/snippets.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/help3/xhpeditor/snippets.js b/help3/xhpeditor/snippets.js
index b34fec97..82b3b4f5 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() {