Features
The CKEditor integration with XWiki provides most of the standard editing features available in CKEditor and some additional features that are specific to XWiki.
Standard CKEditor Features
The standard features include: text formatting, lists, links, images, tables and many more. Check the CKEditor web site to see all the supported features. Note that by default XWiki doesn't enable all the features available in CKEditor because we want the users to focus on the content and leave the styling in the hands of the XWiki skin. This way all wiki pages will have a consistent style. For this we disable by default the features that are related to styles, such as text aligning, changing fonts or text color. If you really need these features you can enable them from the dedicated administration section.
XWiki Features
In order to integrate CKEditor with XWiki we had to modify some of the standard features, like links and images, and to add new features that only make sense in XWiki, like support for wiki macros.
Advanced Content Filter for XWiki Syntax
From the start you need to know that the content you edit with the CKEditor is saved in XWiki as wiki syntax. This means that the HTML produced by the CKEditor is converted at save time to wiki syntax. In order for this conversion to be possible we have to disable the CKEditor features that produce content that cannot be written in wiki syntax and to remove (filter) such content from the CKEditor output. We achieve this by configuring the Advanced Content Filter and the Paste Filter with rules for the XWiki Syntax.
In order for a wiki syntax to be compatible with the CKEditor it needs to:
- have a parser so that we can convert from the wiki syntax to HTML before the editor is loaded or when switching from Source to WYSIWYG mode
- have a renderer so that we can convert from HTML to wiki syntax on save or when switching from WYSIWYG mode to Source
- provide a configuration for the Advanced Content Filter; this is hard-coded at the moment unfortunately but we plan to make it plugable
Changing the wiki syntax while the content is being edited with the CKEditor will trigger a reload of the editor because the Advanced Content Filter configuration cannot be updated on the fly. But don't worry, unsaved changes won't be lost. In case the new wiki syntax doesn't support WYSIWYG editing (because it doesn't have a renderer that would allow the editor to convert the edited content from HTML to the new syntax) then the CKEditor will force the Source mode after the reload, disabling the WYSIWYG mode at the same time.
Checkout the XWiki Rendering Framework documentation for more information on available syntaxes.
Wiki Syntax Source
The Source button from the tool bar allows you to view and edit the underlying wiki syntax that is generated by the CKEditor. The text selection (caret) is preserved when switching between Source and WYSIWYG mode (
).Wiki Links
We modified the link dialog to add support for creating links to wiki pages and attachments. You can still create links to arbitrary web pages (URLs) and links to mail addresses though.
You can select the target page or attachment from the list of suggestions that you get as you type or from the tree picker. You can attach files to the edited page from the Upload tab that is visible when the link target type is set to Attachment, or you can drop them over the editing area and the editor will automatically create a link to the new attachment.
You can also create links to existing wiki pages and attachments directly from the editing area using the link auto-complete feature. Just type [ (open square bracket) followed by at least 2 characters and you will get link suggestions based on the typed text.
To remove a link (unlink) you have multiple options:
- click on the link and use the balloon (context) toolbar
- right click on the link and use the context menu
- or use the toolbar button, if it's available
Image Attachments
We modified the image dialog to add support for inserting images that are attached to wiki pages. You can still insert external image though.
XWiki 14.10+ The new image dialog is now activated by default on new instances, or when CKEditor.Config does not exists.
Otherwise, activating the new image dialog must be done by removing xwiki-image from the disabled plugins list in the WYSIWYG Editor section of the Administration.
To switch back to the previous image dialog, xwiki-image must be added back to the disabled plugins.
You can select the image attachment from the list images gallery, from the document tree, by uploading a new attachment, by using an icon, or by inserting an external link. You can also drop images over the editing area and the editor will automatically upload and insert them.
XWiki 1.62+ The new xwiki-image plugin aims at covering the same feature as xwiki-image-old. In addition, the new xwiki-image allows users to select an image style, giving a standardized appearance to an image by selecting a style from a dropdown list. Image style can be configured from the Image Style Administration page.
XWiki 1.64+ The image size fields (widget and height) from the image edit advanced panel locks the dimensions by default. When changing one of the dimension, the other one is updated accordingly, following the ratio between the dimensions of the selected image.
This behavior can be dactivated by clicking on the lock button.
XWiki 1.63+ Note for developers: The image selection tabs are now provided using an User Interface Extension Point. For more information see the UIXP documentation.
XWiki 15.1+
A warning message is displayed to the user when the width or height of an image are larger than the dimensions of the selected image.
Wiki Macros
We added support for inserting wiki syntax macros. For this you can use either the generic Insert menu or the dedicated macro toolbar button, when available, which opens the Macro Wizard, allowing you to select a macro and set its parameters.
Most macros have their output protected (read-only) within the editing area because the output is generated by transforming the macro content based on the parameters you set. The only way to modify the output of such a macro is through the Macro Wizard, which you can open using the same tool bar button or simply by double clicking anywhere on the macro output. If the macro output is empty a place-holder is displayed instead so that you are able to edit the macro parameters.
If the macro is on a separate line (stand-alone, not inside a paragraph of text) and its content is rendered without being transformed then the editor allows editing the macro content in-place, directly inside the editing area. Some parts of the macro output will still be protected but the area where the macro content is displayed is editable. Using the tool bar button while the caret is inside the macro content will insert a nested macro. Double clicking on the macro output won't open the Macro Wizard. If you want to edit the macro parameters you can use the balloon tool bar visible when the macro content is focused.
When the output of a macro is selected, the macro name appears on the path displayed on the editor status bar.
XWiki <14.4.3, <14.6 On the "Select Macro" step of the Macro Wizard the deprecated and internal macros are hidden from the "All Macros" category that is selected by default. If you need to use a deprecated or internal macro you need to select the corresponding category explicitly.
XWiki 14.6+ On the "Select Macro" step, it is now possible to filter by several categories (as macros can now be attached to several categories). The listed macros are the one who have at least all of the selected categories. If no category is selected, all the macros are listed. Macros with an hidden category are not displayed to users who have Display hidden pages set to False in their preferences. Hidden macros categories are Deprecated and Internal by default, and can be configured by Admins since 14.8+.
XWiki 14.4+ It's also possible to install and select a not yet installed macro by searching for the "Not Installed" category.
On the Edit Macro step the mandatory parameters and those that have an explicit value set are shown first. The advanced parameters are shown last. The deprecated parameters and those that can be edited in-place (within the editing area) are not shown. If there are too many parameters, some of them are collapsed under a "More" section. When inserting a macro, the macro content text area is prefilled with the text selected within the editing area. This means you can for instance transform a paragraph into an error message by selecting the paragraph text, click the Insert Macro button from the tool bar, select the Error Message macro and insert it. The Macro Wizard doesn't show the macro content text area if the macro content can be edited in-place.
The macro parameters can be grouped, if the macro descriptor says so. Check for instance the Include Macro. Two types of macro parameter groups are supported:
- groups of related parameters (e.g. reference and type in the case of the Include Macro)
- groups of alternative parameters (only one parameter in the group should be set); this type of groups are displayed using tabs (e.g. "Resource" and "Page" in the case of the Include Macro)
Some macro parameters will have pickers, depending on their type. The binding between macro parameter types and the associated pickers is done on the server side (check the templates/html_displayer folder inside the XWiki WAR). For instance, if you have a wiki-based rendering macro, you can set the type of a macro parameter to "org.xwiki.model.reference.DocumentReference" in order to get a document picker when inserting or editing your macro from the WYSIWYG editor.
Office Import
You can import office files using a dedicated button from the tool bar. The files are uploaded and attached to the edited page and their content (including images) is inserted in the content of the page. You have the option to filter the styles and to use the Office Viewer macro.
This feature requires the Office Server to be connected. See the Office Importer Application documentation for more information.
Custom Styles
We customized the Styles drop down from the tool bar to include only the styles that make sense in XWiki. We added new styles for tables, images and paragraphs that are specific to the XWiki skin.
Spell Checker
The CKEditor integration uses by default the native browser spell checker. To access the spell checking suggestions you need to use one of the following shortcuts:
- Windows: Ctrl + Right Click
- MacOS: Alt + Cmd
- Linux: Ctrl + Right Click
If you don't get any suggestions then it may be the case that your browser doesn't support spell checking natively. You can also configure CKEditor to use an external spell checking web service. Checkout the CKEditor documentation for more information.
If you're looking for a more secure (local) spell checker then there are CKEditor plugins that provide this functionality.
Full Screen Mode
We modified the standard full screen mode from CKEditor to integrate with XWiki's form action buttons.
Unsaved Changes Protection
A confirmation popup is shown when leaving the page with unsaved changes. This should prevent you from loosing unsaved changes by mistake. Additionally, on Firefox, unsaved changes are cached and restored if you leave the page and then go back. The same happens if you (soft) reload the page.
Quick Actions
XWiki 15.5+
The CKEditor integration supports performing various editing actions via a single / shortcut.
To use
The Quick Actions dropdown comes with a set of default action:
- Structure
- Heading
- Paragraph
- Bulleted List
- Numbered List
- Table
- Quote
- Info Box
- Warning Box
- Error Box
- Success Box
- Divider
- Content
- Link
- Image
- Mention
- Emoji
- Include Page
- Formatting
- Code Snippet
- Navigation
- Table Of Contents
- Actions
- Find & Replace
- Table
- Insert Row
- Insert Column
- Delete Row
- Delete Column
- Split Cell
- Merge Cells
- Insert Cell
- Delete Cell
- Delete Table
Keyboard Shortcuts
The following keyboard shortcuts are available:
- standard keyboard shortcuts provided by CKEditor, independent of its integration in XWiki
- XWiki custom shortcut keys:
- [ (open square bracket) provided by XWiki's custom link plugin
- @ (at sign) provided by Mentions Application
- XWiki 15.5+ / (forward slash) provided by XWiki's custom quick actions plugin
- edit form shortcut keys to preview, save or cancel the edit form
- custom shortcut keys that an administrator can add using the keystrokes CKEditor configuration parameter from the dedicated administration section.
Administration Section
A dedicated section in the Wiki Administration is available for the CKEditor where you can enable or disable editing features. Check the customization guide for more advanced configuration options.
Classic Editor vs. Inline Editor
CKEditor can be integrated either by replacing (or acting as) a text area (the classic editor) or by making a paragraph or a section of the page editable in-place (the inline editor). Let's see what are the main differences:
Classic Editor | Inline Editor | |
---|---|---|
Used by | WYSIWYG edit mode, Form edit mode for TextArea properties | In-place editing |
Height | Fixed | Variable |
Toolbar position | Fixed, above the editing area | Floating, at the top or at the bottom of the edited section, visible only on focus |
Missing features | JavaScript execution disabled by default within the editing area | Bottom (path) bar |