Feature Proposal: Restructure TinyMCE to support multiple versions, add support for TinyMCE Version 4.

Motivation

Make it easier to migrate to new versions of TinyMCE. The API has changed again between 3.x and 4.x, invalidating our custom plugins. This proposal is to restructure the pub/System/TinyMCEPlugin directory structure to support multiple versions of TinyMCE, and also allow versioning of the foswiki plugins.

Description and Documentation

Revised structure:

  pub/System/TinyMCEPlugin/
      plugins   ... (relocate to version specific directories)
      tinymce  ... (relocate to version specific directories
      tinymce-3.4.9 (Foswiki 1.1.9 default)
         -->tinymce/jscripts/tiny_mce/
         -->plugins
      tinymce-3.5.7    (current Foswiki trunk)
   ...
      tinymce-3.5.10  (Moxicode latest 3.x)
         -->tinymce/jscripts/tiny_mce/
         -->plugins
      tinymce-4.0.11  (Moxicode latest 4.x)
         -->tinymce/js/tinymce/..
         -->plugins

Because the plugins directory will depend upon the version, add a %TMCEPLUGINURL% macro for use in the TINYMCEPLUGIN_INIT settings.

TinyMCE.pm jquery plugin needs to be changed to generate the version dependent paths.

Also, 4.x has revised the default script naming

 
V3.x
V4.0
Dev source
script_src.js
script.js
Minified source
script.js
script_min.js

Version configuration:

# ---++ TinyMCEPlugin
# **SELECT tinymce-3.5.10, tinymce-3.4.9, tinymce-3.5.7, tinymce-4.0.11**
# Select the version of TinyMCE editor.
$Foswiki::cfg{Plugins}{TinyMCEPlugin}{TinyMCEVersion} = 'tinymce-3.5.10';

Other considerations

TinyMCE 4 has also removed the theme we use, and has changed the available plugins. This will require more changes to the INIT configuration. We may need a TMCE version specific init string.

TinyMCE 4 now ships the minified versions of the files. We need to decide if we use their minified versions, or generate our own using uglify.js In any event, build instructions need to be revised, as the .min version will already be in the manifest.

Examples

Impact

%WHATDOESITAFFECT%
edit

Implementation

-- Contributors: GeorgeClark - 23 Nov 2013

Discussion

Checked in as Tasks.Item12665 for testing. We can still choose to ship a single tmce version, but this lets trunk more easily switch between versions during development.

-- GeorgeClark - 26 Nov 2013

Good work, George. The issue of switching between TMCE versions that use different directory structures/APIs that we discussed on IRC is not one I feel we should be beating ourselves up with. ideally a rev of FW will restrict itself to using those TMCE versions that it is compatible with, but really that would be gilding the lily - documentation should suffice.

-- CrawfordCurrie - 27 Nov 2013

Thinking about this a bit more, I agree, for our production releases, we should only ship a single, or maybe two compatible versions. I'd still like to keep some mechanism for developing a new version without disabling the current production version.

  • Move the "plugins" back to where it was.
  • If a version specific plugins directory exists in the active version, use it instead

I'm still pondering the init string. That's probably the most difficult part because of all the version specific settings. TMCE 4 makes it all the worse because of the removed skin and plugins.

-- GeorgeClark - 27 Nov 2013

I've created a test topic on trunk Sandbox: http://trunk.foswiki.org/Sandbox/TinyMCEVersion4Edit It attempts to use tmce 4.0.11 to edit that topic. It doesn't work, but it's a starting point to test.

-- GeorgeClark - 28 Nov 2013

Changing this to Parked. The changes have been reverted. They are out on my repo on github. https://github.com/gac410/foswiki/tree/TinyMCEv4 if anyone wants to try again.

My changes missed some resources that should have been versioned.

-- GeorgeClark - 02 Apr 2014
 
Topic revision: r8 - 19 Nov 2015, GeorgeClark
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