You are here: Foswiki>Tasks Web>Item12614 (19 Nov 2013, GeorgeClark)Edit Attach

Item12614: Uglify.js breaks TinyMCE Editor

Priority: Urgent
Current State: Closed
Released In: 1.1.9
Target Release: patch
Applies To: Engine
Component: BuildContrib, TinyMCEPlugin
Branches: Release01x01 trunk
Reported By: GeorgeClark
Waiting For:
Last Change By: GeorgeClark
The conversion to Uglify.js for javascript compression appears to break TinyMCE. I've confirmed on both our default TMCE as well as on the latest TMCE 4.0.8

  • Checkout Release01x01x
  • ./pseudo-install developer
  • Make operational
  • cd tools; ./build release -nocheck
    • Hit enter to accept "test" as the build type.

These steps build all the extensions, and compress them using uglify.js and cssMin

Create a simple TML file

(A few blank lines) Some text (A few more blank lines) Some more text

Save and edit with TinyMCE

Put cursor on first line, and then with the cursor at the beginning of the blank line, pick Format: Heading 1 When uglify has been used, the blank heading is filled with strange characters.

Hit the [HTML] button to view the wysiwyg editor raw html, the blank lines are incorrectly encoded with both a &#194 and &#160. When yuicompressor is used, the coded line only contains the &#160.


Save the file and the results are:


Because JQuery 2.0.x won't compile with yuicompressor, and tmce is corrupted by uglify, This stops the release.

-- GeorgeClark - 25 Oct 2013

None of the newer jQueries - starting with 1.9.x - is minifiable using yuicompressor.

This does not happen with a {Site}{CharSet} = 'utf-8';

Type file tiny_mce_src.js tiny_mce.js and you get:

tiny_mce_src.js: ASCII English text, with CRLF line terminators
tiny_mce.js:     UTF-8 Unicode text, with very long lines

This file has to be minified using --ascii. Uglify defaults to UTF8. Non-ascii chars in the javascript code will then be translated using an \uxxx notation. Here's a similar report on a non-core plugin - Tasks.Item12610 - which was resolved similarly.

Put the other way around, TinyMCE inserts UTF8 strings into an iso-8859-1 HTML page. Here's a summary of the problem:

For now we default to an ASCII encoding for javascript files, like yui-compressor does as well.

-- MichaelDaum - 25 Oct 2013

The current version of uglify is now version 2. The command line options are very different. New command needed is:

uglifyjs infile -o outfile -b beautify=false,ascii-only=true

-- GeorgeClark - 25 Oct 2013
Topic revision: r16 - 19 Nov 2013, GeorgeClark - This page was cached on 16 Jan 2020 - 04:14.

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