tinymce-rails 4.9.8 → 4.9.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 614ac01f6c433f0dbe49a668558b6fb352c55012a0b681761cefd1e14fbe27c7
4
- data.tar.gz: be5da35dabf44055ec9de9830117efe3abb751bb0be8fdf391c9ecfce45be4ae
3
+ metadata.gz: 6fa577ba4bb17221c1c259c4a18147670dcb81722b0202b28c08913a4d872751
4
+ data.tar.gz: 86ec35ae2896adbad31380729974a58e08d953bedb61223dccb2ebf16d81e7d8
5
5
  SHA512:
6
- metadata.gz: 221cb26dbcf98c97d64111815485170c7a479c17b18ecdef45a86d86ae5be91808fcac9f1ab0a9ee8660479e08be2cb6351e7c1547e12fa3d7ca662f1252bb3d
7
- data.tar.gz: b0039c6c13abfb9556126a0452bcee6b30375a95c2d1f492b8c4faa0a48bb6623cd8232be9c1c90a2863731a5f652b87ae01dcd95983cc2075c680fe6e5cce22
6
+ metadata.gz: 25c329bdd1abb59169c61009a187ccb20345f3ec97cf57f0babbf19bde9a1eb9bf4af731be4916c0615e0ff0dcacefec12223198290e9fb54933f76bb03b8dcf
7
+ data.tar.gz: 8ac5274d54ef0df889162f70f8fa62164dd631d5c92744a9ca47a8abb56aa63022acabb785e58747be3284b3296867293d75ad9ce505f32b7c8a66a1aab6432f
@@ -1,4 +1,4 @@
1
- // 4.9.8 (2020-01-28)
1
+ // 4.9.10 (2020-04-23)
2
2
  (function () {
3
3
  (function (domGlobals) {
4
4
  'use strict';
@@ -3721,6 +3721,17 @@
3721
3721
  return r.length > 0;
3722
3722
  });
3723
3723
  };
3724
+ var getAllRaw = function (element) {
3725
+ var css = {};
3726
+ var dom = element.dom();
3727
+ if (isSupported(dom)) {
3728
+ for (var i = 0; i < dom.style.length; i++) {
3729
+ var ruleName = dom.style.item(i);
3730
+ css[ruleName] = dom.style[ruleName];
3731
+ }
3732
+ }
3733
+ return css;
3734
+ };
3724
3735
 
3725
3736
  var Immutable = function () {
3726
3737
  var fields = [];
@@ -6653,12 +6664,14 @@
6653
6664
  var node;
6654
6665
  var container = doc.createElement('div');
6655
6666
  var frag = doc.createDocumentFragment();
6667
+ frag.appendChild(container);
6656
6668
  if (html) {
6657
6669
  container.innerHTML = html;
6658
6670
  }
6659
6671
  while (node = container.firstChild) {
6660
6672
  frag.appendChild(node);
6661
6673
  }
6674
+ frag.removeChild(container);
6662
6675
  return frag;
6663
6676
  };
6664
6677
  var remove = function (node, keepChildren) {
@@ -7790,6 +7803,18 @@
7790
7803
  };
7791
7804
  };
7792
7805
 
7806
+ var __assign = function () {
7807
+ __assign = Object.assign || function __assign(t) {
7808
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
7809
+ s = arguments[i];
7810
+ for (var p in s)
7811
+ if (Object.prototype.hasOwnProperty.call(s, p))
7812
+ t[p] = s[p];
7813
+ }
7814
+ return t;
7815
+ };
7816
+ return __assign.apply(this, arguments);
7817
+ };
7793
7818
  function __rest(s, e) {
7794
7819
  var t = {};
7795
7820
  for (var p in s)
@@ -7802,6 +7827,14 @@
7802
7827
  }
7803
7828
  return t;
7804
7829
  }
7830
+ function __spreadArrays() {
7831
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
7832
+ s += arguments[i].length;
7833
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
7834
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
7835
+ r[k] = a[j];
7836
+ return r;
7837
+ }
7805
7838
 
7806
7839
  var unique = 0;
7807
7840
  var generate = function (prefix) {
@@ -16570,106 +16603,355 @@
16570
16603
  };
16571
16604
  }
16572
16605
 
16573
- var getAbsolutePosition = function (elm) {
16574
- var doc, docElem, win, clientRect;
16575
- clientRect = elm.getBoundingClientRect();
16576
- doc = elm.ownerDocument;
16577
- docElem = doc.documentElement;
16578
- win = doc.defaultView;
16579
- return {
16580
- top: clientRect.top + win.pageYOffset - docElem.clientTop,
16581
- left: clientRect.left + win.pageXOffset - docElem.clientLeft
16582
- };
16606
+ var VK = {
16607
+ BACKSPACE: 8,
16608
+ DELETE: 46,
16609
+ DOWN: 40,
16610
+ ENTER: 13,
16611
+ LEFT: 37,
16612
+ RIGHT: 39,
16613
+ SPACEBAR: 32,
16614
+ TAB: 9,
16615
+ UP: 38,
16616
+ END: 35,
16617
+ HOME: 36,
16618
+ modifierPressed: function (e) {
16619
+ return e.shiftKey || e.ctrlKey || e.altKey || this.metaKeyPressed(e);
16620
+ },
16621
+ metaKeyPressed: function (e) {
16622
+ return Env.mac ? e.metaKey : e.ctrlKey && !e.altKey;
16623
+ }
16583
16624
  };
16584
- var getBodyPosition = function (editor) {
16585
- return editor.inline ? getAbsolutePosition(editor.getBody()) : {
16586
- left: 0,
16587
- top: 0
16625
+
16626
+ var getNodeClientRects = function (node) {
16627
+ var toArrayWithNode = function (clientRects) {
16628
+ return map(clientRects, function (clientRect) {
16629
+ clientRect = clone$1(clientRect);
16630
+ clientRect.node = node;
16631
+ return clientRect;
16632
+ });
16588
16633
  };
16634
+ if (NodeType.isElement(node)) {
16635
+ return toArrayWithNode(node.getClientRects());
16636
+ }
16637
+ if (NodeType.isText(node)) {
16638
+ var rng = node.ownerDocument.createRange();
16639
+ rng.setStart(node, 0);
16640
+ rng.setEnd(node, node.data.length);
16641
+ return toArrayWithNode(rng.getClientRects());
16642
+ }
16589
16643
  };
16590
- var getScrollPosition = function (editor) {
16591
- var body = editor.getBody();
16592
- return editor.inline ? {
16593
- left: body.scrollLeft,
16594
- top: body.scrollTop
16595
- } : {
16596
- left: 0,
16597
- top: 0
16598
- };
16644
+ var getClientRects = function (node) {
16645
+ return foldl(node, function (result, node) {
16646
+ return result.concat(getNodeClientRects(node));
16647
+ }, []);
16599
16648
  };
16600
- var getBodyScroll = function (editor) {
16601
- var body = editor.getBody(), docElm = editor.getDoc().documentElement;
16602
- var inlineScroll = {
16603
- left: body.scrollLeft,
16604
- top: body.scrollTop
16605
- };
16606
- var iframeScroll = {
16607
- left: body.scrollLeft || docElm.scrollLeft,
16608
- top: body.scrollTop || docElm.scrollTop
16609
- };
16610
- return editor.inline ? inlineScroll : iframeScroll;
16649
+
16650
+ var VDirection;
16651
+ (function (VDirection) {
16652
+ VDirection[VDirection['Up'] = -1] = 'Up';
16653
+ VDirection[VDirection['Down'] = 1] = 'Down';
16654
+ }(VDirection || (VDirection = {})));
16655
+ var findUntil = function (direction, root, predicateFn, node) {
16656
+ while (node = findNode(node, direction, isEditableCaretCandidate, root)) {
16657
+ if (predicateFn(node)) {
16658
+ return;
16659
+ }
16660
+ }
16611
16661
  };
16612
- var getMousePosition = function (editor, event) {
16613
- if (event.target.ownerDocument !== editor.getDoc()) {
16614
- var iframePosition = getAbsolutePosition(editor.getContentAreaContainer());
16615
- var scrollPosition = getBodyScroll(editor);
16616
- return {
16617
- left: event.pageX - iframePosition.left + scrollPosition.left,
16618
- top: event.pageY - iframePosition.top + scrollPosition.top
16619
- };
16662
+ var walkUntil = function (direction, isAboveFn, isBeflowFn, root, predicateFn, caretPosition) {
16663
+ var line = 0, node;
16664
+ var result = [];
16665
+ var targetClientRect;
16666
+ var add = function (node) {
16667
+ var i, clientRect, clientRects;
16668
+ clientRects = getClientRects([node]);
16669
+ if (direction === -1) {
16670
+ clientRects = clientRects.reverse();
16671
+ }
16672
+ for (i = 0; i < clientRects.length; i++) {
16673
+ clientRect = clientRects[i];
16674
+ if (isBeflowFn(clientRect, targetClientRect)) {
16675
+ continue;
16676
+ }
16677
+ if (result.length > 0 && isAboveFn(clientRect, ArrUtils.last(result))) {
16678
+ line++;
16679
+ }
16680
+ clientRect.line = line;
16681
+ if (predicateFn(clientRect)) {
16682
+ return true;
16683
+ }
16684
+ result.push(clientRect);
16685
+ }
16686
+ };
16687
+ targetClientRect = ArrUtils.last(caretPosition.getClientRects());
16688
+ if (!targetClientRect) {
16689
+ return result;
16620
16690
  }
16621
- return {
16622
- left: event.pageX,
16623
- top: event.pageY
16691
+ node = caretPosition.getNode();
16692
+ add(node);
16693
+ findUntil(direction, root, add, node);
16694
+ return result;
16695
+ };
16696
+ var aboveLineNumber = function (lineNumber, clientRect) {
16697
+ return clientRect.line > lineNumber;
16698
+ };
16699
+ var isLineNumber = function (lineNumber, clientRect) {
16700
+ return clientRect.line === lineNumber;
16701
+ };
16702
+ var upUntil = curry(walkUntil, VDirection.Up, isAbove, isBelow);
16703
+ var downUntil = curry(walkUntil, VDirection.Down, isBelow, isAbove);
16704
+ var positionsUntil = function (direction, root, predicateFn, node) {
16705
+ var caretWalker = CaretWalker(root);
16706
+ var walkFn, isBelowFn, isAboveFn, caretPosition;
16707
+ var result = [];
16708
+ var line = 0, clientRect, targetClientRect;
16709
+ var getClientRect = function (caretPosition) {
16710
+ if (direction === 1) {
16711
+ return ArrUtils.last(caretPosition.getClientRects());
16712
+ }
16713
+ return ArrUtils.last(caretPosition.getClientRects());
16624
16714
  };
16715
+ if (direction === 1) {
16716
+ walkFn = caretWalker.next;
16717
+ isBelowFn = isBelow;
16718
+ isAboveFn = isAbove;
16719
+ caretPosition = CaretPosition$1.after(node);
16720
+ } else {
16721
+ walkFn = caretWalker.prev;
16722
+ isBelowFn = isAbove;
16723
+ isAboveFn = isBelow;
16724
+ caretPosition = CaretPosition$1.before(node);
16725
+ }
16726
+ targetClientRect = getClientRect(caretPosition);
16727
+ do {
16728
+ if (!caretPosition.isVisible()) {
16729
+ continue;
16730
+ }
16731
+ clientRect = getClientRect(caretPosition);
16732
+ if (isAboveFn(clientRect, targetClientRect)) {
16733
+ continue;
16734
+ }
16735
+ if (result.length > 0 && isBelowFn(clientRect, ArrUtils.last(result))) {
16736
+ line++;
16737
+ }
16738
+ clientRect = clone$1(clientRect);
16739
+ clientRect.position = caretPosition;
16740
+ clientRect.line = line;
16741
+ if (predicateFn(clientRect)) {
16742
+ return result;
16743
+ }
16744
+ result.push(clientRect);
16745
+ } while (caretPosition = walkFn(caretPosition));
16746
+ return result;
16625
16747
  };
16626
- var calculatePosition = function (bodyPosition, scrollPosition, mousePosition) {
16627
- return {
16628
- pageX: mousePosition.left - bodyPosition.left + scrollPosition.left,
16629
- pageY: mousePosition.top - bodyPosition.top + scrollPosition.top
16748
+ var isAboveLine = function (lineNumber) {
16749
+ return function (clientRect) {
16750
+ return aboveLineNumber(lineNumber, clientRect);
16630
16751
  };
16631
16752
  };
16632
- var calc = function (editor, event) {
16633
- return calculatePosition(getBodyPosition(editor), getScrollPosition(editor), getMousePosition(editor, event));
16753
+ var isLine = function (lineNumber) {
16754
+ return function (clientRect) {
16755
+ return isLineNumber(lineNumber, clientRect);
16756
+ };
16634
16757
  };
16635
- var MousePosition = { calc: calc };
16636
16758
 
16637
- var isContentEditableFalse$7 = NodeType.isContentEditableFalse, isContentEditableTrue$3 = NodeType.isContentEditableTrue;
16638
- var isDraggable = function (rootElm, elm) {
16639
- return isContentEditableFalse$7(elm) && elm !== rootElm;
16759
+ var isContentEditableFalse$7 = NodeType.isContentEditableFalse;
16760
+ var findNode$1 = findNode;
16761
+ var distanceToRectLeft = function (clientRect, clientX) {
16762
+ return Math.abs(clientRect.left - clientX);
16640
16763
  };
16641
- var isValidDropTarget = function (editor, targetElement, dragElement) {
16642
- if (targetElement === dragElement || editor.dom.isChildOf(targetElement, dragElement)) {
16643
- return false;
16644
- }
16645
- if (isContentEditableFalse$7(targetElement)) {
16646
- return false;
16647
- }
16648
- return true;
16764
+ var distanceToRectRight = function (clientRect, clientX) {
16765
+ return Math.abs(clientRect.right - clientX);
16649
16766
  };
16650
- var cloneElement = function (elm) {
16651
- var cloneElm = elm.cloneNode(true);
16652
- cloneElm.removeAttribute('data-mce-selected');
16653
- return cloneElm;
16767
+ var isInside = function (clientX, clientRect) {
16768
+ return clientX >= clientRect.left && clientX <= clientRect.right;
16654
16769
  };
16655
- var createGhost = function (editor, elm, width, height) {
16656
- var clonedElm = elm.cloneNode(true);
16657
- editor.dom.setStyles(clonedElm, {
16658
- width: width,
16659
- height: height
16660
- });
16661
- editor.dom.setAttrib(clonedElm, 'data-mce-selected', null);
16662
- var ghostElm = editor.dom.create('div', {
16663
- 'class': 'mce-drag-container',
16664
- 'data-mce-bogus': 'all',
16665
- 'unselectable': 'on',
16666
- 'contenteditable': 'false'
16770
+ var findClosestClientRect = function (clientRects, clientX) {
16771
+ return ArrUtils.reduce(clientRects, function (oldClientRect, clientRect) {
16772
+ var oldDistance, newDistance;
16773
+ oldDistance = Math.min(distanceToRectLeft(oldClientRect, clientX), distanceToRectRight(oldClientRect, clientX));
16774
+ newDistance = Math.min(distanceToRectLeft(clientRect, clientX), distanceToRectRight(clientRect, clientX));
16775
+ if (isInside(clientX, clientRect)) {
16776
+ return clientRect;
16777
+ }
16778
+ if (isInside(clientX, oldClientRect)) {
16779
+ return oldClientRect;
16780
+ }
16781
+ if (newDistance === oldDistance && isContentEditableFalse$7(clientRect.node)) {
16782
+ return clientRect;
16783
+ }
16784
+ if (newDistance < oldDistance) {
16785
+ return clientRect;
16786
+ }
16787
+ return oldClientRect;
16667
16788
  });
16668
- editor.dom.setStyles(ghostElm, {
16669
- position: 'absolute',
16670
- opacity: 0.5,
16671
- overflow: 'hidden',
16672
- border: 0,
16789
+ };
16790
+ var walkUntil$1 = function (direction, root, predicateFn, node) {
16791
+ while (node = findNode$1(node, direction, isEditableCaretCandidate, root)) {
16792
+ if (predicateFn(node)) {
16793
+ return;
16794
+ }
16795
+ }
16796
+ };
16797
+ var findLineNodeRects = function (root, targetNodeRect) {
16798
+ var clientRects = [];
16799
+ var collect = function (checkPosFn, node) {
16800
+ var lineRects;
16801
+ lineRects = filter(getClientRects([node]), function (clientRect) {
16802
+ return !checkPosFn(clientRect, targetNodeRect);
16803
+ });
16804
+ clientRects = clientRects.concat(lineRects);
16805
+ return lineRects.length === 0;
16806
+ };
16807
+ clientRects.push(targetNodeRect);
16808
+ walkUntil$1(VDirection.Up, root, curry(collect, isAbove), targetNodeRect.node);
16809
+ walkUntil$1(VDirection.Down, root, curry(collect, isBelow), targetNodeRect.node);
16810
+ return clientRects;
16811
+ };
16812
+ var getFakeCaretTargets = function (root) {
16813
+ return filter(from$1(root.getElementsByTagName('*')), isFakeCaretTarget);
16814
+ };
16815
+ var caretInfo = function (clientRect, clientX) {
16816
+ return {
16817
+ node: clientRect.node,
16818
+ before: distanceToRectLeft(clientRect, clientX) < distanceToRectRight(clientRect, clientX)
16819
+ };
16820
+ };
16821
+ var closestCaret = function (root, clientX, clientY) {
16822
+ var closestNodeRect;
16823
+ var contentEditableFalseNodeRects = getClientRects(getFakeCaretTargets(root));
16824
+ var targetNodeRects = filter(contentEditableFalseNodeRects, function (rect) {
16825
+ return clientY >= rect.top && clientY <= rect.bottom;
16826
+ });
16827
+ closestNodeRect = findClosestClientRect(targetNodeRects, clientX);
16828
+ if (closestNodeRect) {
16829
+ closestNodeRect = findClosestClientRect(findLineNodeRects(root, closestNodeRect), clientX);
16830
+ if (closestNodeRect && isFakeCaretTarget(closestNodeRect.node)) {
16831
+ return caretInfo(closestNodeRect, clientX);
16832
+ }
16833
+ }
16834
+ return null;
16835
+ };
16836
+
16837
+ var isXYWithinRange = function (clientX, clientY, range) {
16838
+ if (range.collapsed) {
16839
+ return false;
16840
+ }
16841
+ if (Env.ie && Env.ie <= 11 && range.startOffset === range.endOffset - 1 && range.startContainer === range.endContainer) {
16842
+ var elm = range.startContainer.childNodes[range.startOffset];
16843
+ if (NodeType.isElement(elm)) {
16844
+ return exists(elm.getClientRects(), function (rect) {
16845
+ return containsXY(rect, clientX, clientY);
16846
+ });
16847
+ }
16848
+ }
16849
+ return exists(range.getClientRects(), function (rect) {
16850
+ return containsXY(rect, clientX, clientY);
16851
+ });
16852
+ };
16853
+ var RangePoint = { isXYWithinRange: isXYWithinRange };
16854
+
16855
+ var getAbsolutePosition = function (elm) {
16856
+ var doc, docElem, win, clientRect;
16857
+ clientRect = elm.getBoundingClientRect();
16858
+ doc = elm.ownerDocument;
16859
+ docElem = doc.documentElement;
16860
+ win = doc.defaultView;
16861
+ return {
16862
+ top: clientRect.top + win.pageYOffset - docElem.clientTop,
16863
+ left: clientRect.left + win.pageXOffset - docElem.clientLeft
16864
+ };
16865
+ };
16866
+ var getBodyPosition = function (editor) {
16867
+ return editor.inline ? getAbsolutePosition(editor.getBody()) : {
16868
+ left: 0,
16869
+ top: 0
16870
+ };
16871
+ };
16872
+ var getScrollPosition = function (editor) {
16873
+ var body = editor.getBody();
16874
+ return editor.inline ? {
16875
+ left: body.scrollLeft,
16876
+ top: body.scrollTop
16877
+ } : {
16878
+ left: 0,
16879
+ top: 0
16880
+ };
16881
+ };
16882
+ var getBodyScroll = function (editor) {
16883
+ var body = editor.getBody(), docElm = editor.getDoc().documentElement;
16884
+ var inlineScroll = {
16885
+ left: body.scrollLeft,
16886
+ top: body.scrollTop
16887
+ };
16888
+ var iframeScroll = {
16889
+ left: body.scrollLeft || docElm.scrollLeft,
16890
+ top: body.scrollTop || docElm.scrollTop
16891
+ };
16892
+ return editor.inline ? inlineScroll : iframeScroll;
16893
+ };
16894
+ var getMousePosition = function (editor, event) {
16895
+ if (event.target.ownerDocument !== editor.getDoc()) {
16896
+ var iframePosition = getAbsolutePosition(editor.getContentAreaContainer());
16897
+ var scrollPosition = getBodyScroll(editor);
16898
+ return {
16899
+ left: event.pageX - iframePosition.left + scrollPosition.left,
16900
+ top: event.pageY - iframePosition.top + scrollPosition.top
16901
+ };
16902
+ }
16903
+ return {
16904
+ left: event.pageX,
16905
+ top: event.pageY
16906
+ };
16907
+ };
16908
+ var calculatePosition = function (bodyPosition, scrollPosition, mousePosition) {
16909
+ return {
16910
+ pageX: mousePosition.left - bodyPosition.left + scrollPosition.left,
16911
+ pageY: mousePosition.top - bodyPosition.top + scrollPosition.top
16912
+ };
16913
+ };
16914
+ var calc = function (editor, event) {
16915
+ return calculatePosition(getBodyPosition(editor), getScrollPosition(editor), getMousePosition(editor, event));
16916
+ };
16917
+ var MousePosition = { calc: calc };
16918
+
16919
+ var isContentEditableFalse$8 = NodeType.isContentEditableFalse, isContentEditableTrue$3 = NodeType.isContentEditableTrue;
16920
+ var isDraggable = function (rootElm, elm) {
16921
+ return isContentEditableFalse$8(elm) && elm !== rootElm;
16922
+ };
16923
+ var isValidDropTarget = function (editor, targetElement, dragElement) {
16924
+ if (targetElement === dragElement || editor.dom.isChildOf(targetElement, dragElement)) {
16925
+ return false;
16926
+ }
16927
+ if (isContentEditableFalse$8(targetElement)) {
16928
+ return false;
16929
+ }
16930
+ return true;
16931
+ };
16932
+ var cloneElement = function (elm) {
16933
+ var cloneElm = elm.cloneNode(true);
16934
+ cloneElm.removeAttribute('data-mce-selected');
16935
+ return cloneElm;
16936
+ };
16937
+ var createGhost = function (editor, elm, width, height) {
16938
+ var clonedElm = elm.cloneNode(true);
16939
+ editor.dom.setStyles(clonedElm, {
16940
+ width: width,
16941
+ height: height
16942
+ });
16943
+ editor.dom.setAttrib(clonedElm, 'data-mce-selected', null);
16944
+ var ghostElm = editor.dom.create('div', {
16945
+ 'class': 'mce-drag-container',
16946
+ 'data-mce-bogus': 'all',
16947
+ 'unselectable': 'on',
16948
+ 'contenteditable': 'false'
16949
+ });
16950
+ editor.dom.setStyles(ghostElm, {
16951
+ position: 'absolute',
16952
+ opacity: 0.5,
16953
+ overflow: 'hidden',
16954
+ border: 0,
16673
16955
  padding: 0,
16674
16956
  margin: 0,
16675
16957
  width: width,
@@ -16720,7 +17002,7 @@
16720
17002
  var start$1 = function (state, editor) {
16721
17003
  return function (e) {
16722
17004
  if (isLeftMouseButtonPressed(e)) {
16723
- var ceElm = find(editor.dom.getParents(e.target), Predicate.or(isContentEditableFalse$7, isContentEditableTrue$3)).getOr(null);
17005
+ var ceElm = find(editor.dom.getParents(e.target), Predicate.or(isContentEditableFalse$8, isContentEditableTrue$3)).getOr(null);
16724
17006
  if (isDraggable(editor.getBody(), ceElm)) {
16725
17007
  var elmPos = editor.dom.getPos(ceElm);
16726
17008
  var bodyElm = editor.getBody();
@@ -16825,7 +17107,7 @@
16825
17107
  var blockIeDrop = function (editor) {
16826
17108
  editor.on('drop', function (e) {
16827
17109
  var realTarget = typeof e.clientX !== 'undefined' ? editor.getDoc().elementFromPoint(e.clientX, e.clientY) : null;
16828
- if (isContentEditableFalse$7(realTarget) || isContentEditableFalse$7(editor.dom.getContentEditableParent(realTarget))) {
17110
+ if (isContentEditableFalse$8(realTarget) || isContentEditableFalse$8(editor.dom.getContentEditableParent(realTarget))) {
16829
17111
  e.preventDefault();
16830
17112
  }
16831
17113
  });
@@ -16836,235 +17118,6 @@
16836
17118
  };
16837
17119
  var DragDropOverrides = { init: init };
16838
17120
 
16839
- var getNodeClientRects = function (node) {
16840
- var toArrayWithNode = function (clientRects) {
16841
- return map(clientRects, function (clientRect) {
16842
- clientRect = clone$1(clientRect);
16843
- clientRect.node = node;
16844
- return clientRect;
16845
- });
16846
- };
16847
- if (NodeType.isElement(node)) {
16848
- return toArrayWithNode(node.getClientRects());
16849
- }
16850
- if (NodeType.isText(node)) {
16851
- var rng = node.ownerDocument.createRange();
16852
- rng.setStart(node, 0);
16853
- rng.setEnd(node, node.data.length);
16854
- return toArrayWithNode(rng.getClientRects());
16855
- }
16856
- };
16857
- var getClientRects = function (node) {
16858
- return foldl(node, function (result, node) {
16859
- return result.concat(getNodeClientRects(node));
16860
- }, []);
16861
- };
16862
-
16863
- var VDirection;
16864
- (function (VDirection) {
16865
- VDirection[VDirection['Up'] = -1] = 'Up';
16866
- VDirection[VDirection['Down'] = 1] = 'Down';
16867
- }(VDirection || (VDirection = {})));
16868
- var findUntil = function (direction, root, predicateFn, node) {
16869
- while (node = findNode(node, direction, isEditableCaretCandidate, root)) {
16870
- if (predicateFn(node)) {
16871
- return;
16872
- }
16873
- }
16874
- };
16875
- var walkUntil = function (direction, isAboveFn, isBeflowFn, root, predicateFn, caretPosition) {
16876
- var line = 0, node;
16877
- var result = [];
16878
- var targetClientRect;
16879
- var add = function (node) {
16880
- var i, clientRect, clientRects;
16881
- clientRects = getClientRects([node]);
16882
- if (direction === -1) {
16883
- clientRects = clientRects.reverse();
16884
- }
16885
- for (i = 0; i < clientRects.length; i++) {
16886
- clientRect = clientRects[i];
16887
- if (isBeflowFn(clientRect, targetClientRect)) {
16888
- continue;
16889
- }
16890
- if (result.length > 0 && isAboveFn(clientRect, ArrUtils.last(result))) {
16891
- line++;
16892
- }
16893
- clientRect.line = line;
16894
- if (predicateFn(clientRect)) {
16895
- return true;
16896
- }
16897
- result.push(clientRect);
16898
- }
16899
- };
16900
- targetClientRect = ArrUtils.last(caretPosition.getClientRects());
16901
- if (!targetClientRect) {
16902
- return result;
16903
- }
16904
- node = caretPosition.getNode();
16905
- add(node);
16906
- findUntil(direction, root, add, node);
16907
- return result;
16908
- };
16909
- var aboveLineNumber = function (lineNumber, clientRect) {
16910
- return clientRect.line > lineNumber;
16911
- };
16912
- var isLineNumber = function (lineNumber, clientRect) {
16913
- return clientRect.line === lineNumber;
16914
- };
16915
- var upUntil = curry(walkUntil, VDirection.Up, isAbove, isBelow);
16916
- var downUntil = curry(walkUntil, VDirection.Down, isBelow, isAbove);
16917
- var positionsUntil = function (direction, root, predicateFn, node) {
16918
- var caretWalker = CaretWalker(root);
16919
- var walkFn, isBelowFn, isAboveFn, caretPosition;
16920
- var result = [];
16921
- var line = 0, clientRect, targetClientRect;
16922
- var getClientRect = function (caretPosition) {
16923
- if (direction === 1) {
16924
- return ArrUtils.last(caretPosition.getClientRects());
16925
- }
16926
- return ArrUtils.last(caretPosition.getClientRects());
16927
- };
16928
- if (direction === 1) {
16929
- walkFn = caretWalker.next;
16930
- isBelowFn = isBelow;
16931
- isAboveFn = isAbove;
16932
- caretPosition = CaretPosition$1.after(node);
16933
- } else {
16934
- walkFn = caretWalker.prev;
16935
- isBelowFn = isAbove;
16936
- isAboveFn = isBelow;
16937
- caretPosition = CaretPosition$1.before(node);
16938
- }
16939
- targetClientRect = getClientRect(caretPosition);
16940
- do {
16941
- if (!caretPosition.isVisible()) {
16942
- continue;
16943
- }
16944
- clientRect = getClientRect(caretPosition);
16945
- if (isAboveFn(clientRect, targetClientRect)) {
16946
- continue;
16947
- }
16948
- if (result.length > 0 && isBelowFn(clientRect, ArrUtils.last(result))) {
16949
- line++;
16950
- }
16951
- clientRect = clone$1(clientRect);
16952
- clientRect.position = caretPosition;
16953
- clientRect.line = line;
16954
- if (predicateFn(clientRect)) {
16955
- return result;
16956
- }
16957
- result.push(clientRect);
16958
- } while (caretPosition = walkFn(caretPosition));
16959
- return result;
16960
- };
16961
- var isAboveLine = function (lineNumber) {
16962
- return function (clientRect) {
16963
- return aboveLineNumber(lineNumber, clientRect);
16964
- };
16965
- };
16966
- var isLine = function (lineNumber) {
16967
- return function (clientRect) {
16968
- return isLineNumber(lineNumber, clientRect);
16969
- };
16970
- };
16971
-
16972
- var isContentEditableFalse$8 = NodeType.isContentEditableFalse;
16973
- var findNode$1 = findNode;
16974
- var distanceToRectLeft = function (clientRect, clientX) {
16975
- return Math.abs(clientRect.left - clientX);
16976
- };
16977
- var distanceToRectRight = function (clientRect, clientX) {
16978
- return Math.abs(clientRect.right - clientX);
16979
- };
16980
- var isInside = function (clientX, clientRect) {
16981
- return clientX >= clientRect.left && clientX <= clientRect.right;
16982
- };
16983
- var findClosestClientRect = function (clientRects, clientX) {
16984
- return ArrUtils.reduce(clientRects, function (oldClientRect, clientRect) {
16985
- var oldDistance, newDistance;
16986
- oldDistance = Math.min(distanceToRectLeft(oldClientRect, clientX), distanceToRectRight(oldClientRect, clientX));
16987
- newDistance = Math.min(distanceToRectLeft(clientRect, clientX), distanceToRectRight(clientRect, clientX));
16988
- if (isInside(clientX, clientRect)) {
16989
- return clientRect;
16990
- }
16991
- if (isInside(clientX, oldClientRect)) {
16992
- return oldClientRect;
16993
- }
16994
- if (newDistance === oldDistance && isContentEditableFalse$8(clientRect.node)) {
16995
- return clientRect;
16996
- }
16997
- if (newDistance < oldDistance) {
16998
- return clientRect;
16999
- }
17000
- return oldClientRect;
17001
- });
17002
- };
17003
- var walkUntil$1 = function (direction, root, predicateFn, node) {
17004
- while (node = findNode$1(node, direction, isEditableCaretCandidate, root)) {
17005
- if (predicateFn(node)) {
17006
- return;
17007
- }
17008
- }
17009
- };
17010
- var findLineNodeRects = function (root, targetNodeRect) {
17011
- var clientRects = [];
17012
- var collect = function (checkPosFn, node) {
17013
- var lineRects;
17014
- lineRects = filter(getClientRects([node]), function (clientRect) {
17015
- return !checkPosFn(clientRect, targetNodeRect);
17016
- });
17017
- clientRects = clientRects.concat(lineRects);
17018
- return lineRects.length === 0;
17019
- };
17020
- clientRects.push(targetNodeRect);
17021
- walkUntil$1(VDirection.Up, root, curry(collect, isAbove), targetNodeRect.node);
17022
- walkUntil$1(VDirection.Down, root, curry(collect, isBelow), targetNodeRect.node);
17023
- return clientRects;
17024
- };
17025
- var getFakeCaretTargets = function (root) {
17026
- return filter(from$1(root.getElementsByTagName('*')), isFakeCaretTarget);
17027
- };
17028
- var caretInfo = function (clientRect, clientX) {
17029
- return {
17030
- node: clientRect.node,
17031
- before: distanceToRectLeft(clientRect, clientX) < distanceToRectRight(clientRect, clientX)
17032
- };
17033
- };
17034
- var closestCaret = function (root, clientX, clientY) {
17035
- var closestNodeRect;
17036
- var contentEditableFalseNodeRects = getClientRects(getFakeCaretTargets(root));
17037
- var targetNodeRects = filter(contentEditableFalseNodeRects, function (rect) {
17038
- return clientY >= rect.top && clientY <= rect.bottom;
17039
- });
17040
- closestNodeRect = findClosestClientRect(targetNodeRects, clientX);
17041
- if (closestNodeRect) {
17042
- closestNodeRect = findClosestClientRect(findLineNodeRects(root, closestNodeRect), clientX);
17043
- if (closestNodeRect && isFakeCaretTarget(closestNodeRect.node)) {
17044
- return caretInfo(closestNodeRect, clientX);
17045
- }
17046
- }
17047
- return null;
17048
- };
17049
-
17050
- var isXYWithinRange = function (clientX, clientY, range) {
17051
- if (range.collapsed) {
17052
- return false;
17053
- }
17054
- if (Env.ie && Env.ie <= 11 && range.startOffset === range.endOffset - 1 && range.startContainer === range.endContainer) {
17055
- var elm = range.startContainer.childNodes[range.startOffset];
17056
- if (NodeType.isElement(elm)) {
17057
- return exists(elm.getClientRects(), function (rect) {
17058
- return containsXY(rect, clientX, clientY);
17059
- });
17060
- }
17061
- }
17062
- return exists(range.getClientRects(), function (rect) {
17063
- return containsXY(rect, clientX, clientY);
17064
- });
17065
- };
17066
- var RangePoint = { isXYWithinRange: isXYWithinRange };
17067
-
17068
17121
  var setup$4 = function (editor) {
17069
17122
  var renderFocusCaret = first(function () {
17070
17123
  if (!editor.removed) {
@@ -17084,26 +17137,6 @@
17084
17137
  };
17085
17138
  var CefFocus = { setup: setup$4 };
17086
17139
 
17087
- var VK = {
17088
- BACKSPACE: 8,
17089
- DELETE: 46,
17090
- DOWN: 40,
17091
- ENTER: 13,
17092
- LEFT: 37,
17093
- RIGHT: 39,
17094
- SPACEBAR: 32,
17095
- TAB: 9,
17096
- UP: 38,
17097
- END: 35,
17098
- HOME: 36,
17099
- modifierPressed: function (e) {
17100
- return e.shiftKey || e.ctrlKey || e.altKey || this.metaKeyPressed(e);
17101
- },
17102
- metaKeyPressed: function (e) {
17103
- return Env.mac ? e.metaKey : e.ctrlKey && !e.altKey;
17104
- }
17105
- };
17106
-
17107
17140
  var isContentEditableTrue$4 = NodeType.isContentEditableTrue;
17108
17141
  var isContentEditableFalse$9 = NodeType.isContentEditableFalse;
17109
17142
  var getContentEditableRoot$1 = function (editor, node) {
@@ -17302,8 +17335,8 @@
17302
17335
  }
17303
17336
  });
17304
17337
  editor.on('setSelectionRange', function (e) {
17305
- var rng;
17306
- rng = setContentEditableSelection(e.range, e.forward);
17338
+ e.range = normalizeShortEndedElementSelection(e.range);
17339
+ var rng = setContentEditableSelection(e.range, e.forward);
17307
17340
  if (rng) {
17308
17341
  e.range = rng;
17309
17342
  }
@@ -17346,6 +17379,33 @@
17346
17379
  var isRangeInCaretContainer = function (rng) {
17347
17380
  return isWithinCaretContainer(rng.startContainer) || isWithinCaretContainer(rng.endContainer);
17348
17381
  };
17382
+ var normalizeShortEndedElementSelection = function (rng) {
17383
+ var shortEndedElements = editor.schema.getShortEndedElements();
17384
+ var newRng = editor.dom.createRng();
17385
+ var startContainer = rng.startContainer;
17386
+ var startOffset = rng.startOffset;
17387
+ var endContainer = rng.endContainer;
17388
+ var endOffset = rng.endOffset;
17389
+ if (has(shortEndedElements, startContainer.nodeName.toLowerCase())) {
17390
+ if (startOffset === 0) {
17391
+ newRng.setStartBefore(startContainer);
17392
+ } else {
17393
+ newRng.setStartAfter(startContainer);
17394
+ }
17395
+ } else {
17396
+ newRng.setStart(startContainer, startOffset);
17397
+ }
17398
+ if (has(shortEndedElements, endContainer.nodeName.toLowerCase())) {
17399
+ if (endOffset === 0) {
17400
+ newRng.setEndBefore(endContainer);
17401
+ } else {
17402
+ newRng.setEndAfter(endContainer);
17403
+ }
17404
+ } else {
17405
+ newRng.setEnd(endContainer, endOffset);
17406
+ }
17407
+ return newRng;
17408
+ };
17349
17409
  var setContentEditableSelection = function (range, forward) {
17350
17410
  var node;
17351
17411
  var $ = editor.$;
@@ -17466,7 +17526,11 @@
17466
17526
  return name.indexOf('data-') === 0 || name.indexOf('aria-') === 0;
17467
17527
  };
17468
17528
  var trimComments = function (text) {
17469
- return text.replace(/<!--|--!?>/g, '');
17529
+ var sanitizedText = text;
17530
+ while (/<!--|--!?>/g.test(sanitizedText)) {
17531
+ sanitizedText = sanitizedText.replace(/<!--|--!?>/g, '');
17532
+ }
17533
+ return sanitizedText;
17470
17534
  };
17471
17535
  var isInvalidUri = function (settings, uri) {
17472
17536
  if (settings.allow_html_data_urls) {
@@ -23352,10 +23416,41 @@
23352
23416
  }
23353
23417
  return parent !== root ? editableRoot : root;
23354
23418
  };
23419
+ var applyAttributes = function (editor, node, forcedRootBlockAttrs) {
23420
+ Option.from(forcedRootBlockAttrs.style).map(editor.dom.parseStyle).each(function (attrStyles) {
23421
+ var currentStyles = getAllRaw(Element.fromDom(node));
23422
+ var newStyles = __assign(__assign({}, currentStyles), attrStyles);
23423
+ editor.dom.setStyles(node, newStyles);
23424
+ });
23425
+ var attrClassesOpt = Option.from(forcedRootBlockAttrs.class).map(function (attrClasses) {
23426
+ return attrClasses.split(/\s+/);
23427
+ });
23428
+ var currentClassesOpt = Option.from(node.className).map(function (currentClasses) {
23429
+ return filter(currentClasses.split(/\s+/), function (clazz) {
23430
+ return clazz !== '';
23431
+ });
23432
+ });
23433
+ lift2(attrClassesOpt, currentClassesOpt, function (attrClasses, currentClasses) {
23434
+ var filteredClasses = filter(currentClasses, function (clazz) {
23435
+ return !contains(attrClasses, clazz);
23436
+ });
23437
+ var newClasses = __spreadArrays(attrClasses, filteredClasses);
23438
+ editor.dom.setAttrib(node, 'class', newClasses.join(' '));
23439
+ });
23440
+ var appliedAttrs = [
23441
+ 'style',
23442
+ 'class'
23443
+ ];
23444
+ var remainingAttrs = bifilter(forcedRootBlockAttrs, function (_, attrs) {
23445
+ return !contains(appliedAttrs, attrs);
23446
+ }).t;
23447
+ editor.dom.setAttribs(node, remainingAttrs);
23448
+ };
23355
23449
  var setForcedBlockAttrs = function (editor, node) {
23356
23450
  var forcedRootBlockName = Settings.getForcedRootBlock(editor);
23357
23451
  if (forcedRootBlockName && forcedRootBlockName.toLowerCase() === node.tagName.toLowerCase()) {
23358
- editor.dom.setAttribs(node, Settings.getForcedRootBlockAttrs(editor));
23452
+ var forcedRootBlockAttrs = Settings.getForcedRootBlockAttrs(editor);
23453
+ applyAttributes(editor, node, forcedRootBlockAttrs);
23359
23454
  }
23360
23455
  };
23361
23456
  var wrapSelfAndSiblingsInDefaultBlock = function (editor, newBlockName, rng, container, offset) {
@@ -23421,7 +23516,6 @@
23421
23516
  var textInlineElements = schema.getTextInlineElements();
23422
23517
  if (name || parentBlockName === 'TABLE' || parentBlockName === 'HR') {
23423
23518
  block = dom.create(name || newBlockName);
23424
- setForcedBlockAttrs(editor, block);
23425
23519
  } else {
23426
23520
  block = parentBlock.cloneNode(false);
23427
23521
  }
@@ -23447,6 +23541,7 @@
23447
23541
  }
23448
23542
  } while ((node = node.parentNode) && node !== editableRoot);
23449
23543
  }
23544
+ setForcedBlockAttrs(editor, block);
23450
23545
  emptyBlock(caretNode);
23451
23546
  return block;
23452
23547
  };
@@ -23553,6 +23648,7 @@
23553
23648
  if (dom.isEmpty(parentBlock)) {
23554
23649
  emptyBlock(parentBlock);
23555
23650
  }
23651
+ setForcedBlockAttrs(editor, newBlock);
23556
23652
  NewLineUtils.moveToCaretPosition(editor, newBlock);
23557
23653
  } else if (isCaretAtStartOrEndOfBlock()) {
23558
23654
  insertNewBlockAfter();
@@ -23577,6 +23673,7 @@
23577
23673
  dom.remove(newBlock);
23578
23674
  insertNewBlockAfter();
23579
23675
  } else {
23676
+ setForcedBlockAttrs(editor, newBlock);
23580
23677
  NewLineUtils.moveToCaretPosition(editor, newBlock);
23581
23678
  }
23582
23679
  }
@@ -26267,15 +26364,15 @@
26267
26364
  defaultSettings: {},
26268
26365
  $: DomQuery,
26269
26366
  majorVersion: '4',
26270
- minorVersion: '9.8',
26271
- releaseDate: '2020-01-28',
26367
+ minorVersion: '9.10',
26368
+ releaseDate: '2020-04-23',
26272
26369
  editors: legacyEditors,
26273
26370
  i18n: I18n,
26274
26371
  activeEditor: null,
26275
26372
  settings: {},
26276
26373
  setup: function () {
26277
26374
  var self = this;
26278
- var baseURL, documentBaseURL, suffix = '', preInit, src;
26375
+ var baseURL, documentBaseURL, suffix = '';
26279
26376
  documentBaseURL = URI.getDocumentBaseUrl(domGlobals.document.location);
26280
26377
  if (/^[^:]+:\/\/\/?[^\/]+\//.test(documentBaseURL)) {
26281
26378
  documentBaseURL = documentBaseURL.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, '');
@@ -26283,14 +26380,17 @@
26283
26380
  documentBaseURL += '/';
26284
26381
  }
26285
26382
  }
26286
- preInit = window.tinymce || window.tinyMCEPreInit;
26383
+ var preInit = window.tinymce || window.tinyMCEPreInit;
26287
26384
  if (preInit) {
26288
26385
  baseURL = preInit.base || preInit.baseURL;
26289
26386
  suffix = preInit.suffix;
26290
26387
  } else {
26291
26388
  var scripts = domGlobals.document.getElementsByTagName('script');
26292
26389
  for (var i = 0; i < scripts.length; i++) {
26293
- src = scripts[i].src;
26390
+ var src = scripts[i].src || '';
26391
+ if (src === '') {
26392
+ continue;
26393
+ }
26294
26394
  var srcScript = src.substring(src.lastIndexOf('/'));
26295
26395
  if (/tinymce(\.full|\.jquery|)(\.min|\.dev|)\.js/.test(src)) {
26296
26396
  if (srcScript.indexOf('.min') !== -1) {
@@ -26301,7 +26401,7 @@
26301
26401
  }
26302
26402
  }
26303
26403
  if (!baseURL && domGlobals.document.currentScript) {
26304
- src = domGlobals.document.currentScript.src;
26404
+ var src = domGlobals.document.currentScript.src;
26305
26405
  if (src.indexOf('.min') !== -1) {
26306
26406
  suffix = '.min';
26307
26407
  }