Log In | Users | Register
Welcome, Registration, and other StartingPoints; Foswiki history & Wiki style; All the docs...
spacer
Edit | Attach | New | Raw | Delete | History | Diff | Print | Pdf | Subscribe | Tools

Foswiki::Plugins::WysiwygPlugin

package WysiwygPlugin

This plugin is responsible for translating TML to HTML before an edit starts and translating the resultant HTML back into TML.

Note: In the case of a new topic, you might expect to see the "create topic" screen in the editor when it goes back to Foswiki for the topic content. This doesn't happen because the earliest possible handler is called on the topic content and not the template. The template is effectively ignored and a blank document is sent to the editor.

Attachment uploads can be handled by URL requests from the editor to the rest handler in this plugin. This avoids the need to add any scripts to the bin dir. You will have to use a form, though, as XmlHttpRequest? does not support file uploads.

StaticMethod notWysiwygEditable($text) -> $boolean

Determine if the given $text is WYSIWYG editable, based on the topic content and the value of the Foswiki preferences WYSIWYG_EXCLUDE and WYSIWYG_EDITABLE_CALLS. Returns a descriptive string if the text is not editable, 0 otherwise.

StaticMethod addXMLTag($tag, \&fn)

Instruct WysiwygPlugin to "lift out" the named tag and pass it to &fn for processing. &fn may modify the text of the tag. &fn should return 0 if the tag is to be re-embedded immediately, or 1 if it is to be re-embedded after all processing is complete. The text passed (by reference) to &fn includes the ... brackets.

The simplest use of this function is something like this: Foswiki::Plugins::WysiwygPlugin::addXMLTag( 'mytag', sub { 1 } );

A plugin may call this function more than once e.g. to change the processing function for a tag. However, only the original plugin may change the processing for a tag.

Plugins should call this function from their initPlugin handlers so that WysiwygPlugin will protect the XML-like tags for all conversions, including REST conversions. Plugins that are intended to be used with older versions of Foswiki (e.g. 1.0.6) should check that this function is defined before calling it, so that they degrade gracefully if an older version of WysiwygPlugin (e.g. that shipped with 1.0.6) is installed. spacer

This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Wiki? Send feedback
Syndicate this site RSS ATOM