Interface EditorManager

  • All Superinterfaces:
    Initializable, ModuleManager
    All Known Implementing Classes:
    DefaultEditorManager

    public interface EditorManager
    extends ModuleManager, 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 java.lang.String ATTR_EDITEDTEXT
      Known attribute name for storing the user edited text inside a session or a page context
      static java.lang.String EDITOR_PLAIN
      Known name for the plain wikimarkup editor.
      static java.lang.String EDITOR_PREVIEW
      Known name for the preview editor component.
      static java.lang.String PARA_EDITOR
      Parameter for changing editors at run-time
      static java.lang.String PROP_EDITORTYPE
      The property name for setting the editor.
      static java.lang.String REQ_EDITEDTEXT
      Known attribute name for storing the user edited text inside a HTTP parameter.
    • Method Detail

      • getEditorName

        java.lang.String getEditorName​(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

        java.lang.String[] getEditorList()
        Returns a list of editors as Strings of editor names.
        Returns:
        the list of available editors
      • getEditorPath

        java.lang.String getEditorPath​(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 java.lang.String getEditedText​(javax.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