ToggleEdit
Questions answered by this recipe
How can I easily add toggle markup when editing pages? How can I add a toggle-button to the edit-gui-buttons?
pmToggleEdit adds a button to the edit-bar for easier addition of toggle-markup.
Requires the PmWiki Cookbook recipe Toggle to be enabled.
Basic usage
- edit page
- highlight region
- click the button that looks like a window-shade:
Output will look something like:
(:toggle id="tog1252880238887" show="Show message" init=hide button=1:) (:div1252880238887 id="tog1252880238887" style="border:1px solid #999; padding:5px;":) toggle this text (:div1252880238887end:) |
(:toggle id="tog1252880238887" show="Show message" init=hide button=1:) toggle this text |
By default, the text is hidden, and the show message is simply "Show message". A simple border-style has also been included. To ensure that divs can be safely toggled, the (:div
n
:)...(:div
n
end:)
markup has been used. A unique id and div-number is assigned using on the JavaScript Date.getTime()
function.
Installation
Download pm-toggle-edit-2014-07-01.zipΔ
- Install Toggle
- copy folders to your root - files will go into
pub
andcookbook
button-template-22x22.gif
is included for reference, but not needed for operation
- add the following line to you
config.php
include_once("$FarmD/cookbook/toggleedit.php");
- Don't forget to enable javascript in your browser!
TODO - further development
The use of css for styling would be preferable to the hard-coded style currently included.
At least putting the default style into a more-readily-edited config variable, instead of the less-accessible javascript-file.
Known Issues
ToggleEdit works with image-based GUI buttons. If you use an icon-based gui-button recipe, ToggleEdit will not work by default.
Button template
I've found it useful to keep a blank 22x22 button template lying around for adding new entries. It's included in pm-toggle-edit.zipΔ, but looks like
Hrm. Pretty boring, yeah? Use your imagination, and start filling it up.
See more buttons and ideas at Cookbook:GuiEdit
Source code
https://github.com/MichaelPaulukonis/pmwikiToggleEdit
See Also
AddToggle - similar recipe
User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.