tinymce-rails 4.5.1 → 4.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -8
  3. data/app/assets/source/tinymce/tinymce.js +337 -60
  4. data/lib/tinymce/rails/engine.rb +4 -4
  5. data/lib/tinymce/rails/version.rb +2 -2
  6. data/vendor/assets/javascripts/tinymce/jquery.tinymce.js +1 -1
  7. data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +1 -1
  8. data/vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js +1 -1
  9. data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.js +1 -1
  10. data/vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js +1 -1
  11. data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.js +1 -1
  12. data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +1 -1
  13. data/vendor/assets/javascripts/tinymce/plugins/fullpage/plugin.js +1 -1
  14. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +1 -1
  15. data/vendor/assets/javascripts/tinymce/plugins/image/plugin.js +1 -1
  16. data/vendor/assets/javascripts/tinymce/plugins/imagetools/plugin.js +1 -1
  17. data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +1 -1
  18. data/vendor/assets/javascripts/tinymce/plugins/link/plugin.js +1 -1
  19. data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +1 -1
  20. data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +1 -1
  21. data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.js +1 -1
  22. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/plugin.js +1 -1
  23. data/vendor/assets/javascripts/tinymce/plugins/spellchecker/plugin.js +1 -1
  24. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +2 -2
  25. data/vendor/assets/javascripts/tinymce/plugins/textcolor/plugin.js +1 -1
  26. data/vendor/assets/javascripts/tinymce/plugins/textpattern/plugin.js +1 -1
  27. data/vendor/assets/javascripts/tinymce/plugins/toc/plugin.js +1 -1
  28. data/vendor/assets/javascripts/tinymce/plugins/visualchars/plugin.js +1 -1
  29. data/vendor/assets/javascripts/tinymce/plugins/wordcount/plugin.js +1 -1
  30. data/vendor/assets/javascripts/tinymce/skins/lightgray/content.inline.min.css +1 -1
  31. data/vendor/assets/javascripts/tinymce/skins/lightgray/content.min.css +1 -1
  32. data/vendor/assets/javascripts/tinymce/themes/inlite/theme.js +1 -1
  33. data/vendor/assets/javascripts/tinymce/themes/modern/theme.js +1 -1
  34. data/vendor/assets/javascripts/tinymce/tinymce.js +14 -14
  35. metadata +2 -63
  36. data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.dev.js +0 -141
  37. data/vendor/assets/javascripts/tinymce/plugins/layer/plugin.js +0 -1
  38. data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.dev.js +0 -143
  39. data/vendor/assets/javascripts/tinymce/plugins/spellchecker/plugin.dev.js +0 -139
  40. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.dev.js +0 -143
  41. data/vendor/assets/javascripts/tinymce/skins/lightgray/AbsoluteLayout.less +0 -17
  42. data/vendor/assets/javascripts/tinymce/skins/lightgray/Animations.less +0 -10
  43. data/vendor/assets/javascripts/tinymce/skins/lightgray/Arrows.less +0 -115
  44. data/vendor/assets/javascripts/tinymce/skins/lightgray/Button.less +0 -175
  45. data/vendor/assets/javascripts/tinymce/skins/lightgray/ButtonGroup.less +0 -71
  46. data/vendor/assets/javascripts/tinymce/skins/lightgray/Checkbox.less +0 -49
  47. data/vendor/assets/javascripts/tinymce/skins/lightgray/ColorBox.less +0 -6
  48. data/vendor/assets/javascripts/tinymce/skins/lightgray/ColorButton.less +0 -72
  49. data/vendor/assets/javascripts/tinymce/skins/lightgray/ColorPicker.less +0 -80
  50. data/vendor/assets/javascripts/tinymce/skins/lightgray/ComboBox.less +0 -97
  51. data/vendor/assets/javascripts/tinymce/skins/lightgray/Container.less +0 -9
  52. data/vendor/assets/javascripts/tinymce/skins/lightgray/Content.Inline.less +0 -4
  53. data/vendor/assets/javascripts/tinymce/skins/lightgray/Content.Objects.less +0 -178
  54. data/vendor/assets/javascripts/tinymce/skins/lightgray/Content.less +0 -27
  55. data/vendor/assets/javascripts/tinymce/skins/lightgray/CropRect.less +0 -62
  56. data/vendor/assets/javascripts/tinymce/skins/lightgray/FieldSet.less +0 -15
  57. data/vendor/assets/javascripts/tinymce/skins/lightgray/FitLayout.less +0 -9
  58. data/vendor/assets/javascripts/tinymce/skins/lightgray/FloatPanel.less +0 -69
  59. data/vendor/assets/javascripts/tinymce/skins/lightgray/FlowLayout.less +0 -36
  60. data/vendor/assets/javascripts/tinymce/skins/lightgray/Icons.Ie7.less +0 -136
  61. data/vendor/assets/javascripts/tinymce/skins/lightgray/Icons.less +0 -182
  62. data/vendor/assets/javascripts/tinymce/skins/lightgray/Iframe.less +0 -6
  63. data/vendor/assets/javascripts/tinymce/skins/lightgray/ImagePanel.less +0 -25
  64. data/vendor/assets/javascripts/tinymce/skins/lightgray/InfoBox.less +0 -71
  65. data/vendor/assets/javascripts/tinymce/skins/lightgray/Label.less +0 -38
  66. data/vendor/assets/javascripts/tinymce/skins/lightgray/ListBox.less +0 -26
  67. data/vendor/assets/javascripts/tinymce/skins/lightgray/Menu.less +0 -34
  68. data/vendor/assets/javascripts/tinymce/skins/lightgray/MenuBar.less +0 -32
  69. data/vendor/assets/javascripts/tinymce/skins/lightgray/MenuButton.less +0 -34
  70. data/vendor/assets/javascripts/tinymce/skins/lightgray/MenuItem.less +0 -176
  71. data/vendor/assets/javascripts/tinymce/skins/lightgray/Mixins.less +0 -54
  72. data/vendor/assets/javascripts/tinymce/skins/lightgray/Notification.less +0 -142
  73. data/vendor/assets/javascripts/tinymce/skins/lightgray/Panel.less +0 -7
  74. data/vendor/assets/javascripts/tinymce/skins/lightgray/Path.less +0 -45
  75. data/vendor/assets/javascripts/tinymce/skins/lightgray/Progress.less +0 -34
  76. data/vendor/assets/javascripts/tinymce/skins/lightgray/Radio.less +0 -1
  77. data/vendor/assets/javascripts/tinymce/skins/lightgray/Reset.less +0 -32
  78. data/vendor/assets/javascripts/tinymce/skins/lightgray/ResizeHandle.less +0 -18
  79. data/vendor/assets/javascripts/tinymce/skins/lightgray/Scrollable.less +0 -44
  80. data/vendor/assets/javascripts/tinymce/skins/lightgray/SelectBox.less +0 -6
  81. data/vendor/assets/javascripts/tinymce/skins/lightgray/Sidebar.less +0 -49
  82. data/vendor/assets/javascripts/tinymce/skins/lightgray/Slider.less +0 -33
  83. data/vendor/assets/javascripts/tinymce/skins/lightgray/Spacer.less +0 -5
  84. data/vendor/assets/javascripts/tinymce/skins/lightgray/SplitButton.less +0 -49
  85. data/vendor/assets/javascripts/tinymce/skins/lightgray/StackLayout.less +0 -5
  86. data/vendor/assets/javascripts/tinymce/skins/lightgray/TabPanel.less +0 -44
  87. data/vendor/assets/javascripts/tinymce/skins/lightgray/TextBox.less +0 -41
  88. data/vendor/assets/javascripts/tinymce/skins/lightgray/Throbber.less +0 -19
  89. data/vendor/assets/javascripts/tinymce/skins/lightgray/TinyMCE.less +0 -159
  90. data/vendor/assets/javascripts/tinymce/skins/lightgray/ToolTip.less +0 -133
  91. data/vendor/assets/javascripts/tinymce/skins/lightgray/Variables.less +0 -218
  92. data/vendor/assets/javascripts/tinymce/skins/lightgray/Window.less +0 -127
  93. data/vendor/assets/javascripts/tinymce/skins/lightgray/skin.dev.less +0 -48
  94. data/vendor/assets/javascripts/tinymce/skins/lightgray/skin.ie7.dev.less +0 -47
  95. data/vendor/assets/javascripts/tinymce/skins/lightgray/skin.ie7.less +0 -2777
  96. data/vendor/assets/javascripts/tinymce/skins/lightgray/skin.less +0 -2874
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1eff555fd94298ee7259be2f9992594ebe666481
4
- data.tar.gz: 971cda6a0667dcfa14039d5e70b645c12a3224e9
3
+ metadata.gz: 774856e68bfdc0e95ca168f1618932b9cdb08938
4
+ data.tar.gz: aa4c60fc005a90f4c5f97a45ba7b669d422872f4
5
5
  SHA512:
6
- metadata.gz: 6ab6d5053352ece597a9cdda52b9ca6e72ed9ecb08892504000b390b5c3f14a0ec5f532f4fcccd7274ed637cbe3473b10a590185812b7fb05a44c4daba1344dc
7
- data.tar.gz: a6c1efd6aec37f00d689182bec76e142b7b268d4bd0fca8437ae01a7b049565c8093a23c083a3e47ac2b3d5fe55ca8682bfc75aef6c54305d27b619ad9076a82
6
+ metadata.gz: 4099dd85f4a21a4740bee21af2ed921a27c17b90f09bb89bdb23708934d1ef0d7161b7bc2a662b08d275e6456c48f97c5cd53d81aef3aaf2179bd7020273ca7a
7
+ data.tar.gz: 21755728d8469875420cdccedafa14063f20d4f93e3b797cad17f6cc0f7c8f0e03a1b90e6a767083109dc2e828dd6814bd04991661c38bd8d48b6d400ddd10dd
data/README.md CHANGED
@@ -85,7 +85,7 @@ For each textarea that you want to use with TinyMCE, add the "tinymce" class and
85
85
  ```erb
86
86
  <%= text_area_tag :content, "", :class => "tinymce", :rows => 40, :cols => 120 %>
87
87
  ```
88
-
88
+
89
89
  or if you are using Rails' form builders:
90
90
 
91
91
  ```erb
@@ -138,22 +138,20 @@ Asset Compilation
138
138
 
139
139
  Since TinyMCE loads most of its files dynamically, some workarounds are required to ensure that the TinyMCE asset files are accessible using non-digested filenames.
140
140
 
141
- As of tinymce-rails 3.5.11, 4.1.10 and 4.2.1, two alternative asset installation methods are available, which can be changed by setting `config.tinymce.install` within your `config/application.rb` file. Both methods are called when you run `rake asset:precompile` (via `Rake::Task#enhance`) after the regular application assets are compiled.
141
+ As of tinymce-rails 3.5.11, 4.1.10 and 4.2.1, two alternative asset installation methods are available, which can be changed by setting `config.tinymce.install` within your `config/application.rb` file. These methods are called when you run `rake asset:precompile` (via `Rake::Task#enhance`) after the regular application assets are compiled.
142
142
 
143
- The default method, `copy`, copies the TinyMCE assets directly into `public/assets` and appends the file information into the asset manifest.
143
+ The default method (as of 4.5.2), `compile`, adds the TinyMCE paths to the Sprockets precompilation paths and then creates symlinks from the non-digested filenames to their digested versions.
144
144
 
145
145
  ```ruby
146
- config.tinymce.install = :copy
146
+ config.tinymce.install = :compile
147
147
  ```
148
148
 
149
- The new method, `compile`, adds the TinyMCE paths to the Sprockets precompilation paths and then creates symlinks from the non-digested filenames to their digested versions.
149
+ If you experience issues with the `compile` method, you may wish to use the `copy` method instead, which copies the TinyMCE assets directly into `public/assets` and appends the file information into the asset manifest.
150
150
 
151
151
  ```ruby
152
- config.tinymce.install = :compile
152
+ config.tinymce.install = :copy
153
153
  ```
154
154
 
155
- Due to compilation times, this method is only recommended using Rails 4 and up. This method is intended to eventually become the default, so please try it if it suits your environment and report any issues.
156
-
157
155
  If you are including TinyMCE via `application.js` or using the `tinymce_assets` helper, you do not need to manually alter the precompile paths. However if you wish to include `tinymce-jquery.js` independently (i.e. using `javascript_include_tag`), you will need to add it to the precompile list in `config/environments/production.rb`:
158
156
 
159
157
  ```ruby
@@ -1,4 +1,4 @@
1
- // 4.5.1 (2016-12-07)
1
+ // 4.5.2 (2017-01-04)
2
2
 
3
3
  /**
4
4
  * Compiled inline version. (Library mode)
@@ -9425,10 +9425,15 @@ define("tinymce/dom/ScriptLoader", [
9425
9425
  var DOM = DOMUtils.DOM;
9426
9426
  var each = Tools.each, grep = Tools.grep;
9427
9427
 
9428
+ var isFunction = function (f) {
9429
+ return typeof f === 'function';
9430
+ };
9431
+
9428
9432
  function ScriptLoader() {
9429
9433
  var QUEUED = 0,
9430
9434
  LOADING = 1,
9431
9435
  LOADED = 2,
9436
+ FAILED = 3,
9432
9437
  states = {},
9433
9438
  queue = [],
9434
9439
  scriptLoadedCallbacks = {},
@@ -9441,9 +9446,10 @@ define("tinymce/dom/ScriptLoader", [
9441
9446
  *
9442
9447
  * @method load
9443
9448
  * @param {String} url Absolute URL to script to add.
9444
- * @param {function} callback Optional callback function to execute ones this script gets loaded.
9449
+ * @param {function} callback Optional success callback function when the script loaded successfully.
9450
+ * @param {function} callback Optional failure callback function when the script failed to load.
9445
9451
  */
9446
- function loadScript(url, callback) {
9452
+ function loadScript(url, success, failure) {
9447
9453
  var dom = DOM, elm, id;
9448
9454
 
9449
9455
  // Execute callback when script is loaded
@@ -9454,21 +9460,25 @@ define("tinymce/dom/ScriptLoader", [
9454
9460
  elm.onreadystatechange = elm.onload = elm = null;
9455
9461
  }
9456
9462
 
9457
- callback();
9463
+ success();
9458
9464
  }
9459
9465
 
9460
9466
  function error() {
9461
9467
  /*eslint no-console:0 */
9462
9468
 
9463
- // Report the error so it's easier for people to spot loading errors
9464
- if (typeof console !== "undefined" && console.log) {
9465
- console.log("Failed to load: " + url);
9466
- }
9467
-
9468
9469
  // We can't mark it as done if there is a load error since
9469
9470
  // A) We don't want to produce 404 errors on the server and
9470
9471
  // B) the onerror event won't fire on all browsers.
9471
9472
  // done();
9473
+
9474
+ if (isFunction(failure)) {
9475
+ failure();
9476
+ } else {
9477
+ // Report the error so it's easier for people to spot loading errors
9478
+ if (typeof console !== "undefined" && console.log) {
9479
+ console.log("Failed to load script: " + url);
9480
+ }
9481
+ }
9472
9482
  }
9473
9483
 
9474
9484
  id = dom.uniqueId();
@@ -9524,10 +9534,11 @@ define("tinymce/dom/ScriptLoader", [
9524
9534
  *
9525
9535
  * @method add
9526
9536
  * @param {String} url Absolute URL to script to add.
9527
- * @param {function} callback Optional callback function to execute ones this script gets loaded.
9537
+ * @param {function} success Optional success callback function to execute when the script loades successfully.
9528
9538
  * @param {Object} scope Optional scope to execute callback in.
9539
+ * @param {function} failure Optional failure callback function to execute when the script failed to load.
9529
9540
  */
9530
- this.add = this.load = function(url, callback, scope) {
9541
+ this.add = this.load = function(url, success, scope, failure) {
9531
9542
  var state = states[url];
9532
9543
 
9533
9544
  // Add url to load queue
@@ -9536,14 +9547,15 @@ define("tinymce/dom/ScriptLoader", [
9536
9547
  states[url] = QUEUED;
9537
9548
  }
9538
9549
 
9539
- if (callback) {
9550
+ if (success) {
9540
9551
  // Store away callback for later execution
9541
9552
  if (!scriptLoadedCallbacks[url]) {
9542
9553
  scriptLoadedCallbacks[url] = [];
9543
9554
  }
9544
9555
 
9545
9556
  scriptLoadedCallbacks[url].push({
9546
- func: callback,
9557
+ success: success,
9558
+ failure: failure,
9547
9559
  scope: scope || this
9548
9560
  });
9549
9561
  }
@@ -9558,11 +9570,12 @@ define("tinymce/dom/ScriptLoader", [
9558
9570
  * Starts the loading of the queue.
9559
9571
  *
9560
9572
  * @method loadQueue
9561
- * @param {function} callback Optional callback to execute when all queued items are loaded.
9573
+ * @param {function} success Optional callback to execute when all queued items are loaded.
9574
+ * @param {function} failure Optional callback to execute when queued items failed to load.
9562
9575
  * @param {Object} scope Optional scope to execute the callback in.
9563
9576
  */
9564
- this.loadQueue = function(callback, scope) {
9565
- this.loadScripts(queue, callback, scope);
9577
+ this.loadQueue = function(success, scope, failure) {
9578
+ this.loadScripts(queue, success, scope, failure);
9566
9579
  };
9567
9580
 
9568
9581
  /**
@@ -9571,23 +9584,27 @@ define("tinymce/dom/ScriptLoader", [
9571
9584
  *
9572
9585
  * @method loadScripts
9573
9586
  * @param {Array} scripts Array of queue items to load.
9574
- * @param {function} callback Optional callback to execute ones all items are loaded.
9587
+ * @param {function} callback Optional callback to execute when scripts is loaded successfully.
9575
9588
  * @param {Object} scope Optional scope to execute callback in.
9589
+ * @param {function} callback Optional callback to execute if scripts failed to load.
9576
9590
  */
9577
- this.loadScripts = function(scripts, callback, scope) {
9578
- var loadScripts;
9591
+ this.loadScripts = function(scripts, success, scope, failure) {
9592
+ var loadScripts, failures = [];
9579
9593
 
9580
- function execScriptLoadedCallbacks(url) {
9594
+ function execCallbacks(name, url) {
9581
9595
  // Execute URL callback functions
9582
9596
  each(scriptLoadedCallbacks[url], function(callback) {
9583
- callback.func.call(callback.scope);
9597
+ if (isFunction(callback[name])) {
9598
+ callback[name].call(callback.scope);
9599
+ }
9584
9600
  });
9585
9601
 
9586
9602
  scriptLoadedCallbacks[url] = undef;
9587
9603
  }
9588
9604
 
9589
9605
  queueLoadedCallbacks.push({
9590
- func: callback,
9606
+ success: success,
9607
+ failure: failure,
9591
9608
  scope: scope || this
9592
9609
  });
9593
9610
 
@@ -9600,13 +9617,18 @@ define("tinymce/dom/ScriptLoader", [
9600
9617
  // Load scripts that needs to be loaded
9601
9618
  each(loadingScripts, function(url) {
9602
9619
  // Script is already loaded then execute script callbacks directly
9603
- if (states[url] == LOADED) {
9604
- execScriptLoadedCallbacks(url);
9620
+ if (states[url] === LOADED) {
9621
+ execCallbacks('success', url);
9622
+ return;
9623
+ }
9624
+
9625
+ if (states[url] === FAILED) {
9626
+ execCallbacks('failure', url);
9605
9627
  return;
9606
9628
  }
9607
9629
 
9608
9630
  // Is script not loading then start loading it
9609
- if (states[url] != LOADING) {
9631
+ if (states[url] !== LOADING) {
9610
9632
  states[url] = LOADING;
9611
9633
  loading++;
9612
9634
 
@@ -9614,7 +9636,16 @@ define("tinymce/dom/ScriptLoader", [
9614
9636
  states[url] = LOADED;
9615
9637
  loading--;
9616
9638
 
9617
- execScriptLoadedCallbacks(url);
9639
+ execCallbacks('success', url);
9640
+
9641
+ // Load more scripts if they where added by the recently loaded script
9642
+ loadScripts();
9643
+ }, function () {
9644
+ states[url] = FAILED;
9645
+ loading--;
9646
+
9647
+ failures.push(url);
9648
+ execCallbacks('failure', url);
9618
9649
 
9619
9650
  // Load more scripts if they where added by the recently loaded script
9620
9651
  loadScripts();
@@ -9625,7 +9656,15 @@ define("tinymce/dom/ScriptLoader", [
9625
9656
  // No scripts are currently loading then execute all pending queue loaded callbacks
9626
9657
  if (!loading) {
9627
9658
  each(queueLoadedCallbacks, function(callback) {
9628
- callback.func.call(callback.scope);
9659
+ if (failures.length === 0) {
9660
+ if (isFunction(callback.success)) {
9661
+ callback.success.call(callback.scope);
9662
+ }
9663
+ } else {
9664
+ if (isFunction(callback.failure)) {
9665
+ callback.failure.call(callback.scope, failures);
9666
+ }
9667
+ }
9629
9668
  });
9630
9669
 
9631
9670
  queueLoadedCallbacks.length = 0;
@@ -9793,8 +9832,9 @@ define("tinymce/AddOnManager", [
9793
9832
  * @method load
9794
9833
  * @param {String} name Short name of the add-on that gets loaded.
9795
9834
  * @param {String} addOnUrl URL to the add-on that will get loaded.
9796
- * @param {function} callback Optional callback to execute ones the add-on is loaded.
9835
+ * @param {function} success Optional success callback to execute when an add-on is loaded.
9797
9836
  * @param {Object} scope Optional scope to execute the callback in.
9837
+ * @param {function} failure Optional failure callback to execute when an add-on failed to load.
9798
9838
  * @example
9799
9839
  * // Loads a plugin from an external URL
9800
9840
  * tinymce.PluginManager.load('myplugin', '/some/dir/someplugin/plugin.js');
@@ -9805,7 +9845,7 @@ define("tinymce/AddOnManager", [
9805
9845
  * plugins: '-myplugin' // Don't try to load it again
9806
9846
  * });
9807
9847
  */
9808
- load: function(name, addOnUrl, callback, scope) {
9848
+ load: function(name, addOnUrl, success, scope, failure) {
9809
9849
  var self = this, url = addOnUrl;
9810
9850
 
9811
9851
  function loadDependencies() {
@@ -9817,11 +9857,11 @@ define("tinymce/AddOnManager", [
9817
9857
  self.load(newUrl.resource, newUrl, undefined, undefined);
9818
9858
  });
9819
9859
 
9820
- if (callback) {
9860
+ if (success) {
9821
9861
  if (scope) {
9822
- callback.call(scope);
9862
+ success.call(scope);
9823
9863
  } else {
9824
- callback.call(ScriptLoader);
9864
+ success.call(ScriptLoader);
9825
9865
  }
9826
9866
  }
9827
9867
  }
@@ -9843,7 +9883,7 @@ define("tinymce/AddOnManager", [
9843
9883
  if (self.lookup[name]) {
9844
9884
  loadDependencies();
9845
9885
  } else {
9846
- ScriptLoader.ScriptLoader.add(url, loadDependencies, scope);
9886
+ ScriptLoader.ScriptLoader.add(url, loadDependencies, scope, failure);
9847
9887
  }
9848
9888
  }
9849
9889
  };
@@ -18811,7 +18851,7 @@ define("tinymce/fmt/Preview", [
18811
18851
 
18812
18852
 
18813
18853
  function selectorToHtml(selector, editor) {
18814
- return parsedSelectorToHtml(parseSelector(selector, editor));
18854
+ return parsedSelectorToHtml(parseSelector(selector), editor);
18815
18855
  }
18816
18856
 
18817
18857
 
@@ -18934,9 +18974,9 @@ define("tinymce/fmt/Preview", [
18934
18974
  items[0].name = name;
18935
18975
  }
18936
18976
  name = format.selector;
18937
- previewFrag = parsedSelectorToHtml(items);
18977
+ previewFrag = parsedSelectorToHtml(items, editor);
18938
18978
  } else {
18939
- previewFrag = parsedSelectorToHtml([name]);
18979
+ previewFrag = parsedSelectorToHtml([name], editor);
18940
18980
  }
18941
18981
 
18942
18982
  previewElm = dom.select(name, previewFrag)[0] || previewFrag.firstChild;
@@ -21364,8 +21404,10 @@ define("tinymce/Formatter", [
21364
21404
  textNode = findFirstTextNode(caretContainer);
21365
21405
  }
21366
21406
 
21367
- // Expand to word is caret is in the middle of a text node and the char before/after is a alpha numeric character
21368
- if (text && offset > 0 && offset < text.length && /\w/.test(text.charAt(offset)) && /\w/.test(text.charAt(offset - 1))) {
21407
+ // Expand to word if caret is in the middle of a text node and the char before/after is a alpha numeric character
21408
+ var wordcharRegex = /[^\s\u00a0\u00ad\u200b\ufeff]/;
21409
+ if (text && offset > 0 && offset < text.length &&
21410
+ wordcharRegex.test(text.charAt(offset)) && wordcharRegex.test(text.charAt(offset - 1))) {
21369
21411
  // Get bookmark of caret position
21370
21412
  bookmark = selection.getBookmark();
21371
21413
 
@@ -22952,6 +22994,10 @@ define("tinymce/EnterKey", [
22952
22994
  // Insert new block before/after the parent block depending on caret location
22953
22995
  if (CaretContainer.isCaretContainerBlock(parentBlock)) {
22954
22996
  newBlock = CaretContainer.showCaretContainerBlock(parentBlock);
22997
+ if (dom.isEmpty(parentBlock)) {
22998
+ emptyBlock(parentBlock);
22999
+ }
23000
+ moveToCaretPosition(newBlock);
22955
23001
  } else if (isCaretAtStartOrEndOfBlock()) {
22956
23002
  insertNewBlockAfter();
22957
23003
  } else if (isCaretAtStartOrEndOfBlock(true)) {
@@ -26051,7 +26097,7 @@ define("tinymce/util/Observable", [
26051
26097
  return {
26052
26098
  /**
26053
26099
  * Fires the specified event by name. Consult the
26054
- * <a href="/advanced/events">event reference</a> for more details on each event.
26100
+ * <a href="/docs/advanced/events">event reference</a> for more details on each event.
26055
26101
  *
26056
26102
  * @method fire
26057
26103
  * @param {String} name Name of the event to fire.
@@ -26085,7 +26131,7 @@ define("tinymce/util/Observable", [
26085
26131
 
26086
26132
  /**
26087
26133
  * Binds an event listener to a specific event by name. Consult the
26088
- * <a href="/advanced/events">event reference</a> for more details on each event.
26134
+ * <a href="/docs/advanced/events">event reference</a> for more details on each event.
26089
26135
  *
26090
26136
  * @method on
26091
26137
  * @param {String} name Event name or space separated list of events to bind.
@@ -26103,7 +26149,7 @@ define("tinymce/util/Observable", [
26103
26149
 
26104
26150
  /**
26105
26151
  * Unbinds an event listener to a specific event by name. Consult the
26106
- * <a href="/advanced/events">event reference</a> for more details on each event.
26152
+ * <a href="/docs/advanced/events">event reference</a> for more details on each event.
26107
26153
  *
26108
26154
  * @method off
26109
26155
  * @param {String?} name Name of the event to unbind.
@@ -26125,7 +26171,7 @@ define("tinymce/util/Observable", [
26125
26171
 
26126
26172
  /**
26127
26173
  * Bind the event callback and once it fires the callback is removed. Consult the
26128
- * <a href="/advanced/events">event reference</a> for more details on each event.
26174
+ * <a href="/docs/advanced/events">event reference</a> for more details on each event.
26129
26175
  *
26130
26176
  * @method once
26131
26177
  * @param {String} name Name of the event to bind.
@@ -34409,8 +34455,12 @@ define("tinymce/util/Quirks", [
34409
34455
  var rng = editor.selection.getRng();
34410
34456
  var startCaretPos = CaretPosition.fromRangeStart(rng);
34411
34457
  var endCaretPos = CaretPosition.fromRangeEnd(rng);
34458
+ var prev = caretWalker.prev(startCaretPos);
34459
+ var next = caretWalker.next(endCaretPos);
34412
34460
 
34413
- return !editor.selection.isCollapsed() && !caretWalker.prev(startCaretPos) && !caretWalker.next(endCaretPos);
34461
+ return !editor.selection.isCollapsed() &&
34462
+ (!prev || prev.isAtStart()) &&
34463
+ (!next || (next.isAtEnd() && startCaretPos.getNode() !== next.getNode()));
34414
34464
  }
34415
34465
 
34416
34466
  // Type over case delete and insert this won't cover typeover with a IME but at least it covers the common case
@@ -35199,11 +35249,11 @@ define("tinymce/file/Uploader", [
35199
35249
  resolve(handlerSuccess(blobInfo, url));
35200
35250
  };
35201
35251
 
35202
- var failure = function() {
35252
+ var failure = function(error) {
35203
35253
  closeNotification();
35204
35254
  uploadStatus.removeFailed(blobInfo.blobUri());
35205
- resolvePending(blobInfo.blobUri(), handlerFailure(blobInfo, failure));
35206
- resolve(handlerFailure(blobInfo, failure));
35255
+ resolvePending(blobInfo.blobUri(), handlerFailure(blobInfo, error));
35256
+ resolve(handlerFailure(blobInfo, error));
35207
35257
  };
35208
35258
 
35209
35259
  progress = function(percent) {
@@ -35401,6 +35451,10 @@ define("tinymce/file/ImageScanner", [
35401
35451
  ], function(Promise, Arr, Fun, Conversions, Env) {
35402
35452
  var count = 0;
35403
35453
 
35454
+ var uniqueId = function(prefix) {
35455
+ return (prefix || 'blobid') + (count++);
35456
+ };
35457
+
35404
35458
  return function(uploadStatus, blobCache) {
35405
35459
  var cachedPromises = {};
35406
35460
 
@@ -35418,6 +35472,19 @@ define("tinymce/file/ImageScanner", [
35418
35472
  image: img,
35419
35473
  blobInfo: blobInfo
35420
35474
  });
35475
+ } else {
35476
+ Conversions.uriToBlob(img.src).then(function (blob) {
35477
+ Conversions.blobToDataUri(blob).then(function (dataUri) {
35478
+ base64 = Conversions.parseDataUri(dataUri).data;
35479
+ blobInfo = blobCache.create(uniqueId(), blob, base64);
35480
+ blobCache.add(blobInfo);
35481
+
35482
+ resolve({
35483
+ image: img,
35484
+ blobInfo: blobInfo
35485
+ });
35486
+ });
35487
+ });
35421
35488
  }
35422
35489
 
35423
35490
  return;
@@ -35435,9 +35502,7 @@ define("tinymce/file/ImageScanner", [
35435
35502
  });
35436
35503
  } else {
35437
35504
  Conversions.uriToBlob(img.src).then(function(blob) {
35438
- var blobInfoId = 'blobid' + (count++),
35439
- blobInfo = blobCache.create(blobInfoId, blob, base64);
35440
-
35505
+ blobInfo = blobCache.create(uniqueId(), blob, base64);
35441
35506
  blobCache.add(blobInfo);
35442
35507
 
35443
35508
  resolve({
@@ -35688,6 +35753,78 @@ define("tinymce/file/UploadStatus", [
35688
35753
  };
35689
35754
  });
35690
35755
 
35756
+ // Included from: js/tinymce/classes/ErrorReporter.js
35757
+
35758
+ /**
35759
+ * ErrorReporter.js
35760
+ *
35761
+ * Released under LGPL License.
35762
+ * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
35763
+ *
35764
+ * License: http://www.tinymce.com/license
35765
+ * Contributing: http://www.tinymce.com/contributing
35766
+ */
35767
+
35768
+ /**
35769
+ * Various error reporting helper functions.
35770
+ *
35771
+ * @class tinymce.ErrorReporter
35772
+ * @private
35773
+ */
35774
+ define("tinymce/ErrorReporter", [
35775
+ "tinymce/AddOnManager"
35776
+ ], function (AddOnManager) {
35777
+ var PluginManager = AddOnManager.PluginManager;
35778
+
35779
+ var resolvePluginName = function (targetUrl, suffix) {
35780
+ for (var name in PluginManager.urls) {
35781
+ var matchUrl = PluginManager.urls[name] + '/plugin' + suffix + '.js';
35782
+ if (matchUrl === targetUrl) {
35783
+ return name;
35784
+ }
35785
+ }
35786
+
35787
+ return null;
35788
+ };
35789
+
35790
+ var pluginUrlToMessage = function (editor, url) {
35791
+ var plugin = resolvePluginName(url, editor.suffix);
35792
+ return plugin ?
35793
+ 'Failed to load plugin: ' + plugin + ' from url ' + url :
35794
+ 'Failed to load plugin url: ' + url;
35795
+ };
35796
+
35797
+ var displayNotification = function (editor, message) {
35798
+ editor.notificationManager.open({
35799
+ type: 'error',
35800
+ text: message
35801
+ });
35802
+ };
35803
+
35804
+ var displayError = function (editor, message) {
35805
+ if (editor._skinLoaded) {
35806
+ displayNotification(editor, message);
35807
+ } else {
35808
+ editor.on('SkinLoaded', function () {
35809
+ displayNotification(editor, message);
35810
+ });
35811
+ }
35812
+ };
35813
+
35814
+ var uploadError = function (editor, message) {
35815
+ displayError(editor, 'Failed to upload image: ' + message);
35816
+ };
35817
+
35818
+ var pluginLoadError = function (editor, url) {
35819
+ displayError(editor, pluginUrlToMessage(editor, url));
35820
+ };
35821
+
35822
+ return {
35823
+ pluginLoadError: pluginLoadError,
35824
+ uploadError: uploadError
35825
+ };
35826
+ });
35827
+
35691
35828
  // Included from: js/tinymce/classes/EditorUpload.js
35692
35829
 
35693
35830
  /**
@@ -35711,8 +35848,9 @@ define("tinymce/EditorUpload", [
35711
35848
  "tinymce/file/Uploader",
35712
35849
  "tinymce/file/ImageScanner",
35713
35850
  "tinymce/file/BlobCache",
35714
- "tinymce/file/UploadStatus"
35715
- ], function(Arr, Uploader, ImageScanner, BlobCache, UploadStatus) {
35851
+ "tinymce/file/UploadStatus",
35852
+ "tinymce/ErrorReporter"
35853
+ ], function(Arr, Uploader, ImageScanner, BlobCache, UploadStatus, ErrorReporter) {
35716
35854
  return function(editor) {
35717
35855
  var blobCache = new BlobCache(), uploader, imageScanner, settings = editor.settings;
35718
35856
  var uploadStatus = new UploadStatus();
@@ -35808,6 +35946,8 @@ define("tinymce/EditorUpload", [
35808
35946
 
35809
35947
  if (uploadInfo.status && editor.settings.images_replace_blob_uris !== false) {
35810
35948
  replaceImageUri(image, uploadInfo.url);
35949
+ } else if (uploadInfo.error) {
35950
+ ErrorReporter.uploadError(editor, uploadInfo.error);
35811
35951
  }
35812
35952
 
35813
35953
  return {
@@ -37822,6 +37962,7 @@ define("tinymce/SelectionOverrides", [
37822
37962
  editor.$('*[data-mce-selected]').removeAttr('data-mce-selected');
37823
37963
  node.setAttribute('data-mce-selected', 1);
37824
37964
  selectedContentEditableNode = node;
37965
+ hideFakeCaret();
37825
37966
 
37826
37967
  return range;
37827
37968
  }
@@ -38005,13 +38146,14 @@ define("tinymce/Editor", [
38005
38146
  "tinymce/EditorUpload",
38006
38147
  "tinymce/SelectionOverrides",
38007
38148
  "tinymce/util/Uuid",
38008
- "tinymce/ui/Sidebar"
38149
+ "tinymce/ui/Sidebar",
38150
+ "tinymce/ErrorReporter"
38009
38151
  ], function(
38010
38152
  DOMUtils, DomQuery, AddOnManager, NodeChange, Node, DomSerializer, Serializer,
38011
38153
  Selection, Formatter, UndoManager, EnterKey, ForceBlocks, EditorCommands,
38012
38154
  URI, ScriptLoader, EventUtils, WindowManager, NotificationManager,
38013
38155
  Schema, DomParser, Quirks, Env, Tools, Delay, EditorObservable, Mode, Shortcuts, EditorUpload,
38014
- SelectionOverrides, Uuid, Sidebar
38156
+ SelectionOverrides, Uuid, Sidebar, ErrorReporter
38015
38157
  ) {
38016
38158
  // Shorten these names
38017
38159
  var DOM = DOMUtils.DOM, ThemeManager = AddOnManager.ThemeManager, PluginManager = AddOnManager.PluginManager;
@@ -38407,6 +38549,12 @@ define("tinymce/Editor", [
38407
38549
  });
38408
38550
 
38409
38551
  scriptLoader.loadQueue(function() {
38552
+ if (!self.removed) {
38553
+ self.init();
38554
+ }
38555
+ }, self, function (urls) {
38556
+ ErrorReporter.pluginLoadError(self, urls[0]);
38557
+
38410
38558
  if (!self.removed) {
38411
38559
  self.init();
38412
38560
  }
@@ -40695,7 +40843,7 @@ define("tinymce/EditorManager", [
40695
40843
  * @property minorVersion
40696
40844
  * @type String
40697
40845
  */
40698
- minorVersion: '5.1',
40846
+ minorVersion: '5.2',
40699
40847
 
40700
40848
  /**
40701
40849
  * Release date of TinyMCE build.
@@ -40703,7 +40851,7 @@ define("tinymce/EditorManager", [
40703
40851
  * @property releaseDate
40704
40852
  * @type String
40705
40853
  */
40706
- releaseDate: '2016-12-07',
40854
+ releaseDate: '2017-01-04',
40707
40855
 
40708
40856
  /**
40709
40857
  * Collection of editor instances.
@@ -45239,6 +45387,73 @@ define("tinymce/ui/FlowLayout", [
45239
45387
  });
45240
45388
  });
45241
45389
 
45390
+ // Included from: js/tinymce/classes/fmt/FontInfo.js
45391
+
45392
+ /**
45393
+ * FontInfo.js
45394
+ *
45395
+ * Released under LGPL License.
45396
+ * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
45397
+ *
45398
+ * License: http://www.tinymce.com/license
45399
+ * Contributing: http://www.tinymce.com/contributing
45400
+ */
45401
+
45402
+ /**
45403
+ * Internal class for computing font size for elements.
45404
+ *
45405
+ * @private
45406
+ * @class tinymce.fmt.FontInfo
45407
+ */
45408
+ define("tinymce/fmt/FontInfo", [
45409
+ "tinymce/dom/DOMUtils"
45410
+ ], function(DOMUtils) {
45411
+ var getSpecifiedFontProp = function (propName, rootElm, elm) {
45412
+ while (elm !== rootElm) {
45413
+ if (elm.style[propName]) {
45414
+ return elm.style[propName];
45415
+ }
45416
+
45417
+ elm = elm.parentNode;
45418
+ }
45419
+
45420
+ return 0;
45421
+ };
45422
+
45423
+ var toPt = function (fontSize) {
45424
+ if (/[0-9.]+px$/.test(fontSize)) {
45425
+ return Math.round(parseInt(fontSize, 10) * 72 / 96) + 'pt';
45426
+ }
45427
+
45428
+ return fontSize;
45429
+ };
45430
+
45431
+ var normalizeFontFamily = function (fontFamily) {
45432
+ // 'Font name', Font -> Font name,Font
45433
+ return fontFamily.replace(/[\'\"]/g, '').replace(/,\s+/g, ',');
45434
+ };
45435
+
45436
+ var getComputedFontProp = function (propName, elm) {
45437
+ return DOMUtils.DOM.getStyle(elm, propName, true);
45438
+ };
45439
+
45440
+ var getFontSize = function (rootElm, elm) {
45441
+ var specifiedFontSize = getSpecifiedFontProp('fontSize', rootElm, elm);
45442
+ return specifiedFontSize ? specifiedFontSize : getComputedFontProp('fontSize', elm);
45443
+ };
45444
+
45445
+ var getFontFamily = function (rootElm, elm) {
45446
+ var specifiedFontSize = getSpecifiedFontProp('fontFamily', rootElm, elm);
45447
+ return normalizeFontFamily(specifiedFontSize ? specifiedFontSize : getComputedFontProp('fontFamily', elm));
45448
+ };
45449
+
45450
+ return {
45451
+ getFontSize: getFontSize,
45452
+ getFontFamily: getFontFamily,
45453
+ toPt: toPt
45454
+ };
45455
+ });
45456
+
45242
45457
  // Included from: js/tinymce/classes/ui/FormatControls.js
45243
45458
 
45244
45459
  /**
@@ -45265,8 +45480,9 @@ define("tinymce/ui/FormatControls", [
45265
45480
  "tinymce/util/Arr",
45266
45481
  "tinymce/dom/DOMUtils",
45267
45482
  "tinymce/EditorManager",
45268
- "tinymce/Env"
45269
- ], function(Control, Widget, FloatPanel, Tools, Arr, DOMUtils, EditorManager, Env) {
45483
+ "tinymce/Env",
45484
+ "tinymce/fmt/FontInfo"
45485
+ ], function(Control, Widget, FloatPanel, Tools, Arr, DOMUtils, EditorManager, Env, FontInfo) {
45270
45486
  var each = Tools.each;
45271
45487
 
45272
45488
  var flatten = function (ar) {
@@ -45341,6 +45557,67 @@ define("tinymce/ui/FormatControls", [
45341
45557
  };
45342
45558
  }
45343
45559
 
45560
+ function createFontNameListBoxChangeHandler(items) {
45561
+ return function() {
45562
+ var self = this;
45563
+
45564
+ var getFirstFont = function (fontFamily) {
45565
+ return fontFamily ? fontFamily.split(',')[0] : '';
45566
+ };
45567
+
45568
+ editor.on('nodeChange', function(e) {
45569
+ var fontFamily, value = null;
45570
+
45571
+ fontFamily = FontInfo.getFontFamily(editor.getBody(), e.element);
45572
+
45573
+ each(items, function(item) {
45574
+ if (item.value.toLowerCase() === fontFamily.toLowerCase()) {
45575
+ value = item.value;
45576
+ }
45577
+ });
45578
+
45579
+ each(items, function(item) {
45580
+ if (!value && getFirstFont(item.value).toLowerCase() === getFirstFont(fontFamily).toLowerCase()) {
45581
+ value = item.value;
45582
+ }
45583
+ });
45584
+
45585
+ self.value(value);
45586
+
45587
+ if (!value && fontFamily) {
45588
+ self.text(getFirstFont(fontFamily));
45589
+ }
45590
+ });
45591
+ };
45592
+ }
45593
+
45594
+ function createFontSizeListBoxChangeHandler(items) {
45595
+ return function() {
45596
+ var self = this;
45597
+
45598
+ editor.on('nodeChange', function(e) {
45599
+ var px, pt, value = null;
45600
+
45601
+ px = FontInfo.getFontSize(editor.getBody(), e.element);
45602
+ pt = FontInfo.toPt(px);
45603
+
45604
+ each(items, function(item) {
45605
+ if (item.value === px) {
45606
+ value = px;
45607
+ } else if (item.value === pt) {
45608
+ value = pt;
45609
+ }
45610
+ });
45611
+
45612
+ self.value(value);
45613
+
45614
+ if (!value) {
45615
+ self.text(pt);
45616
+ }
45617
+ });
45618
+ };
45619
+ }
45620
+
45344
45621
  function createFormats(formats) {
45345
45622
  formats = formats.replace(/;$/, '').split(';');
45346
45623
 
@@ -45724,7 +46001,7 @@ define("tinymce/ui/FormatControls", [
45724
46001
  selectall: ['Select all', 'SelectAll', 'Meta+A'],
45725
46002
  bold: ['Bold', 'Bold', 'Meta+B'],
45726
46003
  italic: ['Italic', 'Italic', 'Meta+I'],
45727
- underline: ['Underline', 'Underline'],
46004
+ underline: ['Underline', 'Underline', 'Meta+U'],
45728
46005
  strikethrough: ['Strikethrough', 'Strikethrough'],
45729
46006
  subscript: ['Subscript', 'Subscript'],
45730
46007
  superscript: ['Superscript', 'Superscript'],
@@ -45877,7 +46154,7 @@ define("tinymce/ui/FormatControls", [
45877
46154
  tooltip: 'Font Family',
45878
46155
  values: items,
45879
46156
  fixedWidth: true,
45880
- onPostRender: createListBoxChangeHandler(items, 'fontname'),
46157
+ onPostRender: createFontNameListBoxChangeHandler(items),
45881
46158
  onselect: function(e) {
45882
46159
  if (e.control.settings.value) {
45883
46160
  editor.execCommand('FontName', false, e.control.settings.value);
@@ -45907,7 +46184,7 @@ define("tinymce/ui/FormatControls", [
45907
46184
  tooltip: 'Font Sizes',
45908
46185
  values: items,
45909
46186
  fixedWidth: true,
45910
- onPostRender: createListBoxChangeHandler(items, 'fontsize'),
46187
+ onPostRender: createFontSizeListBoxChangeHandler(items),
45911
46188
  onclick: function(e) {
45912
46189
  if (e.control.settings.value) {
45913
46190
  editor.execCommand('FontSize', false, e.control.settings.value);