Repository: mockup
Branch: refs/heads/master
Date: 2014-11-24T16:31:44+01:00
Author: Johannes Raggam (thet) <raggam-nl@adm.at>
Commit: https://github.com/plone/mockup/commit/7c1085147c59eced56176d17cf68efca50cbaae8

Depend on tinymce-builded 4.1.6, include TinyMCE copy and sed configuration in here and fix some sed tasks.  Revert cd89d377e10a28b797fd3c9d48410ad6ad597486: 'Remove bower dependency on tinymce-builded, since the tinymce dependency already points to the official builded tinymce-dist reposotory.' tinymce-dist doesn't include the language files, which are needed.

Files changed:
M CHANGES.rst
M mockup/Gruntfile.js
M mockup/bower.json
M mockup/js/config.js
M mockup/patterns/tinymce/pattern.js

diff --git a/CHANGES.rst b/CHANGES.rst
index ed665c3..64517bd 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -4,6 +4,14 @@ Changelog
 1.8.3 (unreleased)
 ------------------
 
+- Depend on ``tinymce-builded`` 4.1.6, include TinyMCE copy and sed
+  configuration in here and fix some sed tasks.
+  Revert cd89d377e10a28b797fd3c9d48410ad6ad597486: "Remove bower dependency on
+  ``tinymce-builded``, since the ``tinymce`` dependency already points to the
+  official builded ``tinymce-dist`` reposotory." ``tinymce-dist`` doesn't
+  include the language files, which are needed. 
+  [thet]
+
 - Add mimetype selector pattern for textareas.
   [thet]
 
diff --git a/mockup/Gruntfile.js b/mockup/Gruntfile.js
index a3ecaa8..7799c75 100644
--- a/mockup/Gruntfile.js
+++ b/mockup/Gruntfile.js
@@ -9,6 +9,7 @@ module.exports = function(grunt) {
 
   var MockupGrunt = require('./bower_components/mockup-core/js/grunt'),
       requirejsOptions = require('./js/config'),
+      extend = require('./node_modules/extend/index'),
       mockup = new MockupGrunt(requirejsOptions),
       docsExtraIncludes = [];
 
@@ -20,6 +21,74 @@ module.exports = function(grunt) {
     }
   }
 
+  var copy_tinymce = function (name, path) {
+    var ret = {};
+    ret[name] = {
+      files: [
+        {
+          expand: true, cwd: 'bower_components/tinymce-builded/js/tinymce/langs', src: '*', dest: path + name + '-tinymce/langs'
+        }, {
+          expand: true, cwd: 'bower_components/tinymce-builded/js/tinymce/skins/lightgray/fonts/', src: 'tinymce*', dest: path,
+          rename: function(dest, src) { return dest + name + '-tinymce-font-' + src; }
+        }, {
+          expand: true, cwd: 'bower_components/tinymce-builded/js/tinymce/skins/lightgray/img/', src: '*', dest: path,
+          rename: function(dest, src) { return dest + name + '-tinymce-img-' + src; }
+        }, {
+          expand: true, cwd: 'bower_components/tinymce-builded/js/tinymce/skins/lightgray/', src: 'content.min.css', dest: path,
+          rename: function(dest, src) { return dest + name + '-tinymce-' + src; }
+        }
+      ]
+    };
+    return ret;
+  };
+  var sed_tinymce = function(name, path, url) {
+    var ret = {};
+
+    ret[name + '-tinymce-fonts'] = {
+      path: path + name + '.min.css',
+      pattern: 'url\\(\'?fonts/tinymce\'?',  // match urls with and without quotes
+      replacement: 'url(\'' + url + '-tinymce-font-tinymce\''
+    };
+    ret[name + '-tinymce-img-loader'] = {
+      path: path + name + '.min.css',
+      pattern: 'url\\(\'?img/loader.gif\'?',
+      replacement: 'url(\'' + url + '-tinymce-img-loader.gif\''
+    };
+    ret[name + '-tinymce-img-anchor'] = {
+      path: path + name + '.min.css',
+      pattern: 'url\\(\'?img/anchor.gif\'?',
+      replacement: 'url(\'' + url + '-tinymce-img-anchor.gif\''
+    };
+    ret[name + '-tinymce-img-object'] = {
+      path: path + name + '.min.css',
+      pattern: 'url\\(\'?img/object.gif\'?',
+      replacement: 'url(\'' + url + '-tinymce-img-object.gif\''
+    };
+
+    ret[name + '-tinymce-fonts2'] = {
+      path: path + name + '-tinymce-content.min.css',
+      pattern: 'url\\(\'?fonts/tinymce\'?',  // match urls with and without quotes
+      replacement: 'url(\'' + url + '-tinymce-font-tinymce\''
+    };
+    ret[name + '-tinymce-img-loader2'] = {
+      path: path + name + '-tinymce-content.min.css',
+      pattern: 'url\\(\'?img/loader.gif\'?',
+      replacement: 'url(\'' + url + '-tinymce-img-loader.gif\''
+    };
+    ret[name + '-tinymce-img-anchor2'] = {
+      path: path + name + '-tinymce-content.min.css',
+      pattern: 'url\\(\'?img/anchor.gif\'?',
+      replacement: 'url(\'' + url + '-tinymce-img-anchor.gif\''
+    };
+    ret[name + '-tinymce-img-object2'] = {
+      path: path + name + '-tinymce-content.min.css',
+      pattern: 'url\\(\'?img/object.gif\'?',
+      replacement: 'url(\'' + url + '-tinymce-img-object.gif\''
+    };
+    return ret;
+  };
+
+
   mockup.registerBundle('docs', {
     less: {
       options : {
@@ -32,48 +101,61 @@ module.exports = function(grunt) {
       }
     },
     copy: {
-      docs: {
-        files: [
-          { expand: true, src: 'index.html', dest: 'docs/dev/' },
-          { expand: true, src: '*.md', dest: 'docs/dev/' },
-          { expand: true, src: 'js/**', dest: 'docs/dev/' },
-          { expand: true, src: 'tests/**', dest: 'docs/dev/' },
-          { expand: true, src: 'lib/**', dest: 'docs/dev/' },
-          { expand: true, src: 'bower_components/**', dest: 'docs/dev/' },
-          { expand: true, src: 'node_modules/requirejs/require.js', dest: 'docs/dev/' },
-          { expand: true, src: 'build/**', dest: 'docs/dev/' },
-          { expand: true, src: 'less/**', dest: 'docs/dev/' }
-        ]
-      }
+      docs: extend(true,
+        {
+          files: [
+            { expand: true, src: 'index.html', dest: 'docs/dev/' },
+            { expand: true, src: '*.md', dest: 'docs/dev/' },
+            { expand: true, src: 'js/**', dest: 'docs/dev/' },
+            { expand: true, src: 'tests/**', dest: 'docs/dev/' },
+            { expand: true, src: 'lib/**', dest: 'docs/dev/' },
+            { expand: true, src: 'bower_components/**', dest: 'docs/dev/' },
+            { expand: true, src: 'node_modules/requirejs/require.js', dest: 'docs/dev/' },
+            { expand: true, src: 'build/**', dest: 'docs/dev/' },
+            { expand: true, src: 'less/**', dest: 'docs/dev/' }
+          ]
+        },
+        copy_tinymce('docs', 'docs/dev/')
+      )
     },
-    sed: {
-      'docs-css': {
-        path: 'docs/dev/index.html',
-        pattern: 'href="docs/dev/docs.min.css"',
-        replacement: 'href="docs.min.css"'
-      },
-      'docs-js': {
-        path: 'docs/dev/index.html',
-        pattern: '<script src="node_modules/grunt-contrib-less/node_modules/less/dist/less-1.6.1.js"></script>\n  <script src="node_modules/requirejs/require.js"></script>\n  <script src="js/config.js"></script>\n  <script>require\\(\\[\'mockup-bundles-docs\'\\]\\);</script>',
-        replacement: '<script src="docs.min.js"></script>'
+    sed: extend(true,
+      {
+        'docs-css': {
+          path: 'docs/dev/index.html',
+          pattern: 'href="docs/dev/docs.min.css"',
+          replacement: 'href="docs.min.css"'
+        },
+        'docs-js': {
+          path: 'docs/dev/index.html',
+          pattern: '<script src="node_modules/grunt-contrib-less/node_modules/less/dist/less-1.6.1.js"></script>\n  <script src="node_modules/requirejs/require.js"></script>\n  <script src="js/config.js"></script>\n  <script>require\\(\\[\'mockup-bundles-docs\'\\]\\);</script>',
+          replacement: '<script src="docs.min.js"></script>'
+        },
+        'docs-legacy-js': {
+          path: 'docs/dev/index.html',
+          pattern: '<script src="bower_components/es5-shim/es5-shim.js"></script>\n    <script src="bower_components/es5-shim/es5-sham.js"></script>\n    <script src="bower_components/console-polyfill/index.js"></script>',
+          replacement: '<script src="docs-legacy.js"></script>'
+        }
       },
-      'docs-legacy-js': {
-        path: 'docs/dev/index.html',
-        pattern: '<script src="bower_components/es5-shim/es5-shim.js"></script>\n    <script src="bower_components/es5-shim/es5-sham.js"></script>\n    <script src="bower_components/console-polyfill/index.js"></script>',
-        replacement: '<script src="docs-legacy.js"></script>'
-      }
-    }
+      sed_tinymce('widgets', 'docs/dev/', '++resource++plone.app.widgets')
+    )
   }, {
     path: 'docs/dev/',
     url: 'docs',
     extraInclude: docsExtraIncludes,
-  }, ['requirejs', 'less', 'copy', 'sed']);
+  }, ['requirejs', 'uglify', 'less', 'copy', 'sed']);
 
   mockup.registerBundle('structure', {}, { url: '++resource++wildcard.foldercontents-structure' });
   mockup.registerBundle('filemanager', {}, { url: '++resource++plone.resourceeditor-filemanager' });
   mockup.registerBundle('resourceregistry');
-  mockup.registerBundle('plone', {}, {url: '++resource++plone'});
-  mockup.registerBundle('widgets');
+  mockup.registerBundle('plone', {
+    copy: copy_tinymce('plone', 'build/'),
+    sed: sed_tinymce('plone', 'build/', '++resource++plone')
+  }, {path: 'build/', url: '++resource++plone'});
+  mockup.registerBundle('widgets', {
+    copy: copy_tinymce('widgets', 'build/'),
+    sed: sed_tinymce('widgets', 'build/', '++resource++plone.app.widgets')
+  }, {path: 'build/', url: '++resource++plone.app.widgets'});
+
 
   mockup.initGrunt(grunt, {
     sed: {
diff --git a/mockup/bower.json b/mockup/bower.json
index e6d5ff9..fa4ea7a 100644
--- a/mockup/bower.json
+++ b/mockup/bower.json
@@ -19,7 +19,7 @@
     "pickadate": "3.4.0",
     "requirejs-text": "2.0.12",
     "select2": "3.5.1",
-    "tinymce": "4.1.6"
+    "tinymce-builded": "4.1.6"
   },
   "devDependencies": {
     "expect": "0.3.1",
diff --git a/mockup/js/config.js b/mockup/js/config.js
index a41aa7e..f7b7497 100644
--- a/mockup/js/config.js
+++ b/mockup/js/config.js
@@ -108,8 +108,8 @@
       'select2': 'bower_components/select2/select2',
       'sinon': 'bower_components/sinonjs/sinon',
       'text': 'bower_components/requirejs-text/text',
-      'tinymce': 'bower_components/tinymce/tinymce',
-      'tinymce-modern-theme': 'bower_components/tinymce/themes/modern/theme',
+      'tinymce': 'bower_components/tinymce-builded/js/tinymce/tinymce',
+      'tinymce-modern-theme': 'bower_components/tinymce-builded/js/tinymce/themes/modern/theme',
       'underscore': 'bower_components/lodash/dist/lodash.underscore'
     },
     shim: {
diff --git a/mockup/patterns/tinymce/pattern.js b/mockup/patterns/tinymce/pattern.js
index 1cde373..1b74013 100644
--- a/mockup/patterns/tinymce/pattern.js
+++ b/mockup/patterns/tinymce/pattern.js
@@ -116,7 +116,7 @@ define([
         externalImage: _t('External Image URI')
       },
       // URL generation options
-      loadingBaseUrl: '../../../bower_components/tinymce/',
+      loadingBaseUrl: '../../../bower_components/tinymce-builded/js/tinymce/',
       prependToUrl: '',
       appendToUrl: '',
       linkAttribute: 'path', // attribute to get link value from data