Edit File by line
/home/barbar84/www/wp-inclu.../js/tinymce/plugins/paste
File: plugin.js
var make = function (run) {
[1500] Fix | Delete
var get = function (callback) {
[1501] Fix | Delete
run().then(callback, errorReporter);
[1502] Fix | Delete
};
[1503] Fix | Delete
var map = function (fab) {
[1504] Fix | Delete
return make(function () {
[1505] Fix | Delete
return run().then(fab);
[1506] Fix | Delete
});
[1507] Fix | Delete
};
[1508] Fix | Delete
var bind = function (aFutureB) {
[1509] Fix | Delete
return make(function () {
[1510] Fix | Delete
return run().then(function (v) {
[1511] Fix | Delete
return aFutureB(v).toPromise();
[1512] Fix | Delete
});
[1513] Fix | Delete
});
[1514] Fix | Delete
};
[1515] Fix | Delete
var anonBind = function (futureB) {
[1516] Fix | Delete
return make(function () {
[1517] Fix | Delete
return run().then(function () {
[1518] Fix | Delete
return futureB.toPromise();
[1519] Fix | Delete
});
[1520] Fix | Delete
});
[1521] Fix | Delete
};
[1522] Fix | Delete
var toLazy = function () {
[1523] Fix | Delete
return LazyValue.nu(get);
[1524] Fix | Delete
};
[1525] Fix | Delete
var toCached = function () {
[1526] Fix | Delete
var cache = null;
[1527] Fix | Delete
return make(function () {
[1528] Fix | Delete
if (cache === null) {
[1529] Fix | Delete
cache = run();
[1530] Fix | Delete
}
[1531] Fix | Delete
return cache;
[1532] Fix | Delete
});
[1533] Fix | Delete
};
[1534] Fix | Delete
var toPromise = run;
[1535] Fix | Delete
return {
[1536] Fix | Delete
map: map,
[1537] Fix | Delete
bind: bind,
[1538] Fix | Delete
anonBind: anonBind,
[1539] Fix | Delete
toLazy: toLazy,
[1540] Fix | Delete
toCached: toCached,
[1541] Fix | Delete
toPromise: toPromise,
[1542] Fix | Delete
get: get
[1543] Fix | Delete
};
[1544] Fix | Delete
};
[1545] Fix | Delete
var nu$1 = function (baseFn) {
[1546] Fix | Delete
return make(function () {
[1547] Fix | Delete
return new Promise(baseFn);
[1548] Fix | Delete
});
[1549] Fix | Delete
};
[1550] Fix | Delete
var pure$1 = function (a) {
[1551] Fix | Delete
return make(function () {
[1552] Fix | Delete
return Promise.resolve(a);
[1553] Fix | Delete
});
[1554] Fix | Delete
};
[1555] Fix | Delete
var Future = {
[1556] Fix | Delete
nu: nu$1,
[1557] Fix | Delete
pure: pure$1
[1558] Fix | Delete
};
[1559] Fix | Delete
[1560] Fix | Delete
var par = function (asyncValues, nu) {
[1561] Fix | Delete
return nu(function (callback) {
[1562] Fix | Delete
var r = [];
[1563] Fix | Delete
var count = 0;
[1564] Fix | Delete
var cb = function (i) {
[1565] Fix | Delete
return function (value) {
[1566] Fix | Delete
r[i] = value;
[1567] Fix | Delete
count++;
[1568] Fix | Delete
if (count >= asyncValues.length) {
[1569] Fix | Delete
callback(r);
[1570] Fix | Delete
}
[1571] Fix | Delete
};
[1572] Fix | Delete
};
[1573] Fix | Delete
if (asyncValues.length === 0) {
[1574] Fix | Delete
callback([]);
[1575] Fix | Delete
} else {
[1576] Fix | Delete
each(asyncValues, function (asyncValue, i) {
[1577] Fix | Delete
asyncValue.get(cb(i));
[1578] Fix | Delete
});
[1579] Fix | Delete
}
[1580] Fix | Delete
});
[1581] Fix | Delete
};
[1582] Fix | Delete
[1583] Fix | Delete
var par$1 = function (futures) {
[1584] Fix | Delete
return par(futures, Future.nu);
[1585] Fix | Delete
};
[1586] Fix | Delete
var traverse = function (array, fn) {
[1587] Fix | Delete
return par$1(map(array, fn));
[1588] Fix | Delete
};
[1589] Fix | Delete
var mapM = traverse;
[1590] Fix | Delete
[1591] Fix | Delete
var value = function () {
[1592] Fix | Delete
var subject = Cell(Option.none());
[1593] Fix | Delete
var clear = function () {
[1594] Fix | Delete
subject.set(Option.none());
[1595] Fix | Delete
};
[1596] Fix | Delete
var set = function (s) {
[1597] Fix | Delete
subject.set(Option.some(s));
[1598] Fix | Delete
};
[1599] Fix | Delete
var on = function (f) {
[1600] Fix | Delete
subject.get().each(f);
[1601] Fix | Delete
};
[1602] Fix | Delete
var isSet = function () {
[1603] Fix | Delete
return subject.get().isSome();
[1604] Fix | Delete
};
[1605] Fix | Delete
return {
[1606] Fix | Delete
clear: clear,
[1607] Fix | Delete
set: set,
[1608] Fix | Delete
isSet: isSet,
[1609] Fix | Delete
on: on
[1610] Fix | Delete
};
[1611] Fix | Delete
};
[1612] Fix | Delete
[1613] Fix | Delete
var pasteHtml$1 = function (editor, html, internalFlag) {
[1614] Fix | Delete
var internal = internalFlag ? internalFlag : InternalHtml.isMarked(html);
[1615] Fix | Delete
var args = ProcessFilters.process(editor, InternalHtml.unmark(html), internal);
[1616] Fix | Delete
if (args.cancelled === false) {
[1617] Fix | Delete
SmartPaste.insertContent(editor, args.content);
[1618] Fix | Delete
}
[1619] Fix | Delete
};
[1620] Fix | Delete
var pasteText = function (editor, text) {
[1621] Fix | Delete
text = editor.dom.encode(text).replace(/\r\n/g, '\n');
[1622] Fix | Delete
text = Newlines.convert(text, editor.settings.forced_root_block, editor.settings.forced_root_block_attrs);
[1623] Fix | Delete
pasteHtml$1(editor, text, false);
[1624] Fix | Delete
};
[1625] Fix | Delete
var getDataTransferItems = function (dataTransfer) {
[1626] Fix | Delete
var items = {};
[1627] Fix | Delete
var mceInternalUrlPrefix = 'data:text/mce-internal,';
[1628] Fix | Delete
if (dataTransfer) {
[1629] Fix | Delete
if (dataTransfer.getData) {
[1630] Fix | Delete
var legacyText = dataTransfer.getData('Text');
[1631] Fix | Delete
if (legacyText && legacyText.length > 0) {
[1632] Fix | Delete
if (legacyText.indexOf(mceInternalUrlPrefix) === -1) {
[1633] Fix | Delete
items['text/plain'] = legacyText;
[1634] Fix | Delete
}
[1635] Fix | Delete
}
[1636] Fix | Delete
}
[1637] Fix | Delete
if (dataTransfer.types) {
[1638] Fix | Delete
for (var i = 0; i < dataTransfer.types.length; i++) {
[1639] Fix | Delete
var contentType = dataTransfer.types[i];
[1640] Fix | Delete
try {
[1641] Fix | Delete
items[contentType] = dataTransfer.getData(contentType);
[1642] Fix | Delete
} catch (ex) {
[1643] Fix | Delete
items[contentType] = '';
[1644] Fix | Delete
}
[1645] Fix | Delete
}
[1646] Fix | Delete
}
[1647] Fix | Delete
}
[1648] Fix | Delete
return items;
[1649] Fix | Delete
};
[1650] Fix | Delete
var getClipboardContent = function (editor, clipboardEvent) {
[1651] Fix | Delete
var content = getDataTransferItems(clipboardEvent.clipboardData || editor.getDoc().dataTransfer);
[1652] Fix | Delete
return Utils.isMsEdge() ? global$4.extend(content, { 'text/html': '' }) : content;
[1653] Fix | Delete
};
[1654] Fix | Delete
var hasContentType = function (clipboardContent, mimeType) {
[1655] Fix | Delete
return mimeType in clipboardContent && clipboardContent[mimeType].length > 0;
[1656] Fix | Delete
};
[1657] Fix | Delete
var hasHtmlOrText = function (content) {
[1658] Fix | Delete
return hasContentType(content, 'text/html') || hasContentType(content, 'text/plain');
[1659] Fix | Delete
};
[1660] Fix | Delete
var getBase64FromUri = function (uri) {
[1661] Fix | Delete
var idx;
[1662] Fix | Delete
idx = uri.indexOf(',');
[1663] Fix | Delete
if (idx !== -1) {
[1664] Fix | Delete
return uri.substr(idx + 1);
[1665] Fix | Delete
}
[1666] Fix | Delete
return null;
[1667] Fix | Delete
};
[1668] Fix | Delete
var isValidDataUriImage = function (settings, imgElm) {
[1669] Fix | Delete
return settings.images_dataimg_filter ? settings.images_dataimg_filter(imgElm) : true;
[1670] Fix | Delete
};
[1671] Fix | Delete
var extractFilename = function (editor, str) {
[1672] Fix | Delete
var m = str.match(/([\s\S]+?)\.(?:jpeg|jpg|png|gif)$/i);
[1673] Fix | Delete
return m ? editor.dom.encode(m[1]) : null;
[1674] Fix | Delete
};
[1675] Fix | Delete
var uniqueId = Utils.createIdGenerator('mceclip');
[1676] Fix | Delete
var pasteImage = function (editor, imageItem) {
[1677] Fix | Delete
var base64 = getBase64FromUri(imageItem.uri);
[1678] Fix | Delete
var id = uniqueId();
[1679] Fix | Delete
var name = editor.settings.images_reuse_filename && imageItem.blob.name ? extractFilename(editor, imageItem.blob.name) : id;
[1680] Fix | Delete
var img = new domGlobals.Image();
[1681] Fix | Delete
img.src = imageItem.uri;
[1682] Fix | Delete
if (isValidDataUriImage(editor.settings, img)) {
[1683] Fix | Delete
var blobCache = editor.editorUpload.blobCache;
[1684] Fix | Delete
var blobInfo = void 0, existingBlobInfo = void 0;
[1685] Fix | Delete
existingBlobInfo = blobCache.findFirst(function (cachedBlobInfo) {
[1686] Fix | Delete
return cachedBlobInfo.base64() === base64;
[1687] Fix | Delete
});
[1688] Fix | Delete
if (!existingBlobInfo) {
[1689] Fix | Delete
blobInfo = blobCache.create(id, imageItem.blob, base64, name);
[1690] Fix | Delete
blobCache.add(blobInfo);
[1691] Fix | Delete
} else {
[1692] Fix | Delete
blobInfo = existingBlobInfo;
[1693] Fix | Delete
}
[1694] Fix | Delete
pasteHtml$1(editor, '<img src="' + blobInfo.blobUri() + '">', false);
[1695] Fix | Delete
} else {
[1696] Fix | Delete
pasteHtml$1(editor, '<img src="' + imageItem.uri + '">', false);
[1697] Fix | Delete
}
[1698] Fix | Delete
};
[1699] Fix | Delete
var isClipboardEvent = function (event) {
[1700] Fix | Delete
return event.type === 'paste';
[1701] Fix | Delete
};
[1702] Fix | Delete
var readBlobsAsDataUris = function (items) {
[1703] Fix | Delete
return mapM(items, function (item) {
[1704] Fix | Delete
return Future.nu(function (resolve) {
[1705] Fix | Delete
var blob = item.getAsFile ? item.getAsFile() : item;
[1706] Fix | Delete
var reader = new window.FileReader();
[1707] Fix | Delete
reader.onload = function () {
[1708] Fix | Delete
resolve({
[1709] Fix | Delete
blob: blob,
[1710] Fix | Delete
uri: reader.result
[1711] Fix | Delete
});
[1712] Fix | Delete
};
[1713] Fix | Delete
reader.readAsDataURL(blob);
[1714] Fix | Delete
});
[1715] Fix | Delete
});
[1716] Fix | Delete
};
[1717] Fix | Delete
var getImagesFromDataTransfer = function (dataTransfer) {
[1718] Fix | Delete
var items = dataTransfer.items ? map(from$1(dataTransfer.items), function (item) {
[1719] Fix | Delete
return item.getAsFile();
[1720] Fix | Delete
}) : [];
[1721] Fix | Delete
var files = dataTransfer.files ? from$1(dataTransfer.files) : [];
[1722] Fix | Delete
var images = filter$1(items.length > 0 ? items : files, function (file) {
[1723] Fix | Delete
return /^image\/(jpeg|png|gif|bmp)$/.test(file.type);
[1724] Fix | Delete
});
[1725] Fix | Delete
return images;
[1726] Fix | Delete
};
[1727] Fix | Delete
var pasteImageData = function (editor, e, rng) {
[1728] Fix | Delete
var dataTransfer = isClipboardEvent(e) ? e.clipboardData : e.dataTransfer;
[1729] Fix | Delete
if (editor.settings.paste_data_images && dataTransfer) {
[1730] Fix | Delete
var images = getImagesFromDataTransfer(dataTransfer);
[1731] Fix | Delete
if (images.length > 0) {
[1732] Fix | Delete
e.preventDefault();
[1733] Fix | Delete
readBlobsAsDataUris(images).get(function (blobResults) {
[1734] Fix | Delete
if (rng) {
[1735] Fix | Delete
editor.selection.setRng(rng);
[1736] Fix | Delete
}
[1737] Fix | Delete
each(blobResults, function (result) {
[1738] Fix | Delete
pasteImage(editor, result);
[1739] Fix | Delete
});
[1740] Fix | Delete
});
[1741] Fix | Delete
return true;
[1742] Fix | Delete
}
[1743] Fix | Delete
}
[1744] Fix | Delete
return false;
[1745] Fix | Delete
};
[1746] Fix | Delete
var isBrokenAndroidClipboardEvent = function (e) {
[1747] Fix | Delete
var clipboardData = e.clipboardData;
[1748] Fix | Delete
return domGlobals.navigator.userAgent.indexOf('Android') !== -1 && clipboardData && clipboardData.items && clipboardData.items.length === 0;
[1749] Fix | Delete
};
[1750] Fix | Delete
var isKeyboardPasteEvent = function (e) {
[1751] Fix | Delete
return global$5.metaKeyPressed(e) && e.keyCode === 86 || e.shiftKey && e.keyCode === 45;
[1752] Fix | Delete
};
[1753] Fix | Delete
var registerEventHandlers = function (editor, pasteBin, pasteFormat) {
[1754] Fix | Delete
var keyboardPasteEvent = value();
[1755] Fix | Delete
var keyboardPastePlainTextState;
[1756] Fix | Delete
editor.on('keydown', function (e) {
[1757] Fix | Delete
function removePasteBinOnKeyUp(e) {
[1758] Fix | Delete
if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {
[1759] Fix | Delete
pasteBin.remove();
[1760] Fix | Delete
}
[1761] Fix | Delete
}
[1762] Fix | Delete
if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {
[1763] Fix | Delete
keyboardPastePlainTextState = e.shiftKey && e.keyCode === 86;
[1764] Fix | Delete
if (keyboardPastePlainTextState && global$2.webkit && domGlobals.navigator.userAgent.indexOf('Version/') !== -1) {
[1765] Fix | Delete
return;
[1766] Fix | Delete
}
[1767] Fix | Delete
e.stopImmediatePropagation();
[1768] Fix | Delete
keyboardPasteEvent.set(e);
[1769] Fix | Delete
window.setTimeout(function () {
[1770] Fix | Delete
keyboardPasteEvent.clear();
[1771] Fix | Delete
}, 100);
[1772] Fix | Delete
if (global$2.ie && keyboardPastePlainTextState) {
[1773] Fix | Delete
e.preventDefault();
[1774] Fix | Delete
Events.firePaste(editor, true);
[1775] Fix | Delete
return;
[1776] Fix | Delete
}
[1777] Fix | Delete
pasteBin.remove();
[1778] Fix | Delete
pasteBin.create();
[1779] Fix | Delete
editor.once('keyup', removePasteBinOnKeyUp);
[1780] Fix | Delete
editor.once('paste', function () {
[1781] Fix | Delete
editor.off('keyup', removePasteBinOnKeyUp);
[1782] Fix | Delete
});
[1783] Fix | Delete
}
[1784] Fix | Delete
});
[1785] Fix | Delete
function insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal) {
[1786] Fix | Delete
var content, isPlainTextHtml;
[1787] Fix | Delete
if (hasContentType(clipboardContent, 'text/html')) {
[1788] Fix | Delete
content = clipboardContent['text/html'];
[1789] Fix | Delete
} else {
[1790] Fix | Delete
content = pasteBin.getHtml();
[1791] Fix | Delete
internal = internal ? internal : InternalHtml.isMarked(content);
[1792] Fix | Delete
if (pasteBin.isDefaultContent(content)) {
[1793] Fix | Delete
plainTextMode = true;
[1794] Fix | Delete
}
[1795] Fix | Delete
}
[1796] Fix | Delete
content = Utils.trimHtml(content);
[1797] Fix | Delete
pasteBin.remove();
[1798] Fix | Delete
isPlainTextHtml = internal === false && Newlines.isPlainText(content);
[1799] Fix | Delete
if (!content.length || isPlainTextHtml) {
[1800] Fix | Delete
plainTextMode = true;
[1801] Fix | Delete
}
[1802] Fix | Delete
if (plainTextMode) {
[1803] Fix | Delete
if (hasContentType(clipboardContent, 'text/plain') && isPlainTextHtml) {
[1804] Fix | Delete
content = clipboardContent['text/plain'];
[1805] Fix | Delete
} else {
[1806] Fix | Delete
content = Utils.innerText(content);
[1807] Fix | Delete
}
[1808] Fix | Delete
}
[1809] Fix | Delete
if (pasteBin.isDefaultContent(content)) {
[1810] Fix | Delete
if (!isKeyBoardPaste) {
[1811] Fix | Delete
editor.windowManager.alert('Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.');
[1812] Fix | Delete
}
[1813] Fix | Delete
return;
[1814] Fix | Delete
}
[1815] Fix | Delete
if (plainTextMode) {
[1816] Fix | Delete
pasteText(editor, content);
[1817] Fix | Delete
} else {
[1818] Fix | Delete
pasteHtml$1(editor, content, internal);
[1819] Fix | Delete
}
[1820] Fix | Delete
}
[1821] Fix | Delete
var getLastRng = function () {
[1822] Fix | Delete
return pasteBin.getLastRng() || editor.selection.getRng();
[1823] Fix | Delete
};
[1824] Fix | Delete
editor.on('paste', function (e) {
[1825] Fix | Delete
var isKeyBoardPaste = keyboardPasteEvent.isSet();
[1826] Fix | Delete
var clipboardContent = getClipboardContent(editor, e);
[1827] Fix | Delete
var plainTextMode = pasteFormat.get() === 'text' || keyboardPastePlainTextState;
[1828] Fix | Delete
var internal = hasContentType(clipboardContent, InternalHtml.internalHtmlMime());
[1829] Fix | Delete
keyboardPastePlainTextState = false;
[1830] Fix | Delete
if (e.isDefaultPrevented() || isBrokenAndroidClipboardEvent(e)) {
[1831] Fix | Delete
pasteBin.remove();
[1832] Fix | Delete
return;
[1833] Fix | Delete
}
[1834] Fix | Delete
if (!hasHtmlOrText(clipboardContent) && pasteImageData(editor, e, getLastRng())) {
[1835] Fix | Delete
pasteBin.remove();
[1836] Fix | Delete
return;
[1837] Fix | Delete
}
[1838] Fix | Delete
if (!isKeyBoardPaste) {
[1839] Fix | Delete
e.preventDefault();
[1840] Fix | Delete
}
[1841] Fix | Delete
if (global$2.ie && (!isKeyBoardPaste || e.ieFake) && !hasContentType(clipboardContent, 'text/html')) {
[1842] Fix | Delete
pasteBin.create();
[1843] Fix | Delete
editor.dom.bind(pasteBin.getEl(), 'paste', function (e) {
[1844] Fix | Delete
e.stopPropagation();
[1845] Fix | Delete
});
[1846] Fix | Delete
editor.getDoc().execCommand('Paste', false, null);
[1847] Fix | Delete
clipboardContent['text/html'] = pasteBin.getHtml();
[1848] Fix | Delete
}
[1849] Fix | Delete
if (hasContentType(clipboardContent, 'text/html')) {
[1850] Fix | Delete
e.preventDefault();
[1851] Fix | Delete
if (!internal) {
[1852] Fix | Delete
internal = InternalHtml.isMarked(clipboardContent['text/html']);
[1853] Fix | Delete
}
[1854] Fix | Delete
insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);
[1855] Fix | Delete
} else {
[1856] Fix | Delete
global$3.setEditorTimeout(editor, function () {
[1857] Fix | Delete
insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);
[1858] Fix | Delete
}, 0);
[1859] Fix | Delete
}
[1860] Fix | Delete
});
[1861] Fix | Delete
};
[1862] Fix | Delete
var registerEventsAndFilters = function (editor, pasteBin, pasteFormat) {
[1863] Fix | Delete
registerEventHandlers(editor, pasteBin, pasteFormat);
[1864] Fix | Delete
var src;
[1865] Fix | Delete
editor.parser.addNodeFilter('img', function (nodes, name, args) {
[1866] Fix | Delete
var isPasteInsert = function (args) {
[1867] Fix | Delete
return args.data && args.data.paste === true;
[1868] Fix | Delete
};
[1869] Fix | Delete
var remove = function (node) {
[1870] Fix | Delete
if (!node.attr('data-mce-object') && src !== global$2.transparentSrc) {
[1871] Fix | Delete
node.remove();
[1872] Fix | Delete
}
[1873] Fix | Delete
};
[1874] Fix | Delete
var isWebKitFakeUrl = function (src) {
[1875] Fix | Delete
return src.indexOf('webkit-fake-url') === 0;
[1876] Fix | Delete
};
[1877] Fix | Delete
var isDataUri = function (src) {
[1878] Fix | Delete
return src.indexOf('data:') === 0;
[1879] Fix | Delete
};
[1880] Fix | Delete
if (!editor.settings.paste_data_images && isPasteInsert(args)) {
[1881] Fix | Delete
var i = nodes.length;
[1882] Fix | Delete
while (i--) {
[1883] Fix | Delete
src = nodes[i].attributes.map.src;
[1884] Fix | Delete
if (!src) {
[1885] Fix | Delete
continue;
[1886] Fix | Delete
}
[1887] Fix | Delete
if (isWebKitFakeUrl(src)) {
[1888] Fix | Delete
remove(nodes[i]);
[1889] Fix | Delete
} else if (!editor.settings.allow_html_data_urls && isDataUri(src)) {
[1890] Fix | Delete
remove(nodes[i]);
[1891] Fix | Delete
}
[1892] Fix | Delete
}
[1893] Fix | Delete
}
[1894] Fix | Delete
});
[1895] Fix | Delete
};
[1896] Fix | Delete
[1897] Fix | Delete
var getPasteBinParent = function (editor) {
[1898] Fix | Delete
return global$2.ie && editor.inline ? domGlobals.document.body : editor.getBody();
[1899] Fix | Delete
};
[1900] Fix | Delete
var isExternalPasteBin = function (editor) {
[1901] Fix | Delete
return getPasteBinParent(editor) !== editor.getBody();
[1902] Fix | Delete
};
[1903] Fix | Delete
var delegatePasteEvents = function (editor, pasteBinElm, pasteBinDefaultContent) {
[1904] Fix | Delete
if (isExternalPasteBin(editor)) {
[1905] Fix | Delete
editor.dom.bind(pasteBinElm, 'paste keyup', function (e) {
[1906] Fix | Delete
if (!isDefault(editor, pasteBinDefaultContent)) {
[1907] Fix | Delete
editor.fire('paste');
[1908] Fix | Delete
}
[1909] Fix | Delete
});
[1910] Fix | Delete
}
[1911] Fix | Delete
};
[1912] Fix | Delete
var create = function (editor, lastRngCell, pasteBinDefaultContent) {
[1913] Fix | Delete
var dom = editor.dom, body = editor.getBody();
[1914] Fix | Delete
var pasteBinElm;
[1915] Fix | Delete
lastRngCell.set(editor.selection.getRng());
[1916] Fix | Delete
pasteBinElm = editor.dom.add(getPasteBinParent(editor), 'div', {
[1917] Fix | Delete
'id': 'mcepastebin',
[1918] Fix | Delete
'class': 'mce-pastebin',
[1919] Fix | Delete
'contentEditable': true,
[1920] Fix | Delete
'data-mce-bogus': 'all',
[1921] Fix | Delete
'style': 'position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0'
[1922] Fix | Delete
}, pasteBinDefaultContent);
[1923] Fix | Delete
if (global$2.ie || global$2.gecko) {
[1924] Fix | Delete
dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) === 'rtl' ? 65535 : -65535);
[1925] Fix | Delete
}
[1926] Fix | Delete
dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function (e) {
[1927] Fix | Delete
e.stopPropagation();
[1928] Fix | Delete
});
[1929] Fix | Delete
delegatePasteEvents(editor, pasteBinElm, pasteBinDefaultContent);
[1930] Fix | Delete
pasteBinElm.focus();
[1931] Fix | Delete
editor.selection.select(pasteBinElm, true);
[1932] Fix | Delete
};
[1933] Fix | Delete
var remove = function (editor, lastRngCell) {
[1934] Fix | Delete
if (getEl(editor)) {
[1935] Fix | Delete
var pasteBinClone = void 0;
[1936] Fix | Delete
var lastRng = lastRngCell.get();
[1937] Fix | Delete
while (pasteBinClone = editor.dom.get('mcepastebin')) {
[1938] Fix | Delete
editor.dom.remove(pasteBinClone);
[1939] Fix | Delete
editor.dom.unbind(pasteBinClone);
[1940] Fix | Delete
}
[1941] Fix | Delete
if (lastRng) {
[1942] Fix | Delete
editor.selection.setRng(lastRng);
[1943] Fix | Delete
}
[1944] Fix | Delete
}
[1945] Fix | Delete
lastRngCell.set(null);
[1946] Fix | Delete
};
[1947] Fix | Delete
var getEl = function (editor) {
[1948] Fix | Delete
return editor.dom.get('mcepastebin');
[1949] Fix | Delete
};
[1950] Fix | Delete
var getHtml = function (editor) {
[1951] Fix | Delete
var pasteBinElm, pasteBinClones, i, dirtyWrappers, cleanWrapper;
[1952] Fix | Delete
var copyAndRemove = function (toElm, fromElm) {
[1953] Fix | Delete
toElm.appendChild(fromElm);
[1954] Fix | Delete
editor.dom.remove(fromElm, true);
[1955] Fix | Delete
};
[1956] Fix | Delete
pasteBinClones = global$4.grep(getPasteBinParent(editor).childNodes, function (elm) {
[1957] Fix | Delete
return elm.id === 'mcepastebin';
[1958] Fix | Delete
});
[1959] Fix | Delete
pasteBinElm = pasteBinClones.shift();
[1960] Fix | Delete
global$4.each(pasteBinClones, function (pasteBinClone) {
[1961] Fix | Delete
copyAndRemove(pasteBinElm, pasteBinClone);
[1962] Fix | Delete
});
[1963] Fix | Delete
dirtyWrappers = editor.dom.select('div[id=mcepastebin]', pasteBinElm);
[1964] Fix | Delete
for (i = dirtyWrappers.length - 1; i >= 0; i--) {
[1965] Fix | Delete
cleanWrapper = editor.dom.create('div');
[1966] Fix | Delete
pasteBinElm.insertBefore(cleanWrapper, dirtyWrappers[i]);
[1967] Fix | Delete
copyAndRemove(cleanWrapper, dirtyWrappers[i]);
[1968] Fix | Delete
}
[1969] Fix | Delete
return pasteBinElm ? pasteBinElm.innerHTML : '';
[1970] Fix | Delete
};
[1971] Fix | Delete
var getLastRng = function (lastRng) {
[1972] Fix | Delete
return lastRng.get();
[1973] Fix | Delete
};
[1974] Fix | Delete
var isDefaultContent = function (pasteBinDefaultContent, content) {
[1975] Fix | Delete
return content === pasteBinDefaultContent;
[1976] Fix | Delete
};
[1977] Fix | Delete
var isPasteBin = function (elm) {
[1978] Fix | Delete
return elm && elm.id === 'mcepastebin';
[1979] Fix | Delete
};
[1980] Fix | Delete
var isDefault = function (editor, pasteBinDefaultContent) {
[1981] Fix | Delete
var pasteBinElm = getEl(editor);
[1982] Fix | Delete
return isPasteBin(pasteBinElm) && isDefaultContent(pasteBinDefaultContent, pasteBinElm.innerHTML);
[1983] Fix | Delete
};
[1984] Fix | Delete
var PasteBin = function (editor) {
[1985] Fix | Delete
var lastRng = Cell(null);
[1986] Fix | Delete
var pasteBinDefaultContent = '%MCEPASTEBIN%';
[1987] Fix | Delete
return {
[1988] Fix | Delete
create: function () {
[1989] Fix | Delete
return create(editor, lastRng, pasteBinDefaultContent);
[1990] Fix | Delete
},
[1991] Fix | Delete
remove: function () {
[1992] Fix | Delete
return remove(editor, lastRng);
[1993] Fix | Delete
},
[1994] Fix | Delete
getEl: function () {
[1995] Fix | Delete
return getEl(editor);
[1996] Fix | Delete
},
[1997] Fix | Delete
getHtml: function () {
[1998] Fix | Delete
return getHtml(editor);
[1999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function