tinymce-rails 6.2.0 → 6.3.0
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 +808 -566
- data/lib/tinymce/rails/version.rb +2 -2
- data/vendor/assets/javascripts/tinymce/icons/default/icons.js +1 -1
- data/vendor/assets/javascripts/tinymce/models/dom/model.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/code/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/help/plugin.js +2 -2
- data/vendor/assets/javascripts/tinymce/plugins/image/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/link/plugin.js +2 -2
- data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/pagebreak/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/preview/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/quickbars/plugin.js +2 -2
- data/vendor/assets/javascripts/tinymce/plugins/save/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/searchreplace/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/template/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/visualblocks/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/visualchars/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/wordcount/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.inline.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.inline.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/themes/silver/theme.js +2 -2
- data/vendor/assets/javascripts/tinymce/tinymce.d.ts +62 -17
- data/vendor/assets/javascripts/tinymce/tinymce.js +2 -2
- metadata +2 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* TinyMCE version 6.
|
2
|
+
* TinyMCE version 6.3.0 (2022-11-23)
|
3
3
|
*/
|
4
4
|
|
5
5
|
(function () {
|
@@ -1346,13 +1346,13 @@
|
|
1346
1346
|
};
|
1347
1347
|
const siblings = element => {
|
1348
1348
|
const filterSelf = elements => filter$5(elements, x => !eq(element, x));
|
1349
|
-
return parent(element).map(children).map(filterSelf).getOr([]);
|
1349
|
+
return parent(element).map(children$1).map(filterSelf).getOr([]);
|
1350
1350
|
};
|
1351
1351
|
const prevSibling = element => Optional.from(element.dom.previousSibling).map(SugarElement.fromDom);
|
1352
1352
|
const nextSibling = element => Optional.from(element.dom.nextSibling).map(SugarElement.fromDom);
|
1353
1353
|
const prevSiblings = element => reverse(toArray(element, prevSibling));
|
1354
1354
|
const nextSiblings = element => toArray(element, nextSibling);
|
1355
|
-
const children = element => map$3(element.dom.childNodes, SugarElement.fromDom);
|
1355
|
+
const children$1 = element => map$3(element.dom.childNodes, SugarElement.fromDom);
|
1356
1356
|
const child$1 = (element, index) => {
|
1357
1357
|
const cs = element.dom.childNodes;
|
1358
1358
|
return Optional.from(cs[index]).map(SugarElement.fromDom);
|
@@ -1508,7 +1508,7 @@
|
|
1508
1508
|
|
1509
1509
|
const empty = element => {
|
1510
1510
|
element.dom.textContent = '';
|
1511
|
-
each$e(children(element), rogue => {
|
1511
|
+
each$e(children$1(element), rogue => {
|
1512
1512
|
remove$6(rogue);
|
1513
1513
|
});
|
1514
1514
|
};
|
@@ -1519,9 +1519,9 @@
|
|
1519
1519
|
}
|
1520
1520
|
};
|
1521
1521
|
const unwrap = wrapper => {
|
1522
|
-
const children
|
1523
|
-
if (children
|
1524
|
-
after$3(wrapper, children
|
1522
|
+
const children = children$1(wrapper);
|
1523
|
+
if (children.length > 0) {
|
1524
|
+
after$3(wrapper, children);
|
1525
1525
|
}
|
1526
1526
|
remove$6(wrapper);
|
1527
1527
|
};
|
@@ -1530,7 +1530,7 @@
|
|
1530
1530
|
const doc = scope || document;
|
1531
1531
|
const div = doc.createElement('div');
|
1532
1532
|
div.innerHTML = html;
|
1533
|
-
return children(SugarElement.fromDom(div));
|
1533
|
+
return children$1(SugarElement.fromDom(div));
|
1534
1534
|
};
|
1535
1535
|
const fromDom$1 = nodes => map$3(nodes, SugarElement.fromDom);
|
1536
1536
|
|
@@ -1680,154 +1680,16 @@
|
|
1680
1680
|
}, visualViewport => bounds(Math.max(visualViewport.pageLeft, scroll.left), Math.max(visualViewport.pageTop, scroll.top), visualViewport.width, visualViewport.height));
|
1681
1681
|
};
|
1682
1682
|
|
1683
|
-
const
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
const isElement$6 = isNodeType(1);
|
1690
|
-
const matchNodeName = name => {
|
1691
|
-
const lowerCasedName = name.toLowerCase();
|
1692
|
-
return node => isNonNullable(node) && node.nodeName.toLowerCase() === lowerCasedName;
|
1693
|
-
};
|
1694
|
-
const matchNodeNames = names => {
|
1695
|
-
const lowerCasedNames = names.map(s => s.toLowerCase());
|
1696
|
-
return node => {
|
1697
|
-
if (node && node.nodeName) {
|
1698
|
-
const nodeName = node.nodeName.toLowerCase();
|
1699
|
-
return contains$2(lowerCasedNames, nodeName);
|
1700
|
-
}
|
1701
|
-
return false;
|
1702
|
-
};
|
1703
|
-
};
|
1704
|
-
const matchStyleValues = (name, values) => {
|
1705
|
-
const items = values.toLowerCase().split(' ');
|
1706
|
-
return node => {
|
1707
|
-
if (isElement$6(node)) {
|
1708
|
-
const win = node.ownerDocument.defaultView;
|
1709
|
-
if (win) {
|
1710
|
-
for (let i = 0; i < items.length; i++) {
|
1711
|
-
const computed = win.getComputedStyle(node, null);
|
1712
|
-
const cssValue = computed ? computed.getPropertyValue(name) : null;
|
1713
|
-
if (cssValue === items[i]) {
|
1714
|
-
return true;
|
1715
|
-
}
|
1716
|
-
}
|
1717
|
-
}
|
1718
|
-
}
|
1719
|
-
return false;
|
1720
|
-
};
|
1721
|
-
};
|
1722
|
-
const hasAttribute = attrName => {
|
1723
|
-
return node => {
|
1724
|
-
return isElement$6(node) && node.hasAttribute(attrName);
|
1725
|
-
};
|
1726
|
-
};
|
1727
|
-
const hasAttributeValue = (attrName, attrValue) => {
|
1728
|
-
return node => {
|
1729
|
-
return isElement$6(node) && node.getAttribute(attrName) === attrValue;
|
1730
|
-
};
|
1731
|
-
};
|
1732
|
-
const isBogus$2 = node => isElement$6(node) && node.hasAttribute('data-mce-bogus');
|
1733
|
-
const isBogusAll$1 = node => isElement$6(node) && node.getAttribute('data-mce-bogus') === 'all';
|
1734
|
-
const isTable$2 = node => isElement$6(node) && node.tagName === 'TABLE';
|
1735
|
-
const hasContentEditableState = value => {
|
1736
|
-
return node => {
|
1737
|
-
if (isElement$6(node)) {
|
1738
|
-
if (node.contentEditable === value) {
|
1739
|
-
return true;
|
1740
|
-
}
|
1741
|
-
if (node.getAttribute('data-mce-contenteditable') === value) {
|
1742
|
-
return true;
|
1743
|
-
}
|
1744
|
-
}
|
1745
|
-
return false;
|
1746
|
-
};
|
1747
|
-
};
|
1748
|
-
const isTextareaOrInput = matchNodeNames([
|
1749
|
-
'textarea',
|
1750
|
-
'input'
|
1751
|
-
]);
|
1752
|
-
const isText$a = isNodeType(3);
|
1753
|
-
const isCData = isNodeType(4);
|
1754
|
-
const isPi = isNodeType(7);
|
1755
|
-
const isComment = isNodeType(8);
|
1756
|
-
const isDocument$1 = isNodeType(9);
|
1757
|
-
const isDocumentFragment = isNodeType(11);
|
1758
|
-
const isBr$6 = matchNodeName('br');
|
1759
|
-
const isImg = matchNodeName('img');
|
1760
|
-
const isContentEditableTrue$3 = hasContentEditableState('true');
|
1761
|
-
const isContentEditableFalse$a = hasContentEditableState('false');
|
1762
|
-
const isTableCell$3 = matchNodeNames([
|
1763
|
-
'td',
|
1764
|
-
'th'
|
1765
|
-
]);
|
1766
|
-
const isTableCellOrCaption = matchNodeNames([
|
1767
|
-
'td',
|
1768
|
-
'th',
|
1769
|
-
'caption'
|
1770
|
-
]);
|
1771
|
-
const isMedia$2 = matchNodeNames([
|
1772
|
-
'video',
|
1773
|
-
'audio',
|
1774
|
-
'object',
|
1775
|
-
'embed'
|
1776
|
-
]);
|
1777
|
-
const isListItem$2 = matchNodeName('li');
|
1778
|
-
|
1779
|
-
const browser = detect$2().browser;
|
1780
|
-
const firstElement = nodes => find$2(nodes, isElement$7);
|
1781
|
-
const getTableCaptionDeltaY = elm => {
|
1782
|
-
if (browser.isFirefox() && name(elm) === 'table') {
|
1783
|
-
return firstElement(children(elm)).filter(elm => {
|
1784
|
-
return name(elm) === 'caption';
|
1785
|
-
}).bind(caption => {
|
1786
|
-
return firstElement(nextSiblings(caption)).map(body => {
|
1787
|
-
const bodyTop = body.dom.offsetTop;
|
1788
|
-
const captionTop = caption.dom.offsetTop;
|
1789
|
-
const captionHeight = caption.dom.offsetHeight;
|
1790
|
-
return bodyTop <= captionTop ? -captionHeight : 0;
|
1791
|
-
});
|
1792
|
-
}).getOr(0);
|
1793
|
-
} else {
|
1794
|
-
return 0;
|
1795
|
-
}
|
1796
|
-
};
|
1797
|
-
const hasChild = (elm, child) => elm.children && contains$2(elm.children, child);
|
1798
|
-
const getPos = (body, elm, rootElm) => {
|
1799
|
-
let x = 0, y = 0;
|
1800
|
-
const doc = body.ownerDocument;
|
1801
|
-
rootElm = rootElm ? rootElm : body;
|
1802
|
-
if (elm) {
|
1803
|
-
if (rootElm === body && elm.getBoundingClientRect && get$7(SugarElement.fromDom(body), 'position') === 'static') {
|
1804
|
-
const pos = elm.getBoundingClientRect();
|
1805
|
-
x = pos.left + (doc.documentElement.scrollLeft || body.scrollLeft) - doc.documentElement.clientLeft;
|
1806
|
-
y = pos.top + (doc.documentElement.scrollTop || body.scrollTop) - doc.documentElement.clientTop;
|
1807
|
-
return {
|
1808
|
-
x,
|
1809
|
-
y
|
1810
|
-
};
|
1811
|
-
}
|
1812
|
-
let offsetParent = elm;
|
1813
|
-
while (offsetParent && offsetParent !== rootElm && offsetParent.nodeType && !hasChild(offsetParent, rootElm)) {
|
1814
|
-
const castOffsetParent = offsetParent;
|
1815
|
-
x += castOffsetParent.offsetLeft || 0;
|
1816
|
-
y += castOffsetParent.offsetTop || 0;
|
1817
|
-
offsetParent = castOffsetParent.offsetParent;
|
1818
|
-
}
|
1819
|
-
offsetParent = elm.parentNode;
|
1820
|
-
while (offsetParent && offsetParent !== rootElm && offsetParent.nodeType && !hasChild(offsetParent, rootElm)) {
|
1821
|
-
x -= offsetParent.scrollLeft || 0;
|
1822
|
-
y -= offsetParent.scrollTop || 0;
|
1823
|
-
offsetParent = offsetParent.parentNode;
|
1683
|
+
const children = (scope, predicate) => filter$5(children$1(scope), predicate);
|
1684
|
+
const descendants$1 = (scope, predicate) => {
|
1685
|
+
let result = [];
|
1686
|
+
each$e(children$1(scope), x => {
|
1687
|
+
if (predicate(x)) {
|
1688
|
+
result = result.concat([x]);
|
1824
1689
|
}
|
1825
|
-
|
1826
|
-
}
|
1827
|
-
return
|
1828
|
-
x,
|
1829
|
-
y
|
1830
|
-
};
|
1690
|
+
result = result.concat(descendants$1(x, predicate));
|
1691
|
+
});
|
1692
|
+
return result;
|
1831
1693
|
};
|
1832
1694
|
|
1833
1695
|
var ClosestOrAncestor = (is, ancestor, scope, a, isRoot) => {
|
@@ -1894,157 +1756,7 @@
|
|
1894
1756
|
return ClosestOrAncestor(is, ancestor$2, scope, selector, isRoot);
|
1895
1757
|
};
|
1896
1758
|
|
1897
|
-
const
|
1898
|
-
let idCount = 0;
|
1899
|
-
const loadedStates = {};
|
1900
|
-
const edos = SugarElement.fromDom(documentOrShadowRoot);
|
1901
|
-
const doc = documentOrOwner(edos);
|
1902
|
-
const maxLoadTime = settings.maxLoadTime || 5000;
|
1903
|
-
const _setReferrerPolicy = referrerPolicy => {
|
1904
|
-
settings.referrerPolicy = referrerPolicy;
|
1905
|
-
};
|
1906
|
-
const addStyle = element => {
|
1907
|
-
append$1(getStyleContainer(edos), element);
|
1908
|
-
};
|
1909
|
-
const removeStyle = id => {
|
1910
|
-
const styleContainer = getStyleContainer(edos);
|
1911
|
-
descendant(styleContainer, '#' + id).each(remove$6);
|
1912
|
-
};
|
1913
|
-
const getOrCreateState = url => get$a(loadedStates, url).getOrThunk(() => ({
|
1914
|
-
id: 'mce-u' + idCount++,
|
1915
|
-
passed: [],
|
1916
|
-
failed: [],
|
1917
|
-
count: 0
|
1918
|
-
}));
|
1919
|
-
const load = url => new Promise((success, failure) => {
|
1920
|
-
let link;
|
1921
|
-
const urlWithSuffix = Tools._addCacheSuffix(url);
|
1922
|
-
const state = getOrCreateState(urlWithSuffix);
|
1923
|
-
loadedStates[urlWithSuffix] = state;
|
1924
|
-
state.count++;
|
1925
|
-
const resolve = (callbacks, status) => {
|
1926
|
-
each$e(callbacks, call);
|
1927
|
-
state.status = status;
|
1928
|
-
state.passed = [];
|
1929
|
-
state.failed = [];
|
1930
|
-
if (link) {
|
1931
|
-
link.onload = null;
|
1932
|
-
link.onerror = null;
|
1933
|
-
link = null;
|
1934
|
-
}
|
1935
|
-
};
|
1936
|
-
const passed = () => resolve(state.passed, 2);
|
1937
|
-
const failed = () => resolve(state.failed, 3);
|
1938
|
-
const wait = (testCallback, waitCallback) => {
|
1939
|
-
if (!testCallback()) {
|
1940
|
-
if (Date.now() - startTime < maxLoadTime) {
|
1941
|
-
setTimeout(waitCallback);
|
1942
|
-
} else {
|
1943
|
-
failed();
|
1944
|
-
}
|
1945
|
-
}
|
1946
|
-
};
|
1947
|
-
const waitForWebKitLinkLoaded = () => {
|
1948
|
-
wait(() => {
|
1949
|
-
const styleSheets = documentOrShadowRoot.styleSheets;
|
1950
|
-
let i = styleSheets.length;
|
1951
|
-
while (i--) {
|
1952
|
-
const styleSheet = styleSheets[i];
|
1953
|
-
const owner = styleSheet.ownerNode;
|
1954
|
-
if (owner && link && owner.id === link.id) {
|
1955
|
-
passed();
|
1956
|
-
return true;
|
1957
|
-
}
|
1958
|
-
}
|
1959
|
-
return false;
|
1960
|
-
}, waitForWebKitLinkLoaded);
|
1961
|
-
};
|
1962
|
-
if (success) {
|
1963
|
-
state.passed.push(success);
|
1964
|
-
}
|
1965
|
-
if (failure) {
|
1966
|
-
state.failed.push(failure);
|
1967
|
-
}
|
1968
|
-
if (state.status === 1) {
|
1969
|
-
return;
|
1970
|
-
}
|
1971
|
-
if (state.status === 2) {
|
1972
|
-
passed();
|
1973
|
-
return;
|
1974
|
-
}
|
1975
|
-
if (state.status === 3) {
|
1976
|
-
failed();
|
1977
|
-
return;
|
1978
|
-
}
|
1979
|
-
state.status = 1;
|
1980
|
-
const linkElem = SugarElement.fromTag('link', doc.dom);
|
1981
|
-
setAll$1(linkElem, {
|
1982
|
-
rel: 'stylesheet',
|
1983
|
-
type: 'text/css',
|
1984
|
-
id: state.id
|
1985
|
-
});
|
1986
|
-
const startTime = Date.now();
|
1987
|
-
if (settings.contentCssCors) {
|
1988
|
-
set$2(linkElem, 'crossOrigin', 'anonymous');
|
1989
|
-
}
|
1990
|
-
if (settings.referrerPolicy) {
|
1991
|
-
set$2(linkElem, 'referrerpolicy', settings.referrerPolicy);
|
1992
|
-
}
|
1993
|
-
link = linkElem.dom;
|
1994
|
-
link.onload = waitForWebKitLinkLoaded;
|
1995
|
-
link.onerror = failed;
|
1996
|
-
addStyle(linkElem);
|
1997
|
-
set$2(linkElem, 'href', urlWithSuffix);
|
1998
|
-
});
|
1999
|
-
const loadAll = urls => {
|
2000
|
-
const loadedUrls = Promise.allSettled(map$3(urls, url => load(url).then(constant(url))));
|
2001
|
-
return loadedUrls.then(results => {
|
2002
|
-
const parts = partition$2(results, r => r.status === 'fulfilled');
|
2003
|
-
if (parts.fail.length > 0) {
|
2004
|
-
return Promise.reject(map$3(parts.fail, result => result.reason));
|
2005
|
-
} else {
|
2006
|
-
return map$3(parts.pass, result => result.value);
|
2007
|
-
}
|
2008
|
-
});
|
2009
|
-
};
|
2010
|
-
const unload = url => {
|
2011
|
-
const urlWithSuffix = Tools._addCacheSuffix(url);
|
2012
|
-
get$a(loadedStates, urlWithSuffix).each(state => {
|
2013
|
-
const count = --state.count;
|
2014
|
-
if (count === 0) {
|
2015
|
-
delete loadedStates[urlWithSuffix];
|
2016
|
-
removeStyle(state.id);
|
2017
|
-
}
|
2018
|
-
});
|
2019
|
-
};
|
2020
|
-
const unloadAll = urls => {
|
2021
|
-
each$e(urls, url => {
|
2022
|
-
unload(url);
|
2023
|
-
});
|
2024
|
-
};
|
2025
|
-
return {
|
2026
|
-
load,
|
2027
|
-
loadAll,
|
2028
|
-
unload,
|
2029
|
-
unloadAll,
|
2030
|
-
_setReferrerPolicy
|
2031
|
-
};
|
2032
|
-
};
|
2033
|
-
|
2034
|
-
const create$d = () => {
|
2035
|
-
const map = new WeakMap();
|
2036
|
-
const forElement = (referenceElement, settings) => {
|
2037
|
-
const root = getRootNode(referenceElement);
|
2038
|
-
const rootDom = root.dom;
|
2039
|
-
return Optional.from(map.get(rootDom)).getOrThunk(() => {
|
2040
|
-
const sl = StyleSheetLoader(rootDom, settings);
|
2041
|
-
map.set(rootDom, sl);
|
2042
|
-
return sl;
|
2043
|
-
});
|
2044
|
-
};
|
2045
|
-
return { forElement };
|
2046
|
-
};
|
2047
|
-
const instance = create$d();
|
1759
|
+
const ancestor$1 = (scope, selector, isRoot) => ancestor$2(scope, selector, isRoot).isSome();
|
2048
1760
|
|
2049
1761
|
class DomTreeWalker {
|
2050
1762
|
constructor(startNode, rootNode) {
|
@@ -2115,6 +1827,134 @@
|
|
2115
1827
|
}
|
2116
1828
|
}
|
2117
1829
|
|
1830
|
+
const isNodeType = type => {
|
1831
|
+
return node => {
|
1832
|
+
return !!node && node.nodeType === type;
|
1833
|
+
};
|
1834
|
+
};
|
1835
|
+
const isRestrictedNode = node => !!node && !Object.getPrototypeOf(node);
|
1836
|
+
const isElement$6 = isNodeType(1);
|
1837
|
+
const matchNodeName = name => {
|
1838
|
+
const lowerCasedName = name.toLowerCase();
|
1839
|
+
return node => isNonNullable(node) && node.nodeName.toLowerCase() === lowerCasedName;
|
1840
|
+
};
|
1841
|
+
const matchNodeNames = names => {
|
1842
|
+
const lowerCasedNames = names.map(s => s.toLowerCase());
|
1843
|
+
return node => {
|
1844
|
+
if (node && node.nodeName) {
|
1845
|
+
const nodeName = node.nodeName.toLowerCase();
|
1846
|
+
return contains$2(lowerCasedNames, nodeName);
|
1847
|
+
}
|
1848
|
+
return false;
|
1849
|
+
};
|
1850
|
+
};
|
1851
|
+
const matchStyleValues = (name, values) => {
|
1852
|
+
const items = values.toLowerCase().split(' ');
|
1853
|
+
return node => {
|
1854
|
+
if (isElement$6(node)) {
|
1855
|
+
const win = node.ownerDocument.defaultView;
|
1856
|
+
if (win) {
|
1857
|
+
for (let i = 0; i < items.length; i++) {
|
1858
|
+
const computed = win.getComputedStyle(node, null);
|
1859
|
+
const cssValue = computed ? computed.getPropertyValue(name) : null;
|
1860
|
+
if (cssValue === items[i]) {
|
1861
|
+
return true;
|
1862
|
+
}
|
1863
|
+
}
|
1864
|
+
}
|
1865
|
+
}
|
1866
|
+
return false;
|
1867
|
+
};
|
1868
|
+
};
|
1869
|
+
const hasAttribute = attrName => {
|
1870
|
+
return node => {
|
1871
|
+
return isElement$6(node) && node.hasAttribute(attrName);
|
1872
|
+
};
|
1873
|
+
};
|
1874
|
+
const hasAttributeValue = (attrName, attrValue) => {
|
1875
|
+
return node => {
|
1876
|
+
return isElement$6(node) && node.getAttribute(attrName) === attrValue;
|
1877
|
+
};
|
1878
|
+
};
|
1879
|
+
const isBogus$2 = node => isElement$6(node) && node.hasAttribute('data-mce-bogus');
|
1880
|
+
const isBogusAll$1 = node => isElement$6(node) && node.getAttribute('data-mce-bogus') === 'all';
|
1881
|
+
const isTable$2 = node => isElement$6(node) && node.tagName === 'TABLE';
|
1882
|
+
const hasContentEditableState = value => {
|
1883
|
+
return node => {
|
1884
|
+
if (isElement$6(node)) {
|
1885
|
+
if (node.contentEditable === value) {
|
1886
|
+
return true;
|
1887
|
+
}
|
1888
|
+
if (node.getAttribute('data-mce-contenteditable') === value) {
|
1889
|
+
return true;
|
1890
|
+
}
|
1891
|
+
}
|
1892
|
+
return false;
|
1893
|
+
};
|
1894
|
+
};
|
1895
|
+
const isTextareaOrInput = matchNodeNames([
|
1896
|
+
'textarea',
|
1897
|
+
'input'
|
1898
|
+
]);
|
1899
|
+
const isText$a = isNodeType(3);
|
1900
|
+
const isCData = isNodeType(4);
|
1901
|
+
const isPi = isNodeType(7);
|
1902
|
+
const isComment = isNodeType(8);
|
1903
|
+
const isDocument$1 = isNodeType(9);
|
1904
|
+
const isDocumentFragment = isNodeType(11);
|
1905
|
+
const isBr$6 = matchNodeName('br');
|
1906
|
+
const isImg = matchNodeName('img');
|
1907
|
+
const isContentEditableTrue$3 = hasContentEditableState('true');
|
1908
|
+
const isContentEditableFalse$a = hasContentEditableState('false');
|
1909
|
+
const isTableCell$3 = matchNodeNames([
|
1910
|
+
'td',
|
1911
|
+
'th'
|
1912
|
+
]);
|
1913
|
+
const isTableCellOrCaption = matchNodeNames([
|
1914
|
+
'td',
|
1915
|
+
'th',
|
1916
|
+
'caption'
|
1917
|
+
]);
|
1918
|
+
const isMedia$2 = matchNodeNames([
|
1919
|
+
'video',
|
1920
|
+
'audio',
|
1921
|
+
'object',
|
1922
|
+
'embed'
|
1923
|
+
]);
|
1924
|
+
const isListItem$2 = matchNodeName('li');
|
1925
|
+
|
1926
|
+
const zeroWidth = '\uFEFF';
|
1927
|
+
const nbsp = '\xA0';
|
1928
|
+
const isZwsp$1 = char => char === zeroWidth;
|
1929
|
+
const removeZwsp = s => s.replace(/\uFEFF/g, '');
|
1930
|
+
|
1931
|
+
const descendants = (scope, selector) => all(selector, scope);
|
1932
|
+
|
1933
|
+
const NodeValue = (is, name) => {
|
1934
|
+
const get = element => {
|
1935
|
+
if (!is(element)) {
|
1936
|
+
throw new Error('Can only get ' + name + ' value of a ' + name + ' node');
|
1937
|
+
}
|
1938
|
+
return getOption(element).getOr('');
|
1939
|
+
};
|
1940
|
+
const getOption = element => is(element) ? Optional.from(element.dom.nodeValue) : Optional.none();
|
1941
|
+
const set = (element, value) => {
|
1942
|
+
if (!is(element)) {
|
1943
|
+
throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node');
|
1944
|
+
}
|
1945
|
+
element.dom.nodeValue = value;
|
1946
|
+
};
|
1947
|
+
return {
|
1948
|
+
get,
|
1949
|
+
getOption,
|
1950
|
+
set
|
1951
|
+
};
|
1952
|
+
};
|
1953
|
+
|
1954
|
+
const api$1 = NodeValue(isText$b, 'text');
|
1955
|
+
const get$3 = element => api$1.get(element);
|
1956
|
+
const getOption = element => api$1.getOption(element);
|
1957
|
+
|
2118
1958
|
const blocks = [
|
2119
1959
|
'article',
|
2120
1960
|
'aside',
|
@@ -2237,58 +2077,13 @@
|
|
2237
2077
|
const isInline$1 = node => isElement$7(node) && !isBlock$2(node);
|
2238
2078
|
const isBr$5 = node => isElement$7(node) && name(node) === 'br';
|
2239
2079
|
const isTextBlock$2 = lazyLookup(textBlocks);
|
2240
|
-
const isList = lazyLookup(lists);
|
2241
|
-
const isListItem$1 = lazyLookup(listItems$1);
|
2242
|
-
const isTableSection = lazyLookup(tableSections);
|
2243
|
-
const isTableCell$2 = lazyLookup(tableCells);
|
2244
|
-
const isWsPreserveElement = lazyLookup(wsElements);
|
2245
|
-
const isWrapBlockElement = lazyLookup(wrapBlockElements);
|
2246
|
-
const isWrapElement = node => isWrapBlockElement(node) || isInline$1(node);
|
2247
|
-
|
2248
|
-
const ancestor$1 = (scope, selector, isRoot) => ancestor$2(scope, selector, isRoot).isSome();
|
2249
|
-
|
2250
|
-
const zeroWidth = '\uFEFF';
|
2251
|
-
const nbsp = '\xA0';
|
2252
|
-
const isZwsp$1 = char => char === zeroWidth;
|
2253
|
-
const removeZwsp = s => s.replace(/\uFEFF/g, '');
|
2254
|
-
|
2255
|
-
const descendants$1 = (scope, predicate) => {
|
2256
|
-
let result = [];
|
2257
|
-
each$e(children(scope), x => {
|
2258
|
-
if (predicate(x)) {
|
2259
|
-
result = result.concat([x]);
|
2260
|
-
}
|
2261
|
-
result = result.concat(descendants$1(x, predicate));
|
2262
|
-
});
|
2263
|
-
return result;
|
2264
|
-
};
|
2265
|
-
|
2266
|
-
const descendants = (scope, selector) => all(selector, scope);
|
2267
|
-
|
2268
|
-
const NodeValue = (is, name) => {
|
2269
|
-
const get = element => {
|
2270
|
-
if (!is(element)) {
|
2271
|
-
throw new Error('Can only get ' + name + ' value of a ' + name + ' node');
|
2272
|
-
}
|
2273
|
-
return getOption(element).getOr('');
|
2274
|
-
};
|
2275
|
-
const getOption = element => is(element) ? Optional.from(element.dom.nodeValue) : Optional.none();
|
2276
|
-
const set = (element, value) => {
|
2277
|
-
if (!is(element)) {
|
2278
|
-
throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node');
|
2279
|
-
}
|
2280
|
-
element.dom.nodeValue = value;
|
2281
|
-
};
|
2282
|
-
return {
|
2283
|
-
get,
|
2284
|
-
getOption,
|
2285
|
-
set
|
2286
|
-
};
|
2287
|
-
};
|
2288
|
-
|
2289
|
-
const api$1 = NodeValue(isText$b, 'text');
|
2290
|
-
const get$3 = element => api$1.get(element);
|
2291
|
-
const getOption = element => api$1.getOption(element);
|
2080
|
+
const isList = lazyLookup(lists);
|
2081
|
+
const isListItem$1 = lazyLookup(listItems$1);
|
2082
|
+
const isTableSection = lazyLookup(tableSections);
|
2083
|
+
const isTableCell$2 = lazyLookup(tableCells);
|
2084
|
+
const isWsPreserveElement = lazyLookup(wsElements);
|
2085
|
+
const isWrapBlockElement = lazyLookup(wrapBlockElements);
|
2086
|
+
const isWrapElement = node => isWrapBlockElement(node) || isInline$1(node);
|
2292
2087
|
|
2293
2088
|
const getLastChildren$1 = elm => {
|
2294
2089
|
const children = [];
|
@@ -2470,109 +2265,415 @@
|
|
2470
2265
|
if (isNonUiContentEditableFalse(tempNode)) {
|
2471
2266
|
return false;
|
2472
2267
|
}
|
2473
|
-
if (isContentEditableTrue$2(tempNode)) {
|
2474
|
-
return true;
|
2268
|
+
if (isContentEditableTrue$2(tempNode)) {
|
2269
|
+
return true;
|
2270
|
+
}
|
2271
|
+
}
|
2272
|
+
return true;
|
2273
|
+
};
|
2274
|
+
const isAtomicContentEditableFalse = node => {
|
2275
|
+
if (!isNonUiContentEditableFalse(node)) {
|
2276
|
+
return false;
|
2277
|
+
}
|
2278
|
+
return !foldl(from(node.getElementsByTagName('*')), (result, elm) => {
|
2279
|
+
return result || isContentEditableTrue$2(elm);
|
2280
|
+
}, false);
|
2281
|
+
};
|
2282
|
+
const isAtomic$1 = node => isAtomicInline(node) || isAtomicContentEditableFalse(node);
|
2283
|
+
const isEditableCaretCandidate$1 = (node, root) => isCaretCandidate$3(node) && isInEditable(node, root);
|
2284
|
+
|
2285
|
+
const whiteSpaceRegExp = /^[ \t\r\n]*$/;
|
2286
|
+
const isWhitespaceText = text => whiteSpaceRegExp.test(text);
|
2287
|
+
const isCollapsibleWhitespace$1 = c => ' \f\t\x0B'.indexOf(c) !== -1;
|
2288
|
+
const isNewLineChar = c => c === '\n' || c === '\r';
|
2289
|
+
const isNewline = (text, idx) => idx < text.length && idx >= 0 ? isNewLineChar(text[idx]) : false;
|
2290
|
+
const normalize$4 = (text, tabSpaces = 4, isStartOfContent = true, isEndOfContent = true) => {
|
2291
|
+
const tabSpace = repeat(' ', tabSpaces);
|
2292
|
+
const normalizedText = text.replace(/\t/g, tabSpace);
|
2293
|
+
const result = foldl(normalizedText, (acc, c) => {
|
2294
|
+
if (isCollapsibleWhitespace$1(c) || c === nbsp) {
|
2295
|
+
if (acc.pcIsSpace || acc.str === '' && isStartOfContent || acc.str.length === normalizedText.length - 1 && isEndOfContent || isNewline(normalizedText, acc.str.length + 1)) {
|
2296
|
+
return {
|
2297
|
+
pcIsSpace: false,
|
2298
|
+
str: acc.str + nbsp
|
2299
|
+
};
|
2300
|
+
} else {
|
2301
|
+
return {
|
2302
|
+
pcIsSpace: true,
|
2303
|
+
str: acc.str + ' '
|
2304
|
+
};
|
2305
|
+
}
|
2306
|
+
} else {
|
2307
|
+
return {
|
2308
|
+
pcIsSpace: isNewLineChar(c),
|
2309
|
+
str: acc.str + c
|
2310
|
+
};
|
2311
|
+
}
|
2312
|
+
}, {
|
2313
|
+
pcIsSpace: false,
|
2314
|
+
str: ''
|
2315
|
+
});
|
2316
|
+
return result.str;
|
2317
|
+
};
|
2318
|
+
|
2319
|
+
const hasWhitespacePreserveParent = (node, rootNode) => {
|
2320
|
+
const rootElement = SugarElement.fromDom(rootNode);
|
2321
|
+
const startNode = SugarElement.fromDom(node);
|
2322
|
+
return ancestor$1(startNode, 'pre,code', curry(eq, rootElement));
|
2323
|
+
};
|
2324
|
+
const isWhitespace$1 = (node, rootNode) => {
|
2325
|
+
return isText$a(node) && isWhitespaceText(node.data) && !hasWhitespacePreserveParent(node, rootNode);
|
2326
|
+
};
|
2327
|
+
const isNamedAnchor = node => {
|
2328
|
+
return isElement$6(node) && node.nodeName === 'A' && !node.hasAttribute('href') && (node.hasAttribute('name') || node.hasAttribute('id'));
|
2329
|
+
};
|
2330
|
+
const isContent$1 = (node, rootNode) => {
|
2331
|
+
return isCaretCandidate$3(node) && !isWhitespace$1(node, rootNode) || isNamedAnchor(node) || isBookmark(node);
|
2332
|
+
};
|
2333
|
+
const isBookmark = hasAttribute('data-mce-bookmark');
|
2334
|
+
const isBogus$1 = hasAttribute('data-mce-bogus');
|
2335
|
+
const isBogusAll = hasAttributeValue('data-mce-bogus', 'all');
|
2336
|
+
const isEmptyNode = (targetNode, skipBogus) => {
|
2337
|
+
let brCount = 0;
|
2338
|
+
if (isContent$1(targetNode, targetNode)) {
|
2339
|
+
return false;
|
2340
|
+
} else {
|
2341
|
+
let node = targetNode.firstChild;
|
2342
|
+
if (!node) {
|
2343
|
+
return true;
|
2344
|
+
}
|
2345
|
+
const walker = new DomTreeWalker(node, targetNode);
|
2346
|
+
do {
|
2347
|
+
if (skipBogus) {
|
2348
|
+
if (isBogusAll(node)) {
|
2349
|
+
node = walker.next(true);
|
2350
|
+
continue;
|
2351
|
+
}
|
2352
|
+
if (isBogus$1(node)) {
|
2353
|
+
node = walker.next();
|
2354
|
+
continue;
|
2355
|
+
}
|
2356
|
+
}
|
2357
|
+
if (isBr$6(node)) {
|
2358
|
+
brCount++;
|
2359
|
+
node = walker.next();
|
2360
|
+
continue;
|
2361
|
+
}
|
2362
|
+
if (isContent$1(node, targetNode)) {
|
2363
|
+
return false;
|
2364
|
+
}
|
2365
|
+
node = walker.next();
|
2366
|
+
} while (node);
|
2367
|
+
return brCount <= 1;
|
2368
|
+
}
|
2369
|
+
};
|
2370
|
+
const isEmpty$2 = (elm, skipBogus = true) => isEmptyNode(elm.dom, skipBogus);
|
2371
|
+
|
2372
|
+
const transparentBlockAttr = 'data-mce-block';
|
2373
|
+
const elementNames = map => filter$5(keys(map), key => !/[A-Z]/.test(key));
|
2374
|
+
const makeSelectorFromSchemaMap = map => elementNames(map).join(',');
|
2375
|
+
const updateTransparent = (blocksSelector, transparent) => {
|
2376
|
+
if (isNonNullable(transparent.querySelector(blocksSelector))) {
|
2377
|
+
transparent.setAttribute(transparentBlockAttr, 'true');
|
2378
|
+
if (transparent.getAttribute('data-mce-selected') === 'inline-boundary') {
|
2379
|
+
transparent.removeAttribute('data-mce-selected');
|
2380
|
+
}
|
2381
|
+
return true;
|
2382
|
+
} else {
|
2383
|
+
transparent.removeAttribute(transparentBlockAttr);
|
2384
|
+
return false;
|
2385
|
+
}
|
2386
|
+
};
|
2387
|
+
const updateBlockStateOnChildren = (schema, scope) => {
|
2388
|
+
const transparentSelector = makeSelectorFromSchemaMap(schema.getTransparentElements());
|
2389
|
+
const blocksSelector = makeSelectorFromSchemaMap(schema.getBlockElements());
|
2390
|
+
return filter$5(scope.querySelectorAll(transparentSelector), transparent => updateTransparent(blocksSelector, transparent));
|
2391
|
+
};
|
2392
|
+
const trimEdge = (el, leftSide) => {
|
2393
|
+
var _a;
|
2394
|
+
const childPropertyName = leftSide ? 'lastChild' : 'firstChild';
|
2395
|
+
for (let child = el[childPropertyName]; child; child = child[childPropertyName]) {
|
2396
|
+
if (isEmpty$2(SugarElement.fromDom(child))) {
|
2397
|
+
(_a = child.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(child);
|
2398
|
+
return;
|
2399
|
+
}
|
2400
|
+
}
|
2401
|
+
};
|
2402
|
+
const split$2 = (parentElm, splitElm) => {
|
2403
|
+
const range = document.createRange();
|
2404
|
+
const parentNode = parentElm.parentNode;
|
2405
|
+
if (parentNode) {
|
2406
|
+
range.setStartBefore(parentElm);
|
2407
|
+
range.setEndBefore(splitElm);
|
2408
|
+
const beforeFragment = range.extractContents();
|
2409
|
+
trimEdge(beforeFragment, true);
|
2410
|
+
range.setStartAfter(splitElm);
|
2411
|
+
range.setEndAfter(parentElm);
|
2412
|
+
const afterFragment = range.extractContents();
|
2413
|
+
trimEdge(afterFragment, false);
|
2414
|
+
if (!isEmpty$2(SugarElement.fromDom(beforeFragment))) {
|
2415
|
+
parentNode.insertBefore(beforeFragment, parentElm);
|
2416
|
+
}
|
2417
|
+
if (!isEmpty$2(SugarElement.fromDom(splitElm))) {
|
2418
|
+
parentNode.insertBefore(splitElm, parentElm);
|
2419
|
+
}
|
2420
|
+
if (!isEmpty$2(SugarElement.fromDom(afterFragment))) {
|
2421
|
+
parentNode.insertBefore(afterFragment, parentElm);
|
2422
|
+
}
|
2423
|
+
parentNode.removeChild(parentElm);
|
2424
|
+
}
|
2425
|
+
};
|
2426
|
+
const splitInvalidChildren = (schema, scope, transparentBlocks) => {
|
2427
|
+
const blocksElements = schema.getBlockElements();
|
2428
|
+
const rootNode = SugarElement.fromDom(scope);
|
2429
|
+
const isBlock = el => name(el) in blocksElements;
|
2430
|
+
const isRoot = el => eq(el, rootNode);
|
2431
|
+
each$e(fromDom$1(transparentBlocks), transparentBlock => {
|
2432
|
+
ancestor$3(transparentBlock, isBlock, isRoot).each(parentBlock => {
|
2433
|
+
const invalidChildren = children(transparentBlock, el => isBlock(el) && !schema.isValidChild(name(parentBlock), name(el)));
|
2434
|
+
if (invalidChildren.length > 0) {
|
2435
|
+
const stateScope = parentElement(parentBlock);
|
2436
|
+
each$e(invalidChildren, child => {
|
2437
|
+
ancestor$3(child, isBlock, isRoot).each(parentBlock => {
|
2438
|
+
split$2(parentBlock.dom, child.dom);
|
2439
|
+
});
|
2440
|
+
});
|
2441
|
+
stateScope.each(scope => updateBlockStateOnChildren(schema, scope.dom));
|
2442
|
+
}
|
2443
|
+
});
|
2444
|
+
});
|
2445
|
+
};
|
2446
|
+
const updateChildren = (schema, scope) => {
|
2447
|
+
const transparentBlocks = updateBlockStateOnChildren(schema, scope);
|
2448
|
+
splitInvalidChildren(schema, scope, transparentBlocks);
|
2449
|
+
};
|
2450
|
+
const updateElement = (schema, target) => {
|
2451
|
+
if (isTransparentElement(schema, target)) {
|
2452
|
+
const blocksSelector = makeSelectorFromSchemaMap(schema.getBlockElements());
|
2453
|
+
updateTransparent(blocksSelector, target);
|
2454
|
+
}
|
2455
|
+
};
|
2456
|
+
const updateCaret = (schema, root, caretParent) => {
|
2457
|
+
const isRoot = el => eq(el, SugarElement.fromDom(root));
|
2458
|
+
const parents = parents$1(SugarElement.fromDom(caretParent), isRoot);
|
2459
|
+
get$b(parents, parents.length - 2).filter(isElement$7).fold(() => updateChildren(schema, root), scope => updateChildren(schema, scope.dom));
|
2460
|
+
};
|
2461
|
+
const hasBlockAttr = el => el.hasAttribute(transparentBlockAttr);
|
2462
|
+
const isTransparentElementName = (schema, name) => has$2(schema.getTransparentElements(), name);
|
2463
|
+
const isTransparentElement = (schema, node) => isElement$6(node) && isTransparentElementName(schema, node.nodeName);
|
2464
|
+
const isTransparentBlock = (schema, node) => isTransparentElement(schema, node) && hasBlockAttr(node);
|
2465
|
+
const isTransparentAstBlock = (schema, node) => node.type === 1 && isTransparentElementName(schema, node.name) && isString(node.attr(transparentBlockAttr));
|
2466
|
+
const isTransparentAstInline = (schema, node) => node.type === 1 && isTransparentElementName(schema, node.name) && isUndefined(node.attr(transparentBlockAttr));
|
2467
|
+
|
2468
|
+
const browser = detect$2().browser;
|
2469
|
+
const firstElement = nodes => find$2(nodes, isElement$7);
|
2470
|
+
const getTableCaptionDeltaY = elm => {
|
2471
|
+
if (browser.isFirefox() && name(elm) === 'table') {
|
2472
|
+
return firstElement(children$1(elm)).filter(elm => {
|
2473
|
+
return name(elm) === 'caption';
|
2474
|
+
}).bind(caption => {
|
2475
|
+
return firstElement(nextSiblings(caption)).map(body => {
|
2476
|
+
const bodyTop = body.dom.offsetTop;
|
2477
|
+
const captionTop = caption.dom.offsetTop;
|
2478
|
+
const captionHeight = caption.dom.offsetHeight;
|
2479
|
+
return bodyTop <= captionTop ? -captionHeight : 0;
|
2480
|
+
});
|
2481
|
+
}).getOr(0);
|
2482
|
+
} else {
|
2483
|
+
return 0;
|
2484
|
+
}
|
2485
|
+
};
|
2486
|
+
const hasChild = (elm, child) => elm.children && contains$2(elm.children, child);
|
2487
|
+
const getPos = (body, elm, rootElm) => {
|
2488
|
+
let x = 0, y = 0;
|
2489
|
+
const doc = body.ownerDocument;
|
2490
|
+
rootElm = rootElm ? rootElm : body;
|
2491
|
+
if (elm) {
|
2492
|
+
if (rootElm === body && elm.getBoundingClientRect && get$7(SugarElement.fromDom(body), 'position') === 'static') {
|
2493
|
+
const pos = elm.getBoundingClientRect();
|
2494
|
+
x = pos.left + (doc.documentElement.scrollLeft || body.scrollLeft) - doc.documentElement.clientLeft;
|
2495
|
+
y = pos.top + (doc.documentElement.scrollTop || body.scrollTop) - doc.documentElement.clientTop;
|
2496
|
+
return {
|
2497
|
+
x,
|
2498
|
+
y
|
2499
|
+
};
|
2500
|
+
}
|
2501
|
+
let offsetParent = elm;
|
2502
|
+
while (offsetParent && offsetParent !== rootElm && offsetParent.nodeType && !hasChild(offsetParent, rootElm)) {
|
2503
|
+
const castOffsetParent = offsetParent;
|
2504
|
+
x += castOffsetParent.offsetLeft || 0;
|
2505
|
+
y += castOffsetParent.offsetTop || 0;
|
2506
|
+
offsetParent = castOffsetParent.offsetParent;
|
2507
|
+
}
|
2508
|
+
offsetParent = elm.parentNode;
|
2509
|
+
while (offsetParent && offsetParent !== rootElm && offsetParent.nodeType && !hasChild(offsetParent, rootElm)) {
|
2510
|
+
x -= offsetParent.scrollLeft || 0;
|
2511
|
+
y -= offsetParent.scrollTop || 0;
|
2512
|
+
offsetParent = offsetParent.parentNode;
|
2513
|
+
}
|
2514
|
+
y += getTableCaptionDeltaY(SugarElement.fromDom(elm));
|
2515
|
+
}
|
2516
|
+
return {
|
2517
|
+
x,
|
2518
|
+
y
|
2519
|
+
};
|
2520
|
+
};
|
2521
|
+
|
2522
|
+
const StyleSheetLoader = (documentOrShadowRoot, settings = {}) => {
|
2523
|
+
let idCount = 0;
|
2524
|
+
const loadedStates = {};
|
2525
|
+
const edos = SugarElement.fromDom(documentOrShadowRoot);
|
2526
|
+
const doc = documentOrOwner(edos);
|
2527
|
+
const maxLoadTime = settings.maxLoadTime || 5000;
|
2528
|
+
const _setReferrerPolicy = referrerPolicy => {
|
2529
|
+
settings.referrerPolicy = referrerPolicy;
|
2530
|
+
};
|
2531
|
+
const _setContentCssCors = contentCssCors => {
|
2532
|
+
settings.contentCssCors = contentCssCors;
|
2533
|
+
};
|
2534
|
+
const addStyle = element => {
|
2535
|
+
append$1(getStyleContainer(edos), element);
|
2536
|
+
};
|
2537
|
+
const removeStyle = id => {
|
2538
|
+
const styleContainer = getStyleContainer(edos);
|
2539
|
+
descendant(styleContainer, '#' + id).each(remove$6);
|
2540
|
+
};
|
2541
|
+
const getOrCreateState = url => get$a(loadedStates, url).getOrThunk(() => ({
|
2542
|
+
id: 'mce-u' + idCount++,
|
2543
|
+
passed: [],
|
2544
|
+
failed: [],
|
2545
|
+
count: 0
|
2546
|
+
}));
|
2547
|
+
const load = url => new Promise((success, failure) => {
|
2548
|
+
let link;
|
2549
|
+
const urlWithSuffix = Tools._addCacheSuffix(url);
|
2550
|
+
const state = getOrCreateState(urlWithSuffix);
|
2551
|
+
loadedStates[urlWithSuffix] = state;
|
2552
|
+
state.count++;
|
2553
|
+
const resolve = (callbacks, status) => {
|
2554
|
+
each$e(callbacks, call);
|
2555
|
+
state.status = status;
|
2556
|
+
state.passed = [];
|
2557
|
+
state.failed = [];
|
2558
|
+
if (link) {
|
2559
|
+
link.onload = null;
|
2560
|
+
link.onerror = null;
|
2561
|
+
link = null;
|
2562
|
+
}
|
2563
|
+
};
|
2564
|
+
const passed = () => resolve(state.passed, 2);
|
2565
|
+
const failed = () => resolve(state.failed, 3);
|
2566
|
+
const wait = (testCallback, waitCallback) => {
|
2567
|
+
if (!testCallback()) {
|
2568
|
+
if (Date.now() - startTime < maxLoadTime) {
|
2569
|
+
setTimeout(waitCallback);
|
2570
|
+
} else {
|
2571
|
+
failed();
|
2572
|
+
}
|
2573
|
+
}
|
2574
|
+
};
|
2575
|
+
const waitForWebKitLinkLoaded = () => {
|
2576
|
+
wait(() => {
|
2577
|
+
const styleSheets = documentOrShadowRoot.styleSheets;
|
2578
|
+
let i = styleSheets.length;
|
2579
|
+
while (i--) {
|
2580
|
+
const styleSheet = styleSheets[i];
|
2581
|
+
const owner = styleSheet.ownerNode;
|
2582
|
+
if (owner && link && owner.id === link.id) {
|
2583
|
+
passed();
|
2584
|
+
return true;
|
2585
|
+
}
|
2586
|
+
}
|
2587
|
+
return false;
|
2588
|
+
}, waitForWebKitLinkLoaded);
|
2589
|
+
};
|
2590
|
+
if (success) {
|
2591
|
+
state.passed.push(success);
|
2592
|
+
}
|
2593
|
+
if (failure) {
|
2594
|
+
state.failed.push(failure);
|
2475
2595
|
}
|
2476
|
-
|
2477
|
-
|
2478
|
-
};
|
2479
|
-
const isAtomicContentEditableFalse = node => {
|
2480
|
-
if (!isNonUiContentEditableFalse(node)) {
|
2481
|
-
return false;
|
2482
|
-
}
|
2483
|
-
return !foldl(from(node.getElementsByTagName('*')), (result, elm) => {
|
2484
|
-
return result || isContentEditableTrue$2(elm);
|
2485
|
-
}, false);
|
2486
|
-
};
|
2487
|
-
const isAtomic$1 = node => isAtomicInline(node) || isAtomicContentEditableFalse(node);
|
2488
|
-
const isEditableCaretCandidate$1 = (node, root) => isCaretCandidate$3(node) && isInEditable(node, root);
|
2489
|
-
|
2490
|
-
const whiteSpaceRegExp = /^[ \t\r\n]*$/;
|
2491
|
-
const isWhitespaceText = text => whiteSpaceRegExp.test(text);
|
2492
|
-
const isCollapsibleWhitespace$1 = c => ' \f\t\x0B'.indexOf(c) !== -1;
|
2493
|
-
const isNewLineChar = c => c === '\n' || c === '\r';
|
2494
|
-
const isNewline = (text, idx) => idx < text.length && idx >= 0 ? isNewLineChar(text[idx]) : false;
|
2495
|
-
const normalize$4 = (text, tabSpaces = 4, isStartOfContent = true, isEndOfContent = true) => {
|
2496
|
-
const tabSpace = repeat(' ', tabSpaces);
|
2497
|
-
const normalizedText = text.replace(/\t/g, tabSpace);
|
2498
|
-
const result = foldl(normalizedText, (acc, c) => {
|
2499
|
-
if (isCollapsibleWhitespace$1(c) || c === nbsp) {
|
2500
|
-
if (acc.pcIsSpace || acc.str === '' && isStartOfContent || acc.str.length === normalizedText.length - 1 && isEndOfContent || isNewline(normalizedText, acc.str.length + 1)) {
|
2501
|
-
return {
|
2502
|
-
pcIsSpace: false,
|
2503
|
-
str: acc.str + nbsp
|
2504
|
-
};
|
2505
|
-
} else {
|
2506
|
-
return {
|
2507
|
-
pcIsSpace: true,
|
2508
|
-
str: acc.str + ' '
|
2509
|
-
};
|
2510
|
-
}
|
2511
|
-
} else {
|
2512
|
-
return {
|
2513
|
-
pcIsSpace: isNewLineChar(c),
|
2514
|
-
str: acc.str + c
|
2515
|
-
};
|
2596
|
+
if (state.status === 1) {
|
2597
|
+
return;
|
2516
2598
|
}
|
2517
|
-
|
2518
|
-
|
2519
|
-
|
2520
|
-
});
|
2521
|
-
return result.str;
|
2522
|
-
};
|
2523
|
-
|
2524
|
-
const hasWhitespacePreserveParent = (node, rootNode) => {
|
2525
|
-
const rootElement = SugarElement.fromDom(rootNode);
|
2526
|
-
const startNode = SugarElement.fromDom(node);
|
2527
|
-
return ancestor$1(startNode, 'pre,code', curry(eq, rootElement));
|
2528
|
-
};
|
2529
|
-
const isWhitespace$1 = (node, rootNode) => {
|
2530
|
-
return isText$a(node) && isWhitespaceText(node.data) && !hasWhitespacePreserveParent(node, rootNode);
|
2531
|
-
};
|
2532
|
-
const isNamedAnchor = node => {
|
2533
|
-
return isElement$6(node) && node.nodeName === 'A' && !node.hasAttribute('href') && (node.hasAttribute('name') || node.hasAttribute('id'));
|
2534
|
-
};
|
2535
|
-
const isContent$1 = (node, rootNode) => {
|
2536
|
-
return isCaretCandidate$3(node) && !isWhitespace$1(node, rootNode) || isNamedAnchor(node) || isBookmark(node);
|
2537
|
-
};
|
2538
|
-
const isBookmark = hasAttribute('data-mce-bookmark');
|
2539
|
-
const isBogus$1 = hasAttribute('data-mce-bogus');
|
2540
|
-
const isBogusAll = hasAttributeValue('data-mce-bogus', 'all');
|
2541
|
-
const isEmptyNode = (targetNode, skipBogus) => {
|
2542
|
-
let brCount = 0;
|
2543
|
-
if (isContent$1(targetNode, targetNode)) {
|
2544
|
-
return false;
|
2545
|
-
} else {
|
2546
|
-
let node = targetNode.firstChild;
|
2547
|
-
if (!node) {
|
2548
|
-
return true;
|
2599
|
+
if (state.status === 2) {
|
2600
|
+
passed();
|
2601
|
+
return;
|
2549
2602
|
}
|
2550
|
-
|
2551
|
-
|
2552
|
-
|
2553
|
-
|
2554
|
-
|
2555
|
-
|
2556
|
-
|
2557
|
-
|
2558
|
-
|
2559
|
-
|
2560
|
-
|
2561
|
-
|
2562
|
-
|
2563
|
-
|
2564
|
-
|
2565
|
-
|
2603
|
+
if (state.status === 3) {
|
2604
|
+
failed();
|
2605
|
+
return;
|
2606
|
+
}
|
2607
|
+
state.status = 1;
|
2608
|
+
const linkElem = SugarElement.fromTag('link', doc.dom);
|
2609
|
+
setAll$1(linkElem, {
|
2610
|
+
rel: 'stylesheet',
|
2611
|
+
type: 'text/css',
|
2612
|
+
id: state.id
|
2613
|
+
});
|
2614
|
+
const startTime = Date.now();
|
2615
|
+
if (settings.contentCssCors) {
|
2616
|
+
set$2(linkElem, 'crossOrigin', 'anonymous');
|
2617
|
+
}
|
2618
|
+
if (settings.referrerPolicy) {
|
2619
|
+
set$2(linkElem, 'referrerpolicy', settings.referrerPolicy);
|
2620
|
+
}
|
2621
|
+
link = linkElem.dom;
|
2622
|
+
link.onload = waitForWebKitLinkLoaded;
|
2623
|
+
link.onerror = failed;
|
2624
|
+
addStyle(linkElem);
|
2625
|
+
set$2(linkElem, 'href', urlWithSuffix);
|
2626
|
+
});
|
2627
|
+
const loadAll = urls => {
|
2628
|
+
const loadedUrls = Promise.allSettled(map$3(urls, url => load(url).then(constant(url))));
|
2629
|
+
return loadedUrls.then(results => {
|
2630
|
+
const parts = partition$2(results, r => r.status === 'fulfilled');
|
2631
|
+
if (parts.fail.length > 0) {
|
2632
|
+
return Promise.reject(map$3(parts.fail, result => result.reason));
|
2633
|
+
} else {
|
2634
|
+
return map$3(parts.pass, result => result.value);
|
2566
2635
|
}
|
2567
|
-
|
2568
|
-
|
2636
|
+
});
|
2637
|
+
};
|
2638
|
+
const unload = url => {
|
2639
|
+
const urlWithSuffix = Tools._addCacheSuffix(url);
|
2640
|
+
get$a(loadedStates, urlWithSuffix).each(state => {
|
2641
|
+
const count = --state.count;
|
2642
|
+
if (count === 0) {
|
2643
|
+
delete loadedStates[urlWithSuffix];
|
2644
|
+
removeStyle(state.id);
|
2569
2645
|
}
|
2570
|
-
|
2571
|
-
|
2572
|
-
|
2573
|
-
|
2646
|
+
});
|
2647
|
+
};
|
2648
|
+
const unloadAll = urls => {
|
2649
|
+
each$e(urls, url => {
|
2650
|
+
unload(url);
|
2651
|
+
});
|
2652
|
+
};
|
2653
|
+
return {
|
2654
|
+
load,
|
2655
|
+
loadAll,
|
2656
|
+
unload,
|
2657
|
+
unloadAll,
|
2658
|
+
_setReferrerPolicy,
|
2659
|
+
_setContentCssCors
|
2660
|
+
};
|
2574
2661
|
};
|
2575
|
-
|
2662
|
+
|
2663
|
+
const create$d = () => {
|
2664
|
+
const map = new WeakMap();
|
2665
|
+
const forElement = (referenceElement, settings) => {
|
2666
|
+
const root = getRootNode(referenceElement);
|
2667
|
+
const rootDom = root.dom;
|
2668
|
+
return Optional.from(map.get(rootDom)).getOrThunk(() => {
|
2669
|
+
const sl = StyleSheetLoader(rootDom, settings);
|
2670
|
+
map.set(rootDom, sl);
|
2671
|
+
return sl;
|
2672
|
+
});
|
2673
|
+
};
|
2674
|
+
return { forElement };
|
2675
|
+
};
|
2676
|
+
const instance = create$d();
|
2576
2677
|
|
2577
2678
|
const isSpan = node => node.nodeName.toLowerCase() === 'span';
|
2578
2679
|
const isInlineContent = (node, root) => isNonNullable(node) && (isContent$1(node, root) || isInline$1(SugarElement.fromDom(node)));
|
@@ -2808,8 +2909,9 @@
|
|
2808
2909
|
blockContent = 'address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul';
|
2809
2910
|
phrasingContent = 'a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd ' + 'label map noscript object q s samp script select small span strong sub sup ' + 'textarea u var #text #comment';
|
2810
2911
|
if (type !== 'html4') {
|
2912
|
+
const transparentContent = 'a ins del canvas map';
|
2811
2913
|
globalAttributes += ' contenteditable contextmenu draggable dropzone ' + 'hidden spellcheck translate';
|
2812
|
-
blockContent += ' article aside details dialog figure main header footer hgroup section nav';
|
2914
|
+
blockContent += ' article aside details dialog figure main header footer hgroup section nav ' + transparentContent;
|
2813
2915
|
phrasingContent += ' audio canvas command datalist mark meter output picture ' + 'progress time wbr video ruby bdi keygen';
|
2814
2916
|
}
|
2815
2917
|
if (type !== 'html5-strict') {
|
@@ -2855,7 +2957,7 @@
|
|
2855
2957
|
add('ul', '', 'li');
|
2856
2958
|
add('li', 'value', flowContent);
|
2857
2959
|
add('dl', '', 'dt dd');
|
2858
|
-
add('a', 'href target rel media hreflang type',
|
2960
|
+
add('a', 'href target rel media hreflang type', flowContent);
|
2859
2961
|
add('q', 'cite', phrasingContent);
|
2860
2962
|
add('ins del', 'cite datetime', flowContent);
|
2861
2963
|
add('img', 'src sizes srcset alt usemap ismap width height');
|
@@ -3051,6 +3153,7 @@
|
|
3051
3153
|
const 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');
|
3052
3154
|
const 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);
|
3053
3155
|
const textInlineElementsMap = createLookupTable('text_inline_elements', 'span strong b em i font s strike u var cite ' + 'dfn code mark q sup sub samp');
|
3156
|
+
const transparentElementsMap = createLookupTable('transparent_elements', 'a ins del canvas map');
|
3054
3157
|
each$b('script noscript iframe noframes noembed title style textarea xmp plaintext'.split(' '), name => {
|
3055
3158
|
specialElements[name] = new RegExp('</' + name + '[^>]*>', 'gi');
|
3056
3159
|
});
|
@@ -3335,6 +3438,7 @@
|
|
3335
3438
|
const getNonEmptyElements = constant(nonEmptyElementsMap);
|
3336
3439
|
const getMoveCaretBeforeOnEnterElements = constant(moveCaretBeforeOnEnterElementsMap);
|
3337
3440
|
const getWhitespaceElements = constant(whitespaceElementsMap);
|
3441
|
+
const getTransparentElements = constant(transparentElementsMap);
|
3338
3442
|
const getSpecialElements = constant(Object.seal(specialElements));
|
3339
3443
|
const isValidChild = (name, child) => {
|
3340
3444
|
const parent = children[name.toLowerCase()];
|
@@ -3380,6 +3484,7 @@
|
|
3380
3484
|
getNonEmptyElements,
|
3381
3485
|
getMoveCaretBeforeOnEnterElements,
|
3382
3486
|
getWhitespaceElements,
|
3487
|
+
getTransparentElements,
|
3383
3488
|
getSpecialElements,
|
3384
3489
|
isValidChild,
|
3385
3490
|
isValid,
|
@@ -4033,7 +4138,7 @@
|
|
4033
4138
|
if (isString(node)) {
|
4034
4139
|
return has$2(blockElementsMap, node);
|
4035
4140
|
} else {
|
4036
|
-
return isElement$6(node) && has$2(blockElementsMap, node.nodeName);
|
4141
|
+
return isElement$6(node) && (has$2(blockElementsMap, node.nodeName) || isTransparentBlock(schema, node));
|
4037
4142
|
}
|
4038
4143
|
};
|
4039
4144
|
const get = elm => elm && doc && isString(elm) ? doc.getElementById(elm) : elm;
|
@@ -4303,7 +4408,7 @@
|
|
4303
4408
|
return run(node, n => {
|
4304
4409
|
const $node = SugarElement.fromDom(n);
|
4305
4410
|
if (keepChildren) {
|
4306
|
-
each$e(children($node), child => {
|
4411
|
+
each$e(children$1($node), child => {
|
4307
4412
|
if (isText$b(child) && child.dom.length === 0) {
|
4308
4413
|
remove$6(child);
|
4309
4414
|
} else {
|
@@ -5343,8 +5448,8 @@
|
|
5343
5448
|
const mutate = (original, tag) => {
|
5344
5449
|
const nu = shallowAs(original, tag);
|
5345
5450
|
after$4(original, nu);
|
5346
|
-
const children
|
5347
|
-
append(nu, children
|
5451
|
+
const children = children$1(original);
|
5452
|
+
append(nu, children);
|
5348
5453
|
remove$6(original);
|
5349
5454
|
return nu;
|
5350
5455
|
};
|
@@ -8299,12 +8404,7 @@
|
|
8299
8404
|
}
|
8300
8405
|
return undefined;
|
8301
8406
|
};
|
8302
|
-
const isTextBlock$1 = (
|
8303
|
-
if (isNode(name)) {
|
8304
|
-
name = name.nodeName;
|
8305
|
-
}
|
8306
|
-
return !!editor.schema.getTextBlockElements()[name.toLowerCase()];
|
8307
|
-
};
|
8407
|
+
const isTextBlock$1 = (schema, node) => !!schema.getTextBlockElements()[node.nodeName.toLowerCase()] || isTransparentBlock(schema, node);
|
8308
8408
|
const isValid = (ed, parent, child) => {
|
8309
8409
|
return ed.schema.isValidChild(parent, child);
|
8310
8410
|
};
|
@@ -8444,9 +8544,17 @@
|
|
8444
8544
|
};
|
8445
8545
|
const walkText = (start, node, offset, predicate) => {
|
8446
8546
|
const str = node.data;
|
8447
|
-
|
8448
|
-
|
8449
|
-
|
8547
|
+
if (start) {
|
8548
|
+
for (let i = offset; i > 0; i--) {
|
8549
|
+
if (predicate(str.charAt(i - 1))) {
|
8550
|
+
return i;
|
8551
|
+
}
|
8552
|
+
}
|
8553
|
+
} else {
|
8554
|
+
for (let i = offset; i < str.length; i++) {
|
8555
|
+
if (predicate(str.charAt(i))) {
|
8556
|
+
return i;
|
8557
|
+
}
|
8450
8558
|
}
|
8451
8559
|
}
|
8452
8560
|
return -1;
|
@@ -8493,10 +8601,9 @@
|
|
8493
8601
|
}
|
8494
8602
|
return container;
|
8495
8603
|
};
|
8496
|
-
const findBlockEndPoint = (
|
8604
|
+
const findBlockEndPoint = (dom, formatList, container, siblingName) => {
|
8497
8605
|
var _a;
|
8498
8606
|
let node = container;
|
8499
|
-
const dom = editor.dom;
|
8500
8607
|
const root = dom.getRoot();
|
8501
8608
|
const format = formatList[0];
|
8502
8609
|
if (isBlockFormat(format)) {
|
@@ -8504,7 +8611,7 @@
|
|
8504
8611
|
}
|
8505
8612
|
if (!node) {
|
8506
8613
|
const scopeRoot = (_a = dom.getParent(container, 'LI,TD,TH')) !== null && _a !== void 0 ? _a : root;
|
8507
|
-
node = dom.getParent(isText$a(container) ? container.parentNode : container, node => node !== root && isTextBlock(
|
8614
|
+
node = dom.getParent(isText$a(container) ? container.parentNode : container, node => node !== root && isTextBlock(dom.schema, node), scopeRoot);
|
8508
8615
|
}
|
8509
8616
|
if (node && isBlockFormat(format) && format.wrapper) {
|
8510
8617
|
node = getParents$1(dom, node, 'ul,ol').reverse()[0] || node;
|
@@ -8558,9 +8665,8 @@
|
|
8558
8665
|
return container;
|
8559
8666
|
};
|
8560
8667
|
const isSelfOrParentBookmark = container => isBookmarkNode(container.parentNode) || isBookmarkNode(container);
|
8561
|
-
const expandRng = (
|
8668
|
+
const expandRng = (dom, rng, formatList, includeTrailingSpace = false) => {
|
8562
8669
|
let {startContainer, startOffset, endContainer, endOffset} = rng;
|
8563
|
-
const dom = editor.dom;
|
8564
8670
|
const format = formatList[0];
|
8565
8671
|
if (isElement$6(startContainer) && startContainer.hasChildNodes()) {
|
8566
8672
|
startContainer = getNode$1(startContainer, startOffset);
|
@@ -8599,12 +8705,12 @@
|
|
8599
8705
|
}
|
8600
8706
|
}
|
8601
8707
|
if (rng.collapsed) {
|
8602
|
-
const startPoint = findWordEndPoint(dom,
|
8708
|
+
const startPoint = findWordEndPoint(dom, dom.getRoot(), startContainer, startOffset, true, includeTrailingSpace);
|
8603
8709
|
startPoint.each(({container, offset}) => {
|
8604
8710
|
startContainer = container;
|
8605
8711
|
startOffset = offset;
|
8606
8712
|
});
|
8607
|
-
const endPoint = findWordEndPoint(dom,
|
8713
|
+
const endPoint = findWordEndPoint(dom, dom.getRoot(), endContainer, endOffset, false, includeTrailingSpace);
|
8608
8714
|
endPoint.each(({container, offset}) => {
|
8609
8715
|
endContainer = container;
|
8610
8716
|
endOffset = offset;
|
@@ -8623,8 +8729,8 @@
|
|
8623
8729
|
endContainer = findSelectorEndPoint(dom, formatList, rng, endContainer, 'nextSibling');
|
8624
8730
|
}
|
8625
8731
|
if (isBlockFormat(format) || isSelectorFormat(format)) {
|
8626
|
-
startContainer = findBlockEndPoint(
|
8627
|
-
endContainer = findBlockEndPoint(
|
8732
|
+
startContainer = findBlockEndPoint(dom, formatList, startContainer, 'previousSibling');
|
8733
|
+
endContainer = findBlockEndPoint(dom, formatList, endContainer, 'nextSibling');
|
8628
8734
|
if (isBlockFormat(format)) {
|
8629
8735
|
if (!dom.isBlock(startContainer)) {
|
8630
8736
|
startContainer = findParentContainer(dom, formatList, startContainer, startOffset, true);
|
@@ -8734,7 +8840,7 @@
|
|
8734
8840
|
});
|
8735
8841
|
|
8736
8842
|
const applyWordGrab = (editor, rng) => {
|
8737
|
-
const r = expandRng(editor, rng, [{ inline: 'span' }]);
|
8843
|
+
const r = expandRng(editor.dom, rng, [{ inline: 'span' }]);
|
8738
8844
|
rng.setStart(r.startContainer, r.startOffset);
|
8739
8845
|
rng.setEnd(r.endContainer, r.endOffset);
|
8740
8846
|
editor.selection.setRng(rng);
|
@@ -8795,8 +8901,8 @@
|
|
8795
8901
|
switch (ctx) {
|
8796
8902
|
case 'invalid-child': {
|
8797
8903
|
finishWrapper();
|
8798
|
-
const children
|
8799
|
-
processElements(children
|
8904
|
+
const children = children$1(elem);
|
8905
|
+
processElements(children);
|
8800
8906
|
finishWrapper();
|
8801
8907
|
break;
|
8802
8908
|
}
|
@@ -9863,9 +9969,20 @@
|
|
9863
9969
|
return true;
|
9864
9970
|
});
|
9865
9971
|
};
|
9972
|
+
const expand = (rng, options = { type: 'word' }) => {
|
9973
|
+
if (options.type === 'word') {
|
9974
|
+
const rangeLike = expandRng(dom, rng, [{ inline: 'span' }]);
|
9975
|
+
const newRange = dom.createRng();
|
9976
|
+
newRange.setStart(rangeLike.startContainer, rangeLike.startOffset);
|
9977
|
+
newRange.setEnd(rangeLike.endContainer, rangeLike.endOffset);
|
9978
|
+
return newRange;
|
9979
|
+
}
|
9980
|
+
return rng;
|
9981
|
+
};
|
9866
9982
|
return {
|
9867
9983
|
walk,
|
9868
9984
|
split: split$1,
|
9985
|
+
expand,
|
9869
9986
|
normalize
|
9870
9987
|
};
|
9871
9988
|
};
|
@@ -9973,19 +10090,19 @@
|
|
9973
10090
|
editor.dispatch('AfterScrollIntoView', data);
|
9974
10091
|
};
|
9975
10092
|
const descend = (element, offset) => {
|
9976
|
-
const children
|
9977
|
-
if (children
|
10093
|
+
const children = children$1(element);
|
10094
|
+
if (children.length === 0 || excludeFromDescend(element)) {
|
9978
10095
|
return {
|
9979
10096
|
element,
|
9980
10097
|
offset
|
9981
10098
|
};
|
9982
|
-
} else if (offset < children
|
10099
|
+
} else if (offset < children.length && !excludeFromDescend(children[offset])) {
|
9983
10100
|
return {
|
9984
|
-
element: children
|
10101
|
+
element: children[offset],
|
9985
10102
|
offset: 0
|
9986
10103
|
};
|
9987
10104
|
} else {
|
9988
|
-
const last = children
|
10105
|
+
const last = children[children.length - 1];
|
9989
10106
|
if (excludeFromDescend(last)) {
|
9990
10107
|
return {
|
9991
10108
|
element,
|
@@ -10005,7 +10122,7 @@
|
|
10005
10122
|
} else {
|
10006
10123
|
return {
|
10007
10124
|
element: last,
|
10008
|
-
offset: children(last).length
|
10125
|
+
offset: children$1(last).length
|
10009
10126
|
};
|
10010
10127
|
}
|
10011
10128
|
}
|
@@ -10127,7 +10244,7 @@
|
|
10127
10244
|
const search = element => active$1(getRootNode(element)).filter(e => element.dom.contains(e.dom));
|
10128
10245
|
|
10129
10246
|
const clamp$1 = (offset, element) => {
|
10130
|
-
const max = isText$b(element) ? get$3(element).length : children(element).length + 1;
|
10247
|
+
const max = isText$b(element) ? get$3(element).length : children$1(element).length + 1;
|
10131
10248
|
if (offset > max) {
|
10132
10249
|
return max;
|
10133
10250
|
} else if (offset < 0) {
|
@@ -10138,7 +10255,7 @@
|
|
10138
10255
|
const normalizeRng = rng => SimSelection.range(rng.start, clamp$1(rng.soffset, rng.start), rng.finish, clamp$1(rng.foffset, rng.finish));
|
10139
10256
|
const isOrContains = (root, elm) => !isRestrictedNode(elm.dom) && (contains(root, elm) || eq(root, elm));
|
10140
10257
|
const isRngInRoot = root => rng => isOrContains(root, rng.start) && isOrContains(root, rng.finish);
|
10141
|
-
const shouldStore = editor => editor.inline;
|
10258
|
+
const shouldStore = editor => editor.inline || Env.browser.isFirefox();
|
10142
10259
|
const nativeRangeToSelectionRange = r => SimSelection.range(SugarElement.fromDom(r.startContainer), r.startOffset, SugarElement.fromDom(r.endContainer), r.endOffset);
|
10143
10260
|
const readRange = win => {
|
10144
10261
|
const selection = win.getSelection();
|
@@ -10506,7 +10623,7 @@
|
|
10506
10623
|
return evt.range !== range ? evt.range : range;
|
10507
10624
|
});
|
10508
10625
|
|
10509
|
-
const getEnd = element => name(element) === 'img' ? 1 : getOption(element).fold(() => children(element).length, v => v.length);
|
10626
|
+
const getEnd = element => name(element) === 'img' ? 1 : getOption(element).fold(() => children$1(element).length, v => v.length);
|
10510
10627
|
const isTextNodeWithCursorPosition = el => getOption(el).filter(text => text.trim().length !== 0 || text.indexOf(nbsp) > -1).isSome();
|
10511
10628
|
const elementsWithCursorPosition = [
|
10512
10629
|
'img',
|
@@ -10521,9 +10638,9 @@
|
|
10521
10638
|
const last = element => descendantRtl(element, isCursorPosition);
|
10522
10639
|
const descendantRtl = (scope, predicate) => {
|
10523
10640
|
const descend = element => {
|
10524
|
-
const children
|
10525
|
-
for (let i = children
|
10526
|
-
const child = children
|
10641
|
+
const children = children$1(element);
|
10642
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
10643
|
+
const child = children[i];
|
10527
10644
|
if (predicate(child)) {
|
10528
10645
|
return Optional.some(child);
|
10529
10646
|
}
|
@@ -10935,6 +11052,27 @@
|
|
10935
11052
|
};
|
10936
11053
|
const trimExternal = trimInternal;
|
10937
11054
|
|
11055
|
+
const cleanupBogusElements = parent => {
|
11056
|
+
const bogusElements = descendants(parent, '[data-mce-bogus]');
|
11057
|
+
each$e(bogusElements, elem => {
|
11058
|
+
const bogusValue = get$9(elem, 'data-mce-bogus');
|
11059
|
+
if (bogusValue === 'all') {
|
11060
|
+
remove$6(elem);
|
11061
|
+
} else if (isBr$5(elem)) {
|
11062
|
+
before$3(elem, SugarElement.fromText(zeroWidth));
|
11063
|
+
remove$6(elem);
|
11064
|
+
} else {
|
11065
|
+
unwrap(elem);
|
11066
|
+
}
|
11067
|
+
});
|
11068
|
+
};
|
11069
|
+
const cleanupInputNames = parent => {
|
11070
|
+
const inputs = descendants(parent, 'input');
|
11071
|
+
each$e(inputs, input => {
|
11072
|
+
remove$b(input, 'name');
|
11073
|
+
});
|
11074
|
+
};
|
11075
|
+
|
10938
11076
|
const trimEmptyContents = (editor, html) => {
|
10939
11077
|
const blockName = getForcedRootBlock(editor);
|
10940
11078
|
const emptyRegExp = new RegExp(`^(<${ blockName }[^>]*>( | |\\s|\u00a0|<br \\/>|)<\\/${ blockName }>[\r\n]*|<br \\/>[\r\n]*)$`);
|
@@ -10951,18 +11089,8 @@
|
|
10951
11089
|
top: '0'
|
10952
11090
|
});
|
10953
11091
|
set(offscreenDiv, body.innerHTML);
|
10954
|
-
|
10955
|
-
|
10956
|
-
const bogusValue = get$9(elem, 'data-mce-bogus');
|
10957
|
-
if (bogusValue === 'all') {
|
10958
|
-
remove$6(elem);
|
10959
|
-
} else if (isBr$5(elem)) {
|
10960
|
-
before$3(elem, SugarElement.fromText(zeroWidth));
|
10961
|
-
remove$6(elem);
|
10962
|
-
} else {
|
10963
|
-
unwrap(elem);
|
10964
|
-
}
|
10965
|
-
});
|
11092
|
+
cleanupBogusElements(offscreenDiv);
|
11093
|
+
cleanupInputNames(offscreenDiv);
|
10966
11094
|
const root = getContentContainer(dos);
|
10967
11095
|
append$1(root, offscreenDiv);
|
10968
11096
|
const content = trim$1(offscreenDiv.dom.innerText);
|
@@ -11580,7 +11708,7 @@
|
|
11580
11708
|
const strongRtl = /[\u0591-\u07FF\uFB1D-\uFDFF\uFE70-\uFEFC]/;
|
11581
11709
|
const hasStrongRtl = text => strongRtl.test(text);
|
11582
11710
|
|
11583
|
-
const isInlineTarget = (editor, elm) => is$1(SugarElement.fromDom(elm), getInlineBoundarySelector(editor));
|
11711
|
+
const isInlineTarget = (editor, elm) => is$1(SugarElement.fromDom(elm), getInlineBoundarySelector(editor)) && !isTransparentBlock(editor.schema, elm);
|
11584
11712
|
const isRtl = element => {
|
11585
11713
|
var _a;
|
11586
11714
|
return DOMUtils.DOM.getStyle(element, 'direction', true) === 'rtl' || hasStrongRtl((_a = element.textContent) !== null && _a !== void 0 ? _a : '');
|
@@ -11677,7 +11805,7 @@
|
|
11677
11805
|
}
|
11678
11806
|
if (!eq(root, lastBlock)) {
|
11679
11807
|
const additionalCleanupNodes = is$2(parent(lastBlock), root) ? [] : siblings(lastBlock);
|
11680
|
-
each$e(additionalCleanupNodes.concat(children(root)), node => {
|
11808
|
+
each$e(additionalCleanupNodes.concat(children$1(root)), node => {
|
11681
11809
|
if (!eq(node, lastBlock) && !contains(node, lastBlock) && isEmpty$2(node)) {
|
11682
11810
|
remove$6(node);
|
11683
11811
|
}
|
@@ -12087,8 +12215,8 @@
|
|
12087
12215
|
runFilters(matches, args);
|
12088
12216
|
};
|
12089
12217
|
|
12090
|
-
const paddEmptyNode = (
|
12091
|
-
if (args.insert &&
|
12218
|
+
const paddEmptyNode = (args, isBlock, node) => {
|
12219
|
+
if (args.insert && isBlock(node)) {
|
12092
12220
|
const astNode = new AstNode('br', 1);
|
12093
12221
|
astNode.attr('data-mce-bogus', '1');
|
12094
12222
|
node.empty().append(astNode);
|
@@ -12109,7 +12237,7 @@
|
|
12109
12237
|
return (rule === null || rule === void 0 ? void 0 : rule.paddEmpty) === true;
|
12110
12238
|
};
|
12111
12239
|
const isEmpty = (schema, nonEmptyElements, whitespaceElements, node) => node.isEmpty(nonEmptyElements, whitespaceElements, node => isPadded(schema, node));
|
12112
|
-
const isLineBreakNode = (node,
|
12240
|
+
const isLineBreakNode = (node, isBlock) => isNonNullable(node) && (isBlock(node) || node.name === 'br');
|
12113
12241
|
|
12114
12242
|
const removeOrUnwrapInvalidNode = (node, schema, originalNodeParent = node.parent) => {
|
12115
12243
|
if (schema.getSpecialElements()[node.name]) {
|
@@ -12218,6 +12346,25 @@
|
|
12218
12346
|
}
|
12219
12347
|
}
|
12220
12348
|
};
|
12349
|
+
const hasClosest = (node, parentName) => {
|
12350
|
+
let tempNode = node;
|
12351
|
+
while (tempNode) {
|
12352
|
+
if (tempNode.name === parentName) {
|
12353
|
+
return true;
|
12354
|
+
}
|
12355
|
+
tempNode = tempNode.parent;
|
12356
|
+
}
|
12357
|
+
return false;
|
12358
|
+
};
|
12359
|
+
const isInvalid = (schema, node, parent = node.parent) => {
|
12360
|
+
if (parent && schema.children[node.name] && !schema.isValidChild(parent.name, node.name)) {
|
12361
|
+
return true;
|
12362
|
+
} else if (parent && node.name === 'a' && hasClosest(parent, 'a')) {
|
12363
|
+
return true;
|
12364
|
+
} else {
|
12365
|
+
return false;
|
12366
|
+
}
|
12367
|
+
};
|
12221
12368
|
|
12222
12369
|
const createRange = (sc, so, ec, eo) => {
|
12223
12370
|
const rng = document.createRange();
|
@@ -12525,12 +12672,14 @@
|
|
12525
12672
|
const startCell = dom.getParent(rng.startContainer, isTableCell);
|
12526
12673
|
if (isTableCellContentSelected(dom, rng, startCell)) {
|
12527
12674
|
deleteCellContents(editor, rng, SugarElement.fromDom(startCell));
|
12675
|
+
} else if (rng.startContainer === rng.endContainer && rng.endOffset - rng.startOffset === 1 && isText$a(rng.startContainer.childNodes[rng.startOffset])) {
|
12676
|
+
rng.deleteContents();
|
12528
12677
|
} else {
|
12529
12678
|
editor.getDoc().execCommand('Delete', false);
|
12530
12679
|
}
|
12531
12680
|
};
|
12532
12681
|
const insertHtmlAtCaret = (editor, value, details) => {
|
12533
|
-
var _a, _b
|
12682
|
+
var _a, _b;
|
12534
12683
|
const selection = editor.selection;
|
12535
12684
|
const dom = editor.dom;
|
12536
12685
|
const parser = editor.parser;
|
@@ -12612,9 +12761,9 @@
|
|
12612
12761
|
}
|
12613
12762
|
}
|
12614
12763
|
const toExtract = fragment.children();
|
12615
|
-
const parent = (
|
12764
|
+
const parent = (_b = fragment.parent) !== null && _b !== void 0 ? _b : root;
|
12616
12765
|
fragment.unwrap();
|
12617
|
-
const invalidChildren = filter$5(toExtract, node =>
|
12766
|
+
const invalidChildren = filter$5(toExtract, node => isInvalid(editor.schema, node, parent));
|
12618
12767
|
cleanInvalidNodes(invalidChildren, editor.schema);
|
12619
12768
|
filter$2(parser.getNodeFilters(), parser.getAttributeFilters(), root);
|
12620
12769
|
value = serializer.serialize(root);
|
@@ -12628,6 +12777,7 @@
|
|
12628
12777
|
moveSelectionToMarker(editor, dom.get('mce_marker'));
|
12629
12778
|
unmarkFragmentElements(editor.getBody());
|
12630
12779
|
trimBrsFromTableCell(dom, selection.getStart());
|
12780
|
+
updateCaret(editor.schema, editor.getBody(), selection.getStart());
|
12631
12781
|
return value;
|
12632
12782
|
};
|
12633
12783
|
|
@@ -12980,7 +13130,7 @@
|
|
12980
13130
|
const insertCaretContainerNode = (editor, caretContainer, formatNode) => {
|
12981
13131
|
var _a, _b;
|
12982
13132
|
const dom = editor.dom;
|
12983
|
-
const block = dom.getParent(formatNode, curry(isTextBlock$1, editor));
|
13133
|
+
const block = dom.getParent(formatNode, curry(isTextBlock$1, editor.schema));
|
12984
13134
|
if (block && dom.isEmpty(block)) {
|
12985
13135
|
(_a = formatNode.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(caretContainer, formatNode);
|
12986
13136
|
} else {
|
@@ -13036,7 +13186,7 @@
|
|
13036
13186
|
if (text && offset > 0 && offset < text.length && wordcharRegex.test(text.charAt(offset)) && wordcharRegex.test(text.charAt(offset - 1))) {
|
13037
13187
|
const bookmark = selection.getBookmark();
|
13038
13188
|
selectionRng.collapse(true);
|
13039
|
-
let rng = expandRng(editor, selectionRng, formatList);
|
13189
|
+
let rng = expandRng(editor.dom, selectionRng, formatList);
|
13040
13190
|
rng = split(rng);
|
13041
13191
|
editor.formatter.apply(name, vars, rng);
|
13042
13192
|
selection.moveToBookmark(bookmark);
|
@@ -13091,7 +13241,7 @@
|
|
13091
13241
|
if (hasContentAfter) {
|
13092
13242
|
const bookmark = selection.getBookmark();
|
13093
13243
|
rng.collapse(true);
|
13094
|
-
let expandedRng = expandRng(
|
13244
|
+
let expandedRng = expandRng(dom, rng, formatList, true);
|
13095
13245
|
expandedRng = split(expandedRng);
|
13096
13246
|
editor.formatter.remove(name, vars, expandedRng, similar);
|
13097
13247
|
selection.moveToBookmark(bookmark);
|
@@ -13169,7 +13319,7 @@
|
|
13169
13319
|
append(SugarElement.fromDom(pre1), [
|
13170
13320
|
SugarElement.fromTag('br', doc),
|
13171
13321
|
SugarElement.fromTag('br', doc),
|
13172
|
-
...children(sPre2)
|
13322
|
+
...children$1(sPre2)
|
13173
13323
|
]);
|
13174
13324
|
};
|
13175
13325
|
if (!rng.collapsed) {
|
@@ -13438,6 +13588,11 @@
|
|
13438
13588
|
const removeFormatInternal = (ed, format, vars, node, compareNode) => {
|
13439
13589
|
const dom = ed.dom;
|
13440
13590
|
const elementUtils = ElementUtils(ed);
|
13591
|
+
const schema = ed.schema;
|
13592
|
+
if (isInlineFormat(format) && isTransparentElementName(schema, format.inline) && isTransparentBlock(schema, node) && node.parentElement === ed.getBody()) {
|
13593
|
+
removeNode(ed, node, format);
|
13594
|
+
return removeResult.removed();
|
13595
|
+
}
|
13441
13596
|
if (!format.ceFalseOverride && node && dom.getContentEditableParent(node) === 'false') {
|
13442
13597
|
return removeResult.keep();
|
13443
13598
|
}
|
@@ -13633,7 +13788,7 @@
|
|
13633
13788
|
const removeRngStyle = rng => {
|
13634
13789
|
let startContainer;
|
13635
13790
|
let endContainer;
|
13636
|
-
let expandedRng = expandRng(
|
13791
|
+
let expandedRng = expandRng(dom, rng, formatList, rng.collapsed);
|
13637
13792
|
if (format.split) {
|
13638
13793
|
expandedRng = split(expandedRng);
|
13639
13794
|
startContainer = getContainer(ed, expandedRng, true);
|
@@ -13855,8 +14010,8 @@
|
|
13855
14010
|
const wrapName = format.inline || format.block;
|
13856
14011
|
const wrapElm = createWrapElement(wrapName);
|
13857
14012
|
const isMatchingWrappingBlock = node => isWrappingBlockFormat(format) && matchNode(ed, node, name, vars);
|
13858
|
-
const canRenameBlock = (
|
13859
|
-
const isValidBlockFormatForNode = isNonWrappingBlockFormat(format) && isTextBlock$1(ed,
|
14013
|
+
const canRenameBlock = (node, parentName, isEditableDescendant) => {
|
14014
|
+
const isValidBlockFormatForNode = isNonWrappingBlockFormat(format) && isTextBlock$1(ed.schema, node) && isValid(ed, parentName, wrapName);
|
13860
14015
|
return isEditableDescendant && isValidBlockFormatForNode;
|
13861
14016
|
};
|
13862
14017
|
const canWrapNode = (node, parentName, isEditableDescendant, isWrappableNoneditableElm) => {
|
@@ -13873,7 +14028,6 @@
|
|
13873
14028
|
let hasContentEditableState = false;
|
13874
14029
|
let lastContentEditable = contentEditable;
|
13875
14030
|
let isWrappableNoneditableElm = false;
|
13876
|
-
const nodeName = node.nodeName.toLowerCase();
|
13877
14031
|
const parentNode = node.parentNode;
|
13878
14032
|
const parentName = parentNode.nodeName.toLowerCase();
|
13879
14033
|
const contentEditableValue = dom.getContentEditable(node);
|
@@ -13895,7 +14049,7 @@
|
|
13895
14049
|
currentWrapElm = null;
|
13896
14050
|
return;
|
13897
14051
|
}
|
13898
|
-
if (canRenameBlock(
|
14052
|
+
if (canRenameBlock(node, parentName, isEditableDescendant)) {
|
13899
14053
|
const elm = dom.rename(node, wrapName);
|
13900
14054
|
setElementFormat(elm);
|
13901
14055
|
newWrappers.push(elm);
|
@@ -13996,7 +14150,7 @@
|
|
13996
14150
|
const rng = dom.createRng();
|
13997
14151
|
rng.setStartBefore(node);
|
13998
14152
|
rng.setEndAfter(node);
|
13999
|
-
applyRngStyle(dom, expandRng(
|
14153
|
+
applyRngStyle(dom, expandRng(dom, rng, formatList), true);
|
14000
14154
|
}
|
14001
14155
|
} else {
|
14002
14156
|
applyRngStyle(dom, node, true);
|
@@ -14006,7 +14160,7 @@
|
|
14006
14160
|
selection.setRng(normalize(selection.getRng()));
|
14007
14161
|
preserveSelection(ed, () => {
|
14008
14162
|
runOnRanges(ed, (selectionRng, fake) => {
|
14009
|
-
const expandedRng = fake ? selectionRng : expandRng(
|
14163
|
+
const expandedRng = fake ? selectionRng : expandRng(dom, selectionRng, formatList);
|
14010
14164
|
applyRngStyle(dom, expandedRng, false);
|
14011
14165
|
});
|
14012
14166
|
}, always);
|
@@ -15959,6 +16113,7 @@
|
|
15959
16113
|
const nonEmptyElements = schema.getNonEmptyElements();
|
15960
16114
|
const whitespaceElements = schema.getWhitespaceElements();
|
15961
16115
|
blockElements.body = 1;
|
16116
|
+
const isBlock = node => node.name in blockElements && isTransparentAstInline(schema, node);
|
15962
16117
|
for (let i = 0, l = nodes.length; i < l; i++) {
|
15963
16118
|
let node = nodes[i];
|
15964
16119
|
let parent = node.parent;
|
@@ -15982,7 +16137,7 @@
|
|
15982
16137
|
if (elementRule.removeEmpty) {
|
15983
16138
|
parent.remove();
|
15984
16139
|
} else if (elementRule.paddEmpty) {
|
15985
|
-
paddEmptyNode(
|
16140
|
+
paddEmptyNode(args, isBlock, parent);
|
15986
16141
|
}
|
15987
16142
|
}
|
15988
16143
|
}
|
@@ -16582,12 +16737,13 @@
|
|
16582
16737
|
}
|
16583
16738
|
return false;
|
16584
16739
|
};
|
16740
|
+
const isBlock = node => node.name in blockElements && !isTransparentAstInline(schema, node);
|
16585
16741
|
const isAtEdgeOfBlock = (node, start) => {
|
16586
16742
|
const neighbour = start ? node.prev : node.next;
|
16587
16743
|
if (isNonNullable(neighbour) || isNullable(node.parent)) {
|
16588
16744
|
return false;
|
16589
16745
|
}
|
16590
|
-
return node.parent
|
16746
|
+
return isBlock(node.parent) && (node.parent !== root || args.isRootContent === true);
|
16591
16747
|
};
|
16592
16748
|
const preprocess = node => {
|
16593
16749
|
var _a;
|
@@ -16595,7 +16751,7 @@
|
|
16595
16751
|
if (!hasWhitespaceParent(node)) {
|
16596
16752
|
let text = (_a = node.value) !== null && _a !== void 0 ? _a : '';
|
16597
16753
|
text = text.replace(allWhiteSpaceRegExp, ' ');
|
16598
|
-
if (isLineBreakNode(node.prev,
|
16754
|
+
if (isLineBreakNode(node.prev, isBlock) || isAtEdgeOfBlock(node, true)) {
|
16599
16755
|
text = text.replace(startWhiteSpaceRegExp, '');
|
16600
16756
|
}
|
16601
16757
|
if (text.length === 0) {
|
@@ -16613,21 +16769,21 @@
|
|
16613
16769
|
if (validate && elementRule) {
|
16614
16770
|
const isNodeEmpty = isEmpty(schema, nonEmptyElements, whitespaceElements, node);
|
16615
16771
|
if (elementRule.paddInEmptyBlock && isNodeEmpty && isTextRootBlockEmpty(node)) {
|
16616
|
-
paddEmptyNode(
|
16772
|
+
paddEmptyNode(args, isBlock, node);
|
16617
16773
|
} else if (elementRule.removeEmpty && isNodeEmpty) {
|
16618
|
-
if (
|
16774
|
+
if (isBlock(node)) {
|
16619
16775
|
node.remove();
|
16620
16776
|
} else {
|
16621
16777
|
node.unwrap();
|
16622
16778
|
}
|
16623
16779
|
} else if (elementRule.paddEmpty && (isNodeEmpty || isPaddedWithNbsp(node))) {
|
16624
|
-
paddEmptyNode(
|
16780
|
+
paddEmptyNode(args, isBlock, node);
|
16625
16781
|
}
|
16626
16782
|
}
|
16627
16783
|
} else if (node.type === 3) {
|
16628
16784
|
if (!hasWhitespaceParent(node)) {
|
16629
16785
|
let text = (_a = node.value) !== null && _a !== void 0 ? _a : '';
|
16630
|
-
if (node.next &&
|
16786
|
+
if (node.next && isBlock(node.next) || isAtEdgeOfBlock(node, false)) {
|
16631
16787
|
text = text.replace(endWhiteSpaceRegExp, '');
|
16632
16788
|
}
|
16633
16789
|
if (text.length === 0) {
|
@@ -16681,11 +16837,15 @@
|
|
16681
16837
|
const getAttributeFilters = attributeFilterRegistry.getFilters;
|
16682
16838
|
const removeAttributeFilter = attributeFilterRegistry.removeFilter;
|
16683
16839
|
const findInvalidChildren = (node, invalidChildren) => {
|
16684
|
-
|
16685
|
-
if (parent && schema.children[node.name] && !schema.isValidChild(parent.name, node.name)) {
|
16840
|
+
if (isInvalid(schema, node)) {
|
16686
16841
|
invalidChildren.push(node);
|
16687
16842
|
}
|
16688
16843
|
};
|
16844
|
+
const isWrappableNode = (blockElements, node) => {
|
16845
|
+
const isInternalElement = isString(node.attr(internalElementAttr));
|
16846
|
+
const isInlineElement = node.type === 1 && (!has$2(blockElements, node.name) && !isTransparentAstBlock(schema, node));
|
16847
|
+
return node.type === 3 || isInlineElement && !isInternalElement;
|
16848
|
+
};
|
16689
16849
|
const addRootBlocks = (rootNode, rootBlockName) => {
|
16690
16850
|
const blockElements = extend$1(makeMap('script,style,head,html,body,title,meta,param'), schema.getBlockElements());
|
16691
16851
|
const startWhiteSpaceRegExp = /^[ \t\r\n]+/;
|
@@ -16709,7 +16869,7 @@
|
|
16709
16869
|
}
|
16710
16870
|
while (node) {
|
16711
16871
|
const next = node.next;
|
16712
|
-
if (
|
16872
|
+
if (isWrappableNode(blockElements, node)) {
|
16713
16873
|
if (!rootBlockNode) {
|
16714
16874
|
rootBlockNode = new AstNode(rootBlockName, 1);
|
16715
16875
|
rootBlockNode.attr(defaultedSettings.forced_root_block_attrs);
|
@@ -16731,8 +16891,10 @@
|
|
16731
16891
|
const validate = defaultedSettings.validate;
|
16732
16892
|
const rootName = (_a = args.context) !== null && _a !== void 0 ? _a : defaultedSettings.root_name;
|
16733
16893
|
const element = parseAndSanitizeWithContext(html, rootName, args.format);
|
16894
|
+
updateChildren(schema, element);
|
16734
16895
|
const rootNode = new AstNode(rootName, 11);
|
16735
16896
|
transferChildren(rootNode, element, schema.getSpecialElements());
|
16897
|
+
element.innerHTML = '';
|
16736
16898
|
const [whitespacePre, whitespacePost] = whitespaceCleaner(rootNode, schema, defaultedSettings, args);
|
16737
16899
|
const invalidChildren = [];
|
16738
16900
|
const invalidFinder = validate ? node => findInvalidChildren(node, invalidChildren) : noop;
|
@@ -17036,10 +17198,13 @@
|
|
17036
17198
|
const parentBlockOpt = Optional.from(editor.dom.getParent(rng.commonAncestorContainer, editor.dom.isBlock));
|
17037
17199
|
const body = editor.getBody();
|
17038
17200
|
const contextNodeName = getContextNodeName(parentBlockOpt);
|
17201
|
+
const rangeContentClone = SugarElement.fromDom(rng.cloneContents());
|
17202
|
+
cleanupBogusElements(rangeContentClone);
|
17203
|
+
cleanupInputNames(rangeContentClone);
|
17039
17204
|
const bin = editor.dom.add(body, contextNodeName, {
|
17040
17205
|
'data-mce-bogus': 'all',
|
17041
17206
|
'style': 'overflow: hidden; opacity: 0;'
|
17042
|
-
},
|
17207
|
+
}, rangeContentClone.dom);
|
17043
17208
|
const text = getInnerText(bin);
|
17044
17209
|
const nonRenderedText = trim$1((_a = bin.textContent) !== null && _a !== void 0 ? _a : '');
|
17045
17210
|
editor.dom.remove(bin);
|
@@ -17317,6 +17482,7 @@
|
|
17317
17482
|
}
|
17318
17483
|
if (bookmark) {
|
17319
17484
|
editor.selection.moveToBookmark(bookmark);
|
17485
|
+
editor.selection.scrollIntoView();
|
17320
17486
|
}
|
17321
17487
|
};
|
17322
17488
|
const getLevelContent = level => {
|
@@ -18091,11 +18257,13 @@
|
|
18091
18257
|
win = selectedRange = explicitRange = null;
|
18092
18258
|
controlSelection.destroy();
|
18093
18259
|
};
|
18260
|
+
const expand = (options = { type: 'word' }) => setRng(RangeUtils(dom).expand(getRng$1(), options));
|
18094
18261
|
const exports = {
|
18095
18262
|
dom,
|
18096
18263
|
win,
|
18097
18264
|
serializer,
|
18098
18265
|
editor,
|
18266
|
+
expand,
|
18099
18267
|
collapse,
|
18100
18268
|
setCursorLocation,
|
18101
18269
|
getContent,
|
@@ -18264,7 +18432,7 @@
|
|
18264
18432
|
}
|
18265
18433
|
});
|
18266
18434
|
});
|
18267
|
-
htmlParser.addAttributeFilter('data-mce-src,data-mce-href,data-mce-style,' + 'data-mce-selected,data-mce-expando,' + 'data-mce-type,data-mce-resize,data-mce-placeholder', (nodes, name) => {
|
18435
|
+
htmlParser.addAttributeFilter('data-mce-src,data-mce-href,data-mce-style,' + 'data-mce-selected,data-mce-expando,data-mce-block,' + 'data-mce-type,data-mce-resize,data-mce-placeholder', (nodes, name) => {
|
18268
18436
|
let i = nodes.length;
|
18269
18437
|
while (i--) {
|
18270
18438
|
nodes[i].attr(name, null);
|
@@ -20390,8 +20558,20 @@
|
|
20390
20558
|
return getParentBlock$2(rootElm, containerElm).map(block => blockPosition(block, pos));
|
20391
20559
|
};
|
20392
20560
|
const isDifferentBlocks = blockBoundary => !eq(blockBoundary.from.block, blockBoundary.to.block);
|
20393
|
-
const
|
20561
|
+
const getClosestHost = (root, scope) => {
|
20562
|
+
const isRoot = node => eq(node, root);
|
20563
|
+
const isHost = node => isTableCell$2(node) || isContentEditableTrue$3(node.dom);
|
20564
|
+
return closest$4(scope, isHost, isRoot).filter(isElement$7).getOr(root);
|
20565
|
+
};
|
20566
|
+
const hasSameHost = (rootNode, blockBoundary) => {
|
20567
|
+
const root = SugarElement.fromDom(rootNode);
|
20568
|
+
return eq(getClosestHost(root, blockBoundary.from.block), getClosestHost(root, blockBoundary.to.block));
|
20569
|
+
};
|
20394
20570
|
const isEditable$2 = blockBoundary => isContentEditableFalse$a(blockBoundary.from.block.dom) === false && isContentEditableFalse$a(blockBoundary.to.block.dom) === false;
|
20571
|
+
const hasValidBlocks = blockBoundary => {
|
20572
|
+
const isValidBlock = block => isTextBlock$2(block) || hasBlockAttr(block.dom);
|
20573
|
+
return isValidBlock(blockBoundary.from.block) && isValidBlock(blockBoundary.to.block);
|
20574
|
+
};
|
20395
20575
|
const skipLastBr = (rootNode, forward, blockPosition) => {
|
20396
20576
|
if (isBr$6(blockPosition.position.getNode()) && !isEmpty$2(blockPosition.block)) {
|
20397
20577
|
return positionIn(false, blockPosition.block.dom).bind(lastPositionInBlock => {
|
@@ -20408,13 +20588,13 @@
|
|
20408
20588
|
const readFromRange = (rootNode, forward, rng) => {
|
20409
20589
|
const fromBlockPos = getBlockPosition(rootNode, CaretPosition.fromRangeStart(rng));
|
20410
20590
|
const toBlockPos = fromBlockPos.bind(blockPos => fromPosition(forward, rootNode, blockPos.position).bind(to => getBlockPosition(rootNode, to).map(blockPos => skipLastBr(rootNode, forward, blockPos))));
|
20411
|
-
return lift2(fromBlockPos, toBlockPos, blockBoundary).filter(blockBoundary => isDifferentBlocks(blockBoundary) &&
|
20591
|
+
return lift2(fromBlockPos, toBlockPos, blockBoundary).filter(blockBoundary => isDifferentBlocks(blockBoundary) && hasSameHost(rootNode, blockBoundary) && isEditable$2(blockBoundary) && hasValidBlocks(blockBoundary));
|
20412
20592
|
};
|
20413
20593
|
const read$1 = (rootNode, forward, rng) => rng.collapsed ? readFromRange(rootNode, forward, rng) : Optional.none();
|
20414
20594
|
|
20415
20595
|
const getChildrenUntilBlockBoundary = block => {
|
20416
|
-
const children
|
20417
|
-
return findIndex$2(children
|
20596
|
+
const children = children$1(block);
|
20597
|
+
return findIndex$2(children, isBlock$2).fold(constant(children), index => children.slice(0, index));
|
20418
20598
|
};
|
20419
20599
|
const extractChildren = block => {
|
20420
20600
|
const children = getChildrenUntilBlockBoundary(block);
|
@@ -21674,11 +21854,11 @@
|
|
21674
21854
|
};
|
21675
21855
|
|
21676
21856
|
const isBlockElement = (blockElements, node) => has$2(blockElements, node.nodeName);
|
21677
|
-
const isValidTarget = (
|
21857
|
+
const isValidTarget = (schema, node) => {
|
21678
21858
|
if (isText$a(node)) {
|
21679
21859
|
return true;
|
21680
21860
|
} else if (isElement$6(node)) {
|
21681
|
-
return !isBlockElement(
|
21861
|
+
return !isBlockElement(schema.getBlockElements(), node) && !isBookmarkNode$1(node) && !isTransparentBlock(schema, node);
|
21682
21862
|
} else {
|
21683
21863
|
return false;
|
21684
21864
|
}
|
@@ -21701,7 +21881,8 @@
|
|
21701
21881
|
const createRootBlock = editor => editor.dom.create(getForcedRootBlock(editor), getForcedRootBlockAttrs(editor));
|
21702
21882
|
const addRootBlocks = editor => {
|
21703
21883
|
const dom = editor.dom, selection = editor.selection;
|
21704
|
-
const schema = editor.schema
|
21884
|
+
const schema = editor.schema;
|
21885
|
+
const blockElements = schema.getBlockElements();
|
21705
21886
|
const startNode = selection.getStart();
|
21706
21887
|
const rootNode = editor.getBody();
|
21707
21888
|
let rootBlockNode;
|
@@ -21720,7 +21901,10 @@
|
|
21720
21901
|
const restoreSelection = hasFocus(editor);
|
21721
21902
|
let node = rootNode.firstChild;
|
21722
21903
|
while (node) {
|
21723
|
-
if (
|
21904
|
+
if (isElement$6(node)) {
|
21905
|
+
updateElement(schema, node);
|
21906
|
+
}
|
21907
|
+
if (isValidTarget(schema, node)) {
|
21724
21908
|
if (shouldRemoveTextNode(blockElements, node)) {
|
21725
21909
|
tempNode = node;
|
21726
21910
|
node = node.nextSibling;
|
@@ -22028,7 +22212,7 @@
|
|
22028
22212
|
return filterFirstLayer(scope, selector, always);
|
22029
22213
|
};
|
22030
22214
|
const filterFirstLayer = (scope, selector, predicate) => {
|
22031
|
-
return bind$3(children(scope), x => {
|
22215
|
+
return bind$3(children$1(scope), x => {
|
22032
22216
|
if (is$1(x, selector)) {
|
22033
22217
|
return predicate(x) ? [x] : [];
|
22034
22218
|
} else {
|
@@ -25171,8 +25355,10 @@
|
|
25171
25355
|
};
|
25172
25356
|
const traverseUp = (rootElm, scope, clientX, clientY) => {
|
25173
25357
|
const helper = (scope, prevScope) => {
|
25174
|
-
|
25175
|
-
|
25358
|
+
const isDragGhostContainer = node => isElement$6(node) && node.classList.contains('mce-drag-container');
|
25359
|
+
const childNodesWithoutGhost = filter$5(scope.dom.childNodes, not(isDragGhostContainer));
|
25360
|
+
return prevScope.fold(() => closestChildCaretCandidateNodeRect(childNodesWithoutGhost, clientX, clientY), prevScope => {
|
25361
|
+
const uncheckedChildren = filter$5(childNodesWithoutGhost, node => node !== prevScope.dom);
|
25176
25362
|
return closestChildCaretCandidateNodeRect(uncheckedChildren, clientX, clientY);
|
25177
25363
|
}).orThunk(() => {
|
25178
25364
|
const parent = eq(scope, rootElm) ? Optional.none() : parentElement(scope);
|
@@ -25315,7 +25501,7 @@
|
|
25315
25501
|
const scrollRight = scrollEditor('left', scrollPixelsPerInterval);
|
25316
25502
|
const scrollUp = scrollEditor('top', -scrollPixelsPerInterval);
|
25317
25503
|
const scrollDown = scrollEditor('top', scrollPixelsPerInterval);
|
25318
|
-
const moveGhost = (ghostElm, position, width, height, maxX, maxY, mouseY, mouseX, contentAreaContainer, win, state) => {
|
25504
|
+
const moveGhost = (ghostElm, position, width, height, maxX, maxY, mouseY, mouseX, contentAreaContainer, win, state, mouseEventOriginatedFromWithinTheEditor) => {
|
25319
25505
|
let overflowX = 0, overflowY = 0;
|
25320
25506
|
ghostElm.style.left = position.pageX + 'px';
|
25321
25507
|
ghostElm.style.top = position.pageY + 'px';
|
@@ -25333,7 +25519,7 @@
|
|
25333
25519
|
const outerMouseX = mouseX + contentAreaContainer.getBoundingClientRect().left;
|
25334
25520
|
state.on(state => {
|
25335
25521
|
state.intervalId.clear();
|
25336
|
-
if (state.dragging) {
|
25522
|
+
if (state.dragging && mouseEventOriginatedFromWithinTheEditor) {
|
25337
25523
|
if (mouseY + mouseRangeToTriggerScrollInsideEditor >= clientHeight) {
|
25338
25524
|
state.intervalId.set(scrollDown(win));
|
25339
25525
|
} else if (mouseY - mouseRangeToTriggerScrollInsideEditor <= 0) {
|
@@ -25391,7 +25577,14 @@
|
|
25391
25577
|
const move = (state, editor) => {
|
25392
25578
|
const throttledPlaceCaretAt = first$1((clientX, clientY) => {
|
25393
25579
|
editor._selectionOverrides.hideFakeCaret();
|
25394
|
-
editor.selection.placeCaretAt(clientX, clientY)
|
25580
|
+
closestFakeCaretCandidate(editor.getBody(), clientX, clientY).fold(() => editor.selection.placeCaretAt(clientX, clientY), caretInfo => {
|
25581
|
+
const range = editor._selectionOverrides.showCaret(1, caretInfo.node, caretInfo.position === FakeCaretPosition.Before, false);
|
25582
|
+
if (range) {
|
25583
|
+
editor.selection.setRng(range);
|
25584
|
+
} else {
|
25585
|
+
editor.selection.placeCaretAt(clientX, clientY);
|
25586
|
+
}
|
25587
|
+
});
|
25395
25588
|
}, 0);
|
25396
25589
|
editor.on('remove', throttledPlaceCaretAt.cancel);
|
25397
25590
|
const state_ = state;
|
@@ -25406,9 +25599,10 @@
|
|
25406
25599
|
editor.focus();
|
25407
25600
|
}
|
25408
25601
|
if (state.dragging) {
|
25602
|
+
const mouseEventOriginatedFromWithinTheEditor = e.currentTarget === editor.getDoc().documentElement;
|
25409
25603
|
const targetPos = applyRelPos(state, calc(editor, e));
|
25410
25604
|
appendGhostToBody(state.ghost, editor.getBody());
|
25411
|
-
moveGhost(state.ghost, targetPos, state.width, state.height, state.maxX, state.maxY, e.clientY, e.clientX, editor.getContentAreaContainer(), editor.getWin(), state_);
|
25605
|
+
moveGhost(state.ghost, targetPos, state.width, state.height, state.maxX, state.maxY, e.clientY, e.clientX, editor.getContentAreaContainer(), editor.getWin(), state_, mouseEventOriginatedFromWithinTheEditor);
|
25412
25606
|
throttledPlaceCaretAt.throttle(e.clientX, e.clientY);
|
25413
25607
|
}
|
25414
25608
|
});
|
@@ -25781,12 +25975,28 @@
|
|
25781
25975
|
const dir = forward ? 1 : -1;
|
25782
25976
|
const caretPosition = getNormalizedRangeEndPoint(dir, rootNode, range);
|
25783
25977
|
const beforeNode = caretPosition.getNode(!forward);
|
25784
|
-
if (
|
25785
|
-
|
25978
|
+
if (isNonNullable(beforeNode)) {
|
25979
|
+
if (isFakeCaretTarget(beforeNode)) {
|
25980
|
+
return showCaret(dir, beforeNode, forward ? !caretPosition.isAtEnd() : false, false);
|
25981
|
+
}
|
25982
|
+
if (isCaretContainerInline(beforeNode) && isContentEditableFalse$a(beforeNode.nextSibling)) {
|
25983
|
+
const rng = dom.createRng();
|
25984
|
+
rng.setStart(beforeNode, 0);
|
25985
|
+
rng.setEnd(beforeNode, 0);
|
25986
|
+
return rng;
|
25987
|
+
}
|
25786
25988
|
}
|
25787
25989
|
const afterNode = caretPosition.getNode(forward);
|
25788
|
-
if (
|
25789
|
-
|
25990
|
+
if (isNonNullable(afterNode)) {
|
25991
|
+
if (isFakeCaretTarget(afterNode)) {
|
25992
|
+
return showCaret(dir, afterNode, forward ? false : !caretPosition.isAtEnd(), false);
|
25993
|
+
}
|
25994
|
+
if (isCaretContainerInline(afterNode) && isContentEditableFalse$a(afterNode.previousSibling)) {
|
25995
|
+
const rng = dom.createRng();
|
25996
|
+
rng.setStart(afterNode, 1);
|
25997
|
+
rng.setEnd(afterNode, 1);
|
25998
|
+
return rng;
|
25999
|
+
}
|
25790
26000
|
}
|
25791
26001
|
}
|
25792
26002
|
return null;
|
@@ -25975,9 +26185,9 @@
|
|
25975
26185
|
});
|
25976
26186
|
return true;
|
25977
26187
|
};
|
25978
|
-
const sortPatterns = patterns => sort(patterns, (a, b) => b.start.length - a.start.length);
|
26188
|
+
const sortPatterns$1 = patterns => sort(patterns, (a, b) => b.start.length - a.start.length);
|
25979
26189
|
const findPattern$1 = (patterns, text) => {
|
25980
|
-
const sortedPatterns = sortPatterns(patterns);
|
26190
|
+
const sortedPatterns = sortPatterns$1(patterns);
|
25981
26191
|
const nuText = text.replace(nbsp, ' ');
|
25982
26192
|
return find$2(sortedPatterns, pattern => text.indexOf(pattern.start) === 0 || nuText.indexOf(pattern.start) === 0);
|
25983
26193
|
};
|
@@ -26055,7 +26265,10 @@
|
|
26055
26265
|
const startPattern = pattern.start;
|
26056
26266
|
const startSpot = repeatLeft(dom, spot.container, spot.offset, matchesPattern(startPattern), block);
|
26057
26267
|
return startSpot.bind(spot => {
|
26058
|
-
|
26268
|
+
var _a, _b;
|
26269
|
+
const startPatternIndex = (_b = (_a = block.textContent) === null || _a === void 0 ? void 0 : _a.indexOf(startPattern)) !== null && _b !== void 0 ? _b : -1;
|
26270
|
+
const isCompleteMatch = startPatternIndex !== -1 && spot.offset >= startPatternIndex + startPattern.length;
|
26271
|
+
if (isCompleteMatch) {
|
26059
26272
|
const rng = dom.createRng();
|
26060
26273
|
rng.setStart(spot.container, spot.offset - startPattern.length);
|
26061
26274
|
rng.setEnd(spot.container, spot.offset);
|
@@ -26148,6 +26361,9 @@
|
|
26148
26361
|
remainingPatterns: patternsWithoutCurrent,
|
26149
26362
|
position: endSpot
|
26150
26363
|
}, normalizedMatches);
|
26364
|
+
if (result.isNone() && offset > 0) {
|
26365
|
+
return findPatternsRec(editor, patterns, node, offset - 1, block, normalizedMatches);
|
26366
|
+
}
|
26151
26367
|
if (result.isSome()) {
|
26152
26368
|
return result;
|
26153
26369
|
}
|
@@ -26202,7 +26418,23 @@
|
|
26202
26418
|
}]);
|
26203
26419
|
}, []);
|
26204
26420
|
};
|
26205
|
-
const
|
26421
|
+
const sortPatterns = patterns => sort(patterns, (a, b) => b.end.length - a.end.length);
|
26422
|
+
const getBestMatches = (matches, matchesWithSortedPatterns) => {
|
26423
|
+
const hasSameMatches = forall(matches, match => exists(matchesWithSortedPatterns, sortedMatch => match.pattern.start === sortedMatch.pattern.start && match.pattern.end === sortedMatch.pattern.end));
|
26424
|
+
if (matches.length === matchesWithSortedPatterns.length) {
|
26425
|
+
if (hasSameMatches) {
|
26426
|
+
return matches;
|
26427
|
+
} else {
|
26428
|
+
return matchesWithSortedPatterns;
|
26429
|
+
}
|
26430
|
+
}
|
26431
|
+
return matches.length > matchesWithSortedPatterns.length ? matches : matchesWithSortedPatterns;
|
26432
|
+
};
|
26433
|
+
const findPatterns = (editor, block, node, offset, patternSet, normalizedMatches) => {
|
26434
|
+
const matches = findPatternsRec(editor, patternSet.inlinePatterns, node, offset, block, normalizedMatches).fold(() => [], result => result.matches);
|
26435
|
+
const matchesWithSortedPatterns = findPatternsRec(editor, sortPatterns(patternSet.inlinePatterns), node, offset, block, normalizedMatches).fold(() => [], result => result.matches);
|
26436
|
+
return getBestMatches(matches, matchesWithSortedPatterns);
|
26437
|
+
};
|
26206
26438
|
const applyMatches = (editor, matches) => {
|
26207
26439
|
if (matches.length === 0) {
|
26208
26440
|
return;
|
@@ -26546,7 +26778,7 @@
|
|
26546
26778
|
};
|
26547
26779
|
const addBrAfterLastLinks = () => {
|
26548
26780
|
const fixLinks = () => {
|
26549
|
-
each(dom.select('a'), node => {
|
26781
|
+
each(dom.select('a:not([data-mce-block])'), node => {
|
26550
26782
|
var _a;
|
26551
26783
|
let parentNode = node.parentNode;
|
26552
26784
|
const root = dom.getRoot();
|
@@ -28019,6 +28251,8 @@
|
|
28019
28251
|
registerExecCommands(editor);
|
28020
28252
|
};
|
28021
28253
|
|
28254
|
+
const selectionSafeCommands = ['toggleview'];
|
28255
|
+
const isSelectionSafeCommand = command => contains$2(selectionSafeCommands, command.toLowerCase());
|
28022
28256
|
class EditorCommands {
|
28023
28257
|
constructor(editor) {
|
28024
28258
|
this.commands = {
|
@@ -28063,7 +28297,7 @@
|
|
28063
28297
|
return false;
|
28064
28298
|
}
|
28065
28299
|
queryCommandState(command) {
|
28066
|
-
if (this.editor.quirks.isHidden() || this.editor.removed) {
|
28300
|
+
if (!isSelectionSafeCommand(command) && this.editor.quirks.isHidden() || this.editor.removed) {
|
28067
28301
|
return false;
|
28068
28302
|
}
|
28069
28303
|
const lowerCaseCommand = command.toLowerCase();
|
@@ -28074,7 +28308,7 @@
|
|
28074
28308
|
return false;
|
28075
28309
|
}
|
28076
28310
|
queryCommandValue(command) {
|
28077
|
-
if (this.editor.quirks.isHidden() || this.editor.removed) {
|
28311
|
+
if (!isSelectionSafeCommand(command) && this.editor.quirks.isHidden() || this.editor.removed) {
|
28078
28312
|
return '';
|
28079
28313
|
}
|
28080
28314
|
const lowerCaseCommand = command.toLowerCase();
|
@@ -28913,6 +29147,7 @@
|
|
28913
29147
|
const contextMenus = {};
|
28914
29148
|
const contextToolbars = {};
|
28915
29149
|
const sidebars = {};
|
29150
|
+
const views = {};
|
28916
29151
|
const add = (collection, type) => (name, spec) => {
|
28917
29152
|
collection[name.toLowerCase()] = {
|
28918
29153
|
...spec,
|
@@ -28934,6 +29169,7 @@
|
|
28934
29169
|
addContextToolbar: add(contextToolbars, 'contexttoolbar'),
|
28935
29170
|
addContextForm: add(contextToolbars, 'contextform'),
|
28936
29171
|
addSidebar: add(sidebars, 'sidebar'),
|
29172
|
+
addView: add(views, 'views'),
|
28937
29173
|
addIcon,
|
28938
29174
|
getAll: () => ({
|
28939
29175
|
buttons,
|
@@ -28942,7 +29178,8 @@
|
|
28942
29178
|
popups,
|
28943
29179
|
contextMenus,
|
28944
29180
|
contextToolbars,
|
28945
|
-
sidebars
|
29181
|
+
sidebars,
|
29182
|
+
views
|
28946
29183
|
})
|
28947
29184
|
};
|
28948
29185
|
};
|
@@ -28964,6 +29201,7 @@
|
|
28964
29201
|
addToggleButton: bridge.addToggleButton,
|
28965
29202
|
addGroupToolbarButton: bridge.addGroupToolbarButton,
|
28966
29203
|
addToggleMenuItem: bridge.addToggleMenuItem,
|
29204
|
+
addView: bridge.addView,
|
28967
29205
|
getAll: bridge.getAll
|
28968
29206
|
};
|
28969
29207
|
};
|
@@ -29015,6 +29253,10 @@
|
|
29015
29253
|
ScriptLoader.ScriptLoader._setReferrerPolicy(referrerPolicy);
|
29016
29254
|
DOMUtils.DOM.styleSheetLoader._setReferrerPolicy(referrerPolicy);
|
29017
29255
|
}
|
29256
|
+
const contentCssCors = hasContentCssCors(self);
|
29257
|
+
if (isNonNullable(contentCssCors)) {
|
29258
|
+
DOMUtils.DOM.styleSheetLoader._setContentCssCors(contentCssCors);
|
29259
|
+
}
|
29018
29260
|
AddOnManager.languageLoad = getOption('language_load');
|
29019
29261
|
AddOnManager.baseURL = editorManager.baseURL;
|
29020
29262
|
this.setDirty(false);
|
@@ -29385,8 +29627,8 @@
|
|
29385
29627
|
documentBaseURL: null,
|
29386
29628
|
suffix: null,
|
29387
29629
|
majorVersion: '6',
|
29388
|
-
minorVersion: '
|
29389
|
-
releaseDate: '2022-
|
29630
|
+
minorVersion: '3.0',
|
29631
|
+
releaseDate: '2022-11-23',
|
29390
29632
|
i18n: I18n,
|
29391
29633
|
activeEditor: null,
|
29392
29634
|
focusedEditor: null,
|