tinymce-rails 4.4.1 → 4.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/source/tinymce/tinymce.js +406 -197
  3. data/lib/tinymce/rails/version.rb +2 -2
  4. data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +1 -1
  5. data/vendor/assets/javascripts/tinymce/plugins/contextmenu/plugin.js +1 -1
  6. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +1 -1
  7. data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +1 -1
  8. data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +1 -1
  9. data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.js +1 -1
  10. data/vendor/assets/javascripts/tinymce/plugins/spellchecker/plugin.js +1 -1
  11. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +2 -2
  12. data/vendor/assets/javascripts/tinymce/plugins/template/plugin.js +1 -1
  13. data/vendor/assets/javascripts/tinymce/themes/inlite/theme.js +1 -1
  14. data/vendor/assets/javascripts/tinymce/tinymce.js +14 -13
  15. metadata +2 -55
  16. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/atomic.js +0 -5
  17. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/bootstrap-atomic.js +0 -1491
  18. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/bootstrap-browser.js +0 -1491
  19. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/bootstrap-demo.js +0 -1491
  20. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/bootstrap-prod.js +0 -1491
  21. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/browser.js +0 -10
  22. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/demo.js +0 -8
  23. data/vendor/assets/javascripts/tinymce/themes/inlite/config/bolt/prod.js +0 -5
  24. data/vendor/assets/javascripts/tinymce/themes/inlite/config/dent/depend.js +0 -21
  25. data/vendor/assets/javascripts/tinymce/themes/inlite/scratch/compile/bootstrap.js +0 -1526
  26. data/vendor/assets/javascripts/tinymce/themes/inlite/scratch/compile/theme.js +0 -1594
  27. data/vendor/assets/javascripts/tinymce/themes/inlite/scratch/inline/theme.js +0 -1679
  28. data/vendor/assets/javascripts/tinymce/themes/inlite/scratch/inline/theme.raw.js +0 -1679
  29. data/vendor/assets/javascripts/tinymce/themes/inlite/src/demo/css/demo.css +0 -25
  30. data/vendor/assets/javascripts/tinymce/themes/inlite/src/demo/html/demo.html +0 -69
  31. data/vendor/assets/javascripts/tinymce/themes/inlite/src/demo/js/tinymce/inlite/Demo.js +0 -28
  32. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/Theme.js +0 -150
  33. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/alien/Arr.js +0 -22
  34. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/alien/Bookmark.js +0 -130
  35. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/alien/Unlink.js +0 -84
  36. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/alien/Uuid.js +0 -34
  37. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/Actions.js +0 -106
  38. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/Convert.js +0 -37
  39. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/ElementMatcher.js +0 -47
  40. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/Layout.js +0 -95
  41. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/Matcher.js +0 -39
  42. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/Measure.js +0 -61
  43. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/PredicateId.js +0 -32
  44. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/SelectionMatcher.js +0 -55
  45. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/SkinLoader.js +0 -45
  46. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/core/UrlType.js +0 -27
  47. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/file/Conversions.js +0 -31
  48. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/file/Picker.js +0 -40
  49. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/ui/Buttons.js +0 -80
  50. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/ui/Forms.js +0 -102
  51. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/ui/Panel.js +0 -218
  52. data/vendor/assets/javascripts/tinymce/themes/inlite/src/main/js/tinymce/inlite/ui/Toolbar.js +0 -126
  53. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/atomic/alien/ArrTest.js +0 -9
  54. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/atomic/alien/UuidTest.js +0 -10
  55. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/atomic/core/ConvertTest.js +0 -12
  56. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/atomic/core/MatcherTest.js +0 -51
  57. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/atomic/core/UrlTypeTest.js +0 -33
  58. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/ThemeTest.js +0 -202
  59. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/alien/BookmarkTest.js +0 -65
  60. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/alien/UnlinkTest.js +0 -38
  61. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/core/ActionsTest.js +0 -177
  62. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/core/ElementMatcher.js +0 -69
  63. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/core/LayoutTest.js +0 -118
  64. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/core/MeasureTest.js +0 -62
  65. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/core/PredicateIdTest.js +0 -26
  66. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/core/SelectionMatcherTest.js +0 -76
  67. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/file/ConversionsTest.js +0 -41
  68. data/vendor/assets/javascripts/tinymce/themes/inlite/src/test/js/browser/file/SelectionMatcher.js +0 -55
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40df16c1eee602625433aa591f4fef9118a49c87
4
- data.tar.gz: af096d2869024aaf9125bb175b013fa69e6471bb
3
+ metadata.gz: 01cceeb063ef5c275b6047395632ef20b0172c49
4
+ data.tar.gz: 53c569fb38de6fb52e80ab83b51daf45fe342712
5
5
  SHA512:
6
- metadata.gz: 1299a6d3f45589d2f96c22d792b6973f3d563189ecf2a4e59fe2b49f153226f68449e7419404de91b7f4830542f0df31ba1e7d89e17e4487b50924c9d037cada
7
- data.tar.gz: eac7d6b32dce1a3c4985c205c8c45d213b44cab29541d7f210b08c9de693349a90083755de4098e7b03d9379480edbe42b9d32fb1a8359dae4654fb5f4a53506
6
+ metadata.gz: 71ed15c1d9aa0caa0ef114a95166200cccddb5cb806c3d9e4d4a7eb878ffda9a4a12093430b4168948e915132bdf64d2a04dd6c88c245ee72bd7bcf722e92f5d
7
+ data.tar.gz: 0c22b390f438c816dbabbaaddce0acb8e913ffde31786e8a5403ebcf3a9fa92e731cf6c8bc612fbc13e8ee23eb7c2ff3fa75994dfc650b1ff3a5993620c63eee
@@ -1,4 +1,4 @@
1
- // 4.4.1 (2016-07-26)
1
+ // 4.4.2 (2016-08-25)
2
2
 
3
3
  /**
4
4
  * Compiled inline version. (Library mode)
@@ -10001,16 +10001,17 @@ define("tinymce/dom/NodeType", [], function() {
10001
10001
  */
10002
10002
 
10003
10003
  /**
10004
- * ....
10004
+ * Utility functions for working with zero width space
10005
+ * characters used as character containers etc.
10005
10006
  *
10006
10007
  * @private
10007
10008
  * @class tinymce.text.Zwsp
10008
10009
  * @example
10009
- * var isZwsp = Zwsp.isZwsp('\u200b');
10010
- * var abc = Zwsp.trim('a\u200bc');
10010
+ * var isZwsp = Zwsp.isZwsp('\uFEFF');
10011
+ * var abc = Zwsp.trim('a\uFEFFc');
10011
10012
  */
10012
10013
  define("tinymce/text/Zwsp", [], function() {
10013
- var ZWSP = '\u200b';
10014
+ var ZWSP = '\uFEFF';
10014
10015
 
10015
10016
  function isZwsp(chr) {
10016
10017
  return chr == ZWSP;
@@ -10069,6 +10070,30 @@ define("tinymce/caret/CaretContainer", [
10069
10070
  return isCaretContainerBlock(node) || isCaretContainerInline(node);
10070
10071
  }
10071
10072
 
10073
+ function removeNode(node) {
10074
+ var parentNode = node.parentNode;
10075
+ if (parentNode) {
10076
+ parentNode.removeChild(node);
10077
+ }
10078
+ }
10079
+
10080
+ function getNodeValue(node) {
10081
+ try {
10082
+ return node.nodeValue;
10083
+ } catch (ex) {
10084
+ // IE sometimes produces "Invalid argument" on nodes
10085
+ return "";
10086
+ }
10087
+ }
10088
+
10089
+ function setNodeValue(node, text) {
10090
+ if (text.length === 0) {
10091
+ removeNode(node);
10092
+ } else {
10093
+ node.nodeValue = text;
10094
+ }
10095
+ }
10096
+
10072
10097
  function insertInline(node, before) {
10073
10098
  var doc, sibling, textNode, parentNode;
10074
10099
 
@@ -10136,28 +10161,17 @@ define("tinymce/caret/CaretContainer", [
10136
10161
  }
10137
10162
 
10138
10163
  function remove(caretContainerNode) {
10139
- var text;
10140
-
10141
10164
  if (isElement(caretContainerNode) && isCaretContainer(caretContainerNode)) {
10142
10165
  if (caretContainerNode.innerHTML != ' ') {
10143
10166
  caretContainerNode.removeAttribute('data-mce-caret');
10144
10167
  } else {
10145
- if (caretContainerNode.parentNode) {
10146
- caretContainerNode.parentNode.removeChild(caretContainerNode);
10147
- }
10168
+ removeNode(caretContainerNode);
10148
10169
  }
10149
10170
  }
10150
10171
 
10151
10172
  if (isText(caretContainerNode)) {
10152
- text = Zwsp.trim(caretContainerNode.data);
10153
-
10154
- if (text.length === 0) {
10155
- if (caretContainerNode.parentNode) {
10156
- caretContainerNode.parentNode.removeChild(caretContainerNode);
10157
- }
10158
- }
10159
-
10160
- caretContainerNode.nodeValue = text;
10173
+ var text = Zwsp.trim(getNodeValue(caretContainerNode));
10174
+ setNodeValue(caretContainerNode, text);
10161
10175
  }
10162
10176
  }
10163
10177
 
@@ -14542,7 +14556,7 @@ define("tinymce/dom/Serializer", [
14542
14556
 
14543
14557
  // Nodes needs to be attached to something in WebKit/Opera
14544
14558
  // This fix will make DOM ranges and make Sizzle happy!
14545
- impl = node.ownerDocument.implementation;
14559
+ impl = document.implementation;
14546
14560
  if (impl.createHTMLDocument) {
14547
14561
  // Create an empty HTML document
14548
14562
  doc = impl.createHTMLDocument("");
@@ -18429,7 +18443,7 @@ define("tinymce/dom/ElementUtils", [
18429
18443
  var name = attr.nodeName.toLowerCase();
18430
18444
 
18431
18445
  // Don't compare internal attributes or style
18432
- if (name.indexOf('_') !== 0 && name !== 'style' && name !== 'data-mce-style' && name != 'data-mce-fragment') {
18446
+ if (name.indexOf('_') !== 0 && name !== 'style' && name.indexOf('data-') !== 0) {
18433
18447
  attribs[name] = dom.getAttrib(node, name);
18434
18448
  }
18435
18449
  });
@@ -20615,7 +20629,8 @@ define("tinymce/Formatter", [
20615
20629
  // Check for non internal attributes
20616
20630
  attrs = dom.getAttribs(node);
20617
20631
  for (i = 0; i < attrs.length; i++) {
20618
- if (attrs[i].nodeName.indexOf('_') !== 0) {
20632
+ var attrName = attrs[i].nodeName;
20633
+ if (attrName.indexOf('_') !== 0 && attrName.indexOf('data-') !== 0) {
20619
20634
  return FALSE;
20620
20635
  }
20621
20636
  }
@@ -26366,14 +26381,15 @@ define("tinymce/ui/Collection", [
26366
26381
  * @class tinymce.ui.DomUtils
26367
26382
  */
26368
26383
  define("tinymce/ui/DomUtils", [
26384
+ "tinymce/Env",
26369
26385
  "tinymce/util/Tools",
26370
26386
  "tinymce/dom/DOMUtils"
26371
- ], function(Tools, DOMUtils) {
26387
+ ], function(Env, Tools, DOMUtils) {
26372
26388
  "use strict";
26373
26389
 
26374
26390
  var count = 0;
26375
26391
 
26376
- return {
26392
+ var funcs = {
26377
26393
  id: function() {
26378
26394
  return 'mceu_' + (count++);
26379
26395
  },
@@ -26421,7 +26437,11 @@ define("tinymce/ui/DomUtils", [
26421
26437
  },
26422
26438
 
26423
26439
  getPos: function(elm, root) {
26424
- return DOMUtils.DOM.getPos(elm, root);
26440
+ return DOMUtils.DOM.getPos(elm, root || funcs.getContainer());
26441
+ },
26442
+
26443
+ getContainer: function () {
26444
+ return Env.container ? Env.container : document.body;
26425
26445
  },
26426
26446
 
26427
26447
  getViewPort: function(win) {
@@ -26473,6 +26493,8 @@ define("tinymce/ui/DomUtils", [
26473
26493
  DOMUtils.DOM.setHTML(elm, html);
26474
26494
  }
26475
26495
  };
26496
+
26497
+ return funcs;
26476
26498
  });
26477
26499
 
26478
26500
  // Included from: js/tinymce/classes/ui/BoxUtils.js
@@ -26971,7 +26993,7 @@ define("tinymce/ui/Control", [
26971
26993
  * @return {Element} HTML DOM element to render into.
26972
26994
  */
26973
26995
  getContainerElm: function() {
26974
- return document.body;
26996
+ return DomUtils.getContainer();
26975
26997
  },
26976
26998
 
26977
26999
  /**
@@ -35594,6 +35616,90 @@ define("tinymce/caret/LineUtils", [
35594
35616
  };
35595
35617
  });
35596
35618
 
35619
+ // Included from: js/tinymce/classes/dom/MousePosition.js
35620
+
35621
+ /**
35622
+ * MousePosition.js
35623
+ *
35624
+ * Released under LGPL License.
35625
+ * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
35626
+ *
35627
+ * License: http://www.tinymce.com/license
35628
+ * Contributing: http://www.tinymce.com/contributing
35629
+ */
35630
+
35631
+ /**
35632
+ * This module calculates an absolute coordinate inside the editor body for both local and global mouse events.
35633
+ *
35634
+ * @private
35635
+ * @class tinymce.dom.MousePosition
35636
+ */
35637
+ define("tinymce/dom/MousePosition", [
35638
+ ], function() {
35639
+ var getAbsolutePosition = function (elm) {
35640
+ var doc, docElem, win, clientRect;
35641
+
35642
+ clientRect = elm.getBoundingClientRect();
35643
+ doc = elm.ownerDocument;
35644
+ docElem = doc.documentElement;
35645
+ win = doc.defaultView;
35646
+
35647
+ return {
35648
+ top: clientRect.top + win.pageYOffset - docElem.clientTop,
35649
+ left: clientRect.left + win.pageXOffset - docElem.clientLeft
35650
+ };
35651
+ };
35652
+
35653
+ var getBodyPosition = function (editor) {
35654
+ return editor.inline ? getAbsolutePosition(editor.getBody()) : {left: 0, top: 0};
35655
+ };
35656
+
35657
+ var getScrollPosition = function (editor) {
35658
+ var body = editor.getBody();
35659
+ return editor.inline ? {left: body.scrollLeft, top: body.scrollTop} : {left: 0, top: 0};
35660
+ };
35661
+
35662
+ var getBodyScroll = function (editor) {
35663
+ var body = editor.getBody(), docElm = editor.getDoc().documentElement;
35664
+ var inlineScroll = {left: body.scrollLeft, top: body.scrollTop};
35665
+ var iframeScroll = {left: body.scrollLeft || docElm.scrollLeft, top: body.scrollTop || docElm.scrollTop};
35666
+
35667
+ return editor.inline ? inlineScroll : iframeScroll;
35668
+ };
35669
+
35670
+ var getMousePosition = function (editor, event) {
35671
+ if (event.target.ownerDocument !== editor.getDoc()) {
35672
+ var iframePosition = getAbsolutePosition(editor.getContentAreaContainer());
35673
+ var scrollPosition = getBodyScroll(editor);
35674
+
35675
+ return {
35676
+ left: event.pageX - iframePosition.left + scrollPosition.left,
35677
+ top: event.pageY - iframePosition.top + scrollPosition.top
35678
+ };
35679
+ }
35680
+
35681
+ return {
35682
+ left: event.pageX,
35683
+ top: event.pageY
35684
+ };
35685
+ };
35686
+
35687
+ var calculatePosition = function (bodyPosition, scrollPosition, mousePosition) {
35688
+ return {
35689
+ pageX: (mousePosition.left - bodyPosition.left) + scrollPosition.left,
35690
+ pageY: (mousePosition.top - bodyPosition.top) + scrollPosition.top
35691
+ };
35692
+ };
35693
+
35694
+ var calc = function (editor, event) {
35695
+ return calculatePosition(getBodyPosition(editor), getScrollPosition(editor), getMousePosition(editor, event));
35696
+ };
35697
+
35698
+ return {
35699
+ calc: calc
35700
+ };
35701
+ });
35702
+
35597
35703
  // Included from: js/tinymce/classes/DragDropOverrides.js
35598
35704
 
35599
35705
  /**
@@ -35615,205 +35721,240 @@ define("tinymce/caret/LineUtils", [
35615
35721
  define("tinymce/DragDropOverrides", [
35616
35722
  "tinymce/dom/NodeType",
35617
35723
  "tinymce/util/Arr",
35618
- "tinymce/util/Fun"
35724
+ "tinymce/util/Fun",
35725
+ "tinymce/util/Delay",
35726
+ "tinymce/dom/DOMUtils",
35727
+ "tinymce/dom/MousePosition"
35619
35728
  ], function(
35620
- NodeType,
35621
- Arr,
35622
- Fun
35729
+ NodeType, Arr, Fun, Delay, DOMUtils, MousePosition
35623
35730
  ) {
35624
35731
  var isContentEditableFalse = NodeType.isContentEditableFalse,
35625
35732
  isContentEditableTrue = NodeType.isContentEditableTrue;
35626
35733
 
35627
- function init(editor) {
35628
- var $ = editor.$, rootDocument = document,
35629
- editableDoc = editor.getDoc(),
35630
- dom = editor.dom, state = {};
35734
+ var isDraggable = function (elm) {
35735
+ return isContentEditableFalse(elm);
35736
+ };
35631
35737
 
35632
- function isDraggable(elm) {
35633
- return isContentEditableFalse(elm);
35738
+ var isValidDropTarget = function (editor, targetElement, dragElement) {
35739
+ if (targetElement === dragElement || editor.dom.isChildOf(targetElement, dragElement)) {
35740
+ return false;
35634
35741
  }
35635
35742
 
35636
- function setBodyCursor(cursor) {
35637
- $(editor.getBody()).css('cursor', cursor);
35743
+ if (isContentEditableFalse(targetElement)) {
35744
+ return false;
35638
35745
  }
35639
35746
 
35640
- function isValidDropTarget(elm) {
35641
- if (elm == state.element || editor.dom.isChildOf(elm, state.element)) {
35642
- return false;
35643
- }
35747
+ return true;
35748
+ };
35644
35749
 
35645
- if (isContentEditableFalse(elm)) {
35646
- return false;
35647
- }
35750
+ var cloneElement = function (elm) {
35751
+ var cloneElm = elm.cloneNode(true);
35752
+ cloneElm.removeAttribute('data-mce-selected');
35753
+ return cloneElm;
35754
+ };
35648
35755
 
35649
- return true;
35650
- }
35756
+ var createGhost = function (editor, elm, width, height) {
35757
+ var clonedElm = elm.cloneNode(true);
35651
35758
 
35652
- function move(e) {
35653
- var deltaX, deltaY, pos, viewPort,
35654
- overflowX = 0, overflowY = 0, movement,
35655
- clientX, clientY, rootClientRect;
35759
+ editor.dom.setStyles(clonedElm, {width: width, height: height});
35760
+ editor.dom.setAttrib(clonedElm, 'data-mce-selected', null);
35656
35761
 
35657
- if (e.button !== 0) {
35658
- return;
35659
- }
35762
+ var ghostElm = editor.dom.create('div', {
35763
+ 'class': 'mce-drag-container',
35764
+ 'data-mce-bogus': 'all',
35765
+ unselectable: 'on',
35766
+ contenteditable: 'false'
35767
+ });
35660
35768
 
35661
- deltaX = e.screenX - state.screenX;
35662
- deltaY = e.screenY - state.screenY;
35663
- movement = Math.max(Math.abs(deltaX), Math.abs(deltaY));
35769
+ editor.dom.setStyles(ghostElm, {
35770
+ position: 'absolute',
35771
+ opacity: 0.5,
35772
+ overflow: 'hidden',
35773
+ border: 0,
35774
+ padding: 0,
35775
+ margin: 0,
35776
+ width: width,
35777
+ height: height
35778
+ });
35664
35779
 
35665
- if (!state.dragging && movement > 10) {
35666
- state.dragging = true;
35667
- setBodyCursor('default');
35668
-
35669
- state.clone = state.element.cloneNode(true);
35670
-
35671
- pos = dom.getPos(state.element);
35672
- state.relX = state.clientX - pos.x;
35673
- state.relY = state.clientY - pos.y;
35674
- state.width = state.element.offsetWidth;
35675
- state.height = state.element.offsetHeight;
35676
-
35677
- $(state.clone).css({
35678
- width: state.width,
35679
- height: state.height
35680
- }).removeAttr('data-mce-selected');
35681
-
35682
- state.ghost = $('<div>').css({
35683
- position: 'absolute',
35684
- opacity: 0.5,
35685
- overflow: 'hidden',
35686
- width: state.width,
35687
- height: state.height
35688
- }).attr({
35689
- 'data-mce-bogus': 'all',
35690
- unselectable: 'on',
35691
- contenteditable: 'false'
35692
- }).addClass('mce-drag-container mce-reset').
35693
- append(state.clone).
35694
- appendTo(editor.getBody())[0];
35695
-
35696
- viewPort = editor.dom.getViewPort(editor.getWin());
35697
- state.maxX = viewPort.w;
35698
- state.maxY = viewPort.h;
35699
- }
35780
+ editor.dom.setStyles(clonedElm, {
35781
+ margin: 0,
35782
+ boxSizing: 'border-box'
35783
+ });
35700
35784
 
35701
- if (state.dragging) {
35702
- editor._selectionOverrides.hideFakeCaret();
35703
- editor.selection.placeCaretAt(e.clientX, e.clientY);
35785
+ ghostElm.appendChild(clonedElm);
35704
35786
 
35705
- clientX = state.clientX + deltaX - state.relX;
35706
- clientY = state.clientY + deltaY + 5;
35787
+ return ghostElm;
35788
+ };
35707
35789
 
35708
- if (clientX + state.width > state.maxX) {
35709
- overflowX = (clientX + state.width) - state.maxX;
35710
- }
35790
+ var appendGhostToBody = function (ghostElm, bodyElm) {
35791
+ if (ghostElm.parentNode !== bodyElm) {
35792
+ bodyElm.appendChild(ghostElm);
35793
+ }
35794
+ };
35711
35795
 
35712
- if (clientY + state.height > state.maxY) {
35713
- overflowY = (clientY + state.height) - state.maxY;
35714
- }
35796
+ var moveGhost = function (ghostElm, position, width, height, maxX, maxY) {
35797
+ var overflowX = 0, overflowY = 0;
35715
35798
 
35716
- if (editor.getBody().nodeName != 'BODY') {
35717
- rootClientRect = editor.getBody().getBoundingClientRect();
35718
- } else {
35719
- rootClientRect = {left: 0, top: 0};
35720
- }
35799
+ ghostElm.style.left = position.pageX + 'px';
35800
+ ghostElm.style.top = position.pageY + 'px';
35721
35801
 
35722
- $(state.ghost).css({
35723
- left: clientX - rootClientRect.left,
35724
- top: clientY - rootClientRect.top,
35725
- width: state.width - overflowX,
35726
- height: state.height - overflowY
35727
- });
35728
- }
35802
+ if (position.pageX + width > maxX) {
35803
+ overflowX = (position.pageX + width) - maxX;
35729
35804
  }
35730
35805
 
35731
- function drop(evt) {
35732
- var dropEvt;
35806
+ if (position.pageY + height > maxY) {
35807
+ overflowY = (position.pageY + height) - maxY;
35808
+ }
35733
35809
 
35734
- if (state.dragging) {
35735
- // Hack for IE since it doesn't sync W3C Range with IE Specific range
35736
- editor.selection.setRng(editor.selection.getSel().getRangeAt(0));
35810
+ ghostElm.style.width = (width - overflowX) + 'px';
35811
+ ghostElm.style.height = (height - overflowY) + 'px';
35812
+ };
35737
35813
 
35738
- if (isValidDropTarget(editor.selection.getNode())) {
35739
- var targetClone = state.element;
35814
+ var removeElement = function (elm) {
35815
+ if (elm && elm.parentNode) {
35816
+ elm.parentNode.removeChild(elm);
35817
+ }
35818
+ };
35740
35819
 
35741
- // Pass along clientX, clientY if we have them
35742
- dropEvt = editor.fire('drop', {
35743
- targetClone: targetClone,
35744
- clientX: evt.clientX,
35745
- clientY: evt.clientY
35746
- });
35820
+ var isLeftMouseButtonPressed = function (e) {
35821
+ return e.button === 0;
35822
+ };
35747
35823
 
35748
- if (dropEvt.isDefaultPrevented()) {
35749
- return;
35750
- }
35824
+ var hasDraggableElement = function (state) {
35825
+ return state.element;
35826
+ };
35751
35827
 
35752
- targetClone = dropEvt.targetClone;
35828
+ var applyRelPos = function (state, position) {
35829
+ return {
35830
+ pageX: position.pageX - state.relX,
35831
+ pageY: position.pageY + 5
35832
+ };
35833
+ };
35753
35834
 
35754
- editor.undoManager.transact(function() {
35755
- editor.insertContent(dom.getOuterHTML(targetClone));
35756
- $(state.element).remove();
35757
- });
35835
+ var start = function (state, editor) {
35836
+ return function (e) {
35837
+ if (isLeftMouseButtonPressed(e)) {
35838
+ var ceElm = Arr.find(editor.dom.getParents(e.target), Fun.or(isContentEditableFalse, isContentEditableTrue));
35839
+
35840
+ if (isDraggable(ceElm)) {
35841
+ var elmPos = editor.dom.getPos(ceElm);
35842
+ var bodyElm = editor.getBody();
35843
+ var docElm = editor.getDoc().documentElement;
35844
+
35845
+ state.element = ceElm;
35846
+ state.screenX = e.screenX;
35847
+ state.screenY = e.screenY;
35848
+ state.maxX = (editor.inline ? bodyElm.scrollWidth : docElm.offsetWidth) - 2;
35849
+ state.maxY = (editor.inline ? bodyElm.scrollHeight : docElm.offsetHeight) - 2;
35850
+ state.relX = e.pageX - elmPos.x;
35851
+ state.relY = e.pageY - elmPos.y;
35852
+ state.width = ceElm.offsetWidth;
35853
+ state.height = ceElm.offsetHeight;
35854
+ state.ghost = createGhost(editor, ceElm, state.width, state.height);
35758
35855
  }
35759
35856
  }
35857
+ };
35858
+ };
35760
35859
 
35761
- stop();
35762
- }
35860
+ var move = function (state, editor) {
35861
+ // Reduces laggy drag behavior on Gecko
35862
+ var throttledPlaceCaretAt = Delay.throttle(function (clientX, clientY) {
35863
+ editor._selectionOverrides.hideFakeCaret();
35864
+ editor.selection.placeCaretAt(clientX, clientY);
35865
+ }, 0);
35866
+
35867
+ return function (e) {
35868
+ var movement = Math.max(Math.abs(e.screenX - state.screenX), Math.abs(e.screenY - state.screenY));
35869
+
35870
+ if (hasDraggableElement(state) && !state.dragging && movement > 10) {
35871
+ var args = editor.fire('dragstart', {target: state.element});
35872
+ if (args.isDefaultPrevented()) {
35873
+ return;
35874
+ }
35763
35875
 
35764
- function start(e) {
35765
- var ceElm, evt;
35876
+ state.dragging = true;
35877
+ editor.focus();
35878
+ }
35766
35879
 
35767
- stop();
35880
+ if (state.dragging) {
35881
+ var targetPos = applyRelPos(state, MousePosition.calc(editor, e));
35768
35882
 
35769
- if (e.button !== 0) {
35770
- return;
35883
+ appendGhostToBody(state.ghost, editor.getBody());
35884
+ moveGhost(state.ghost, targetPos, state.width, state.height, state.maxX, state.maxY);
35885
+
35886
+ throttledPlaceCaretAt(e.clientX, e.clientY);
35771
35887
  }
35888
+ };
35889
+ };
35772
35890
 
35773
- ceElm = Arr.find(editor.dom.getParents(e.target), Fun.or(isContentEditableFalse, isContentEditableTrue));
35891
+ var drop = function (state, editor) {
35892
+ return function (e) {
35893
+ if (state.dragging) {
35894
+ if (isValidDropTarget(editor, editor.selection.getNode(), state.element)) {
35895
+ var targetClone = cloneElement(state.element);
35774
35896
 
35775
- if (isDraggable(ceElm)) {
35776
- evt = editor.fire('dragstart', {target: ceElm});
35777
- if (evt.isDefaultPrevented()) {
35778
- return;
35779
- }
35897
+ var args = editor.fire('drop', {
35898
+ targetClone: targetClone,
35899
+ clientX: e.clientX,
35900
+ clientY: e.clientY
35901
+ });
35780
35902
 
35781
- editor.on('mousemove', move);
35782
- editor.on('mouseup', drop);
35903
+ if (!args.isDefaultPrevented()) {
35904
+ targetClone = args.targetClone;
35783
35905
 
35784
- if (rootDocument != editableDoc) {
35785
- dom.bind(rootDocument, 'mousemove', move);
35786
- dom.bind(rootDocument, 'mouseup', drop);
35906
+ editor.undoManager.transact(function() {
35907
+ removeElement(state.element);
35908
+ editor.insertContent(editor.dom.getOuterHTML(targetClone));
35909
+ editor._selectionOverrides.hideFakeCaret();
35910
+ });
35911
+ }
35787
35912
  }
35913
+ }
35788
35914
 
35789
- state = {
35790
- screenX: e.screenX,
35791
- screenY: e.screenY,
35792
- clientX: e.clientX,
35793
- clientY: e.clientY,
35794
- element: ceElm
35795
- };
35915
+ removeDragState(state);
35916
+ };
35917
+ };
35918
+
35919
+ var stop = function (state, editor) {
35920
+ return function () {
35921
+ removeDragState(state);
35922
+ if (state.dragging) {
35923
+ editor.fire('dragend');
35796
35924
  }
35797
- }
35925
+ };
35926
+ };
35798
35927
 
35799
- function stop() {
35800
- $(state.ghost).remove();
35801
- setBodyCursor(null);
35928
+ var removeDragState = function (state) {
35929
+ state.dragging = false;
35930
+ state.element = null;
35931
+ removeElement(state.ghost);
35932
+ };
35802
35933
 
35803
- editor.off('mousemove', move);
35804
- editor.off('mouseup', stop);
35934
+ var bindFakeDragEvents = function (editor) {
35935
+ var state = {}, pageDom, dragStartHandler, dragHandler, dropHandler, dragEndHandler, rootDocument;
35805
35936
 
35806
- if (rootDocument != editableDoc) {
35807
- dom.unbind(rootDocument, 'mousemove', move);
35808
- dom.unbind(rootDocument, 'mouseup', stop);
35809
- }
35937
+ pageDom = DOMUtils.DOM;
35938
+ rootDocument = document;
35939
+ dragStartHandler = start(state, editor);
35940
+ dragHandler = move(state, editor);
35941
+ dropHandler = drop(state, editor);
35942
+ dragEndHandler = stop(state, editor);
35810
35943
 
35811
- state = {};
35812
- }
35944
+ editor.on('mousedown', dragStartHandler);
35945
+ editor.on('mousemove', dragHandler);
35946
+ editor.on('mouseup', dropHandler);
35813
35947
 
35814
- editor.on('mousedown', start);
35948
+ pageDom.bind(rootDocument, 'mousemove', dragHandler);
35949
+ pageDom.bind(rootDocument, 'mouseup', dragEndHandler);
35815
35950
 
35816
- // Blocks drop inside cE=false on IE
35951
+ editor.on('remove', function () {
35952
+ pageDom.unbind(rootDocument, 'mousemove', dragHandler);
35953
+ pageDom.unbind(rootDocument, 'mouseup', dragEndHandler);
35954
+ });
35955
+ };
35956
+
35957
+ var blockIeDrop = function (editor) {
35817
35958
  editor.on('drop', function(e) {
35818
35959
  // FF doesn't pass out clientX/clientY for drop since this is for IE we just use null instead
35819
35960
  var realTarget = typeof e.clientX !== 'undefined' ? editor.getDoc().elementFromPoint(e.clientX, e.clientY) : null;
@@ -35822,7 +35963,12 @@ define("tinymce/DragDropOverrides", [
35822
35963
  e.preventDefault();
35823
35964
  }
35824
35965
  });
35825
- }
35966
+ };
35967
+
35968
+ var init = function (editor) {
35969
+ bindFakeDragEvents(editor);
35970
+ blockIeDrop(editor);
35971
+ };
35826
35972
 
35827
35973
  return {
35828
35974
  init: init
@@ -35902,6 +36048,11 @@ define("tinymce/SelectionOverrides", [
35902
36048
  realSelectionId = 'sel-' + editor.dom.uniqueId(),
35903
36049
  selectedContentEditableNode, $ = editor.$;
35904
36050
 
36051
+ function getRealSelectionElement() {
36052
+ var container = editor.dom.get(realSelectionId);
36053
+ return container.getElementsByTagName('*')[0];
36054
+ }
36055
+
35905
36056
  function isBlock(node) {
35906
36057
  return editor.dom.isBlock(node);
35907
36058
  }
@@ -36261,25 +36412,51 @@ define("tinymce/SelectionOverrides", [
36261
36412
  return null;
36262
36413
  }
36263
36414
 
36415
+ function isTextBlock(node) {
36416
+ var textBlocks = editor.schema.getTextBlockElements();
36417
+ return node.nodeName in textBlocks;
36418
+ }
36419
+
36420
+ function isEmpty(elm) {
36421
+ return editor.dom.isEmpty(elm);
36422
+ }
36423
+
36264
36424
  function mergeTextBlocks(direction, fromCaretPosition, toCaretPosition) {
36265
- var dom = editor.dom, fromBlock, toBlock, node, textBlocks;
36425
+ var dom = editor.dom, fromBlock, toBlock, node, ceTarget;
36426
+
36427
+ fromBlock = dom.getParent(fromCaretPosition.getNode(), dom.isBlock);
36428
+ toBlock = dom.getParent(toCaretPosition.getNode(), dom.isBlock);
36266
36429
 
36267
36430
  if (direction === -1) {
36268
- if (isAfterContentEditableFalse(toCaretPosition) && isBlock(toCaretPosition.getNode(true))) {
36431
+ ceTarget = toCaretPosition.getNode(true);
36432
+ if (isAfterContentEditableFalse(toCaretPosition) && isBlock(ceTarget)) {
36433
+ if (isTextBlock(fromBlock)) {
36434
+ if (isEmpty(fromBlock)) {
36435
+ dom.remove(fromBlock);
36436
+ }
36437
+
36438
+ return CaretPosition.after(ceTarget).toRange();
36439
+ }
36440
+
36269
36441
  return deleteContentEditableNode(toCaretPosition.getNode(true));
36270
36442
  }
36271
36443
  } else {
36272
- if (isBeforeContentEditableFalse(fromCaretPosition) && isBlock(fromCaretPosition.getNode())) {
36444
+ ceTarget = fromCaretPosition.getNode();
36445
+ if (isBeforeContentEditableFalse(fromCaretPosition) && isBlock(ceTarget)) {
36446
+ if (isTextBlock(toBlock)) {
36447
+ if (isEmpty(toBlock)) {
36448
+ dom.remove(toBlock);
36449
+ }
36450
+
36451
+ return CaretPosition.before(ceTarget).toRange();
36452
+ }
36453
+
36273
36454
  return deleteContentEditableNode(fromCaretPosition.getNode());
36274
36455
  }
36275
36456
  }
36276
36457
 
36277
- textBlocks = editor.schema.getTextBlockElements();
36278
- fromBlock = dom.getParent(fromCaretPosition.getNode(), dom.isBlock);
36279
- toBlock = dom.getParent(toCaretPosition.getNode(), dom.isBlock);
36280
-
36281
36458
  // Verify that both blocks are text blocks
36282
- if (fromBlock === toBlock || !textBlocks[fromBlock.nodeName] || !textBlocks[toBlock.nodeName]) {
36459
+ if (fromBlock === toBlock || !isTextBlock(fromBlock) || !isTextBlock(toBlock)) {
36283
36460
  return null;
36284
36461
  }
36285
36462
 
@@ -36382,6 +36559,7 @@ define("tinymce/SelectionOverrides", [
36382
36559
  if (contentEditableRoot) {
36383
36560
  if (isContentEditableFalse(contentEditableRoot)) {
36384
36561
  e.preventDefault();
36562
+ editor.focus();
36385
36563
  }
36386
36564
  }
36387
36565
  });
@@ -36604,6 +36782,22 @@ define("tinymce/SelectionOverrides", [
36604
36782
  }, 0);
36605
36783
  });
36606
36784
 
36785
+ editor.on('copy', function (e) {
36786
+ var clipboardData = e.clipboardData;
36787
+
36788
+ // Make sure we get proper html/text for the fake cE=false selection
36789
+ // Doesn't work at all on Edge since it doesn't have proper clipboardData support
36790
+ if (!e.isDefaultPrevented() && e.clipboardData && !Env.ie) {
36791
+ var realSelectionElement = getRealSelectionElement();
36792
+ if (realSelectionElement) {
36793
+ e.preventDefault();
36794
+ clipboardData.clearData();
36795
+ clipboardData.setData('text/html', realSelectionElement.outerHTML);
36796
+ clipboardData.setData('text/plain', realSelectionElement.outerText);
36797
+ }
36798
+ }
36799
+ });
36800
+
36607
36801
  DragDropOverrides.init(editor);
36608
36802
  }
36609
36803
 
@@ -36615,8 +36809,6 @@ define("tinymce/SelectionOverrides", [
36615
36809
  rootClass + ' .mce-offscreen-selection {' +
36616
36810
  'position: absolute;' +
36617
36811
  'left: -9999999999px;' +
36618
- 'width: 100px;' +
36619
- 'height: 100px;' +
36620
36812
  '}' +
36621
36813
  rootClass + ' *[contentEditable=false] {' +
36622
36814
  'cursor: default;' +
@@ -37303,11 +37495,12 @@ define("tinymce/Editor", [
37303
37495
  var self = this, settings = self.settings, elm = self.getElement();
37304
37496
  var w, h, minHeight, n, o, Theme, url, bodyId, bodyClass, re, i, initializedPlugins = [];
37305
37497
 
37306
- this.editorManager.i18n.setCode(settings.language);
37307
- self.rtl = settings.rtl_ui || this.editorManager.i18n.rtl;
37308
-
37498
+ self.rtl = settings.rtl_ui || self.editorManager.i18n.rtl;
37499
+ self.editorManager.i18n.setCode(settings.language);
37309
37500
  settings.aria_label = settings.aria_label || DOM.getAttrib(elm, 'aria-label', self.getLang('aria.rich_text_area'));
37310
37501
 
37502
+ self.fire('ScriptsLoaded');
37503
+
37311
37504
  /**
37312
37505
  * Reference to the theme instance that was used to generate the UI.
37313
37506
  *
@@ -38801,7 +38994,8 @@ define("tinymce/Editor", [
38801
38994
  * @return {Element} The root element of the editable area.
38802
38995
  */
38803
38996
  getBody: function() {
38804
- return this.bodyElement || this.getDoc().body;
38997
+ var doc = this.getDoc();
38998
+ return this.bodyElement || (doc ? doc.body : null);
38805
38999
  },
38806
39000
 
38807
39001
  /**
@@ -39520,7 +39714,7 @@ define("tinymce/EditorManager", [
39520
39714
  * @property minorVersion
39521
39715
  * @type String
39522
39716
  */
39523
- minorVersion: '4.1',
39717
+ minorVersion: '4.2',
39524
39718
 
39525
39719
  /**
39526
39720
  * Release date of TinyMCE build.
@@ -39528,7 +39722,7 @@ define("tinymce/EditorManager", [
39528
39722
  * @property releaseDate
39529
39723
  * @type String
39530
39724
  */
39531
- releaseDate: '2016-07-26',
39725
+ releaseDate: '2016-08-25',
39532
39726
 
39533
39727
  /**
39534
39728
  * Collection of editor instances.
@@ -43570,17 +43764,18 @@ define("tinymce/ui/FormatControls", [
43570
43764
  "tinymce/ui/Widget",
43571
43765
  "tinymce/ui/FloatPanel",
43572
43766
  "tinymce/util/Tools",
43767
+ "tinymce/dom/DOMUtils",
43573
43768
  "tinymce/EditorManager",
43574
43769
  "tinymce/Env"
43575
- ], function(Control, Widget, FloatPanel, Tools, EditorManager, Env) {
43770
+ ], function(Control, Widget, FloatPanel, Tools, DOMUtils, EditorManager, Env) {
43576
43771
  var each = Tools.each;
43577
43772
 
43578
43773
  EditorManager.on('AddEditor', function(e) {
43579
- if (e.editor.rtl) {
43580
- Control.rtl = true;
43581
- }
43774
+ var editor = e.editor;
43582
43775
 
43583
- registerControls(e.editor);
43776
+ setupRtlMode(editor);
43777
+ registerControls(editor);
43778
+ setupContainer(editor);
43584
43779
  });
43585
43780
 
43586
43781
  Control.translate = function(text) {
@@ -43589,6 +43784,20 @@ define("tinymce/ui/FormatControls", [
43589
43784
 
43590
43785
  Widget.tooltips = !Env.iOS;
43591
43786
 
43787
+ function setupContainer(editor) {
43788
+ if (editor.settings.ui_container) {
43789
+ Env.container = DOMUtils.DOM.select(editor.settings.ui_container)[0];
43790
+ }
43791
+ }
43792
+
43793
+ function setupRtlMode(editor) {
43794
+ editor.on('ScriptsLoaded', function () {
43795
+ if (editor.rtl) {
43796
+ Control.rtl = true;
43797
+ }
43798
+ });
43799
+ }
43800
+
43592
43801
  function registerControls(editor) {
43593
43802
  var formatMenu;
43594
43803