tinymce-rails 4.6.0 → 4.6.1
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 +219 -128
- data/lib/tinymce/rails/version.rb +2 -2
- data/vendor/assets/javascripts/tinymce/jquery.tinymce.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/visualblocks/css/visualblocks.css +38 -19
- data/vendor/assets/javascripts/tinymce/themes/modern/theme.js +1 -1
- data/vendor/assets/javascripts/tinymce/tinymce.js +15 -14
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf1dfae47b1cc7df0aa69ab91992bd0619c078bc
|
4
|
+
data.tar.gz: daf504ea97ac8e29cccfa8679af34689b8207ce8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36911f091f3b7c365a2d0a66b927f008172c137aea485cb4575c56b87c3d51ec591567e88ee004b790ab338bb817c3d57ac52d50f13f0c3f6b1236472a2434c3
|
7
|
+
data.tar.gz: b6b4412f02611d65b90d4dc91b00f36548e90d19c3fa5ab0a2b93ceb3f07e80b73741bfcb3a9316057fbc936ea5321a703c3b57e84f1bbf42f1f16e293013749
|
@@ -1,3 +1,4 @@
|
|
1
|
+
// 4.6.1 (2017-05-10)
|
1
2
|
(function () {
|
2
3
|
|
3
4
|
var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
|
@@ -6487,7 +6488,20 @@ define(
|
|
6487
6488
|
|
6488
6489
|
function encodeNamedAndNumeric(text, attr) {
|
6489
6490
|
return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {
|
6490
|
-
|
6491
|
+
if (baseEntities[chr] !== undefined) {
|
6492
|
+
return baseEntities[chr];
|
6493
|
+
}
|
6494
|
+
|
6495
|
+
if (entities[chr] !== undefined) {
|
6496
|
+
return entities[chr];
|
6497
|
+
}
|
6498
|
+
|
6499
|
+
// Convert multi-byte sequences to a single entity.
|
6500
|
+
if (chr.length > 1) {
|
6501
|
+
return '&#' + (((chr.charCodeAt(0) - 0xD800) * 0x400) + (chr.charCodeAt(1) - 0xDC00) + 0x10000) + ';';
|
6502
|
+
}
|
6503
|
+
|
6504
|
+
return '&#' + chr.charCodeAt(0) + ';';
|
6491
6505
|
});
|
6492
6506
|
}
|
6493
6507
|
|
@@ -19287,7 +19301,7 @@ define(
|
|
19287
19301
|
if (!self.tridentSel) {
|
19288
19302
|
sel = self.getSel();
|
19289
19303
|
|
19290
|
-
evt = self.editor.fire('SetSelectionRange', { range: rng });
|
19304
|
+
evt = self.editor.fire('SetSelectionRange', { range: rng, forward: forward });
|
19291
19305
|
rng = evt.range;
|
19292
19306
|
|
19293
19307
|
if (sel) {
|
@@ -19335,7 +19349,7 @@ define(
|
|
19335
19349
|
}
|
19336
19350
|
}
|
19337
19351
|
|
19338
|
-
self.editor.fire('AfterSetSelectionRange', { range: rng });
|
19352
|
+
self.editor.fire('AfterSetSelectionRange', { range: rng, forward: forward });
|
19339
19353
|
} else {
|
19340
19354
|
// Is W3C Range fake range on IE
|
19341
19355
|
if (rng.cloneRange) {
|
@@ -22732,8 +22746,8 @@ define(
|
|
22732
22746
|
*/
|
22733
22747
|
function moveStart(rng) {
|
22734
22748
|
var container = rng.startContainer,
|
22735
|
-
offset = rng.startOffset,
|
22736
|
-
walker, node, nodes
|
22749
|
+
offset = rng.startOffset,
|
22750
|
+
walker, node, nodes;
|
22737
22751
|
|
22738
22752
|
if (rng.startContainer == rng.endContainer) {
|
22739
22753
|
if (isInlineBlock(rng.startContainer.childNodes[rng.startOffset])) {
|
@@ -22746,31 +22760,24 @@ define(
|
|
22746
22760
|
// Get the parent container location and walk from there
|
22747
22761
|
offset = nodeIndex(container);
|
22748
22762
|
container = container.parentNode;
|
22749
|
-
isAtEndOfText = true;
|
22750
22763
|
}
|
22751
22764
|
|
22752
22765
|
// Move startContainer/startOffset in to a suitable node
|
22753
22766
|
if (container.nodeType == 1) {
|
22754
22767
|
nodes = container.childNodes;
|
22755
|
-
|
22756
|
-
|
22757
|
-
|
22758
|
-
|
22759
|
-
|
22760
|
-
walker.
|
22768
|
+
if (offset < nodes.length) {
|
22769
|
+
container = nodes[offset];
|
22770
|
+
walker = new TreeWalker(container, dom.getParent(container, dom.isBlock));
|
22771
|
+
} else {
|
22772
|
+
container = nodes[nodes.length - 1];
|
22773
|
+
walker = new TreeWalker(container, dom.getParent(container, dom.isBlock));
|
22774
|
+
walker.next(true);
|
22761
22775
|
}
|
22762
22776
|
|
22763
22777
|
for (node = walker.current(); node; node = walker.next()) {
|
22764
22778
|
if (node.nodeType == 3 && !isWhiteSpaceNode(node)) {
|
22765
|
-
// IE has a "neat" feature where it moves the start node into the closest element
|
22766
|
-
// we can avoid this by inserting an element before it and then remove it after we set the selection
|
22767
|
-
tmpNode = dom.create('a', { 'data-mce-bogus': 'all' }, INVISIBLE_CHAR);
|
22768
|
-
node.parentNode.insertBefore(tmpNode, node);
|
22769
|
-
|
22770
|
-
// Set selection and remove tmpNode
|
22771
22779
|
rng.setStart(node, 0);
|
22772
22780
|
selection.setRng(rng);
|
22773
|
-
dom.remove(tmpNode);
|
22774
22781
|
|
22775
22782
|
return;
|
22776
22783
|
}
|
@@ -25670,6 +25677,9 @@ define(
|
|
25670
25677
|
|
25671
25678
|
if (startCaretPosition.isEqual(CaretPosition.after(rootNode)) && rootNode.lastChild) {
|
25672
25679
|
caretPosition = CaretPosition.after(rootNode.lastChild);
|
25680
|
+
if (isBackwards(direction) && isCaretCandidate(rootNode.lastChild) && isElement(rootNode.lastChild)) {
|
25681
|
+
return isBr(rootNode.lastChild) ? CaretPosition.before(rootNode.lastChild) : caretPosition;
|
25682
|
+
}
|
25673
25683
|
} else {
|
25674
25684
|
caretPosition = startCaretPosition;
|
25675
25685
|
}
|
@@ -26351,11 +26361,12 @@ define(
|
|
26351
26361
|
'tinymce.core.dom.NodeType'
|
26352
26362
|
],
|
26353
26363
|
function (Arr, Option, Insert, Remove, Element, Traverse, CaretFinder, CaretPosition, Empty, NodeType) {
|
26354
|
-
var mergeBlocksAndReposition = function (fromBlock, toBlock, toPosition) {
|
26364
|
+
var mergeBlocksAndReposition = function (forward, fromBlock, toBlock, toPosition) {
|
26355
26365
|
var children = Traverse.children(fromBlock);
|
26356
26366
|
|
26357
26367
|
if (NodeType.isBr(toPosition.getNode())) {
|
26358
26368
|
Remove.remove(Element.fromDom(toPosition.getNode()));
|
26369
|
+
toPosition = CaretFinder.positionIn(false, toBlock.dom()).getOr();
|
26359
26370
|
}
|
26360
26371
|
|
26361
26372
|
Arr.each(children, function (node) {
|
@@ -26366,17 +26377,17 @@ define(
|
|
26366
26377
|
Remove.remove(fromBlock);
|
26367
26378
|
}
|
26368
26379
|
|
26369
|
-
return children.length > 0 ? Option.
|
26380
|
+
return children.length > 0 ? Option.from(toPosition) : Option.none();
|
26370
26381
|
};
|
26371
26382
|
|
26372
26383
|
var mergeBlocks = function (forward, block1, block2) {
|
26373
26384
|
if (forward) {
|
26374
26385
|
return CaretFinder.positionIn(false, block1.dom()).bind(function (toPosition) {
|
26375
|
-
return mergeBlocksAndReposition(block2, block1, toPosition);
|
26386
|
+
return mergeBlocksAndReposition(forward, block2, block1, toPosition);
|
26376
26387
|
});
|
26377
26388
|
} else {
|
26378
26389
|
return CaretFinder.positionIn(false, block2.dom()).bind(function (toPosition) {
|
26379
|
-
return mergeBlocksAndReposition(block1, block2, toPosition);
|
26390
|
+
return mergeBlocksAndReposition(forward, block1, block2, toPosition);
|
26380
26391
|
});
|
26381
26392
|
}
|
26382
26393
|
};
|
@@ -26612,12 +26623,15 @@ define(
|
|
26612
26623
|
[
|
26613
26624
|
'ephox.katamari.api.Adt',
|
26614
26625
|
'ephox.katamari.api.Option',
|
26626
|
+
'ephox.sugar.api.node.Element',
|
26615
26627
|
'tinymce.core.caret.CaretFinder',
|
26616
26628
|
'tinymce.core.caret.CaretPosition',
|
26617
26629
|
'tinymce.core.caret.CaretUtils',
|
26630
|
+
'tinymce.core.delete.DeleteUtils',
|
26631
|
+
'tinymce.core.dom.Empty',
|
26618
26632
|
'tinymce.core.dom.NodeType'
|
26619
26633
|
],
|
26620
|
-
function (Adt, Option, CaretFinder, CaretPosition, CaretUtils, NodeType) {
|
26634
|
+
function (Adt, Option, Element, CaretFinder, CaretPosition, CaretUtils, DeleteUtils, Empty, NodeType) {
|
26621
26635
|
var DeleteAction = Adt.generate([
|
26622
26636
|
{ remove: [ 'element' ] },
|
26623
26637
|
{ moveToElement: [ 'element' ] },
|
@@ -26630,12 +26644,21 @@ define(
|
|
26630
26644
|
return NodeType.isElement(elm) && elm.getAttribute('data-mce-caret') === caretLocation;
|
26631
26645
|
};
|
26632
26646
|
|
26647
|
+
var deleteEmptyBlockOrMoveToCef = function (rootNode, forward, from, to) {
|
26648
|
+
var toCefElm = to.getNode(forward === false);
|
26649
|
+
return DeleteUtils.getParentTextBlock(Element.fromDom(rootNode), Element.fromDom(from.getNode())).map(function (blockElm) {
|
26650
|
+
return Empty.isEmpty(blockElm) ? DeleteAction.remove(blockElm.dom()) : DeleteAction.moveToElement(toCefElm);
|
26651
|
+
}).orThunk(function () {
|
26652
|
+
return Option.some(DeleteAction.moveToElement(toCefElm));
|
26653
|
+
});
|
26654
|
+
};
|
26655
|
+
|
26633
26656
|
var findCefPosition = function (rootNode, forward, from) {
|
26634
26657
|
return CaretFinder.fromPosition(forward, rootNode, from).bind(function (to) {
|
26635
26658
|
if (forward && NodeType.isContentEditableFalse(to.getNode())) {
|
26636
|
-
return
|
26659
|
+
return deleteEmptyBlockOrMoveToCef(rootNode, forward, from, to);
|
26637
26660
|
} else if (forward === false && NodeType.isContentEditableFalse(to.getNode(true))) {
|
26638
|
-
return
|
26661
|
+
return deleteEmptyBlockOrMoveToCef(rootNode, forward, from, to);
|
26639
26662
|
} else if (forward && CaretUtils.isAfterContentEditableFalse(from)) {
|
26640
26663
|
return Option.some(DeleteAction.moveToPosition(to));
|
26641
26664
|
} else if (forward === false && CaretUtils.isBeforeContentEditableFalse(from)) {
|
@@ -26854,32 +26877,72 @@ define(
|
|
26854
26877
|
return NodeType.isText(node) ? new CaretPosition(node, node.data.length) : CaretPosition.after(node);
|
26855
26878
|
};
|
26856
26879
|
|
26857
|
-
var
|
26880
|
+
var getPreviousSiblingCaretPosition = function (elm) {
|
26858
26881
|
if (CaretCandidate.isCaretCandidate(elm.previousSibling)) {
|
26859
26882
|
return Option.some(afterOrEndOf(elm.previousSibling));
|
26860
|
-
} else if (CaretCandidate.isCaretCandidate(elm.nextSibling)) {
|
26861
|
-
return Option.some(beforeOrStartOf(elm));
|
26862
26883
|
} else {
|
26863
|
-
return InlineUtils.
|
26864
|
-
|
26865
|
-
|
26866
|
-
|
26867
|
-
|
26868
|
-
|
26884
|
+
return elm.previousSibling ? InlineUtils.findCaretPositionIn(elm.previousSibling, false) : Option.none();
|
26885
|
+
}
|
26886
|
+
};
|
26887
|
+
|
26888
|
+
var getNextSiblingCaretPosition = function (elm) {
|
26889
|
+
if (CaretCandidate.isCaretCandidate(elm.nextSibling)) {
|
26890
|
+
return Option.some(beforeOrStartOf(elm.nextSibling));
|
26891
|
+
} else {
|
26892
|
+
return elm.nextSibling ? InlineUtils.findCaretPositionIn(elm.nextSibling, true) : Option.none();
|
26869
26893
|
}
|
26870
26894
|
};
|
26871
26895
|
|
26896
|
+
var findCaretPositionBackwardsFromElm = function (rootElement, elm) {
|
26897
|
+
var startPosition = CaretPosition.before(elm.previousSibling ? elm.previousSibling : elm.parentNode);
|
26898
|
+
return InlineUtils.findCaretPosition(rootElement, false, startPosition).fold(
|
26899
|
+
function () {
|
26900
|
+
return InlineUtils.findCaretPosition(rootElement, true, CaretPosition.after(elm));
|
26901
|
+
},
|
26902
|
+
Option.some
|
26903
|
+
);
|
26904
|
+
};
|
26905
|
+
|
26906
|
+
var findCaretPositionForwardsFromElm = function (rootElement, elm) {
|
26907
|
+
return InlineUtils.findCaretPosition(rootElement, true, CaretPosition.after(elm)).fold(
|
26908
|
+
function () {
|
26909
|
+
return InlineUtils.findCaretPosition(rootElement, false, CaretPosition.before(elm));
|
26910
|
+
},
|
26911
|
+
Option.some
|
26912
|
+
);
|
26913
|
+
};
|
26914
|
+
|
26915
|
+
var findCaretPositionBackwards = function (rootElement, elm) {
|
26916
|
+
return getPreviousSiblingCaretPosition(elm).orThunk(function () {
|
26917
|
+
return getNextSiblingCaretPosition(elm);
|
26918
|
+
}).orThunk(function () {
|
26919
|
+
return findCaretPositionBackwardsFromElm(rootElement, elm);
|
26920
|
+
});
|
26921
|
+
};
|
26922
|
+
|
26923
|
+
var findCaretPositionForward = function (rootElement, elm) {
|
26924
|
+
return getNextSiblingCaretPosition(elm).orThunk(function () {
|
26925
|
+
return getPreviousSiblingCaretPosition(elm);
|
26926
|
+
}).orThunk(function () {
|
26927
|
+
return findCaretPositionForwardsFromElm(rootElement, elm);
|
26928
|
+
});
|
26929
|
+
};
|
26930
|
+
|
26931
|
+
var findCaretPosition = function (forward, rootElement, elm) {
|
26932
|
+
return forward ? findCaretPositionForward(rootElement, elm) : findCaretPositionBackwards(rootElement, elm);
|
26933
|
+
};
|
26934
|
+
|
26872
26935
|
var findCaretPosOutsideElmAfterDelete = function (forward, rootElement, elm) {
|
26873
26936
|
return findCaretPosition(forward, rootElement, elm).map(Fun.curry(reposition, elm));
|
26874
26937
|
};
|
26875
26938
|
|
26876
|
-
var setSelection = function (editor, pos) {
|
26939
|
+
var setSelection = function (editor, forward, pos) {
|
26877
26940
|
pos.fold(
|
26878
26941
|
function () {
|
26879
26942
|
editor.focus();
|
26880
26943
|
},
|
26881
26944
|
function (pos) {
|
26882
|
-
editor.selection.setRng(pos.toRange());
|
26945
|
+
editor.selection.setRng(pos.toRange(), forward);
|
26883
26946
|
}
|
26884
26947
|
);
|
26885
26948
|
};
|
@@ -26913,10 +26976,10 @@ define(
|
|
26913
26976
|
|
26914
26977
|
parentBlock.bind(paddEmptyBlock).fold(
|
26915
26978
|
function () {
|
26916
|
-
setSelection(editor, afterDeletePos);
|
26979
|
+
setSelection(editor, forward, afterDeletePos);
|
26917
26980
|
},
|
26918
26981
|
function (paddPos) {
|
26919
|
-
setSelection(editor, Option.some(paddPos));
|
26982
|
+
setSelection(editor, forward, Option.some(paddPos));
|
26920
26983
|
}
|
26921
26984
|
);
|
26922
26985
|
};
|
@@ -27369,12 +27432,18 @@ define(
|
|
27369
27432
|
{ after: [ 'element' ] }
|
27370
27433
|
]);
|
27371
27434
|
|
27435
|
+
var rescope = function (rootNode, node) {
|
27436
|
+
var parentBlock = CaretUtils.getParentBlock(node, rootNode);
|
27437
|
+
return parentBlock ? parentBlock : rootNode;
|
27438
|
+
};
|
27439
|
+
|
27372
27440
|
var before = function (rootNode, pos) {
|
27373
27441
|
var nPos = InlineUtils.normalizeForwards(pos);
|
27374
|
-
|
27442
|
+
var scope = rescope(rootNode, nPos.container());
|
27443
|
+
return InlineUtils.findInline(scope, nPos).fold(
|
27375
27444
|
function () {
|
27376
|
-
return InlineUtils.findCaretPosition(
|
27377
|
-
.bind(Fun.curry(InlineUtils.findInline,
|
27445
|
+
return InlineUtils.findCaretPosition(scope, true, nPos)
|
27446
|
+
.bind(Fun.curry(InlineUtils.findInline, scope))
|
27378
27447
|
.map(function (inline) {
|
27379
27448
|
return Location.before(inline);
|
27380
27449
|
});
|
@@ -27401,10 +27470,11 @@ define(
|
|
27401
27470
|
|
27402
27471
|
var after = function (rootNode, pos) {
|
27403
27472
|
var nPos = InlineUtils.normalizeBackwards(pos);
|
27404
|
-
|
27473
|
+
var scope = rescope(rootNode, nPos.container());
|
27474
|
+
return InlineUtils.findInline(scope, nPos).fold(
|
27405
27475
|
function () {
|
27406
|
-
return InlineUtils.findCaretPosition(
|
27407
|
-
.bind(Fun.curry(InlineUtils.findInline,
|
27476
|
+
return InlineUtils.findCaretPosition(scope, false, nPos)
|
27477
|
+
.bind(Fun.curry(InlineUtils.findInline, scope))
|
27408
27478
|
.map(function (inline) {
|
27409
27479
|
return Location.after(inline);
|
27410
27480
|
});
|
@@ -27437,6 +27507,15 @@ define(
|
|
27437
27507
|
);
|
27438
27508
|
};
|
27439
27509
|
|
27510
|
+
var getName = function (location) {
|
27511
|
+
return location.fold(
|
27512
|
+
Fun.constant('before'), // Before
|
27513
|
+
Fun.constant('start'), // Start
|
27514
|
+
Fun.constant('end'), // End
|
27515
|
+
Fun.constant('after') // After
|
27516
|
+
);
|
27517
|
+
};
|
27518
|
+
|
27440
27519
|
var outside = function (location) {
|
27441
27520
|
return location.fold(
|
27442
27521
|
Location.before, // Before
|
@@ -27455,13 +27534,8 @@ define(
|
|
27455
27534
|
);
|
27456
27535
|
};
|
27457
27536
|
|
27458
|
-
var
|
27459
|
-
return
|
27460
|
-
Fun.constant(false), // Before
|
27461
|
-
Fun.constant(true), // Start
|
27462
|
-
Fun.constant(true), // End
|
27463
|
-
Fun.constant(false) // After
|
27464
|
-
);
|
27537
|
+
var isEq = function (location1, location2) {
|
27538
|
+
return getName(location1) === getName(location2) && getElement(location1) === getElement(location2);
|
27465
27539
|
};
|
27466
27540
|
|
27467
27541
|
var betweenInlines = function (forward, rootNode, from, to, location) {
|
@@ -27478,72 +27552,60 @@ define(
|
|
27478
27552
|
}).getOr(location);
|
27479
27553
|
};
|
27480
27554
|
|
27481
|
-
var
|
27482
|
-
return
|
27483
|
-
|
27484
|
-
|
27485
|
-
|
27486
|
-
return InlineUtils.findCaretPosition(rootBlock, true, pos).bind(function (nextPos) {
|
27487
|
-
if (NodeType.isBr(nextPos.getNode())) {
|
27488
|
-
return InlineUtils.findCaretPosition(rootBlock, true, CaretPosition.after(nextPos.getNode()));
|
27489
|
-
} else {
|
27490
|
-
return Option.some(nextPos);
|
27555
|
+
var skipNoMovement = function (fromLocation, toLocation) {
|
27556
|
+
return fromLocation.fold(
|
27557
|
+
Fun.constant(true),
|
27558
|
+
function (fromLocation) {
|
27559
|
+
return !isEq(fromLocation, toLocation);
|
27491
27560
|
}
|
27492
|
-
|
27493
|
-
};
|
27494
|
-
|
27495
|
-
var isEndPositionInBlock = function (forward, rootBlock, pos) {
|
27496
|
-
return forward ? isLastPositionInBlock(rootBlock, pos) : isFirstPositionInBlock(rootBlock, pos);
|
27497
|
-
};
|
27498
|
-
|
27499
|
-
var onlyOutside = function (location) {
|
27500
|
-
if (isInside(location)) {
|
27501
|
-
return Option.some(outside(location));
|
27502
|
-
} else {
|
27503
|
-
return Option.none();
|
27504
|
-
}
|
27505
|
-
};
|
27506
|
-
|
27507
|
-
var findFirstOrLastLocationInBlock = function (rootNode, forward, toBlock) {
|
27508
|
-
return InlineUtils.findCaretPositionIn(toBlock, forward).bind(function (lastPosition) {
|
27509
|
-
return readLocation(toBlock, lastPosition).map(outside);
|
27510
|
-
});
|
27511
|
-
};
|
27512
|
-
|
27513
|
-
var betweenBlocks = function (forward, rootNode, from, to, location) {
|
27514
|
-
var fromBlock = CaretUtils.getParentBlock(from.container(), rootNode);
|
27515
|
-
if (isEndPositionInBlock(forward, fromBlock, to) && isInside(location) === false) {
|
27516
|
-
return readLocation(rootNode, from).bind(onlyOutside);
|
27517
|
-
} else if (isEndPositionInBlock(forward, fromBlock, from)) {
|
27518
|
-
return readLocation(rootNode, from)
|
27519
|
-
.bind(onlyOutside)
|
27520
|
-
.orThunk(function () {
|
27521
|
-
return Option.from(CaretUtils.getParentBlock(to.container(), rootNode)).bind(function (toBlock) {
|
27522
|
-
return findFirstOrLastLocationInBlock(rootNode, forward, toBlock);
|
27523
|
-
});
|
27524
|
-
});
|
27525
|
-
} else {
|
27526
|
-
return Option.some(location);
|
27527
|
-
}
|
27561
|
+
);
|
27528
27562
|
};
|
27529
27563
|
|
27530
|
-
var
|
27564
|
+
var findLocationTraverse = function (forward, rootNode, fromLocation, pos) {
|
27531
27565
|
var from = InlineUtils.normalizePosition(forward, pos);
|
27532
27566
|
var to = InlineUtils.findCaretPosition(rootNode, forward, from).map(Fun.curry(InlineUtils.normalizePosition, forward));
|
27567
|
+
|
27533
27568
|
var location = to.fold(
|
27534
27569
|
function () {
|
27535
|
-
return
|
27570
|
+
return fromLocation.map(outside);
|
27536
27571
|
},
|
27537
27572
|
function (to) {
|
27538
27573
|
return readLocation(rootNode, to)
|
27539
|
-
.
|
27540
|
-
.
|
27574
|
+
.map(Fun.curry(betweenInlines, forward, rootNode, from, to))
|
27575
|
+
.filter(Fun.curry(skipNoMovement, fromLocation));
|
27541
27576
|
}
|
27542
27577
|
);
|
27543
27578
|
|
27544
27579
|
return location.filter(isValidLocation);
|
27545
27580
|
};
|
27546
27581
|
|
27582
|
+
var findLocationSimple = function (forward, location) {
|
27583
|
+
if (forward) {
|
27584
|
+
return location.fold(
|
27585
|
+
Fun.compose(Option.some, Location.start), // Before -> Start
|
27586
|
+
Option.none,
|
27587
|
+
Fun.compose(Option.some, Location.after), // End -> After
|
27588
|
+
Option.none
|
27589
|
+
);
|
27590
|
+
} else {
|
27591
|
+
return location.fold(
|
27592
|
+
Option.none,
|
27593
|
+
Fun.compose(Option.some, Location.before), // Before <- Start
|
27594
|
+
Option.none,
|
27595
|
+
Fun.compose(Option.some, Location.end) // End <- After
|
27596
|
+
);
|
27597
|
+
}
|
27598
|
+
};
|
27599
|
+
|
27600
|
+
var findLocation = function (forward, rootNode, pos) {
|
27601
|
+
var from = InlineUtils.normalizePosition(forward, pos);
|
27602
|
+
var fromLocation = readLocation(rootNode, from);
|
27603
|
+
|
27604
|
+
return readLocation(rootNode, from).bind(Fun.curry(findLocationSimple, forward)).orThunk(function () {
|
27605
|
+
return findLocationTraverse(forward, rootNode, fromLocation, pos);
|
27606
|
+
});
|
27607
|
+
};
|
27608
|
+
|
27547
27609
|
return {
|
27548
27610
|
readLocation: readLocation,
|
27549
27611
|
prevLocation: Fun.curry(findLocation, false),
|
@@ -27720,13 +27782,18 @@ define(
|
|
27720
27782
|
'ephox.sugar.api.node.Element',
|
27721
27783
|
'tinymce.core.caret.CaretContainer',
|
27722
27784
|
'tinymce.core.caret.CaretPosition',
|
27785
|
+
'tinymce.core.caret.CaretUtils',
|
27723
27786
|
'tinymce.core.delete.DeleteElement',
|
27724
27787
|
'tinymce.core.keyboard.BoundaryCaret',
|
27725
27788
|
'tinymce.core.keyboard.BoundaryLocation',
|
27726
27789
|
'tinymce.core.keyboard.BoundarySelection',
|
27727
27790
|
'tinymce.core.keyboard.InlineUtils'
|
27728
27791
|
],
|
27729
|
-
function (Fun, Option, Options, Element, CaretContainer, CaretPosition, DeleteElement, BoundaryCaret, BoundaryLocation, BoundarySelection, InlineUtils) {
|
27792
|
+
function (Fun, Option, Options, Element, CaretContainer, CaretPosition, CaretUtils, DeleteElement, BoundaryCaret, BoundaryLocation, BoundarySelection, InlineUtils) {
|
27793
|
+
var isFeatureEnabled = function (editor) {
|
27794
|
+
return editor.settings.inline_boundaries !== false;
|
27795
|
+
};
|
27796
|
+
|
27730
27797
|
var rangeFromPositions = function (from, to) {
|
27731
27798
|
var range = document.createRange();
|
27732
27799
|
|
@@ -27760,8 +27827,13 @@ define(
|
|
27760
27827
|
editor.nodeChanged();
|
27761
27828
|
};
|
27762
27829
|
|
27830
|
+
var rescope = function (rootNode, node) {
|
27831
|
+
var parentBlock = CaretUtils.getParentBlock(node, rootNode);
|
27832
|
+
return parentBlock ? parentBlock : rootNode;
|
27833
|
+
};
|
27834
|
+
|
27763
27835
|
var backspaceDeleteCollapsed = function (editor, caret, forward, from) {
|
27764
|
-
var rootNode = editor.getBody();
|
27836
|
+
var rootNode = rescope(editor.getBody(), from.container());
|
27765
27837
|
var fromLocation = BoundaryLocation.readLocation(rootNode, from);
|
27766
27838
|
|
27767
27839
|
return fromLocation.bind(function (location) {
|
@@ -27789,10 +27861,10 @@ define(
|
|
27789
27861
|
});
|
27790
27862
|
|
27791
27863
|
if (fromLocation.isSome() && toLocation.isSome()) {
|
27792
|
-
InlineUtils.findInline(rootNode, from).
|
27793
|
-
|
27794
|
-
|
27795
|
-
|
27864
|
+
return InlineUtils.findInline(rootNode, from).map(function (elm) {
|
27865
|
+
DeleteElement.deleteElement(editor, forward, Element.fromDom(elm));
|
27866
|
+
return true;
|
27867
|
+
}).getOr(false);
|
27796
27868
|
} else {
|
27797
27869
|
return toLocation.map(function (_) {
|
27798
27870
|
toPosition.map(function (to) {
|
@@ -27810,7 +27882,7 @@ define(
|
|
27810
27882
|
};
|
27811
27883
|
|
27812
27884
|
var backspaceDelete = function (editor, caret, forward) {
|
27813
|
-
if (editor.selection.isCollapsed()) {
|
27885
|
+
if (editor.selection.isCollapsed() && isFeatureEnabled(editor)) {
|
27814
27886
|
var from = CaretPosition.fromRangeStart(editor.selection.getRng());
|
27815
27887
|
return backspaceDeleteCollapsed(editor, caret, forward, from);
|
27816
27888
|
}
|
@@ -38890,12 +38962,12 @@ define(
|
|
38890
38962
|
'tinymce.core.keyboard.MatchKeys',
|
38891
38963
|
'tinymce.core.util.VK'
|
38892
38964
|
],
|
38893
|
-
function (Arr, BlockBoundaryDelete, BlockRangeDelete, CefDelete,
|
38965
|
+
function (Arr, BlockBoundaryDelete, BlockRangeDelete, CefDelete, InlineBoundaryDelete, MatchKeys, VK) {
|
38894
38966
|
var setupKeyDownHandler = function (editor, caret) {
|
38895
38967
|
editor.on('keydown', function (evt) {
|
38896
38968
|
var matches = MatchKeys.match([
|
38897
|
-
{ keyCode: VK.BACKSPACE, action: MatchKeys.action(
|
38898
|
-
{ keyCode: VK.DELETE, action: MatchKeys.action(
|
38969
|
+
{ keyCode: VK.BACKSPACE, action: MatchKeys.action(InlineBoundaryDelete.backspaceDelete, editor, caret, false) },
|
38970
|
+
{ keyCode: VK.DELETE, action: MatchKeys.action(InlineBoundaryDelete.backspaceDelete, editor, caret, true) },
|
38899
38971
|
{ keyCode: VK.BACKSPACE, action: MatchKeys.action(CefDelete.backspaceDelete, editor, false) },
|
38900
38972
|
{ keyCode: VK.DELETE, action: MatchKeys.action(CefDelete.backspaceDelete, editor, true) },
|
38901
38973
|
{ keyCode: VK.BACKSPACE, action: MatchKeys.action(BlockRangeDelete.backspaceDelete, editor, false) },
|
@@ -38976,6 +39048,10 @@ define(
|
|
38976
39048
|
elm.innerHTML = !isIE ? '<br data-mce-bogus="1">' : '';
|
38977
39049
|
};
|
38978
39050
|
|
39051
|
+
var containerAndSiblingName = function (container, nodeName) {
|
39052
|
+
return container.nodeName === nodeName || (container.previousSibling && container.previousSibling.nodeName === nodeName);
|
39053
|
+
};
|
39054
|
+
|
38979
39055
|
// Returns true if the block can be split into two blocks or not
|
38980
39056
|
var canSplitBlock = function (dom, node) {
|
38981
39057
|
return node &&
|
@@ -39166,7 +39242,7 @@ define(
|
|
39166
39242
|
function createNewBlock(name) {
|
39167
39243
|
var node = container, block, clonedNode, caretNode, textInlineElements = schema.getTextInlineElements();
|
39168
39244
|
|
39169
|
-
if (name || parentBlockName == "TABLE") {
|
39245
|
+
if (name || parentBlockName == "TABLE" || parentBlockName == "HR") {
|
39170
39246
|
block = dom.create(name || newBlockName);
|
39171
39247
|
setForcedBlockAttrs(block);
|
39172
39248
|
} else {
|
@@ -39230,8 +39306,8 @@ define(
|
|
39230
39306
|
return true;
|
39231
39307
|
}
|
39232
39308
|
|
39233
|
-
// Caret can be before/after a table
|
39234
|
-
if (container
|
39309
|
+
// Caret can be before/after a table or a hr
|
39310
|
+
if (containerAndSiblingName(container, 'TABLE') || containerAndSiblingName(container, 'HR')) {
|
39235
39311
|
return (isAfterLastNodeInContainer && !start) || (!isAfterLastNodeInContainer && start);
|
39236
39312
|
}
|
39237
39313
|
|
@@ -39609,7 +39685,9 @@ define(
|
|
39609
39685
|
// Insert new block before
|
39610
39686
|
newBlock = parentBlock.parentNode.insertBefore(createNewBlock(), parentBlock);
|
39611
39687
|
renderBlockOnIE(dom, selection, newBlock);
|
39612
|
-
|
39688
|
+
|
39689
|
+
// Adjust caret position if HR
|
39690
|
+
containerAndSiblingName(parentBlock, 'HR') ? moveToCaretPosition(newBlock) : moveToCaretPosition(parentBlock);
|
39613
39691
|
} else {
|
39614
39692
|
// Extract after fragment and insert it after the current block
|
39615
39693
|
tmpRng = includeZwspInRange(rng).cloneRange();
|
@@ -41426,7 +41504,8 @@ define(
|
|
41426
41504
|
e.preventDefault();
|
41427
41505
|
setContentEditableSelection(selectNode(contentEditableRoot));
|
41428
41506
|
} else {
|
41429
|
-
|
41507
|
+
// Check that we're not attempting a shift + click select within a contenteditable='true' element
|
41508
|
+
if (!(isContentEditableTrue(contentEditableRoot) && e.shiftKey) && !isXYWithinRange(e.clientX, e.clientY, editor.selection.getRng())) {
|
41430
41509
|
editor.selection.placeCaretAt(e.clientX, e.clientY);
|
41431
41510
|
}
|
41432
41511
|
}
|
@@ -41495,7 +41574,7 @@ define(
|
|
41495
41574
|
editor.on('setSelectionRange', function (e) {
|
41496
41575
|
var rng;
|
41497
41576
|
|
41498
|
-
rng = setContentEditableSelection(e.range);
|
41577
|
+
rng = setContentEditableSelection(e.range, e.forward);
|
41499
41578
|
if (rng) {
|
41500
41579
|
e.range = rng;
|
41501
41580
|
}
|
@@ -41570,7 +41649,7 @@ define(
|
|
41570
41649
|
return isWithinCaretContainer(rng.startContainer) || isWithinCaretContainer(rng.endContainer);
|
41571
41650
|
}
|
41572
41651
|
|
41573
|
-
function setContentEditableSelection(range) {
|
41652
|
+
function setContentEditableSelection(range, forward) {
|
41574
41653
|
var node, $ = editor.$, dom = editor.dom, $realSelectionContainer, sel,
|
41575
41654
|
startContainer, startOffset, endOffset, e, caretPosition, targetClone, origTargetClone;
|
41576
41655
|
|
@@ -41580,14 +41659,26 @@ define(
|
|
41580
41659
|
|
41581
41660
|
if (range.collapsed) {
|
41582
41661
|
if (!isRangeInCaretContainer(range)) {
|
41583
|
-
|
41662
|
+
if (forward === false) {
|
41663
|
+
caretPosition = getNormalizedRangeEndPoint(-1, range);
|
41584
41664
|
|
41585
|
-
|
41586
|
-
|
41587
|
-
|
41665
|
+
if (isContentEditableFalse(caretPosition.getNode(true))) {
|
41666
|
+
return showCaret(-1, caretPosition.getNode(true), false);
|
41667
|
+
}
|
41668
|
+
|
41669
|
+
if (isContentEditableFalse(caretPosition.getNode())) {
|
41670
|
+
return showCaret(-1, caretPosition.getNode(), !caretPosition.isAtEnd());
|
41671
|
+
}
|
41672
|
+
} else {
|
41673
|
+
caretPosition = getNormalizedRangeEndPoint(1, range);
|
41588
41674
|
|
41589
|
-
|
41590
|
-
|
41675
|
+
if (isContentEditableFalse(caretPosition.getNode())) {
|
41676
|
+
return showCaret(1, caretPosition.getNode(), !caretPosition.isAtEnd());
|
41677
|
+
}
|
41678
|
+
|
41679
|
+
if (isContentEditableFalse(caretPosition.getNode(true))) {
|
41680
|
+
return showCaret(1, caretPosition.getNode(true), false);
|
41681
|
+
}
|
41591
41682
|
}
|
41592
41683
|
}
|
41593
41684
|
|
@@ -45967,7 +46058,7 @@ define(
|
|
45967
46058
|
* @property minorVersion
|
45968
46059
|
* @type String
|
45969
46060
|
*/
|
45970
|
-
minorVersion: '6.
|
46061
|
+
minorVersion: '6.1',
|
45971
46062
|
|
45972
46063
|
/**
|
45973
46064
|
* Release date of TinyMCE build.
|
@@ -45975,7 +46066,7 @@ define(
|
|
45975
46066
|
* @property releaseDate
|
45976
46067
|
* @type String
|
45977
46068
|
*/
|
45978
|
-
releaseDate: '2017-05-
|
46069
|
+
releaseDate: '2017-05-10',
|
45979
46070
|
|
45980
46071
|
/**
|
45981
46072
|
* Collection of editor instances.
|
@@ -51257,7 +51348,7 @@ define(
|
|
51257
51348
|
|
51258
51349
|
editor.addButton('fontsizeselect', function () {
|
51259
51350
|
var items = [], defaultFontsizeFormats = '8pt 10pt 12pt 14pt 18pt 24pt 36pt';
|
51260
|
-
var fontsizeFormats = editor.settings.
|
51351
|
+
var fontsizeFormats = editor.settings.fontsize_formats || defaultFontsizeFormats;
|
51261
51352
|
|
51262
51353
|
each(fontsizeFormats.split(' '), function (item) {
|
51263
51354
|
var text = item, value = item;
|