Package org.apache.wiki.ui

# Interface EditorManager

All Superinterfaces:
  `org.apache.wiki.api.engine.Initializable`, `ModuleManager`

All Known Implementing Classes:
  `DefaultEditorManager`

public interface EditorManager extends ModuleManager, org.apache.wiki.api.engine.Initializable
Defines an editor manager. An editor can be added by adding a suitable JSP file under templates/default/editors If you want your editor to include any scripts or something, you can simply request it by adding the following in your `ini/jspwiki_module.xml`:

      <modules>
       <editor name="myeditor">
           <author>Janne Jalkanen</author>
           <script>foo.js</script>
           <stylesheet>foo.css</stylesheet>
           <path>editors/myeditor.jsp</path>
       </editor>
      </modules>

Since:
  2.4

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`ATTR_EDITEDTEXT`
Known attribute name for storing the user edited text inside a session or a page context
`static final String`
`EDITOR_PLAIN`
Known name for the plain wikimarkup editor.
`static final String`
`EDITOR_PREVIEW`
Known name for the preview editor component.
`static final String`
`PARA_EDITOR`
Parameter for changing editors at run-time
`static final String`
`PROP_EDITORTYPE`
The property name for setting the editor.
`static final String`
`REQ_EDITEDTEXT`
Known attribute name for storing the user edited text inside a HTTP parameter.

### Fields inherited from interface org.apache.wiki.modules.ModuleManager

`PLUGIN_I18N_RESOURCE, PLUGIN_RESOURCE_LOCATION`

## Method Summary

Modifier and Type
Method
Description
`static String`
`getEditedText(jakarta.servlet.jsp.PageContext ctx)`
Convenience function which examines the current context and attempts to figure out whether the edited text is in the HTTP request parameters or somewhere in the session.
`String[]`
`getEditorList()`
Returns a list of editors as Strings of editor names.
`String`
`getEditorName(org.apache.wiki.api.core.Context context)`
Returns an editor for the current context.
`String`
`getEditorPath(org.apache.wiki.api.core.Context context)`
Convenience method for getting the path to the editor JSP file.

### Methods inherited from interface org.apache.wiki.api.engine.Initializable

`initialize`

### Methods inherited from interface org.apache.wiki.modules.ModuleManager

`checkCompatibility, getModuleInfo, modules`

## Field Details

### PROP_EDITORTYPE

static final String PROP_EDITORTYPE
The property name for setting the editor. Current value is "jspwiki.editor" - not used anymore: replaced by defaultpref.template.editor

See Also:
  - Constant Field Values

### PARA_EDITOR

static final String PARA_EDITOR
Parameter for changing editors at run-time

See Also:
  - Constant Field Values

### EDITOR_PLAIN

static final String EDITOR_PLAIN
Known name for the plain wikimarkup editor.

See Also:
  - Constant Field Values

### EDITOR_PREVIEW

static final String EDITOR_PREVIEW
Known name for the preview editor component.

See Also:
  - Constant Field Values

### REQ_EDITEDTEXT

static final String REQ_EDITEDTEXT
Known attribute name for storing the user edited text inside a HTTP parameter.

See Also:
  - Constant Field Values

### ATTR_EDITEDTEXT

static final String ATTR_EDITEDTEXT
Known attribute name for storing the user edited text inside a session or a page context

See Also:
  - Constant Field Values

## Method Details

### getEditorName

String getEditorName(org.apache.wiki.api.core.Context context)
Returns an editor for the current context. The editor names are matched in a case insensitive manner. At the moment, the only place that this method looks in is the property file, but in the future this will also look at user preferences.

Determines the editor to use by the following order of conditions: 1. Editor set in User Preferences 2. Default Editor set in jspwiki.properties

For the PREVIEW context, this method returns the "preview" editor.

Parameters:
  `context` - The context that is chosen.
Returns:
  The name of the chosen editor. If no match could be found, will revert to the default "plain" editor.

### getEditorList

String[] getEditorList()
Returns a list of editors as Strings of editor names.

Returns:
  the list of available editors

### getEditorPath

String getEditorPath(org.apache.wiki.api.core.Context context)
Convenience method for getting the path to the editor JSP file.

Parameters:
  `context` - WikiContext from where the editor name is retrieved.
Returns:
  e.g. "editors/plain.jsp"

### getEditedText

static String getEditedText(jakarta.servlet.jsp.PageContext ctx)
Convenience function which examines the current context and attempts to figure out whether the edited text is in the HTTP request parameters or somewhere in the session.

Parameters:
  `ctx` - the JSP page context
Returns:
  the edited text, if present in the session page context or as a parameter