tinymce-rails 4.9.8 → 4.9.11
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 +4 -4
- data/app/assets/source/tinymce/tinymce.js +611 -494
- data/lib/tinymce/rails/version.rb +2 -2
- data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/skins/lightgray/content.inline.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/lightgray/content.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/tinymce.js +2 -2
- metadata +3 -3
@@ -1,4 +1,4 @@
|
|
1
|
-
// 4.9.
|
1
|
+
// 4.9.11 (2020-07-13)
|
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 = [];
|
@@ -5646,7 +5657,7 @@
|
|
5646
5657
|
textBlockElementsMap = createLookupTable('text_block_elements', 'h1 h2 h3 h4 h5 h6 p div address pre form ' + 'blockquote center dir fieldset header footer article section hgroup aside main nav figure');
|
5647
5658
|
blockElementsMap = createLookupTable('block_elements', 'hr table tbody thead tfoot ' + 'th tr td li ol ul caption dl dt dd noscript menu isindex option ' + 'datalist select optgroup figcaption details summary', textBlockElementsMap);
|
5648
5659
|
textInlineElementsMap = createLookupTable('text_inline_elements', 'span strong b em i font strike u var cite ' + 'dfn code mark q sup sub samp');
|
5649
|
-
each$4((settings.special || 'script noscript noframes noembed title style textarea xmp').split(' '), function (name) {
|
5660
|
+
each$4((settings.special || 'script noscript iframe noframes noembed title style textarea xmp').split(' '), function (name) {
|
5650
5661
|
specialElements[name] = new RegExp('</' + name + '[^>]*>', 'gi');
|
5651
5662
|
});
|
5652
5663
|
var patternToRegExp = function (str) {
|
@@ -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) {
|
@@ -8070,7 +8103,8 @@
|
|
8070
8103
|
return overflowY >= 0 && overflowY <= Math.min(rect1.height, rect2.height) / 2;
|
8071
8104
|
};
|
8072
8105
|
var isAbove = function (rect1, rect2) {
|
8073
|
-
|
8106
|
+
var halfHeight = Math.min(rect2.height / 2, rect1.height / 2);
|
8107
|
+
if (rect1.bottom - halfHeight < rect2.top) {
|
8074
8108
|
return true;
|
8075
8109
|
}
|
8076
8110
|
if (rect1.top > rect2.bottom) {
|
@@ -13257,6 +13291,99 @@
|
|
13257
13291
|
};
|
13258
13292
|
var InlineFormatDelete = { backspaceDelete: backspaceDelete$5 };
|
13259
13293
|
|
13294
|
+
var getPos$1 = function (elm) {
|
13295
|
+
var x = 0, y = 0;
|
13296
|
+
var offsetParent = elm;
|
13297
|
+
while (offsetParent && offsetParent.nodeType) {
|
13298
|
+
x += offsetParent.offsetLeft || 0;
|
13299
|
+
y += offsetParent.offsetTop || 0;
|
13300
|
+
offsetParent = offsetParent.offsetParent;
|
13301
|
+
}
|
13302
|
+
return {
|
13303
|
+
x: x,
|
13304
|
+
y: y
|
13305
|
+
};
|
13306
|
+
};
|
13307
|
+
var fireScrollIntoViewEvent = function (editor, elm, alignToTop) {
|
13308
|
+
var scrollEvent = {
|
13309
|
+
elm: elm,
|
13310
|
+
alignToTop: alignToTop
|
13311
|
+
};
|
13312
|
+
editor.fire('scrollIntoView', scrollEvent);
|
13313
|
+
return scrollEvent.isDefaultPrevented();
|
13314
|
+
};
|
13315
|
+
var scrollElementIntoView = function (editor, elm, alignToTop) {
|
13316
|
+
var y, viewPort;
|
13317
|
+
var dom = editor.dom;
|
13318
|
+
var root = dom.getRoot();
|
13319
|
+
var viewPortY, viewPortH, offsetY = 0;
|
13320
|
+
if (fireScrollIntoViewEvent(editor, elm, alignToTop)) {
|
13321
|
+
return;
|
13322
|
+
}
|
13323
|
+
if (!NodeType.isElement(elm)) {
|
13324
|
+
return;
|
13325
|
+
}
|
13326
|
+
if (alignToTop === false) {
|
13327
|
+
offsetY = elm.offsetHeight;
|
13328
|
+
}
|
13329
|
+
if (root.nodeName !== 'BODY') {
|
13330
|
+
var scrollContainer = editor.selection.getScrollContainer();
|
13331
|
+
if (scrollContainer) {
|
13332
|
+
y = getPos$1(elm).y - getPos$1(scrollContainer).y + offsetY;
|
13333
|
+
viewPortH = scrollContainer.clientHeight;
|
13334
|
+
viewPortY = scrollContainer.scrollTop;
|
13335
|
+
if (y < viewPortY || y + 25 > viewPortY + viewPortH) {
|
13336
|
+
scrollContainer.scrollTop = y < viewPortY ? y : y - viewPortH + 25;
|
13337
|
+
}
|
13338
|
+
return;
|
13339
|
+
}
|
13340
|
+
}
|
13341
|
+
viewPort = dom.getViewPort(editor.getWin());
|
13342
|
+
y = dom.getPos(elm).y + offsetY;
|
13343
|
+
viewPortY = viewPort.y;
|
13344
|
+
viewPortH = viewPort.h;
|
13345
|
+
if (y < viewPort.y || y + 25 > viewPortY + viewPortH) {
|
13346
|
+
editor.getWin().scrollTo(0, y < viewPortY ? y : y - viewPortH + 25);
|
13347
|
+
}
|
13348
|
+
};
|
13349
|
+
var getViewPortRect = function (editor) {
|
13350
|
+
if (editor.inline) {
|
13351
|
+
return editor.getBody().getBoundingClientRect();
|
13352
|
+
} else {
|
13353
|
+
var win = editor.getWin();
|
13354
|
+
return {
|
13355
|
+
left: 0,
|
13356
|
+
right: win.innerWidth,
|
13357
|
+
top: 0,
|
13358
|
+
bottom: win.innerHeight,
|
13359
|
+
width: win.innerWidth,
|
13360
|
+
height: win.innerHeight
|
13361
|
+
};
|
13362
|
+
}
|
13363
|
+
};
|
13364
|
+
var scrollBy = function (editor, dx, dy) {
|
13365
|
+
if (editor.inline) {
|
13366
|
+
editor.getBody().scrollLeft += dx;
|
13367
|
+
editor.getBody().scrollTop += dy;
|
13368
|
+
} else {
|
13369
|
+
editor.getWin().scrollBy(dx, dy);
|
13370
|
+
}
|
13371
|
+
};
|
13372
|
+
var scrollRangeIntoView = function (editor, rng) {
|
13373
|
+
head(CaretPosition.fromRangeStart(rng).getClientRects()).each(function (rngRect) {
|
13374
|
+
var bodyRect = getViewPortRect(editor);
|
13375
|
+
var overflow = getOverflow(bodyRect, rngRect);
|
13376
|
+
var margin = 4;
|
13377
|
+
var dx = overflow.x > 0 ? overflow.x + margin : overflow.x - margin;
|
13378
|
+
var dy = overflow.y > 0 ? overflow.y + margin : overflow.y - margin;
|
13379
|
+
scrollBy(editor, overflow.x !== 0 ? dx : 0, overflow.y !== 0 ? dy : 0);
|
13380
|
+
});
|
13381
|
+
};
|
13382
|
+
var ScrollIntoView = {
|
13383
|
+
scrollElementIntoView: scrollElementIntoView,
|
13384
|
+
scrollRangeIntoView: scrollRangeIntoView
|
13385
|
+
};
|
13386
|
+
|
13260
13387
|
var isContentEditableTrue$2 = NodeType.isContentEditableTrue;
|
13261
13388
|
var isContentEditableFalse$6 = NodeType.isContentEditableFalse;
|
13262
13389
|
var showCaret = function (direction, editor, node, before, scrollIntoView) {
|
@@ -13303,6 +13430,10 @@
|
|
13303
13430
|
}
|
13304
13431
|
return range;
|
13305
13432
|
};
|
13433
|
+
var moveToRange = function (editor, rng) {
|
13434
|
+
editor.selection.setRng(rng);
|
13435
|
+
ScrollIntoView.scrollRangeIntoView(editor, editor.selection.getRng());
|
13436
|
+
};
|
13306
13437
|
|
13307
13438
|
var trimEmptyTextNode$1 = function (dom, node) {
|
13308
13439
|
if (NodeType.isText(node) && node.data.length === 0) {
|
@@ -16570,82 +16701,331 @@
|
|
16570
16701
|
};
|
16571
16702
|
}
|
16572
16703
|
|
16573
|
-
var
|
16574
|
-
|
16575
|
-
|
16576
|
-
|
16577
|
-
|
16578
|
-
|
16579
|
-
|
16580
|
-
|
16581
|
-
|
16582
|
-
|
16583
|
-
|
16584
|
-
|
16585
|
-
|
16586
|
-
|
16587
|
-
|
16588
|
-
|
16704
|
+
var VK = {
|
16705
|
+
BACKSPACE: 8,
|
16706
|
+
DELETE: 46,
|
16707
|
+
DOWN: 40,
|
16708
|
+
ENTER: 13,
|
16709
|
+
LEFT: 37,
|
16710
|
+
RIGHT: 39,
|
16711
|
+
SPACEBAR: 32,
|
16712
|
+
TAB: 9,
|
16713
|
+
UP: 38,
|
16714
|
+
END: 35,
|
16715
|
+
HOME: 36,
|
16716
|
+
modifierPressed: function (e) {
|
16717
|
+
return e.shiftKey || e.ctrlKey || e.altKey || this.metaKeyPressed(e);
|
16718
|
+
},
|
16719
|
+
metaKeyPressed: function (e) {
|
16720
|
+
return Env.mac ? e.metaKey : e.ctrlKey && !e.altKey;
|
16721
|
+
}
|
16589
16722
|
};
|
16590
|
-
|
16591
|
-
|
16592
|
-
|
16593
|
-
|
16594
|
-
|
16595
|
-
|
16596
|
-
|
16597
|
-
|
16723
|
+
|
16724
|
+
var getNodeClientRects = function (node) {
|
16725
|
+
var toArrayWithNode = function (clientRects) {
|
16726
|
+
return map(clientRects, function (clientRect) {
|
16727
|
+
clientRect = clone$1(clientRect);
|
16728
|
+
clientRect.node = node;
|
16729
|
+
return clientRect;
|
16730
|
+
});
|
16598
16731
|
};
|
16732
|
+
if (NodeType.isElement(node)) {
|
16733
|
+
return toArrayWithNode(node.getClientRects());
|
16734
|
+
}
|
16735
|
+
if (NodeType.isText(node)) {
|
16736
|
+
var rng = node.ownerDocument.createRange();
|
16737
|
+
rng.setStart(node, 0);
|
16738
|
+
rng.setEnd(node, node.data.length);
|
16739
|
+
return toArrayWithNode(rng.getClientRects());
|
16740
|
+
}
|
16599
16741
|
};
|
16600
|
-
var
|
16601
|
-
|
16602
|
-
|
16603
|
-
|
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;
|
16742
|
+
var getClientRects = function (node) {
|
16743
|
+
return foldl(node, function (result, node) {
|
16744
|
+
return result.concat(getNodeClientRects(node));
|
16745
|
+
}, []);
|
16611
16746
|
};
|
16612
|
-
|
16613
|
-
|
16614
|
-
|
16615
|
-
|
16616
|
-
|
16617
|
-
|
16618
|
-
|
16619
|
-
|
16747
|
+
|
16748
|
+
var VDirection;
|
16749
|
+
(function (VDirection) {
|
16750
|
+
VDirection[VDirection['Up'] = -1] = 'Up';
|
16751
|
+
VDirection[VDirection['Down'] = 1] = 'Down';
|
16752
|
+
}(VDirection || (VDirection = {})));
|
16753
|
+
var findUntil = function (direction, root, predicateFn, node) {
|
16754
|
+
while (node = findNode(node, direction, isEditableCaretCandidate, root)) {
|
16755
|
+
if (predicateFn(node)) {
|
16756
|
+
return;
|
16757
|
+
}
|
16620
16758
|
}
|
16621
|
-
return {
|
16622
|
-
left: event.pageX,
|
16623
|
-
top: event.pageY
|
16624
|
-
};
|
16625
16759
|
};
|
16626
|
-
var
|
16627
|
-
|
16628
|
-
|
16629
|
-
|
16760
|
+
var walkUntil = function (direction, isAboveFn, isBeflowFn, root, predicateFn, caretPosition) {
|
16761
|
+
var line = 0, node;
|
16762
|
+
var result = [];
|
16763
|
+
var targetClientRect;
|
16764
|
+
var add = function (node) {
|
16765
|
+
var i, clientRect, clientRects;
|
16766
|
+
clientRects = getClientRects([node]);
|
16767
|
+
if (direction === -1) {
|
16768
|
+
clientRects = clientRects.reverse();
|
16769
|
+
}
|
16770
|
+
for (i = 0; i < clientRects.length; i++) {
|
16771
|
+
clientRect = clientRects[i];
|
16772
|
+
if (isBeflowFn(clientRect, targetClientRect)) {
|
16773
|
+
continue;
|
16774
|
+
}
|
16775
|
+
if (result.length > 0 && isAboveFn(clientRect, ArrUtils.last(result))) {
|
16776
|
+
line++;
|
16777
|
+
}
|
16778
|
+
clientRect.line = line;
|
16779
|
+
if (predicateFn(clientRect)) {
|
16780
|
+
return true;
|
16781
|
+
}
|
16782
|
+
result.push(clientRect);
|
16783
|
+
}
|
16630
16784
|
};
|
16785
|
+
targetClientRect = ArrUtils.last(caretPosition.getClientRects());
|
16786
|
+
if (!targetClientRect) {
|
16787
|
+
return result;
|
16788
|
+
}
|
16789
|
+
node = caretPosition.getNode();
|
16790
|
+
add(node);
|
16791
|
+
findUntil(direction, root, add, node);
|
16792
|
+
return result;
|
16631
16793
|
};
|
16632
|
-
var
|
16633
|
-
return
|
16634
|
-
};
|
16635
|
-
var MousePosition = { calc: calc };
|
16636
|
-
|
16637
|
-
var isContentEditableFalse$7 = NodeType.isContentEditableFalse, isContentEditableTrue$3 = NodeType.isContentEditableTrue;
|
16638
|
-
var isDraggable = function (rootElm, elm) {
|
16639
|
-
return isContentEditableFalse$7(elm) && elm !== rootElm;
|
16794
|
+
var aboveLineNumber = function (lineNumber, clientRect) {
|
16795
|
+
return clientRect.line > lineNumber;
|
16640
16796
|
};
|
16641
|
-
var
|
16642
|
-
|
16643
|
-
|
16644
|
-
|
16645
|
-
|
16646
|
-
|
16647
|
-
|
16648
|
-
|
16797
|
+
var isLineNumber = function (lineNumber, clientRect) {
|
16798
|
+
return clientRect.line === lineNumber;
|
16799
|
+
};
|
16800
|
+
var upUntil = curry(walkUntil, VDirection.Up, isAbove, isBelow);
|
16801
|
+
var downUntil = curry(walkUntil, VDirection.Down, isBelow, isAbove);
|
16802
|
+
var positionsUntil = function (direction, root, predicateFn, node) {
|
16803
|
+
var caretWalker = CaretWalker(root);
|
16804
|
+
var walkFn, isBelowFn, isAboveFn, caretPosition;
|
16805
|
+
var result = [];
|
16806
|
+
var line = 0, clientRect, targetClientRect;
|
16807
|
+
var getClientRect = function (caretPosition) {
|
16808
|
+
if (direction === 1) {
|
16809
|
+
return ArrUtils.last(caretPosition.getClientRects());
|
16810
|
+
}
|
16811
|
+
return ArrUtils.last(caretPosition.getClientRects());
|
16812
|
+
};
|
16813
|
+
if (direction === 1) {
|
16814
|
+
walkFn = caretWalker.next;
|
16815
|
+
isBelowFn = isBelow;
|
16816
|
+
isAboveFn = isAbove;
|
16817
|
+
caretPosition = CaretPosition$1.after(node);
|
16818
|
+
} else {
|
16819
|
+
walkFn = caretWalker.prev;
|
16820
|
+
isBelowFn = isAbove;
|
16821
|
+
isAboveFn = isBelow;
|
16822
|
+
caretPosition = CaretPosition$1.before(node);
|
16823
|
+
}
|
16824
|
+
targetClientRect = getClientRect(caretPosition);
|
16825
|
+
do {
|
16826
|
+
if (!caretPosition.isVisible()) {
|
16827
|
+
continue;
|
16828
|
+
}
|
16829
|
+
clientRect = getClientRect(caretPosition);
|
16830
|
+
if (isAboveFn(clientRect, targetClientRect)) {
|
16831
|
+
continue;
|
16832
|
+
}
|
16833
|
+
if (result.length > 0 && isBelowFn(clientRect, ArrUtils.last(result))) {
|
16834
|
+
line++;
|
16835
|
+
}
|
16836
|
+
clientRect = clone$1(clientRect);
|
16837
|
+
clientRect.position = caretPosition;
|
16838
|
+
clientRect.line = line;
|
16839
|
+
if (predicateFn(clientRect)) {
|
16840
|
+
return result;
|
16841
|
+
}
|
16842
|
+
result.push(clientRect);
|
16843
|
+
} while (caretPosition = walkFn(caretPosition));
|
16844
|
+
return result;
|
16845
|
+
};
|
16846
|
+
var isAboveLine = function (lineNumber) {
|
16847
|
+
return function (clientRect) {
|
16848
|
+
return aboveLineNumber(lineNumber, clientRect);
|
16849
|
+
};
|
16850
|
+
};
|
16851
|
+
var isLine = function (lineNumber) {
|
16852
|
+
return function (clientRect) {
|
16853
|
+
return isLineNumber(lineNumber, clientRect);
|
16854
|
+
};
|
16855
|
+
};
|
16856
|
+
|
16857
|
+
var isContentEditableFalse$7 = NodeType.isContentEditableFalse;
|
16858
|
+
var findNode$1 = findNode;
|
16859
|
+
var distanceToRectLeft = function (clientRect, clientX) {
|
16860
|
+
return Math.abs(clientRect.left - clientX);
|
16861
|
+
};
|
16862
|
+
var distanceToRectRight = function (clientRect, clientX) {
|
16863
|
+
return Math.abs(clientRect.right - clientX);
|
16864
|
+
};
|
16865
|
+
var isInside = function (clientX, clientRect) {
|
16866
|
+
return clientX >= clientRect.left && clientX <= clientRect.right;
|
16867
|
+
};
|
16868
|
+
var findClosestClientRect = function (clientRects, clientX) {
|
16869
|
+
return ArrUtils.reduce(clientRects, function (oldClientRect, clientRect) {
|
16870
|
+
var oldDistance, newDistance;
|
16871
|
+
oldDistance = Math.min(distanceToRectLeft(oldClientRect, clientX), distanceToRectRight(oldClientRect, clientX));
|
16872
|
+
newDistance = Math.min(distanceToRectLeft(clientRect, clientX), distanceToRectRight(clientRect, clientX));
|
16873
|
+
if (isInside(clientX, clientRect)) {
|
16874
|
+
return clientRect;
|
16875
|
+
}
|
16876
|
+
if (isInside(clientX, oldClientRect)) {
|
16877
|
+
return oldClientRect;
|
16878
|
+
}
|
16879
|
+
if (newDistance === oldDistance && isContentEditableFalse$7(clientRect.node)) {
|
16880
|
+
return clientRect;
|
16881
|
+
}
|
16882
|
+
if (newDistance < oldDistance) {
|
16883
|
+
return clientRect;
|
16884
|
+
}
|
16885
|
+
return oldClientRect;
|
16886
|
+
});
|
16887
|
+
};
|
16888
|
+
var walkUntil$1 = function (direction, root, predicateFn, node) {
|
16889
|
+
while (node = findNode$1(node, direction, isEditableCaretCandidate, root)) {
|
16890
|
+
if (predicateFn(node)) {
|
16891
|
+
return;
|
16892
|
+
}
|
16893
|
+
}
|
16894
|
+
};
|
16895
|
+
var findLineNodeRects = function (root, targetNodeRect) {
|
16896
|
+
var clientRects = [];
|
16897
|
+
var collect = function (checkPosFn, node) {
|
16898
|
+
var lineRects;
|
16899
|
+
lineRects = filter(getClientRects([node]), function (clientRect) {
|
16900
|
+
return !checkPosFn(clientRect, targetNodeRect);
|
16901
|
+
});
|
16902
|
+
clientRects = clientRects.concat(lineRects);
|
16903
|
+
return lineRects.length === 0;
|
16904
|
+
};
|
16905
|
+
clientRects.push(targetNodeRect);
|
16906
|
+
walkUntil$1(VDirection.Up, root, curry(collect, isAbove), targetNodeRect.node);
|
16907
|
+
walkUntil$1(VDirection.Down, root, curry(collect, isBelow), targetNodeRect.node);
|
16908
|
+
return clientRects;
|
16909
|
+
};
|
16910
|
+
var getFakeCaretTargets = function (root) {
|
16911
|
+
return filter(from$1(root.getElementsByTagName('*')), isFakeCaretTarget);
|
16912
|
+
};
|
16913
|
+
var caretInfo = function (clientRect, clientX) {
|
16914
|
+
return {
|
16915
|
+
node: clientRect.node,
|
16916
|
+
before: distanceToRectLeft(clientRect, clientX) < distanceToRectRight(clientRect, clientX)
|
16917
|
+
};
|
16918
|
+
};
|
16919
|
+
var closestCaret = function (root, clientX, clientY) {
|
16920
|
+
var closestNodeRect;
|
16921
|
+
var contentEditableFalseNodeRects = getClientRects(getFakeCaretTargets(root));
|
16922
|
+
var targetNodeRects = filter(contentEditableFalseNodeRects, function (rect) {
|
16923
|
+
return clientY >= rect.top && clientY <= rect.bottom;
|
16924
|
+
});
|
16925
|
+
closestNodeRect = findClosestClientRect(targetNodeRects, clientX);
|
16926
|
+
if (closestNodeRect) {
|
16927
|
+
closestNodeRect = findClosestClientRect(findLineNodeRects(root, closestNodeRect), clientX);
|
16928
|
+
if (closestNodeRect && isFakeCaretTarget(closestNodeRect.node)) {
|
16929
|
+
return caretInfo(closestNodeRect, clientX);
|
16930
|
+
}
|
16931
|
+
}
|
16932
|
+
return null;
|
16933
|
+
};
|
16934
|
+
|
16935
|
+
var isXYWithinRange = function (clientX, clientY, range) {
|
16936
|
+
if (range.collapsed) {
|
16937
|
+
return false;
|
16938
|
+
}
|
16939
|
+
if (Env.ie && Env.ie <= 11 && range.startOffset === range.endOffset - 1 && range.startContainer === range.endContainer) {
|
16940
|
+
var elm = range.startContainer.childNodes[range.startOffset];
|
16941
|
+
if (NodeType.isElement(elm)) {
|
16942
|
+
return exists(elm.getClientRects(), function (rect) {
|
16943
|
+
return containsXY(rect, clientX, clientY);
|
16944
|
+
});
|
16945
|
+
}
|
16946
|
+
}
|
16947
|
+
return exists(range.getClientRects(), function (rect) {
|
16948
|
+
return containsXY(rect, clientX, clientY);
|
16949
|
+
});
|
16950
|
+
};
|
16951
|
+
var RangePoint = { isXYWithinRange: isXYWithinRange };
|
16952
|
+
|
16953
|
+
var getAbsolutePosition = function (elm) {
|
16954
|
+
var doc, docElem, win, clientRect;
|
16955
|
+
clientRect = elm.getBoundingClientRect();
|
16956
|
+
doc = elm.ownerDocument;
|
16957
|
+
docElem = doc.documentElement;
|
16958
|
+
win = doc.defaultView;
|
16959
|
+
return {
|
16960
|
+
top: clientRect.top + win.pageYOffset - docElem.clientTop,
|
16961
|
+
left: clientRect.left + win.pageXOffset - docElem.clientLeft
|
16962
|
+
};
|
16963
|
+
};
|
16964
|
+
var getBodyPosition = function (editor) {
|
16965
|
+
return editor.inline ? getAbsolutePosition(editor.getBody()) : {
|
16966
|
+
left: 0,
|
16967
|
+
top: 0
|
16968
|
+
};
|
16969
|
+
};
|
16970
|
+
var getScrollPosition = function (editor) {
|
16971
|
+
var body = editor.getBody();
|
16972
|
+
return editor.inline ? {
|
16973
|
+
left: body.scrollLeft,
|
16974
|
+
top: body.scrollTop
|
16975
|
+
} : {
|
16976
|
+
left: 0,
|
16977
|
+
top: 0
|
16978
|
+
};
|
16979
|
+
};
|
16980
|
+
var getBodyScroll = function (editor) {
|
16981
|
+
var body = editor.getBody(), docElm = editor.getDoc().documentElement;
|
16982
|
+
var inlineScroll = {
|
16983
|
+
left: body.scrollLeft,
|
16984
|
+
top: body.scrollTop
|
16985
|
+
};
|
16986
|
+
var iframeScroll = {
|
16987
|
+
left: body.scrollLeft || docElm.scrollLeft,
|
16988
|
+
top: body.scrollTop || docElm.scrollTop
|
16989
|
+
};
|
16990
|
+
return editor.inline ? inlineScroll : iframeScroll;
|
16991
|
+
};
|
16992
|
+
var getMousePosition = function (editor, event) {
|
16993
|
+
if (event.target.ownerDocument !== editor.getDoc()) {
|
16994
|
+
var iframePosition = getAbsolutePosition(editor.getContentAreaContainer());
|
16995
|
+
var scrollPosition = getBodyScroll(editor);
|
16996
|
+
return {
|
16997
|
+
left: event.pageX - iframePosition.left + scrollPosition.left,
|
16998
|
+
top: event.pageY - iframePosition.top + scrollPosition.top
|
16999
|
+
};
|
17000
|
+
}
|
17001
|
+
return {
|
17002
|
+
left: event.pageX,
|
17003
|
+
top: event.pageY
|
17004
|
+
};
|
17005
|
+
};
|
17006
|
+
var calculatePosition = function (bodyPosition, scrollPosition, mousePosition) {
|
17007
|
+
return {
|
17008
|
+
pageX: mousePosition.left - bodyPosition.left + scrollPosition.left,
|
17009
|
+
pageY: mousePosition.top - bodyPosition.top + scrollPosition.top
|
17010
|
+
};
|
17011
|
+
};
|
17012
|
+
var calc = function (editor, event) {
|
17013
|
+
return calculatePosition(getBodyPosition(editor), getScrollPosition(editor), getMousePosition(editor, event));
|
17014
|
+
};
|
17015
|
+
var MousePosition = { calc: calc };
|
17016
|
+
|
17017
|
+
var isContentEditableFalse$8 = NodeType.isContentEditableFalse, isContentEditableTrue$3 = NodeType.isContentEditableTrue;
|
17018
|
+
var isDraggable = function (rootElm, elm) {
|
17019
|
+
return isContentEditableFalse$8(elm) && elm !== rootElm;
|
17020
|
+
};
|
17021
|
+
var isValidDropTarget = function (editor, targetElement, dragElement) {
|
17022
|
+
if (targetElement === dragElement || editor.dom.isChildOf(targetElement, dragElement)) {
|
17023
|
+
return false;
|
17024
|
+
}
|
17025
|
+
if (isContentEditableFalse$8(targetElement)) {
|
17026
|
+
return false;
|
17027
|
+
}
|
17028
|
+
return true;
|
16649
17029
|
};
|
16650
17030
|
var cloneElement = function (elm) {
|
16651
17031
|
var cloneElm = elm.cloneNode(true);
|
@@ -16720,7 +17100,7 @@
|
|
16720
17100
|
var start$1 = function (state, editor) {
|
16721
17101
|
return function (e) {
|
16722
17102
|
if (isLeftMouseButtonPressed(e)) {
|
16723
|
-
var ceElm = find(editor.dom.getParents(e.target), Predicate.or(isContentEditableFalse$
|
17103
|
+
var ceElm = find(editor.dom.getParents(e.target), Predicate.or(isContentEditableFalse$8, isContentEditableTrue$3)).getOr(null);
|
16724
17104
|
if (isDraggable(editor.getBody(), ceElm)) {
|
16725
17105
|
var elmPos = editor.dom.getPos(ceElm);
|
16726
17106
|
var bodyElm = editor.getBody();
|
@@ -16776,294 +17156,65 @@
|
|
16776
17156
|
targetClone: targetClone_1,
|
16777
17157
|
clientX: e.clientX,
|
16778
17158
|
clientY: e.clientY
|
16779
|
-
});
|
16780
|
-
if (!args.isDefaultPrevented()) {
|
16781
|
-
targetClone_1 = args.targetClone;
|
16782
|
-
editor.undoManager.transact(function () {
|
16783
|
-
removeElement(state.element);
|
16784
|
-
editor.insertContent(editor.dom.getOuterHTML(targetClone_1));
|
16785
|
-
editor._selectionOverrides.hideFakeCaret();
|
16786
|
-
});
|
16787
|
-
}
|
16788
|
-
}
|
16789
|
-
}
|
16790
|
-
removeDragState(state);
|
16791
|
-
};
|
16792
|
-
};
|
16793
|
-
var stop = function (state, editor) {
|
16794
|
-
return function () {
|
16795
|
-
if (state.dragging) {
|
16796
|
-
editor.fire('dragend');
|
16797
|
-
}
|
16798
|
-
removeDragState(state);
|
16799
|
-
};
|
16800
|
-
};
|
16801
|
-
var removeDragState = function (state) {
|
16802
|
-
state.dragging = false;
|
16803
|
-
state.element = null;
|
16804
|
-
removeElement(state.ghost);
|
16805
|
-
};
|
16806
|
-
var bindFakeDragEvents = function (editor) {
|
16807
|
-
var state = {};
|
16808
|
-
var pageDom, dragStartHandler, dragHandler, dropHandler, dragEndHandler, rootDocument;
|
16809
|
-
pageDom = DOMUtils$1.DOM;
|
16810
|
-
rootDocument = domGlobals.document;
|
16811
|
-
dragStartHandler = start$1(state, editor);
|
16812
|
-
dragHandler = move$1(state, editor);
|
16813
|
-
dropHandler = drop(state, editor);
|
16814
|
-
dragEndHandler = stop(state, editor);
|
16815
|
-
editor.on('mousedown', dragStartHandler);
|
16816
|
-
editor.on('mousemove', dragHandler);
|
16817
|
-
editor.on('mouseup', dropHandler);
|
16818
|
-
pageDom.bind(rootDocument, 'mousemove', dragHandler);
|
16819
|
-
pageDom.bind(rootDocument, 'mouseup', dragEndHandler);
|
16820
|
-
editor.on('remove', function () {
|
16821
|
-
pageDom.unbind(rootDocument, 'mousemove', dragHandler);
|
16822
|
-
pageDom.unbind(rootDocument, 'mouseup', dragEndHandler);
|
16823
|
-
});
|
16824
|
-
};
|
16825
|
-
var blockIeDrop = function (editor) {
|
16826
|
-
editor.on('drop', function (e) {
|
16827
|
-
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))) {
|
16829
|
-
e.preventDefault();
|
16830
|
-
}
|
16831
|
-
});
|
16832
|
-
};
|
16833
|
-
var init = function (editor) {
|
16834
|
-
bindFakeDragEvents(editor);
|
16835
|
-
blockIeDrop(editor);
|
16836
|
-
};
|
16837
|
-
var DragDropOverrides = { init: init };
|
16838
|
-
|
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;
|
17159
|
+
});
|
17160
|
+
if (!args.isDefaultPrevented()) {
|
17161
|
+
targetClone_1 = args.targetClone;
|
17162
|
+
editor.undoManager.transact(function () {
|
17163
|
+
removeElement(state.element);
|
17164
|
+
editor.insertContent(editor.dom.getOuterHTML(targetClone_1));
|
17165
|
+
editor._selectionOverrides.hideFakeCaret();
|
17166
|
+
});
|
17167
|
+
}
|
17168
|
+
}
|
16999
17169
|
}
|
17000
|
-
|
17001
|
-
}
|
17170
|
+
removeDragState(state);
|
17171
|
+
};
|
17002
17172
|
};
|
17003
|
-
var
|
17004
|
-
|
17005
|
-
if (
|
17006
|
-
|
17173
|
+
var stop = function (state, editor) {
|
17174
|
+
return function () {
|
17175
|
+
if (state.dragging) {
|
17176
|
+
editor.fire('dragend');
|
17007
17177
|
}
|
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;
|
17178
|
+
removeDragState(state);
|
17019
17179
|
};
|
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
17180
|
};
|
17028
|
-
var
|
17029
|
-
|
17030
|
-
|
17031
|
-
|
17032
|
-
};
|
17181
|
+
var removeDragState = function (state) {
|
17182
|
+
state.dragging = false;
|
17183
|
+
state.element = null;
|
17184
|
+
removeElement(state.ghost);
|
17033
17185
|
};
|
17034
|
-
var
|
17035
|
-
var
|
17036
|
-
var
|
17037
|
-
|
17038
|
-
|
17186
|
+
var bindFakeDragEvents = function (editor) {
|
17187
|
+
var state = {};
|
17188
|
+
var pageDom, dragStartHandler, dragHandler, dropHandler, dragEndHandler, rootDocument;
|
17189
|
+
pageDom = DOMUtils$1.DOM;
|
17190
|
+
rootDocument = domGlobals.document;
|
17191
|
+
dragStartHandler = start$1(state, editor);
|
17192
|
+
dragHandler = move$1(state, editor);
|
17193
|
+
dropHandler = drop(state, editor);
|
17194
|
+
dragEndHandler = stop(state, editor);
|
17195
|
+
editor.on('mousedown', dragStartHandler);
|
17196
|
+
editor.on('mousemove', dragHandler);
|
17197
|
+
editor.on('mouseup', dropHandler);
|
17198
|
+
pageDom.bind(rootDocument, 'mousemove', dragHandler);
|
17199
|
+
pageDom.bind(rootDocument, 'mouseup', dragEndHandler);
|
17200
|
+
editor.on('remove', function () {
|
17201
|
+
pageDom.unbind(rootDocument, 'mousemove', dragHandler);
|
17202
|
+
pageDom.unbind(rootDocument, 'mouseup', dragEndHandler);
|
17039
17203
|
});
|
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
17204
|
};
|
17049
|
-
|
17050
|
-
|
17051
|
-
|
17052
|
-
|
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
|
-
});
|
17205
|
+
var blockIeDrop = function (editor) {
|
17206
|
+
editor.on('drop', function (e) {
|
17207
|
+
var realTarget = typeof e.clientX !== 'undefined' ? editor.getDoc().elementFromPoint(e.clientX, e.clientY) : null;
|
17208
|
+
if (isContentEditableFalse$8(realTarget) || isContentEditableFalse$8(editor.dom.getContentEditableParent(realTarget))) {
|
17209
|
+
e.preventDefault();
|
17060
17210
|
}
|
17061
|
-
}
|
17062
|
-
return exists(range.getClientRects(), function (rect) {
|
17063
|
-
return containsXY(rect, clientX, clientY);
|
17064
17211
|
});
|
17065
17212
|
};
|
17066
|
-
var
|
17213
|
+
var init = function (editor) {
|
17214
|
+
bindFakeDragEvents(editor);
|
17215
|
+
blockIeDrop(editor);
|
17216
|
+
};
|
17217
|
+
var DragDropOverrides = { init: init };
|
17067
17218
|
|
17068
17219
|
var setup$4 = function (editor) {
|
17069
17220
|
var renderFocusCaret = first(function () {
|
@@ -17084,26 +17235,6 @@
|
|
17084
17235
|
};
|
17085
17236
|
var CefFocus = { setup: setup$4 };
|
17086
17237
|
|
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
17238
|
var isContentEditableTrue$4 = NodeType.isContentEditableTrue;
|
17108
17239
|
var isContentEditableFalse$9 = NodeType.isContentEditableFalse;
|
17109
17240
|
var getContentEditableRoot$1 = function (editor, node) {
|
@@ -17302,8 +17433,8 @@
|
|
17302
17433
|
}
|
17303
17434
|
});
|
17304
17435
|
editor.on('setSelectionRange', function (e) {
|
17305
|
-
|
17306
|
-
rng = setContentEditableSelection(e.range, e.forward);
|
17436
|
+
e.range = normalizeShortEndedElementSelection(e.range);
|
17437
|
+
var rng = setContentEditableSelection(e.range, e.forward);
|
17307
17438
|
if (rng) {
|
17308
17439
|
e.range = rng;
|
17309
17440
|
}
|
@@ -17346,6 +17477,33 @@
|
|
17346
17477
|
var isRangeInCaretContainer = function (rng) {
|
17347
17478
|
return isWithinCaretContainer(rng.startContainer) || isWithinCaretContainer(rng.endContainer);
|
17348
17479
|
};
|
17480
|
+
var normalizeShortEndedElementSelection = function (rng) {
|
17481
|
+
var shortEndedElements = editor.schema.getShortEndedElements();
|
17482
|
+
var newRng = editor.dom.createRng();
|
17483
|
+
var startContainer = rng.startContainer;
|
17484
|
+
var startOffset = rng.startOffset;
|
17485
|
+
var endContainer = rng.endContainer;
|
17486
|
+
var endOffset = rng.endOffset;
|
17487
|
+
if (has(shortEndedElements, startContainer.nodeName.toLowerCase())) {
|
17488
|
+
if (startOffset === 0) {
|
17489
|
+
newRng.setStartBefore(startContainer);
|
17490
|
+
} else {
|
17491
|
+
newRng.setStartAfter(startContainer);
|
17492
|
+
}
|
17493
|
+
} else {
|
17494
|
+
newRng.setStart(startContainer, startOffset);
|
17495
|
+
}
|
17496
|
+
if (has(shortEndedElements, endContainer.nodeName.toLowerCase())) {
|
17497
|
+
if (endOffset === 0) {
|
17498
|
+
newRng.setEndBefore(endContainer);
|
17499
|
+
} else {
|
17500
|
+
newRng.setEndAfter(endContainer);
|
17501
|
+
}
|
17502
|
+
} else {
|
17503
|
+
newRng.setEnd(endContainer, endOffset);
|
17504
|
+
}
|
17505
|
+
return newRng;
|
17506
|
+
};
|
17349
17507
|
var setContentEditableSelection = function (range, forward) {
|
17350
17508
|
var node;
|
17351
17509
|
var $ = editor.$;
|
@@ -17466,7 +17624,11 @@
|
|
17466
17624
|
return name.indexOf('data-') === 0 || name.indexOf('aria-') === 0;
|
17467
17625
|
};
|
17468
17626
|
var trimComments = function (text) {
|
17469
|
-
|
17627
|
+
var sanitizedText = text;
|
17628
|
+
while (/<!--|--!?>/g.test(sanitizedText)) {
|
17629
|
+
sanitizedText = sanitizedText.replace(/<!--|--!?>/g, '');
|
17630
|
+
}
|
17631
|
+
return sanitizedText;
|
17470
17632
|
};
|
17471
17633
|
var isInvalidUri = function (settings, uri) {
|
17472
17634
|
if (settings.allow_html_data_urls) {
|
@@ -20351,7 +20513,7 @@
|
|
20351
20513
|
var blockElements = Tools.extend({}, schema.getBlockElements());
|
20352
20514
|
var nonEmptyElements = schema.getNonEmptyElements();
|
20353
20515
|
var parent, lastParent, prev, prevName;
|
20354
|
-
var whiteSpaceElements = schema.
|
20516
|
+
var whiteSpaceElements = schema.getWhiteSpaceElements();
|
20355
20517
|
var elementRule, textNode;
|
20356
20518
|
blockElements.body = 1;
|
20357
20519
|
for (i = 0; i < l; i++) {
|
@@ -21426,99 +21588,6 @@
|
|
21426
21588
|
};
|
21427
21589
|
};
|
21428
21590
|
|
21429
|
-
var getPos$1 = function (elm) {
|
21430
|
-
var x = 0, y = 0;
|
21431
|
-
var offsetParent = elm;
|
21432
|
-
while (offsetParent && offsetParent.nodeType) {
|
21433
|
-
x += offsetParent.offsetLeft || 0;
|
21434
|
-
y += offsetParent.offsetTop || 0;
|
21435
|
-
offsetParent = offsetParent.offsetParent;
|
21436
|
-
}
|
21437
|
-
return {
|
21438
|
-
x: x,
|
21439
|
-
y: y
|
21440
|
-
};
|
21441
|
-
};
|
21442
|
-
var fireScrollIntoViewEvent = function (editor, elm, alignToTop) {
|
21443
|
-
var scrollEvent = {
|
21444
|
-
elm: elm,
|
21445
|
-
alignToTop: alignToTop
|
21446
|
-
};
|
21447
|
-
editor.fire('scrollIntoView', scrollEvent);
|
21448
|
-
return scrollEvent.isDefaultPrevented();
|
21449
|
-
};
|
21450
|
-
var scrollElementIntoView = function (editor, elm, alignToTop) {
|
21451
|
-
var y, viewPort;
|
21452
|
-
var dom = editor.dom;
|
21453
|
-
var root = dom.getRoot();
|
21454
|
-
var viewPortY, viewPortH, offsetY = 0;
|
21455
|
-
if (fireScrollIntoViewEvent(editor, elm, alignToTop)) {
|
21456
|
-
return;
|
21457
|
-
}
|
21458
|
-
if (!NodeType.isElement(elm)) {
|
21459
|
-
return;
|
21460
|
-
}
|
21461
|
-
if (alignToTop === false) {
|
21462
|
-
offsetY = elm.offsetHeight;
|
21463
|
-
}
|
21464
|
-
if (root.nodeName !== 'BODY') {
|
21465
|
-
var scrollContainer = editor.selection.getScrollContainer();
|
21466
|
-
if (scrollContainer) {
|
21467
|
-
y = getPos$1(elm).y - getPos$1(scrollContainer).y + offsetY;
|
21468
|
-
viewPortH = scrollContainer.clientHeight;
|
21469
|
-
viewPortY = scrollContainer.scrollTop;
|
21470
|
-
if (y < viewPortY || y + 25 > viewPortY + viewPortH) {
|
21471
|
-
scrollContainer.scrollTop = y < viewPortY ? y : y - viewPortH + 25;
|
21472
|
-
}
|
21473
|
-
return;
|
21474
|
-
}
|
21475
|
-
}
|
21476
|
-
viewPort = dom.getViewPort(editor.getWin());
|
21477
|
-
y = dom.getPos(elm).y + offsetY;
|
21478
|
-
viewPortY = viewPort.y;
|
21479
|
-
viewPortH = viewPort.h;
|
21480
|
-
if (y < viewPort.y || y + 25 > viewPortY + viewPortH) {
|
21481
|
-
editor.getWin().scrollTo(0, y < viewPortY ? y : y - viewPortH + 25);
|
21482
|
-
}
|
21483
|
-
};
|
21484
|
-
var getViewPortRect = function (editor) {
|
21485
|
-
if (editor.inline) {
|
21486
|
-
return editor.getBody().getBoundingClientRect();
|
21487
|
-
} else {
|
21488
|
-
var win = editor.getWin();
|
21489
|
-
return {
|
21490
|
-
left: 0,
|
21491
|
-
right: win.innerWidth,
|
21492
|
-
top: 0,
|
21493
|
-
bottom: win.innerHeight,
|
21494
|
-
width: win.innerWidth,
|
21495
|
-
height: win.innerHeight
|
21496
|
-
};
|
21497
|
-
}
|
21498
|
-
};
|
21499
|
-
var scrollBy = function (editor, dx, dy) {
|
21500
|
-
if (editor.inline) {
|
21501
|
-
editor.getBody().scrollLeft += dx;
|
21502
|
-
editor.getBody().scrollTop += dy;
|
21503
|
-
} else {
|
21504
|
-
editor.getWin().scrollBy(dx, dy);
|
21505
|
-
}
|
21506
|
-
};
|
21507
|
-
var scrollRangeIntoView = function (editor, rng) {
|
21508
|
-
head(CaretPosition.fromRangeStart(rng).getClientRects()).each(function (rngRect) {
|
21509
|
-
var bodyRect = getViewPortRect(editor);
|
21510
|
-
var overflow = getOverflow(bodyRect, rngRect);
|
21511
|
-
var margin = 4;
|
21512
|
-
var dx = overflow.x > 0 ? overflow.x + margin : overflow.x - margin;
|
21513
|
-
var dy = overflow.y > 0 ? overflow.y + margin : overflow.y - margin;
|
21514
|
-
scrollBy(editor, overflow.x !== 0 ? dx : 0, overflow.y !== 0 ? dy : 0);
|
21515
|
-
});
|
21516
|
-
};
|
21517
|
-
var ScrollIntoView = {
|
21518
|
-
scrollElementIntoView: scrollElementIntoView,
|
21519
|
-
scrollRangeIntoView: scrollRangeIntoView
|
21520
|
-
};
|
21521
|
-
|
21522
21591
|
var hasCeProperty = function (node) {
|
21523
21592
|
return NodeType.isContentEditableTrue(node) || NodeType.isContentEditableFalse(node);
|
21524
21593
|
};
|
@@ -21837,22 +21906,37 @@
|
|
21837
21906
|
};
|
21838
21907
|
var GetSelectionContent = { getContent: getContent };
|
21839
21908
|
|
21909
|
+
var setupArgs = function (args, content) {
|
21910
|
+
return __assign(__assign({ format: 'html' }, args), {
|
21911
|
+
set: true,
|
21912
|
+
selection: true,
|
21913
|
+
content: content
|
21914
|
+
});
|
21915
|
+
};
|
21916
|
+
var cleanContent = function (editor, args) {
|
21917
|
+
if (args.format !== 'raw') {
|
21918
|
+
var node = editor.parser.parse(args.content, __assign({
|
21919
|
+
isRootContent: true,
|
21920
|
+
forced_root_block: false
|
21921
|
+
}, args));
|
21922
|
+
return HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(node);
|
21923
|
+
} else {
|
21924
|
+
return args.content;
|
21925
|
+
}
|
21926
|
+
};
|
21840
21927
|
var setContent = function (editor, content, args) {
|
21928
|
+
var contentArgs = setupArgs(args, content);
|
21841
21929
|
var rng = editor.selection.getRng(), caretNode;
|
21842
21930
|
var doc = editor.getDoc();
|
21843
21931
|
var frag, temp;
|
21844
|
-
|
21845
|
-
|
21846
|
-
|
21847
|
-
|
21848
|
-
if (!args.no_events) {
|
21849
|
-
args = editor.fire('BeforeSetContent', args);
|
21850
|
-
if (args.isDefaultPrevented()) {
|
21851
|
-
editor.fire('SetContent', args);
|
21932
|
+
if (!contentArgs.no_events) {
|
21933
|
+
contentArgs = editor.fire('BeforeSetContent', contentArgs);
|
21934
|
+
if (contentArgs.isDefaultPrevented()) {
|
21935
|
+
editor.fire('SetContent', contentArgs);
|
21852
21936
|
return;
|
21853
21937
|
}
|
21854
21938
|
}
|
21855
|
-
content =
|
21939
|
+
content = cleanContent(editor, contentArgs);
|
21856
21940
|
if (rng.insertNode) {
|
21857
21941
|
content += '<span id="__caret">_</span>';
|
21858
21942
|
if (rng.startContainer === doc && rng.endContainer === doc) {
|
@@ -21884,19 +21968,20 @@
|
|
21884
21968
|
} catch (ex) {
|
21885
21969
|
}
|
21886
21970
|
} else {
|
21887
|
-
|
21971
|
+
var anyRng = rng;
|
21972
|
+
if (anyRng.item) {
|
21888
21973
|
doc.execCommand('Delete', false, null);
|
21889
|
-
|
21974
|
+
anyRng = editor.selection.getRng();
|
21890
21975
|
}
|
21891
21976
|
if (/^\s+/.test(content)) {
|
21892
|
-
|
21977
|
+
anyRng.pasteHTML('<span id="__mce_tmp">_</span>' + content);
|
21893
21978
|
editor.dom.remove('__mce_tmp');
|
21894
21979
|
} else {
|
21895
|
-
|
21980
|
+
anyRng.pasteHTML(content);
|
21896
21981
|
}
|
21897
21982
|
}
|
21898
|
-
if (!
|
21899
|
-
editor.fire('SetContent',
|
21983
|
+
if (!contentArgs.no_events) {
|
21984
|
+
editor.fire('SetContent', contentArgs);
|
21900
21985
|
}
|
21901
21986
|
};
|
21902
21987
|
var SetSelectionContent = { setContent: setContent };
|
@@ -22585,7 +22670,7 @@
|
|
22585
22670
|
return function () {
|
22586
22671
|
var newRng = getHorizontalRange(editor, forward);
|
22587
22672
|
if (newRng) {
|
22588
|
-
editor
|
22673
|
+
moveToRange(editor, newRng);
|
22589
22674
|
return true;
|
22590
22675
|
} else {
|
22591
22676
|
return false;
|
@@ -22596,7 +22681,7 @@
|
|
22596
22681
|
return function () {
|
22597
22682
|
var newRng = getVerticalRange(editor, down);
|
22598
22683
|
if (newRng) {
|
22599
|
-
editor
|
22684
|
+
moveToRange(editor, newRng);
|
22600
22685
|
return true;
|
22601
22686
|
} else {
|
22602
22687
|
return false;
|
@@ -22698,10 +22783,6 @@
|
|
22698
22783
|
});
|
22699
22784
|
};
|
22700
22785
|
|
22701
|
-
var moveToRange = function (editor, rng) {
|
22702
|
-
editor.selection.setRng(rng);
|
22703
|
-
ScrollIntoView.scrollRangeIntoView(editor, rng);
|
22704
|
-
};
|
22705
22786
|
var hasNextBreak = function (getPositionsUntil, scope, lineInfo) {
|
22706
22787
|
return lineInfo.breakAt.map(function (breakPos) {
|
22707
22788
|
return getPositionsUntil(scope, breakPos).breakAt.isSome();
|
@@ -23352,10 +23433,41 @@
|
|
23352
23433
|
}
|
23353
23434
|
return parent !== root ? editableRoot : root;
|
23354
23435
|
};
|
23436
|
+
var applyAttributes = function (editor, node, forcedRootBlockAttrs) {
|
23437
|
+
Option.from(forcedRootBlockAttrs.style).map(editor.dom.parseStyle).each(function (attrStyles) {
|
23438
|
+
var currentStyles = getAllRaw(Element.fromDom(node));
|
23439
|
+
var newStyles = __assign(__assign({}, currentStyles), attrStyles);
|
23440
|
+
editor.dom.setStyles(node, newStyles);
|
23441
|
+
});
|
23442
|
+
var attrClassesOpt = Option.from(forcedRootBlockAttrs.class).map(function (attrClasses) {
|
23443
|
+
return attrClasses.split(/\s+/);
|
23444
|
+
});
|
23445
|
+
var currentClassesOpt = Option.from(node.className).map(function (currentClasses) {
|
23446
|
+
return filter(currentClasses.split(/\s+/), function (clazz) {
|
23447
|
+
return clazz !== '';
|
23448
|
+
});
|
23449
|
+
});
|
23450
|
+
lift2(attrClassesOpt, currentClassesOpt, function (attrClasses, currentClasses) {
|
23451
|
+
var filteredClasses = filter(currentClasses, function (clazz) {
|
23452
|
+
return !contains(attrClasses, clazz);
|
23453
|
+
});
|
23454
|
+
var newClasses = __spreadArrays(attrClasses, filteredClasses);
|
23455
|
+
editor.dom.setAttrib(node, 'class', newClasses.join(' '));
|
23456
|
+
});
|
23457
|
+
var appliedAttrs = [
|
23458
|
+
'style',
|
23459
|
+
'class'
|
23460
|
+
];
|
23461
|
+
var remainingAttrs = bifilter(forcedRootBlockAttrs, function (_, attrs) {
|
23462
|
+
return !contains(appliedAttrs, attrs);
|
23463
|
+
}).t;
|
23464
|
+
editor.dom.setAttribs(node, remainingAttrs);
|
23465
|
+
};
|
23355
23466
|
var setForcedBlockAttrs = function (editor, node) {
|
23356
23467
|
var forcedRootBlockName = Settings.getForcedRootBlock(editor);
|
23357
23468
|
if (forcedRootBlockName && forcedRootBlockName.toLowerCase() === node.tagName.toLowerCase()) {
|
23358
|
-
|
23469
|
+
var forcedRootBlockAttrs = Settings.getForcedRootBlockAttrs(editor);
|
23470
|
+
applyAttributes(editor, node, forcedRootBlockAttrs);
|
23359
23471
|
}
|
23360
23472
|
};
|
23361
23473
|
var wrapSelfAndSiblingsInDefaultBlock = function (editor, newBlockName, rng, container, offset) {
|
@@ -23421,7 +23533,6 @@
|
|
23421
23533
|
var textInlineElements = schema.getTextInlineElements();
|
23422
23534
|
if (name || parentBlockName === 'TABLE' || parentBlockName === 'HR') {
|
23423
23535
|
block = dom.create(name || newBlockName);
|
23424
|
-
setForcedBlockAttrs(editor, block);
|
23425
23536
|
} else {
|
23426
23537
|
block = parentBlock.cloneNode(false);
|
23427
23538
|
}
|
@@ -23447,6 +23558,7 @@
|
|
23447
23558
|
}
|
23448
23559
|
} while ((node = node.parentNode) && node !== editableRoot);
|
23449
23560
|
}
|
23561
|
+
setForcedBlockAttrs(editor, block);
|
23450
23562
|
emptyBlock(caretNode);
|
23451
23563
|
return block;
|
23452
23564
|
};
|
@@ -23553,6 +23665,7 @@
|
|
23553
23665
|
if (dom.isEmpty(parentBlock)) {
|
23554
23666
|
emptyBlock(parentBlock);
|
23555
23667
|
}
|
23668
|
+
setForcedBlockAttrs(editor, newBlock);
|
23556
23669
|
NewLineUtils.moveToCaretPosition(editor, newBlock);
|
23557
23670
|
} else if (isCaretAtStartOrEndOfBlock()) {
|
23558
23671
|
insertNewBlockAfter();
|
@@ -23577,6 +23690,7 @@
|
|
23577
23690
|
dom.remove(newBlock);
|
23578
23691
|
insertNewBlockAfter();
|
23579
23692
|
} else {
|
23693
|
+
setForcedBlockAttrs(editor, newBlock);
|
23580
23694
|
NewLineUtils.moveToCaretPosition(editor, newBlock);
|
23581
23695
|
}
|
23582
23696
|
}
|
@@ -26267,15 +26381,15 @@
|
|
26267
26381
|
defaultSettings: {},
|
26268
26382
|
$: DomQuery,
|
26269
26383
|
majorVersion: '4',
|
26270
|
-
minorVersion: '9.
|
26271
|
-
releaseDate: '2020-
|
26384
|
+
minorVersion: '9.11',
|
26385
|
+
releaseDate: '2020-07-13',
|
26272
26386
|
editors: legacyEditors,
|
26273
26387
|
i18n: I18n,
|
26274
26388
|
activeEditor: null,
|
26275
26389
|
settings: {},
|
26276
26390
|
setup: function () {
|
26277
26391
|
var self = this;
|
26278
|
-
var baseURL, documentBaseURL, suffix = ''
|
26392
|
+
var baseURL, documentBaseURL, suffix = '';
|
26279
26393
|
documentBaseURL = URI.getDocumentBaseUrl(domGlobals.document.location);
|
26280
26394
|
if (/^[^:]+:\/\/\/?[^\/]+\//.test(documentBaseURL)) {
|
26281
26395
|
documentBaseURL = documentBaseURL.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, '');
|
@@ -26283,14 +26397,17 @@
|
|
26283
26397
|
documentBaseURL += '/';
|
26284
26398
|
}
|
26285
26399
|
}
|
26286
|
-
preInit = window.tinymce || window.tinyMCEPreInit;
|
26400
|
+
var preInit = window.tinymce || window.tinyMCEPreInit;
|
26287
26401
|
if (preInit) {
|
26288
26402
|
baseURL = preInit.base || preInit.baseURL;
|
26289
26403
|
suffix = preInit.suffix;
|
26290
26404
|
} else {
|
26291
26405
|
var scripts = domGlobals.document.getElementsByTagName('script');
|
26292
26406
|
for (var i = 0; i < scripts.length; i++) {
|
26293
|
-
src = scripts[i].src;
|
26407
|
+
var src = scripts[i].src || '';
|
26408
|
+
if (src === '') {
|
26409
|
+
continue;
|
26410
|
+
}
|
26294
26411
|
var srcScript = src.substring(src.lastIndexOf('/'));
|
26295
26412
|
if (/tinymce(\.full|\.jquery|)(\.min|\.dev|)\.js/.test(src)) {
|
26296
26413
|
if (srcScript.indexOf('.min') !== -1) {
|
@@ -26301,7 +26418,7 @@
|
|
26301
26418
|
}
|
26302
26419
|
}
|
26303
26420
|
if (!baseURL && domGlobals.document.currentScript) {
|
26304
|
-
src = domGlobals.document.currentScript.src;
|
26421
|
+
var src = domGlobals.document.currentScript.src;
|
26305
26422
|
if (src.indexOf('.min') !== -1) {
|
26306
26423
|
suffix = '.min';
|
26307
26424
|
}
|