On this page... (hide)
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.
- 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:)
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
end:) markup has been used. A unique id and div-number is assigned using on the Java Script
Download Programming/pm-toggle-edit.zip (3kb)
- Install Toggle
- add the following to your
'<a href=\"#\" onclick=\"pmAddToggle();\"><img src=\'$GUIButtonDirUrlFmt/toggle.gif\' title=\'$[toggle]\' /></a>');
The use of css for styling would be preferable to the hard-coded style currently included.
NOTE: as toggle.php is currently implemented, it does not degrade gracefully when JS is disabled (eg, hidden text remains hidden with no easy way to view, outside of page-source). See notes and proposed patch @ Cookbook:Toggle-Talk
see also: Cookbook:UnToggle which deals with this issue (but is a less robust toggle implementation?)
Hrm. Pretty boring, yeah? Use your imagination, and start filling it up.
See more buttons and ideas at Cookbook:GuiEdit