tinymce-rails 4.2.5 → 4.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3858cb936d4e85659b5facc333f2cc0fa4675043
4
- data.tar.gz: a081a6dc4f51d3e344f323e3741622005151c0c2
3
+ metadata.gz: dfd48724e15eefba82391544f75bb9a2b55433ba
4
+ data.tar.gz: 7459e400b6c4aebd2d3acb20898c5f4b75c964fc
5
5
  SHA512:
6
- metadata.gz: 2d660acc652e20e046697d1a54ca580f988827d07090ca502dd2c1aafa427d569b536eeac446fecb9718db4b02f1be9799f2ec4fb95603bdd0253e7b2a234a57
7
- data.tar.gz: 570e2829d350c7fa44164b0299667dbf76d1ef8e04665cc59f1532f9eaba8a5180164b3be7a1eb6e58462cd6c2482f93b5c361d316c5370d1591850a919d4e40
6
+ metadata.gz: 096af913603a040edd71eb3cc0dc9522ce5bf36fd84475f03e7e6f12f8851c811e3995ff6d326a8424ca1d76a33da15ec4561a2382c5c117c8ee40475b7dd075
7
+ data.tar.gz: 4f81059cd13c921d2120ea8086b410fca03681334b5e2a7fc5fb1f41572ad9525e296b5e8b01f2bc1219519e08f731f3269b4da7356b92e037849dd5ee9ca87d
@@ -1,4 +1,4 @@
1
- // 4.2.5 (2015-08-31)
1
+ // 4.2.6 (2015-09-28)
2
2
 
3
3
  /**
4
4
  * Compiled inline version. (Library mode)
@@ -1473,6 +1473,7 @@ define("tinymce/dom/DomQuery", [
1473
1473
  var doc = document, push = Array.prototype.push, slice = Array.prototype.slice;
1474
1474
  var rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/;
1475
1475
  var Event = EventUtils.Event, undef;
1476
+ var skipUniques = Tools.makeMap('children,contents,next,prev');
1476
1477
 
1477
1478
  function isDefined(obj) {
1478
1479
  return typeof obj !== 'undefined';
@@ -2801,7 +2802,9 @@ define("tinymce/dom/DomQuery", [
2801
2802
 
2802
2803
  // If traversing on multiple elements we might get the same elements twice
2803
2804
  if (this.length > 1) {
2804
- result = DomQuery.unique(result);
2805
+ if (!skipUniques[name]) {
2806
+ result = DomQuery.unique(result);
2807
+ }
2805
2808
 
2806
2809
  if (name.indexOf('parents') === 0) {
2807
2810
  result = result.reverse();
@@ -4803,6 +4806,18 @@ define("tinymce/dom/DOMUtils", [
4803
4806
  return attrHooks;
4804
4807
  }
4805
4808
 
4809
+ function updateInternalStyleAttr(domUtils, $elm) {
4810
+ var value = $elm.attr('style');
4811
+
4812
+ value = domUtils.serializeStyle(domUtils.parseStyle(value), $elm[0].nodeName);
4813
+
4814
+ if (!value) {
4815
+ value = null;
4816
+ }
4817
+
4818
+ $elm.attr('data-mce-style', value);
4819
+ }
4820
+
4806
4821
  /**
4807
4822
  * Constructs a new DOMUtils instance. Consult the Wiki for more details on settings etc for this class.
4808
4823
  *
@@ -5343,7 +5358,7 @@ define("tinymce/dom/DOMUtils", [
5343
5358
  * or the CSS style name like background-color.
5344
5359
  *
5345
5360
  * @method setStyle
5346
- * @param {String/Element/Array} n HTML element/Element ID or Array of elements/ids to set CSS style value on.
5361
+ * @param {String/Element/Array} n HTML element/Array of elements to set CSS style value on.
5347
5362
  * @param {String} na Name of the style value to set.
5348
5363
  * @param {String} v Value to set on the style.
5349
5364
  * @example
@@ -5357,7 +5372,7 @@ define("tinymce/dom/DOMUtils", [
5357
5372
  elm = this.$$(elm).css(name, value);
5358
5373
 
5359
5374
  if (this.settings.update_styles) {
5360
- elm.attr('data-mce-style', null);
5375
+ updateInternalStyleAttr(this, elm);
5361
5376
  }
5362
5377
  },
5363
5378
 
@@ -5406,7 +5421,7 @@ define("tinymce/dom/DOMUtils", [
5406
5421
  elm = this.$$(elm).css(styles);
5407
5422
 
5408
5423
  if (this.settings.update_styles) {
5409
- elm.attr('data-mce-style', null);
5424
+ updateInternalStyleAttr(this, elm);
5410
5425
  }
5411
5426
  },
5412
5427
 
@@ -10977,6 +10992,33 @@ define("tinymce/dom/Serializer", [
10977
10992
  var each = Tools.each, trim = Tools.trim;
10978
10993
  var DOM = DOMUtils.DOM;
10979
10994
 
10995
+ /**
10996
+ * IE 11 has a fantastic bug where it will produce two trailing BR elements to iframe bodies when
10997
+ * the iframe is hidden by display: none on a parent container. The DOM is actually out of sync
10998
+ * with innerHTML in this case. It's like IE adds shadow DOM BR elements that appears on innerHTML
10999
+ * but not as the lastChild of the body. So this fix simply removes the last two
11000
+ * BR elements at the end of the document.
11001
+ *
11002
+ * Example of what happens: <body>text</body> becomes <body>text<br><br></body>
11003
+ */
11004
+ function trimTrailingBr(rootNode) {
11005
+ var brNode1, brNode2;
11006
+
11007
+ function isBr(node) {
11008
+ return node && node.name === 'br';
11009
+ }
11010
+
11011
+ brNode1 = rootNode.lastChild;
11012
+ if (isBr(brNode1)) {
11013
+ brNode2 = brNode1.prev;
11014
+
11015
+ if (isBr(brNode2)) {
11016
+ brNode1.remove();
11017
+ brNode2.remove();
11018
+ }
11019
+ }
11020
+ }
11021
+
10980
11022
  /**
10981
11023
  * Constructs a new DOM serializer class.
10982
11024
  *
@@ -11234,7 +11276,7 @@ define("tinymce/dom/Serializer", [
11234
11276
  * @param {Object} args Arguments option that gets passed to event handlers.
11235
11277
  */
11236
11278
  serialize: function(node, args) {
11237
- var self = this, impl, doc, oldDoc, htmlSerializer, content;
11279
+ var self = this, impl, doc, oldDoc, htmlSerializer, content, rootNode;
11238
11280
 
11239
11281
  // Explorer won't clone contents of script and style and the
11240
11282
  // selected index of select elements are cleared on a clone operation.
@@ -11284,13 +11326,13 @@ define("tinymce/dom/Serializer", [
11284
11326
  self.onPreProcess(args);
11285
11327
  }
11286
11328
 
11287
- // Setup serializer
11288
- htmlSerializer = new Serializer(settings, schema);
11329
+ // Parse HTML
11330
+ rootNode = htmlParser.parse(trim(args.getInner ? node.innerHTML : dom.getOuterHTML(node)), args);
11331
+ trimTrailingBr(rootNode);
11289
11332
 
11290
- // Parse and serialize HTML
11291
- args.content = htmlSerializer.serialize(
11292
- htmlParser.parse(trim(args.getInner ? node.innerHTML : dom.getOuterHTML(node)), args)
11293
- );
11333
+ // Serialize HTML
11334
+ htmlSerializer = new Serializer(settings, schema);
11335
+ args.content = htmlSerializer.serialize(rootNode);
11294
11336
 
11295
11337
  // Replace all BOM characters for now until we can find a better solution
11296
11338
  if (!args.cleanup) {
@@ -12479,7 +12521,7 @@ define("tinymce/dom/ControlSelection", [
12479
12521
  }
12480
12522
  });
12481
12523
 
12482
- editor.on('hide', hideResizeRect);
12524
+ editor.on('hide blur', hideResizeRect);
12483
12525
 
12484
12526
  // Hide rect on focusout since it would float on top of windows otherwise
12485
12527
  //editor.on('focusout', hideResizeRect);
@@ -16624,7 +16666,7 @@ define("tinymce/UndoManager", [
16624
16666
  }
16625
16667
  });
16626
16668
 
16627
- editor.on('ObjectResizeStart', function() {
16669
+ editor.on('ObjectResizeStart Cut', function() {
16628
16670
  self.beforeChange();
16629
16671
  });
16630
16672
 
@@ -16634,6 +16676,12 @@ define("tinymce/UndoManager", [
16634
16676
  editor.on('KeyUp', function(e) {
16635
16677
  var keyCode = e.keyCode;
16636
16678
 
16679
+ // If key is prevented then don't add undo level
16680
+ // This would happen on keyboard shortcuts for example
16681
+ if (e.isDefaultPrevented()) {
16682
+ return;
16683
+ }
16684
+
16637
16685
  if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 45 || keyCode == 13 || e.ctrlKey) {
16638
16686
  addNonTypingUndoLevel();
16639
16687
  editor.nodeChanged();
@@ -16664,6 +16712,12 @@ define("tinymce/UndoManager", [
16664
16712
  editor.on('KeyDown', function(e) {
16665
16713
  var keyCode = e.keyCode;
16666
16714
 
16715
+ // If key is prevented then don't add undo level
16716
+ // This would happen on keyboard shortcuts for example
16717
+ if (e.isDefaultPrevented()) {
16718
+ return;
16719
+ }
16720
+
16667
16721
  // Is caracter positon keys left,right,up,down,home,end,pgdown,pgup,enter
16668
16722
  if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 45) {
16669
16723
  if (self.typing) {
@@ -17098,6 +17152,11 @@ define("tinymce/EnterKey", [
17098
17152
  }
17099
17153
  }
17100
17154
 
17155
+ function emptyBlock(elm) {
17156
+ // BR is needed in empty blocks on non IE browsers
17157
+ elm.innerHTML = !isIE ? '<br data-mce-bogus="1">' : '';
17158
+ }
17159
+
17101
17160
  // Creates a new block element by cloning the current one or creating a new one if the name is specified
17102
17161
  // This function will also copy any text formatting from the parent block and add it to the new one
17103
17162
  function createNewBlock(name) {
@@ -17533,6 +17592,10 @@ define("tinymce/EnterKey", [
17533
17592
  trimInlineElementsOnLeftSideOfBlock(newBlock);
17534
17593
  addBrToBlockIfNeeded(parentBlock);
17535
17594
 
17595
+ if (dom.isEmpty(parentBlock)) {
17596
+ emptyBlock(parentBlock);
17597
+ }
17598
+
17536
17599
  // New block might become empty if it's <p><b>a |</b></p>
17537
17600
  if (dom.isEmpty(newBlock)) {
17538
17601
  dom.remove(newBlock);
@@ -26049,6 +26112,11 @@ define("tinymce/util/Quirks", [
26049
26112
  if (!isDefaultPrevented(e) && (isForward || e.keyCode == BACKSPACE)) {
26050
26113
  var rng = editor.selection.getRng(), container = rng.startContainer, offset = rng.startOffset;
26051
26114
 
26115
+ // Shift+Delete is cut
26116
+ if (isForward && e.shiftKey) {
26117
+ return;
26118
+ }
26119
+
26052
26120
  // Ignore non meta delete in the where there is text before/after the caret
26053
26121
  if (!isMetaOrCtrl && rng.collapsed && container.nodeType == 3) {
26054
26122
  if (isForward ? offset < container.data.length : offset > 0) {
@@ -26902,8 +26970,15 @@ define("tinymce/util/Quirks", [
26902
26970
  if (!editor.inline) {
26903
26971
  editor.contentStyles.push('body {min-height: 150px}');
26904
26972
  editor.on('click', function(e) {
26973
+ var rng;
26974
+
26905
26975
  if (e.target.nodeName == 'HTML') {
26906
- var rng;
26976
+ // Edge seems to only need focus if we set the range
26977
+ // the caret will become invisible and moved out of the iframe!!
26978
+ if (Env.ie > 11) {
26979
+ editor.getBody().focus();
26980
+ return;
26981
+ }
26907
26982
 
26908
26983
  // Need to store away non collapsed ranges since the focus call will mess that up see #7382
26909
26984
  rng = editor.selection.getRng();
@@ -26938,25 +27013,6 @@ define("tinymce/util/Quirks", [
26938
27013
  setEditorCommandState("AutoUrlDetect", false);
26939
27014
  }
26940
27015
 
26941
- /**
26942
- * IE 11 has a fantastic bug where it will produce two trailing BR elements to iframe bodies when
26943
- * the iframe is hidden by display: none on a parent container. The DOM is actually out of sync
26944
- * with innerHTML in this case. It's like IE adds shadow DOM BR elements that appears on innerHTML
26945
- * but not as the lastChild of the body. However is we add a BR element to the body then remove it
26946
- * it doesn't seem to add these BR elements makes sence right?!
26947
- *
26948
- * Example of what happens: <body>text</body> becomes <body>text<br><br></body>
26949
- */
26950
- function doubleTrailingBrElements() {
26951
- if (!editor.inline) {
26952
- editor.on('focus blur beforegetcontent', function() {
26953
- var br = editor.dom.create('br');
26954
- editor.getBody().appendChild(br);
26955
- br.parentNode.removeChild(br);
26956
- }, true);
26957
- }
26958
- }
26959
-
26960
27016
  /**
26961
27017
  * iOS 7.1 introduced two new bugs:
26962
27018
  * 1) It's possible to open links within a contentEditable area by clicking on them.
@@ -27130,7 +27186,6 @@ define("tinymce/util/Quirks", [
27130
27186
 
27131
27187
  if (Env.ie >= 11) {
27132
27188
  bodyHeight();
27133
- doubleTrailingBrElements();
27134
27189
  disableBackspaceIntoATable();
27135
27190
  }
27136
27191
 
@@ -28283,6 +28338,16 @@ define("tinymce/EditorUpload", [
28283
28338
  return function(editor) {
28284
28339
  var blobCache = new BlobCache(), uploader, imageScanner;
28285
28340
 
28341
+ function aliveGuard(callback) {
28342
+ return function(result) {
28343
+ if (editor.selection) {
28344
+ return callback(result);
28345
+ }
28346
+
28347
+ return [];
28348
+ };
28349
+ }
28350
+
28286
28351
  // Replaces strings without regexps to avoid FF regexp to big issue
28287
28352
  function replaceString(content, search, replace) {
28288
28353
  var index = 0;
@@ -28322,14 +28387,14 @@ define("tinymce/EditorUpload", [
28322
28387
  });
28323
28388
  }
28324
28389
 
28325
- return scanForImages().then(function(imageInfos) {
28390
+ return scanForImages().then(aliveGuard(function(imageInfos) {
28326
28391
  var blobInfos;
28327
28392
 
28328
28393
  blobInfos = Arr.map(imageInfos, function(imageInfo) {
28329
28394
  return imageInfo.blobInfo;
28330
28395
  });
28331
28396
 
28332
- return uploader.upload(blobInfos).then(function(result) {
28397
+ return uploader.upload(blobInfos).then(aliveGuard(function(result) {
28333
28398
  result = Arr.map(result, function(uploadInfo, index) {
28334
28399
  var image = imageInfos[index].image;
28335
28400
 
@@ -28351,8 +28416,14 @@ define("tinymce/EditorUpload", [
28351
28416
  }
28352
28417
 
28353
28418
  return result;
28354
- });
28355
- });
28419
+ }));
28420
+ }));
28421
+ }
28422
+
28423
+ function uploadImagesAuto(callback) {
28424
+ if (editor.settings.automatic_uploads !== false) {
28425
+ return uploadImages(callback);
28426
+ }
28356
28427
  }
28357
28428
 
28358
28429
  function scanForImages() {
@@ -28360,14 +28431,14 @@ define("tinymce/EditorUpload", [
28360
28431
  imageScanner = new ImageScanner(blobCache);
28361
28432
  }
28362
28433
 
28363
- return imageScanner.findAll(editor.getBody()).then(function(result) {
28434
+ return imageScanner.findAll(editor.getBody()).then(aliveGuard(function(result) {
28364
28435
  Arr.each(result, function(resultItem) {
28365
28436
  replaceUrlInUndoStack(resultItem.image.src, resultItem.blobInfo.blobUri());
28366
28437
  resultItem.image.src = resultItem.blobInfo.blobUri();
28367
28438
  });
28368
28439
 
28369
28440
  return result;
28370
- });
28441
+ }));
28371
28442
  }
28372
28443
 
28373
28444
  function destroy() {
@@ -28389,11 +28460,17 @@ define("tinymce/EditorUpload", [
28389
28460
  return 'src="data:' + blobInfo.blob().type + ';base64,' + blobInfo.base64() + '"';
28390
28461
  }
28391
28462
 
28392
- return match[0];
28463
+ return match;
28393
28464
  });
28394
28465
  }
28395
28466
 
28396
- editor.on('setContent paste', scanForImages);
28467
+ editor.on('setContent', function() {
28468
+ if (editor.settings.automatic_uploads !== false) {
28469
+ uploadImagesAuto();
28470
+ } else {
28471
+ scanForImages();
28472
+ }
28473
+ });
28397
28474
 
28398
28475
  editor.on('RawSaveContent', function(e) {
28399
28476
  e.content = replaceBlobWithBase64(e.content);
@@ -28410,6 +28487,7 @@ define("tinymce/EditorUpload", [
28410
28487
  return {
28411
28488
  blobCache: blobCache,
28412
28489
  uploadImages: uploadImages,
28490
+ uploadImagesAuto: uploadImagesAuto,
28413
28491
  scanForImages: scanForImages,
28414
28492
  destroy: destroy
28415
28493
  };
@@ -29080,7 +29158,10 @@ define("tinymce/Editor", [
29080
29158
 
29081
29159
  // Domain relaxing is required since the user has messed around with document.domain
29082
29160
  if (document.domain != location.hostname) {
29083
- url = domainRelaxUrl;
29161
+ // Edge seems to be able to handle domain relaxing
29162
+ if (Env.ie && Env.ie < 12) {
29163
+ url = domainRelaxUrl;
29164
+ }
29084
29165
  }
29085
29166
 
29086
29167
  // Create iframe
@@ -31049,7 +31130,7 @@ define("tinymce/EditorManager", [
31049
31130
  * @property minorVersion
31050
31131
  * @type String
31051
31132
  */
31052
- minorVersion: '2.5',
31133
+ minorVersion: '2.6',
31053
31134
 
31054
31135
  /**
31055
31136
  * Release date of TinyMCE build.
@@ -31057,7 +31138,7 @@ define("tinymce/EditorManager", [
31057
31138
  * @property releaseDate
31058
31139
  * @type String
31059
31140
  */
31060
- releaseDate: '2015-08-31',
31141
+ releaseDate: '2015-09-28',
31061
31142
 
31062
31143
  /**
31063
31144
  * Collection of editor instances.
@@ -31782,6 +31863,12 @@ define("tinymce/util/XHR", [
31782
31863
  xhr.setRequestHeader('Content-Type', settings.content_type);
31783
31864
  }
31784
31865
 
31866
+ if (settings.requestheaders) {
31867
+ Tools.each(settings.requestheaders, function(header) {
31868
+ xhr.setRequestHeader(header.key, header.value);
31869
+ });
31870
+ }
31871
+
31785
31872
  xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
31786
31873
 
31787
31874
  xhr = XHR.fire('beforeSend', {xhr: xhr, settings: settings}).xhr;
@@ -1,4 +1,4 @@
1
- // 4.2.5 (2015-08-31)
1
+ // 4.2.6 (2015-09-28)
2
2
 
3
3
  /**
4
4
  * Compiled inline version. (Library mode)
@@ -3489,6 +3489,7 @@ define("tinymce/dom/DomQuery", [
3489
3489
  var doc = document, push = Array.prototype.push, slice = Array.prototype.slice;
3490
3490
  var rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/;
3491
3491
  var Event = EventUtils.Event, undef;
3492
+ var skipUniques = Tools.makeMap('children,contents,next,prev');
3492
3493
 
3493
3494
  function isDefined(obj) {
3494
3495
  return typeof obj !== 'undefined';
@@ -4817,7 +4818,9 @@ define("tinymce/dom/DomQuery", [
4817
4818
 
4818
4819
  // If traversing on multiple elements we might get the same elements twice
4819
4820
  if (this.length > 1) {
4820
- result = DomQuery.unique(result);
4821
+ if (!skipUniques[name]) {
4822
+ result = DomQuery.unique(result);
4823
+ }
4821
4824
 
4822
4825
  if (name.indexOf('parents') === 0) {
4823
4826
  result = result.reverse();
@@ -6819,6 +6822,18 @@ define("tinymce/dom/DOMUtils", [
6819
6822
  return attrHooks;
6820
6823
  }
6821
6824
 
6825
+ function updateInternalStyleAttr(domUtils, $elm) {
6826
+ var value = $elm.attr('style');
6827
+
6828
+ value = domUtils.serializeStyle(domUtils.parseStyle(value), $elm[0].nodeName);
6829
+
6830
+ if (!value) {
6831
+ value = null;
6832
+ }
6833
+
6834
+ $elm.attr('data-mce-style', value);
6835
+ }
6836
+
6822
6837
  /**
6823
6838
  * Constructs a new DOMUtils instance. Consult the Wiki for more details on settings etc for this class.
6824
6839
  *
@@ -7359,7 +7374,7 @@ define("tinymce/dom/DOMUtils", [
7359
7374
  * or the CSS style name like background-color.
7360
7375
  *
7361
7376
  * @method setStyle
7362
- * @param {String/Element/Array} n HTML element/Element ID or Array of elements/ids to set CSS style value on.
7377
+ * @param {String/Element/Array} n HTML element/Array of elements to set CSS style value on.
7363
7378
  * @param {String} na Name of the style value to set.
7364
7379
  * @param {String} v Value to set on the style.
7365
7380
  * @example
@@ -7373,7 +7388,7 @@ define("tinymce/dom/DOMUtils", [
7373
7388
  elm = this.$$(elm).css(name, value);
7374
7389
 
7375
7390
  if (this.settings.update_styles) {
7376
- elm.attr('data-mce-style', null);
7391
+ updateInternalStyleAttr(this, elm);
7377
7392
  }
7378
7393
  },
7379
7394
 
@@ -7422,7 +7437,7 @@ define("tinymce/dom/DOMUtils", [
7422
7437
  elm = this.$$(elm).css(styles);
7423
7438
 
7424
7439
  if (this.settings.update_styles) {
7425
- elm.attr('data-mce-style', null);
7440
+ updateInternalStyleAttr(this, elm);
7426
7441
  }
7427
7442
  },
7428
7443
 
@@ -12993,6 +13008,33 @@ define("tinymce/dom/Serializer", [
12993
13008
  var each = Tools.each, trim = Tools.trim;
12994
13009
  var DOM = DOMUtils.DOM;
12995
13010
 
13011
+ /**
13012
+ * IE 11 has a fantastic bug where it will produce two trailing BR elements to iframe bodies when
13013
+ * the iframe is hidden by display: none on a parent container. The DOM is actually out of sync
13014
+ * with innerHTML in this case. It's like IE adds shadow DOM BR elements that appears on innerHTML
13015
+ * but not as the lastChild of the body. So this fix simply removes the last two
13016
+ * BR elements at the end of the document.
13017
+ *
13018
+ * Example of what happens: <body>text</body> becomes <body>text<br><br></body>
13019
+ */
13020
+ function trimTrailingBr(rootNode) {
13021
+ var brNode1, brNode2;
13022
+
13023
+ function isBr(node) {
13024
+ return node && node.name === 'br';
13025
+ }
13026
+
13027
+ brNode1 = rootNode.lastChild;
13028
+ if (isBr(brNode1)) {
13029
+ brNode2 = brNode1.prev;
13030
+
13031
+ if (isBr(brNode2)) {
13032
+ brNode1.remove();
13033
+ brNode2.remove();
13034
+ }
13035
+ }
13036
+ }
13037
+
12996
13038
  /**
12997
13039
  * Constructs a new DOM serializer class.
12998
13040
  *
@@ -13250,7 +13292,7 @@ define("tinymce/dom/Serializer", [
13250
13292
  * @param {Object} args Arguments option that gets passed to event handlers.
13251
13293
  */
13252
13294
  serialize: function(node, args) {
13253
- var self = this, impl, doc, oldDoc, htmlSerializer, content;
13295
+ var self = this, impl, doc, oldDoc, htmlSerializer, content, rootNode;
13254
13296
 
13255
13297
  // Explorer won't clone contents of script and style and the
13256
13298
  // selected index of select elements are cleared on a clone operation.
@@ -13300,13 +13342,13 @@ define("tinymce/dom/Serializer", [
13300
13342
  self.onPreProcess(args);
13301
13343
  }
13302
13344
 
13303
- // Setup serializer
13304
- htmlSerializer = new Serializer(settings, schema);
13345
+ // Parse HTML
13346
+ rootNode = htmlParser.parse(trim(args.getInner ? node.innerHTML : dom.getOuterHTML(node)), args);
13347
+ trimTrailingBr(rootNode);
13305
13348
 
13306
- // Parse and serialize HTML
13307
- args.content = htmlSerializer.serialize(
13308
- htmlParser.parse(trim(args.getInner ? node.innerHTML : dom.getOuterHTML(node)), args)
13309
- );
13349
+ // Serialize HTML
13350
+ htmlSerializer = new Serializer(settings, schema);
13351
+ args.content = htmlSerializer.serialize(rootNode);
13310
13352
 
13311
13353
  // Replace all BOM characters for now until we can find a better solution
13312
13354
  if (!args.cleanup) {
@@ -14495,7 +14537,7 @@ define("tinymce/dom/ControlSelection", [
14495
14537
  }
14496
14538
  });
14497
14539
 
14498
- editor.on('hide', hideResizeRect);
14540
+ editor.on('hide blur', hideResizeRect);
14499
14541
 
14500
14542
  // Hide rect on focusout since it would float on top of windows otherwise
14501
14543
  //editor.on('focusout', hideResizeRect);
@@ -18640,7 +18682,7 @@ define("tinymce/UndoManager", [
18640
18682
  }
18641
18683
  });
18642
18684
 
18643
- editor.on('ObjectResizeStart', function() {
18685
+ editor.on('ObjectResizeStart Cut', function() {
18644
18686
  self.beforeChange();
18645
18687
  });
18646
18688
 
@@ -18650,6 +18692,12 @@ define("tinymce/UndoManager", [
18650
18692
  editor.on('KeyUp', function(e) {
18651
18693
  var keyCode = e.keyCode;
18652
18694
 
18695
+ // If key is prevented then don't add undo level
18696
+ // This would happen on keyboard shortcuts for example
18697
+ if (e.isDefaultPrevented()) {
18698
+ return;
18699
+ }
18700
+
18653
18701
  if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 45 || keyCode == 13 || e.ctrlKey) {
18654
18702
  addNonTypingUndoLevel();
18655
18703
  editor.nodeChanged();
@@ -18680,6 +18728,12 @@ define("tinymce/UndoManager", [
18680
18728
  editor.on('KeyDown', function(e) {
18681
18729
  var keyCode = e.keyCode;
18682
18730
 
18731
+ // If key is prevented then don't add undo level
18732
+ // This would happen on keyboard shortcuts for example
18733
+ if (e.isDefaultPrevented()) {
18734
+ return;
18735
+ }
18736
+
18683
18737
  // Is caracter positon keys left,right,up,down,home,end,pgdown,pgup,enter
18684
18738
  if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 45) {
18685
18739
  if (self.typing) {
@@ -19114,6 +19168,11 @@ define("tinymce/EnterKey", [
19114
19168
  }
19115
19169
  }
19116
19170
 
19171
+ function emptyBlock(elm) {
19172
+ // BR is needed in empty blocks on non IE browsers
19173
+ elm.innerHTML = !isIE ? '<br data-mce-bogus="1">' : '';
19174
+ }
19175
+
19117
19176
  // Creates a new block element by cloning the current one or creating a new one if the name is specified
19118
19177
  // This function will also copy any text formatting from the parent block and add it to the new one
19119
19178
  function createNewBlock(name) {
@@ -19549,6 +19608,10 @@ define("tinymce/EnterKey", [
19549
19608
  trimInlineElementsOnLeftSideOfBlock(newBlock);
19550
19609
  addBrToBlockIfNeeded(parentBlock);
19551
19610
 
19611
+ if (dom.isEmpty(parentBlock)) {
19612
+ emptyBlock(parentBlock);
19613
+ }
19614
+
19552
19615
  // New block might become empty if it's <p><b>a |</b></p>
19553
19616
  if (dom.isEmpty(newBlock)) {
19554
19617
  dom.remove(newBlock);
@@ -28065,6 +28128,11 @@ define("tinymce/util/Quirks", [
28065
28128
  if (!isDefaultPrevented(e) && (isForward || e.keyCode == BACKSPACE)) {
28066
28129
  var rng = editor.selection.getRng(), container = rng.startContainer, offset = rng.startOffset;
28067
28130
 
28131
+ // Shift+Delete is cut
28132
+ if (isForward && e.shiftKey) {
28133
+ return;
28134
+ }
28135
+
28068
28136
  // Ignore non meta delete in the where there is text before/after the caret
28069
28137
  if (!isMetaOrCtrl && rng.collapsed && container.nodeType == 3) {
28070
28138
  if (isForward ? offset < container.data.length : offset > 0) {
@@ -28918,8 +28986,15 @@ define("tinymce/util/Quirks", [
28918
28986
  if (!editor.inline) {
28919
28987
  editor.contentStyles.push('body {min-height: 150px}');
28920
28988
  editor.on('click', function(e) {
28989
+ var rng;
28990
+
28921
28991
  if (e.target.nodeName == 'HTML') {
28922
- var rng;
28992
+ // Edge seems to only need focus if we set the range
28993
+ // the caret will become invisible and moved out of the iframe!!
28994
+ if (Env.ie > 11) {
28995
+ editor.getBody().focus();
28996
+ return;
28997
+ }
28923
28998
 
28924
28999
  // Need to store away non collapsed ranges since the focus call will mess that up see #7382
28925
29000
  rng = editor.selection.getRng();
@@ -28954,25 +29029,6 @@ define("tinymce/util/Quirks", [
28954
29029
  setEditorCommandState("AutoUrlDetect", false);
28955
29030
  }
28956
29031
 
28957
- /**
28958
- * IE 11 has a fantastic bug where it will produce two trailing BR elements to iframe bodies when
28959
- * the iframe is hidden by display: none on a parent container. The DOM is actually out of sync
28960
- * with innerHTML in this case. It's like IE adds shadow DOM BR elements that appears on innerHTML
28961
- * but not as the lastChild of the body. However is we add a BR element to the body then remove it
28962
- * it doesn't seem to add these BR elements makes sence right?!
28963
- *
28964
- * Example of what happens: <body>text</body> becomes <body>text<br><br></body>
28965
- */
28966
- function doubleTrailingBrElements() {
28967
- if (!editor.inline) {
28968
- editor.on('focus blur beforegetcontent', function() {
28969
- var br = editor.dom.create('br');
28970
- editor.getBody().appendChild(br);
28971
- br.parentNode.removeChild(br);
28972
- }, true);
28973
- }
28974
- }
28975
-
28976
29032
  /**
28977
29033
  * iOS 7.1 introduced two new bugs:
28978
29034
  * 1) It's possible to open links within a contentEditable area by clicking on them.
@@ -29146,7 +29202,6 @@ define("tinymce/util/Quirks", [
29146
29202
 
29147
29203
  if (Env.ie >= 11) {
29148
29204
  bodyHeight();
29149
- doubleTrailingBrElements();
29150
29205
  disableBackspaceIntoATable();
29151
29206
  }
29152
29207
 
@@ -30299,6 +30354,16 @@ define("tinymce/EditorUpload", [
30299
30354
  return function(editor) {
30300
30355
  var blobCache = new BlobCache(), uploader, imageScanner;
30301
30356
 
30357
+ function aliveGuard(callback) {
30358
+ return function(result) {
30359
+ if (editor.selection) {
30360
+ return callback(result);
30361
+ }
30362
+
30363
+ return [];
30364
+ };
30365
+ }
30366
+
30302
30367
  // Replaces strings without regexps to avoid FF regexp to big issue
30303
30368
  function replaceString(content, search, replace) {
30304
30369
  var index = 0;
@@ -30338,14 +30403,14 @@ define("tinymce/EditorUpload", [
30338
30403
  });
30339
30404
  }
30340
30405
 
30341
- return scanForImages().then(function(imageInfos) {
30406
+ return scanForImages().then(aliveGuard(function(imageInfos) {
30342
30407
  var blobInfos;
30343
30408
 
30344
30409
  blobInfos = Arr.map(imageInfos, function(imageInfo) {
30345
30410
  return imageInfo.blobInfo;
30346
30411
  });
30347
30412
 
30348
- return uploader.upload(blobInfos).then(function(result) {
30413
+ return uploader.upload(blobInfos).then(aliveGuard(function(result) {
30349
30414
  result = Arr.map(result, function(uploadInfo, index) {
30350
30415
  var image = imageInfos[index].image;
30351
30416
 
@@ -30367,8 +30432,14 @@ define("tinymce/EditorUpload", [
30367
30432
  }
30368
30433
 
30369
30434
  return result;
30370
- });
30371
- });
30435
+ }));
30436
+ }));
30437
+ }
30438
+
30439
+ function uploadImagesAuto(callback) {
30440
+ if (editor.settings.automatic_uploads !== false) {
30441
+ return uploadImages(callback);
30442
+ }
30372
30443
  }
30373
30444
 
30374
30445
  function scanForImages() {
@@ -30376,14 +30447,14 @@ define("tinymce/EditorUpload", [
30376
30447
  imageScanner = new ImageScanner(blobCache);
30377
30448
  }
30378
30449
 
30379
- return imageScanner.findAll(editor.getBody()).then(function(result) {
30450
+ return imageScanner.findAll(editor.getBody()).then(aliveGuard(function(result) {
30380
30451
  Arr.each(result, function(resultItem) {
30381
30452
  replaceUrlInUndoStack(resultItem.image.src, resultItem.blobInfo.blobUri());
30382
30453
  resultItem.image.src = resultItem.blobInfo.blobUri();
30383
30454
  });
30384
30455
 
30385
30456
  return result;
30386
- });
30457
+ }));
30387
30458
  }
30388
30459
 
30389
30460
  function destroy() {
@@ -30405,11 +30476,17 @@ define("tinymce/EditorUpload", [
30405
30476
  return 'src="data:' + blobInfo.blob().type + ';base64,' + blobInfo.base64() + '"';
30406
30477
  }
30407
30478
 
30408
- return match[0];
30479
+ return match;
30409
30480
  });
30410
30481
  }
30411
30482
 
30412
- editor.on('setContent paste', scanForImages);
30483
+ editor.on('setContent', function() {
30484
+ if (editor.settings.automatic_uploads !== false) {
30485
+ uploadImagesAuto();
30486
+ } else {
30487
+ scanForImages();
30488
+ }
30489
+ });
30413
30490
 
30414
30491
  editor.on('RawSaveContent', function(e) {
30415
30492
  e.content = replaceBlobWithBase64(e.content);
@@ -30426,6 +30503,7 @@ define("tinymce/EditorUpload", [
30426
30503
  return {
30427
30504
  blobCache: blobCache,
30428
30505
  uploadImages: uploadImages,
30506
+ uploadImagesAuto: uploadImagesAuto,
30429
30507
  scanForImages: scanForImages,
30430
30508
  destroy: destroy
30431
30509
  };
@@ -31096,7 +31174,10 @@ define("tinymce/Editor", [
31096
31174
 
31097
31175
  // Domain relaxing is required since the user has messed around with document.domain
31098
31176
  if (document.domain != location.hostname) {
31099
- url = domainRelaxUrl;
31177
+ // Edge seems to be able to handle domain relaxing
31178
+ if (Env.ie && Env.ie < 12) {
31179
+ url = domainRelaxUrl;
31180
+ }
31100
31181
  }
31101
31182
 
31102
31183
  // Create iframe
@@ -33065,7 +33146,7 @@ define("tinymce/EditorManager", [
33065
33146
  * @property minorVersion
33066
33147
  * @type String
33067
33148
  */
33068
- minorVersion: '2.5',
33149
+ minorVersion: '2.6',
33069
33150
 
33070
33151
  /**
33071
33152
  * Release date of TinyMCE build.
@@ -33073,7 +33154,7 @@ define("tinymce/EditorManager", [
33073
33154
  * @property releaseDate
33074
33155
  * @type String
33075
33156
  */
33076
- releaseDate: '2015-08-31',
33157
+ releaseDate: '2015-09-28',
33077
33158
 
33078
33159
  /**
33079
33160
  * Collection of editor instances.
@@ -33798,6 +33879,12 @@ define("tinymce/util/XHR", [
33798
33879
  xhr.setRequestHeader('Content-Type', settings.content_type);
33799
33880
  }
33800
33881
 
33882
+ if (settings.requestheaders) {
33883
+ Tools.each(settings.requestheaders, function(header) {
33884
+ xhr.setRequestHeader(header.key, header.value);
33885
+ });
33886
+ }
33887
+
33801
33888
  xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
33802
33889
 
33803
33890
  xhr = XHR.fire('beforeSend', {xhr: xhr, settings: settings}).xhr;