help3/xhpeditor/buttons.php | 3 ++- help3/xhpeditor/index.php | 8 ++++---- help3/xhpeditor/snippets.js | 29 ++++++++++++++++------------- 3 files changed, 22 insertions(+), 18 deletions(-)
New commits: commit 08ee150ead33a9fd8fd6e8308420a2d05eb3e9f3 Author: Olivier Hallot <[email protected]> AuthorDate: Sat Jan 4 15:07:15 2020 -0300 Commit: Olivier Hallot <[email protected]> CommitDate: Sat Jan 4 21:03:57 2020 +0100 xhpeditor: fixes and improvements - close bracket at right place - improve icontable snippet - add image paragraph - better switch layout - better switchinline layout Change-Id: Ib1f57d0ba35937a5b81427d180d0c5a53769ecaa Reviewed-on: https://gerrit.libreoffice.org/c/dev-tools/+/86228 Reviewed-by: Olivier Hallot <[email protected]> Tested-by: Olivier Hallot <[email protected]> diff --git a/help3/xhpeditor/buttons.php b/help3/xhpeditor/buttons.php index 80efa3c..27dd890 100644 --- a/help3/xhpeditor/buttons.php +++ b/help3/xhpeditor/buttons.php @@ -27,7 +27,7 @@ echo '<div class="snip_heading"> </div> <div class="snip_heading"><div class="snip_div">Tables:</div> <button onclick="table2R3C()" class="snip_buttons">Table Full</button> - <button onclick="tableRow()" class="snip_buttons">TableRow</button> + <button onclick="tableRow()" class="snip_buttons">Table Row</button> <button onclick="tableCell()" class="snip_buttons">Table Cell</button> <button onclick="iconTable()" class="snip_buttons">Icon Table</button> </div> @@ -38,6 +38,7 @@ echo '<div class="snip_heading"> <button onclick="tip()" class="snip_buttons">tip</button> <button onclick="bascode_par()" class="snip_buttons">bascode-par</button> <button onclick="pycode_par()" class="snip_buttons">pycode-par</button> + <button onclick="image_par()" class="snip_buttons">image-par</button> </div> <div class="snip_heading"><div class="snip_div">Characters:</div> <button onclick="emph()" class="snip_buttons">emph</button> diff --git a/help3/xhpeditor/index.php b/help3/xhpeditor/index.php index b732314..e01a172 100644 --- a/help3/xhpeditor/index.php +++ b/help3/xhpeditor/index.php @@ -109,22 +109,22 @@ $xhp = $_POST["xhpdoc"]; foreach ($xmlarray->xpath("//$tag_uniq") as $tag){ $idarray[$i] = $tag['id']; ++$i; + } } $dupped_array = array_values(array_unique(array_diff_key($idarray, array_unique($idarray)))); if (count($dupped_array) > 0){ echo '<p class="bug">Found duplicated ids:</p>'; foreach($dupped_array as $dup) { - echo "<p>$dup</p>"; + echo "<p>$dup</p>"; } }else{ echo "<p>No duplicates ids found.</p>"; } - } }elseif (isset($_POST["get_patch"])) { echo '<h2>Get Patch:</h2>'; } else { - echo '<h2>Boo:</h2>'; - echo '<p>Aha!!!!!</p>';} + echo '<h2>Viewing Area</h2>'; + } ?> </div> </body> diff --git a/help3/xhpeditor/snippets.js b/help3/xhpeditor/snippets.js index 3c5c18d..bab3b1b 100644 --- a/help3/xhpeditor/snippets.js +++ b/help3/xhpeditor/snippets.js @@ -67,19 +67,22 @@ function pycode_par() { editor.replaceSelection(a1 + editor.doc.getSelection() + a2,''); } +function image_par() { + var a1 = '<paragraph role="image" id="' + random('par') + '"><image src="media/CHANGE-ME" id="' + random('img') + '" width="" height=""><alt id="' + random('alt') +'">'; + var a2 = '</alt></image></paragraph>\n'; + editor.replaceSelection(a1 + editor.doc.getSelection() + a2,''); +} // Tables // simple table cell function tCell (role){ return ' <tablecell>\n <paragraph id="' + random('par') + '" role="' + role + '"></paragraph>\n </tablecell>\n'; } - function iconTable() { var a1 = '<table id="' + random('tab') + '">\n <tablerow>\n <tablecell>\n '; - var a2 = '<paragraph id=" ' + random('par')+ '" localize="false">\n '; - var a3 = '<image >CHANGE ME</image>\n </paragraph>\n </tablecell>\n' + tCell(); - var a4 = '\n </tablerow>\n</table>\n'; - editor.replaceRange(a1 + a2 + a3 + a4, editor.doc.getCursor()); + 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()); } function tableCell() { @@ -171,19 +174,19 @@ function _widget() { // switches function switchXHP(type) { + var type_string = (type=='sys') ? "MAC | UNIX | WIN" : "WRITER | CALC | IMPRESS | DRAW | BASE | MATH"; var a1 = '<switch select="' + type + '">\n'; - var a2 = '<case select="APPLICATION OR SYSTEM">CHANGE ME</case>\n'; - var a3 = '<default>DEFAULT STUFF</default>\n'; - var a4 = '</switch>\n'; - editor.replaceRange(a1 + a2 + a3 + a4, editor.doc.getCursor()); + var a2 = '<case select="' + type_string +'">\nCHANGE ME\n</case>\n'; + var a3 = '<default>\nDEFAULT STUFF\n</default>\n</switch>\n'; + editor.replaceRange(a1 + a2 + a3, editor.doc.getCursor()); } function switchInline(type) { + var type_string = (type=='sys') ? "MAC | UNIX | WIN" : "WRITER | CALC | IMPRESS | DRAW | BASE | MATH"; var a1 = '<switchinline select="' + type + '">'; - var a2 = '<caseinline select="APPLICATION OR SYSTEM">CHANGE ME</caseinline>'; - var a3 = '<defaultinline>DEFAULT STUFF</defaultinline>'; - var a4 = '</switchinline>'; - editor.replaceRange(a1 + a2 + a3 + a4, editor.doc.getCursor()); + var a2 = '<caseinline select="' + type_string +'">CHANGE ME</caseinline>'; + var a3 = '<defaultinline>DEFAULT STUFF</defaultinline></switchinline>'; + editor.replaceRange(a1 + a2 + a3, editor.doc.getCursor()); } function MenuPrefMAC(){ editor.replaceRange('<switchinline select="sys"><caseinline select="MAC"><menuitem>%PRODUCTNAME - Preferences</menuitem></caseinline><defaultinline><menuitem>Tools - Options</menuitem></defaultinline></switchinline><menuitem> - </menuitem> ', editor.doc.getCursor()); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
