Power Edit Plugin
OBSOLETE - THIS PLUGIN IS NO LONGER SUPPORTED
It might work, but don't bet on it.
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:
- Cut, Copy, Paste - the cut buffer is a static variable in the applet as there is no access to the system cut buffer from an applet. The cut buffer persists over different invocations of PowerEditPlugin, however, and you can always use the cut and paste functions in the browser menus to cut and paste outside the window.
- Undo - undoes up to 100 commands per edit session.
- Do again - repeats the last command.
- Find, Replace - optionally use Emacs style regular expressions as provided by the gnu.regexp library. Replace is currently not smart enough to use field replacement, however.
- Can be invoked in a separate frame.
- Programmable buttons.
- Convertor from HTML to TWiki markup
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). 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. 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.MyPowerEditControls
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 four button panels are named "top", "bottom", "left" and "right"
- There can be as many "macros" blocks as you like
- In button blocks, the name is used as the label on the button
- Control keys are denoted by a leading ^ character and must be in upper case e.g. ^A not ^a. Note that some browsers may not support key definitions.
- The command string is a mixture of basic editor commands (see below) and text to be inserted.
- The usual 'C' escapes are available in names and macro definitions i.e. prepending the character '\' will cause the next character to be interpreted literally. Note that '\/' will still be interpreted as '/' - to escape a '/' in the text, use a double-slash '//'.
- Single-line comments can be inserted into the file by starting a line with the '<' character. Thus HTML tags on a line of their own will be ignored.
- For some unexplained reason it isn't possible to use the PowerEditPlugin on the PowerEditControls file.
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 |
Description |
| /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. |
| /undo/ |
Undo the last edit |
| /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 |
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. |
| server |
URL |
The URL that the editor will use to pass information back to the server. |
It is a condition of use that any useful customisations are fed back to the
TWiki:Plugins.PowerEditPluginDev
page at
https://twiki.org !
PowerEditPlugin Global Settings
Plugin settings are stored as preferences variables. To reference a plugin setting write
%<plugin>_<setting>%, i.e.
%POWEREDITPLUGIN_SHORTDESCRIPTION%
- One line description, is shown in the TextFormattingRules topic:
- Set SHORTDESCRIPTION = Extend TWiki with a Java 1.1 Applet based text editor.
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.
- Download the ZIP file from the Plugin web (see below). Contents:
| File: | Description: |
PowerEditPlugin.xml | Ant build file |
data/TWiki/PowerEditPlugin.txt | Plugin topic |
data/TWiki/PowerEditControls.txt | Sample control configuration |
templates/edit.power.tmpl | Specialised skin |
templates/applet.power.tmpl | Specialised skin |
pub/TWiki/PowerEditPlugin/poweredit.jar | JAR file |
lib/TWiki/Plugins/PowerEditPlugin/source.zip | Source and test code |
lib/TWiki/Plugins/PowerEditPlugin.pm | Plugin script |
- Unzip
PowerEditPlugin.zip in your twiki installation directory.
Plugin Info
Related Topics: TWikiPreferences,
TWikiPlugins
Known Problems
If you see a message in the text area suggesting that the topic is not locked for edit, try refreshing the page with the applet on (shift+Reload in Netscape, shift+F5 in IE). It's not really a problem, just a side-effect of the security checking in the applet.
Customisation
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
PowerEdit applet sources, the
test directory contains JUnit unit tests, and the
packages directory contains the GNU 'regexp' packages, which is used by search and replace, and the kizna HTML parser.
Copyright
This code is a development of the Architectures and Systems
Platforms group of Motorola Inc. and is protected by the following
copyrights:
- Copyright (C) 2001-2003 Motorola. All Rights Reserved.
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
--
TWiki:Main/CrawfordCurrie
- 15 Mar 2003