DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:toolbar

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
devel:toolbar [2016-03-09 06:58] – [Tips] ismirnovdevel:toolbar [2017-01-07 22:41] – [Tips] turnermm
Line 20: Line 20:
 | ''title'' | title of the button, displayed on mouseover | | ''title'' | title of the button, displayed on mouseover |
 | ''icon'' | icon to use for the button (based in ''DOKUBASE/lib/images/toolbar/'')| | ''icon'' | icon to use for the button (based in ''DOKUBASE/lib/images/toolbar/'')|
-| ''key'' | Hotkey for the button, a value of ''n'' here would result in the button being pressed when the user presses ''ALT + n'' in his browser. (See also the [[:accesskeys|access keys]] used by DokuWiki) |+| ''key''(optional) Hotkey for the button, a value of ''n'' here would result in the button being pressed when the user presses ''ALT + n'' in his browser. (See also the [[:accesskeys|access keys]] used by DokuWiki) 
 +| ''class'' | (optional) classname for styling buttons | 
 +| ''id''    | (optional) id added to button, and with a postfix to icon e.g. ''<id>_ico'' |
 ^ ''format'' type specific parameters  ^^ ^ ''format'' type specific parameters  ^^
 | ''open'' | opening tag of wiki markup to insert, cursor will be placed between opening and closing tag | | ''open'' | opening tag of wiki markup to insert, cursor will be placed between opening and closing tag |
Line 41: Line 43:
 ==== ...using PHP ==== ==== ...using PHP ====
  
-To extend the toolbar from your plugin you need to write a [[devel:Action Plugin]] which registers as handler for the [[events_list#toolbar_define|TOOLBAR_DEFINE]] event with an AFTER advise. Your handler function will receive the toolbar array as described earlier.+To extend the toolbar from your plugin you need to write a [[devel:Action Plugin]] which registers as handler for the [[devel:event:TOOLBAR_DEFINE]] event with an AFTER advise. Your handler function will receive the toolbar array as described earlier.
  
 Create your button structure according to the above information and add it to the received event data.-function in ''inc/toolbar.php''. Create your button structure according to the above information and add it to the received event data.-function in ''inc/toolbar.php''.
Line 112: Line 114:
 </code> </code>
 Some notes: Some notes:
-  * Be aware of the default locations of the images ''lib/images/toolbar/'' and ''lib/images/''+  * Be aware of the default locations of the images''lib/images/toolbar/'' and ''lib/images/''
   * The available options for access keys depends on the [[:accesskeys|access keys]] used by DokuWiki and the whether they are reserved by a browser or operation system as short cut. There are many differences.   * The available options for access keys depends on the [[:accesskeys|access keys]] used by DokuWiki and the whether they are reserved by a browser or operation system as short cut. There are many differences.
   * More about [[devel:localization#javascript localization]]   * More about [[devel:localization#javascript localization]]
Line 183: Line 185:
 === Removing Buttons === === Removing Buttons ===
  
-If you want to remove some of the toolbar buttons, you can do so by adding the following code into `/conf/userscript.js`. Note that this is not in any function, simply append this code to the end of the file:+If you want to remove some of the toolbar buttons, you can do so by adding the following code into ''/conf/userscript.js''. Note that this is not in any function, simply append this code to the end of the file:
  
 <code javascript /conf/userscript.js> <code javascript /conf/userscript.js>
Line 190: Line 192:
    "Same Level Headline", "Lower Headline", "Higher Headline", "Select Headline", "Internal Link", "External Link",     "Same Level Headline", "Lower Headline", "Higher Headline", "Select Headline", "Internal Link", "External Link", 
    "Horizontal Rule", "Add Images and other files (opens in a new window)", "Smileys", "Special Chars", "Insert Signature"];    "Horizontal Rule", "Add Images and other files (opens in a new window)", "Smileys", "Special Chars", "Insert Signature"];
-    window.toolbar = window.toolbar.filter(function(elem){ return jQuery.inArray(elem.title, blacklist) === -1;  +    window.toolbar = window.toolbar.filter(function(elem){ return jQuery.inArray(elem.title, blacklist) === -1; }); 
-});+}
 </code> </code>
  
 This is from my personal wiki where I removed almost all the buttons. You can figure out what the title of your button is by running the following snippet in a javascript console: This is from my personal wiki where I removed almost all the buttons. You can figure out what the title of your button is by running the following snippet in a javascript console:
-<code javascript>for (i in window.toolbar) { console.log(toolbar[i].title)}`</code>+<code javascript>for (i in window.toolbar) { console.log(toolbar[i].title)}</code>
  
 Then take the string and append it to the 'blacklist' array in the code. Then take the string and append it to the 'blacklist' array in the code.
 +
 +See also the [[plugin:toolbuttondel|]] plugin for removing toolbar items.
  
devel/toolbar.txt · Last modified: 2023-08-01 20:08 by annda

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki