Can I use the Xxx editor with Foswiki?

Short answer: yes, you can use any browser-based editor with Foswiki, if you provide an integration. However providing an integration may not be simple

The Gory Detail

The markup used to store topics in Foswiki, TML is designed to be (mostly) human readable. This markup is compiled to HTML before being presented when a page is viewed, but it's capabilities are much less than those of full HTML - it uses a tiny subset of HTML. Any WYSIWYG editor has to work with this subset, while presenting the edited content as close to the final product as possible. At the same time, TML has powerful macro features that allow pages to be generated dynamically. The use of these macros makes WYSIWYG editing of such pages very tricky.

So there are three approaches to support editing TML in Foswiki. Each approach is tuned to a different audience.

  1. A simple text editor that allows editing of TML (basic textarea through to NatEditPlugin).
    • This doesn't attempt to present formatted output - you just edit TML directly. But you can edit the basic code.
    • Ideal for those who write a lot of macros, often preferred by coders.
  2. An enhanced code-sensitive editor that supports more featureful (but still a lot less than HTML) editing (codemirror)
    • This presents the content "WYSIAWYG" (A = almost), so it's still good for editing complex macros, but it isn't WYSIWYG.
    • Probably going to be preferred by coders, but may also be the best choice when Foswiki is used for building frameworks (i.e. users don't have complex requirements for presentation when editing)
  3. A full HTML editor, such as TinyMCE or CK, that supports HTML but has to be "cut down" to work with TML.
    • This is as close to WYSIWYG editing as you can get, but it's really hard to edit dynamic pages this way.
    • Usually preferred by those with non-technical staff or where presentation is important e.g. for shared authoring, but editing macros is left to a minority subset of users.

At the time of writing, Foswiki provides NatEditPlugin for text editing, and TinyMCEPlugin for the full fat WYSIWYG experience. There's work in progress to create a codemirror integration to address the middle ground.

So, WYSIWYG. It's actually relatively easy to integrate a new WYSIWYG editor with Foswiki. When I was writing the TinyMCE integration I abstracted out the TML->HTML->TML conversion into a separate plugin (WysiwygPlugin) and that has vastly simplified the process for other editors. However there are limitations; WysiwygPlugin is not able to convert arbitrary HTML into TML and still maintain text-editable content, because as mentioned above, TML is a tiny subset of full HTML, and has these hairy macros. So the editor has to be "tuned" to produce only a subset of HTML that can be cleanly converted to/from TML, without damaging any macros in the content. This is mostly what TinyMCEPlugin does. Whatever editor you choose, you are still going to end up doing at least the same amount of work as faced with the TinyMCE integration.

The Bottom Line

While it is technically possible to provide an integration for any editor into Foswiki, it is only really easy for simple code / text type editors. If you want the full WYSIWYG experience, then a significant investment is required to "tune" the features of the editor for Foswiki.

-- Main.CrawfordCurrie - 27 Feb 2017 - 10:37

Support.FAQForm edit

TopicClassification FrequentlyAskedQuestion
Subject Editing, Extension, User interface
Topic Summary
Extension
Interested Parties
Related Topics
Topic revision: r1 - 27 Feb 2017, CrawfordCurrie
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy