Skip to main content.
Navigation:
DENX
>
TWiki
>
PowerEditPlugin
Translations:
Edit
|
Attach
|
Raw
|
Ref-By
|
Printable
|
More
TWiki
Sections of this site:
DENX Home
|
DULG
|
ELDK-5
|
Know
|
Training
|
U-Boot
|
U-Bootdoc
Topics
TWiki Home
Welcome
Register
Changes
Topics
Index
Search
Go
List of pages in TWiki
Search
---++!! Power Edit Plugin The Plugin formerly known as TWiki:Plugins.PowerEditAddon %TOC% The <nop>%TOPIC% 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 <u>all</u>!). 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 <nop>%TOPIC%, 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 %<nop>POWEREDIT_CONTROLS% variable (see TWiki.TWikiVariables, "Creating Custom Variables"). If the variable is not set, the topic TWiki<nop>.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, <pre> * <nop>Set POWEREDIT_CONTROLS = Main<nop>.AlanTuringControls </pre> The control file contains a set of button panel and macro definitions. For example: <pre> macros "space" = " " end top "Tele type" = "/cut/=/paste/=" "A Space"="/space/" end keys "^X" = "/cut/" end </pre> 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, probably due to synchronous access, it isn't possible to use the <nop>%TOPIC% on the PowerEditControls file. The default control definitions for this installation may be viewed <a href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/%TWIKIWEB%/PowerEditControls?raw=on">here</a>. ---+++ 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 | | /convert/ | Convert the currently selected text from raw HTML to TWiki ML | | /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. | | text | text | The text to edit. | | controls | text | The control setup | ---++ <nop>%TOPIC% Global Settings Plugin settings are stored as preferences variables. To reference a plugin setting write ==%<nop><plugin>_<setting>%==, i.e. ==%<nop>POWEREDITPLUGIN_SHORTDESCRIPTION%== * One line description, is shown in the %TWIKIWEB%.TextFormattingRules topic: * Set SHORTDESCRIPTION = Extend TWiki with a Java 1.1 Applet based text editor. * __Note__ The %<nop>POWEREDIT_CONTROLS% variable is *not* a plugin variable but a global variable. As such you have to set it in TWiki.TWikiPreferences if you want to override the default. See TWiki.TWikiVariables "Creating Custom Variables". ---+++ 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:* | | ==%TOPIC%.xml== | Ant build file | | ==data/TWiki/%TOPIC%.txt== | Plugin topic | | ==data/TWiki/PowerEditControls.txt== | Sample control configuration | | ==templates/edit.power.tmpl== | Specialised skin. The difference to edit.tmpl are minimal, so deriving a local skin should be trivial. | | ==templates/applet.power.tmpl== | Sub-template use for the applet tag. Done as a sub-skin to short-circuit default TWiki expansions. | | ==pub/TWiki/%TOPIC%/poweredit.jar== | JAR file | | ==lib/TWiki/Plugins/%TOPIC%/source.zip== | Source and test code | | ==lib/TWiki/Plugins/%TOPIC%.pm== | Plugin script | * Unzip ==%TOPIC%.zip== in your twiki installation directory. * A command to invoke the editor can by added to the normal topic view by putting the following line into your =bin/view= template, immediately after the line reading %<nop>EDITTOPIC%: <pre> %<nop>TMPL:P{"sep"}% <a href="%<nop>SCRIPTURLPATH%/edit%<nop>SCRIPTSUFFIX%/%<nop>WEB%/%<nop>TOPIC%?skin=power">PowerEdit</a> </pre> ---++ Plugin Info | Plugin Author: | Main.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/%TOPIC% | | Feedback: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Dev | __Related Topics:__ %TWIKIWEB%.TWikiPreferences, %TWIKIWEB%.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/%TOPIC%= 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.%TOPIC%Dev 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: * 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