Skip to main content.

Power Edit Plugin

The Plugin formerly known as TWiki:Plugins.PowerEditAddon

The PowerEditPlugin is a plug-in extension to TWiki that supports a Java 1.1 applet text editor. This applet works on most Java-enabled browsers (we haven't tested them all!).

The applet provides the same editing capabilities as a standard browser text area, and adds some common editor functionality:

Usage information

Configuring the Buttons and Hot keys

Buttons and hotkeys are all created by reading a user-defined topic which is set by the %POWEREDIT_CONTROLS% variable (see TWikiVariables, "Creating Custom Variables"). If the variable is not set, the topic TWiki.PowerEditControls is read instead. This allows administrators to set default buttons and keys for the whole installation, for each web, and users can to set up their own controls for the editor by defining this variable in their personal topics.

If set, the variable must be set to the full name (including the web) of the topic that contains the control definitions; for example,

      * Set POWEREDIT_CONTROLS = Main.AlanTuringControls
The control file contains a set of button panel and macro definitions. For example:
macros
   "space" = " "
end
top
   "Tele type" = "/cut/=/paste/="
   "A Space"="/space/"
end
keys
   "^X" = "/cut/"
end
In this example the first button in the top panel will be labelled "Tele type" and will perform the sequence /cut/=/paste/= - which will cut the currently selected text, enter an '=' sign, paste the text and enter another '=' sign. The second button will be labelled "A Space" and will execute the space macro, which in turn is defined to insert a ' ' character. The key "Ctrl+X" will be defined to perform the /cut/ command.

The default control definitions for this installation may be viewed here.

Commands

The following commands are basic to the editor and can be used in button definitions:
Name down Description
/convert/ Convert the currently selected text from raw HTML to TWiki ML
/copy/ Copy the currently selected text to the internal cut buffer
/cut/ Cut the currently selected text to the internal cut buffer
/find/ Invoke the find dialog
/paste/ Paste the internal cut buffer. Will erase the current selection.
/redo/ Repeats the last command executed (does not repeat typing)
/refind/ Repeat the last find
/replace/ Invoke the replace dialog
/rereplace/ Repeat the last replacement
/undo/ Undo the last edit

Applet parameters

Parameter Values Description
useframe "yes" or "no" Whether to use a separate window or not
editboxwidth Number of columns If useframe=yes, then defines the number of columns width of the edit area. Ignored if useframe=no.
editboxheight Number of rows If useframe=yes, then defines the number of rows height of the edit area. Ignored if useframe=no.
text text The text to edit.
controls text The control setup

PowerEditPlugin Global Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %POWEREDITPLUGIN_SHORTDESCRIPTION%

Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.

   %TMPL:P{"sep"}% <a href="%SCRIPTURLPATH%/edit%SCRIPTSUFFIX%/%WEB%/%TOPIC%?skin=power">PowerEdit</a>
   

Plugin Info

Plugin Author: CrawfordCurrie?
Plugin Version: 14 Mar 2003
Change History: 1 Oct 2001: Initial version as an Addon
  14 Mar 2003: Total rewrite as a Plugin
CPAN Dependencies: none
Other Dependencies: Java 1.1 (also supports more recent browser plugins)
Perl Version: 5.0
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/PowerEditPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/PowerEditPluginDev

Related Topics: TWikiPreferences, TWikiPlugins

Known Problems

Clipboard Access

In order to access the clipboard on the client machine, an applet has to be signed. By default PowerEdit? is shipped unsigned. This is because (1) proper certificates cost money and (2) certificates you generate yourself have extremely limited lifetimes. So unless you sign the jar (after adding appropriate security API calls to the code!) you won't get clipboard access. This generally isn't much of a problem on UNIX and Linux because of the middle-button copy and paste capability.

Customisation and Further Development

All the sources and unit tests are provided with the distribution, together with an Ant build file (see http://www.jakarta.org) should further customisation be required. The source.zip is shipped in the lib/TWiki/Plugins/PowerEditPlugin directory and when unzipped creates source, packages and test subdirectories. The src directory contains the applet sources, the test directory contains JUnit unit tests, and the packages directory contains the GNU 'regexp' package, which is used by search and replace, and a stripped-down version of the HTML parser from the Sourceforge HTMLParser project.

It is a condition of use that any useful customisations are fed back to the TWiki:Plugins.PowerEditPluginDev page at http://www.twiki.org !

Further development of this plugin is welcomed. The sources are all checked in to the TWiki CVS repository. If you make extensions to the plugin, please, please, please maintain and extend the tests!

Copyright

This code is a development of the Systems on Chip group of Motorola Inc. and is protected by the following copyrights:

License

As required for the publication of all extensions to TWiki, this software is published under the terms of the GNU General Public License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details, published at http://www.gnu.org/copyleft/gpl.html