Edit File by line
/home/barbar84/www/wp-inclu.../js/tinymce/plugins/paste
File: plugin.js
(function () {
[0] Fix | Delete
var paste = (function (domGlobals) {
[1] Fix | Delete
'use strict';
[2] Fix | Delete
[3] Fix | Delete
var Cell = function (initial) {
[4] Fix | Delete
var value = initial;
[5] Fix | Delete
var get = function () {
[6] Fix | Delete
return value;
[7] Fix | Delete
};
[8] Fix | Delete
var set = function (v) {
[9] Fix | Delete
value = v;
[10] Fix | Delete
};
[11] Fix | Delete
var clone = function () {
[12] Fix | Delete
return Cell(get());
[13] Fix | Delete
};
[14] Fix | Delete
return {
[15] Fix | Delete
get: get,
[16] Fix | Delete
set: set,
[17] Fix | Delete
clone: clone
[18] Fix | Delete
};
[19] Fix | Delete
};
[20] Fix | Delete
[21] Fix | Delete
var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager');
[22] Fix | Delete
[23] Fix | Delete
var hasProPlugin = function (editor) {
[24] Fix | Delete
if (/(^|[ ,])powerpaste([, ]|$)/.test(editor.settings.plugins) && global$1.get('powerpaste')) {
[25] Fix | Delete
if (typeof domGlobals.window.console !== 'undefined' && domGlobals.window.console.log) {
[26] Fix | Delete
domGlobals.window.console.log('PowerPaste is incompatible with Paste plugin! Remove \'paste\' from the \'plugins\' option.');
[27] Fix | Delete
}
[28] Fix | Delete
return true;
[29] Fix | Delete
} else {
[30] Fix | Delete
return false;
[31] Fix | Delete
}
[32] Fix | Delete
};
[33] Fix | Delete
var DetectProPlugin = { hasProPlugin: hasProPlugin };
[34] Fix | Delete
[35] Fix | Delete
var get = function (clipboard, quirks) {
[36] Fix | Delete
return {
[37] Fix | Delete
clipboard: clipboard,
[38] Fix | Delete
quirks: quirks
[39] Fix | Delete
};
[40] Fix | Delete
};
[41] Fix | Delete
var Api = { get: get };
[42] Fix | Delete
[43] Fix | Delete
var firePastePreProcess = function (editor, html, internal, isWordHtml) {
[44] Fix | Delete
return editor.fire('PastePreProcess', {
[45] Fix | Delete
content: html,
[46] Fix | Delete
internal: internal,
[47] Fix | Delete
wordContent: isWordHtml
[48] Fix | Delete
});
[49] Fix | Delete
};
[50] Fix | Delete
var firePastePostProcess = function (editor, node, internal, isWordHtml) {
[51] Fix | Delete
return editor.fire('PastePostProcess', {
[52] Fix | Delete
node: node,
[53] Fix | Delete
internal: internal,
[54] Fix | Delete
wordContent: isWordHtml
[55] Fix | Delete
});
[56] Fix | Delete
};
[57] Fix | Delete
var firePastePlainTextToggle = function (editor, state) {
[58] Fix | Delete
return editor.fire('PastePlainTextToggle', { state: state });
[59] Fix | Delete
};
[60] Fix | Delete
var firePaste = function (editor, ieFake) {
[61] Fix | Delete
return editor.fire('paste', { ieFake: ieFake });
[62] Fix | Delete
};
[63] Fix | Delete
var Events = {
[64] Fix | Delete
firePastePreProcess: firePastePreProcess,
[65] Fix | Delete
firePastePostProcess: firePastePostProcess,
[66] Fix | Delete
firePastePlainTextToggle: firePastePlainTextToggle,
[67] Fix | Delete
firePaste: firePaste
[68] Fix | Delete
};
[69] Fix | Delete
[70] Fix | Delete
var shouldPlainTextInform = function (editor) {
[71] Fix | Delete
return editor.getParam('paste_plaintext_inform', true);
[72] Fix | Delete
};
[73] Fix | Delete
var shouldBlockDrop = function (editor) {
[74] Fix | Delete
return editor.getParam('paste_block_drop', false);
[75] Fix | Delete
};
[76] Fix | Delete
var shouldPasteDataImages = function (editor) {
[77] Fix | Delete
return editor.getParam('paste_data_images', false);
[78] Fix | Delete
};
[79] Fix | Delete
var shouldFilterDrop = function (editor) {
[80] Fix | Delete
return editor.getParam('paste_filter_drop', true);
[81] Fix | Delete
};
[82] Fix | Delete
var getPreProcess = function (editor) {
[83] Fix | Delete
return editor.getParam('paste_preprocess');
[84] Fix | Delete
};
[85] Fix | Delete
var getPostProcess = function (editor) {
[86] Fix | Delete
return editor.getParam('paste_postprocess');
[87] Fix | Delete
};
[88] Fix | Delete
var getWebkitStyles = function (editor) {
[89] Fix | Delete
return editor.getParam('paste_webkit_styles');
[90] Fix | Delete
};
[91] Fix | Delete
var shouldRemoveWebKitStyles = function (editor) {
[92] Fix | Delete
return editor.getParam('paste_remove_styles_if_webkit', true);
[93] Fix | Delete
};
[94] Fix | Delete
var shouldMergeFormats = function (editor) {
[95] Fix | Delete
return editor.getParam('paste_merge_formats', true);
[96] Fix | Delete
};
[97] Fix | Delete
var isSmartPasteEnabled = function (editor) {
[98] Fix | Delete
return editor.getParam('smart_paste', true);
[99] Fix | Delete
};
[100] Fix | Delete
var isPasteAsTextEnabled = function (editor) {
[101] Fix | Delete
return editor.getParam('paste_as_text', false);
[102] Fix | Delete
};
[103] Fix | Delete
var getRetainStyleProps = function (editor) {
[104] Fix | Delete
return editor.getParam('paste_retain_style_properties');
[105] Fix | Delete
};
[106] Fix | Delete
var getWordValidElements = function (editor) {
[107] Fix | Delete
var defaultValidElements = '-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,' + '-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,' + 'td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody';
[108] Fix | Delete
return editor.getParam('paste_word_valid_elements', defaultValidElements);
[109] Fix | Delete
};
[110] Fix | Delete
var shouldConvertWordFakeLists = function (editor) {
[111] Fix | Delete
return editor.getParam('paste_convert_word_fake_lists', true);
[112] Fix | Delete
};
[113] Fix | Delete
var shouldUseDefaultFilters = function (editor) {
[114] Fix | Delete
return editor.getParam('paste_enable_default_filters', true);
[115] Fix | Delete
};
[116] Fix | Delete
var Settings = {
[117] Fix | Delete
shouldPlainTextInform: shouldPlainTextInform,
[118] Fix | Delete
shouldBlockDrop: shouldBlockDrop,
[119] Fix | Delete
shouldPasteDataImages: shouldPasteDataImages,
[120] Fix | Delete
shouldFilterDrop: shouldFilterDrop,
[121] Fix | Delete
getPreProcess: getPreProcess,
[122] Fix | Delete
getPostProcess: getPostProcess,
[123] Fix | Delete
getWebkitStyles: getWebkitStyles,
[124] Fix | Delete
shouldRemoveWebKitStyles: shouldRemoveWebKitStyles,
[125] Fix | Delete
shouldMergeFormats: shouldMergeFormats,
[126] Fix | Delete
isSmartPasteEnabled: isSmartPasteEnabled,
[127] Fix | Delete
isPasteAsTextEnabled: isPasteAsTextEnabled,
[128] Fix | Delete
getRetainStyleProps: getRetainStyleProps,
[129] Fix | Delete
getWordValidElements: getWordValidElements,
[130] Fix | Delete
shouldConvertWordFakeLists: shouldConvertWordFakeLists,
[131] Fix | Delete
shouldUseDefaultFilters: shouldUseDefaultFilters
[132] Fix | Delete
};
[133] Fix | Delete
[134] Fix | Delete
var shouldInformUserAboutPlainText = function (editor, userIsInformedState) {
[135] Fix | Delete
return userIsInformedState.get() === false && Settings.shouldPlainTextInform(editor);
[136] Fix | Delete
};
[137] Fix | Delete
var displayNotification = function (editor, message) {
[138] Fix | Delete
editor.notificationManager.open({
[139] Fix | Delete
text: editor.translate(message),
[140] Fix | Delete
type: 'info'
[141] Fix | Delete
});
[142] Fix | Delete
};
[143] Fix | Delete
var togglePlainTextPaste = function (editor, clipboard, userIsInformedState) {
[144] Fix | Delete
if (clipboard.pasteFormat.get() === 'text') {
[145] Fix | Delete
clipboard.pasteFormat.set('html');
[146] Fix | Delete
Events.firePastePlainTextToggle(editor, false);
[147] Fix | Delete
} else {
[148] Fix | Delete
clipboard.pasteFormat.set('text');
[149] Fix | Delete
Events.firePastePlainTextToggle(editor, true);
[150] Fix | Delete
if (shouldInformUserAboutPlainText(editor, userIsInformedState)) {
[151] Fix | Delete
displayNotification(editor, 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.');
[152] Fix | Delete
userIsInformedState.set(true);
[153] Fix | Delete
}
[154] Fix | Delete
}
[155] Fix | Delete
editor.focus();
[156] Fix | Delete
};
[157] Fix | Delete
var Actions = { togglePlainTextPaste: togglePlainTextPaste };
[158] Fix | Delete
[159] Fix | Delete
var register = function (editor, clipboard, userIsInformedState) {
[160] Fix | Delete
editor.addCommand('mceTogglePlainTextPaste', function () {
[161] Fix | Delete
Actions.togglePlainTextPaste(editor, clipboard, userIsInformedState);
[162] Fix | Delete
});
[163] Fix | Delete
editor.addCommand('mceInsertClipboardContent', function (ui, value) {
[164] Fix | Delete
if (value.content) {
[165] Fix | Delete
clipboard.pasteHtml(value.content, value.internal);
[166] Fix | Delete
}
[167] Fix | Delete
if (value.text) {
[168] Fix | Delete
clipboard.pasteText(value.text);
[169] Fix | Delete
}
[170] Fix | Delete
});
[171] Fix | Delete
};
[172] Fix | Delete
var Commands = { register: register };
[173] Fix | Delete
[174] Fix | Delete
var global$2 = tinymce.util.Tools.resolve('tinymce.Env');
[175] Fix | Delete
[176] Fix | Delete
var global$3 = tinymce.util.Tools.resolve('tinymce.util.Delay');
[177] Fix | Delete
[178] Fix | Delete
var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools');
[179] Fix | Delete
[180] Fix | Delete
var global$5 = tinymce.util.Tools.resolve('tinymce.util.VK');
[181] Fix | Delete
[182] Fix | Delete
var internalMimeType = 'x-tinymce/html';
[183] Fix | Delete
var internalMark = '<!-- ' + internalMimeType + ' -->';
[184] Fix | Delete
var mark = function (html) {
[185] Fix | Delete
return internalMark + html;
[186] Fix | Delete
};
[187] Fix | Delete
var unmark = function (html) {
[188] Fix | Delete
return html.replace(internalMark, '');
[189] Fix | Delete
};
[190] Fix | Delete
var isMarked = function (html) {
[191] Fix | Delete
return html.indexOf(internalMark) !== -1;
[192] Fix | Delete
};
[193] Fix | Delete
var InternalHtml = {
[194] Fix | Delete
mark: mark,
[195] Fix | Delete
unmark: unmark,
[196] Fix | Delete
isMarked: isMarked,
[197] Fix | Delete
internalHtmlMime: function () {
[198] Fix | Delete
return internalMimeType;
[199] Fix | Delete
}
[200] Fix | Delete
};
[201] Fix | Delete
[202] Fix | Delete
var global$6 = tinymce.util.Tools.resolve('tinymce.html.Entities');
[203] Fix | Delete
[204] Fix | Delete
var isPlainText = function (text) {
[205] Fix | Delete
return !/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(text);
[206] Fix | Delete
};
[207] Fix | Delete
var toBRs = function (text) {
[208] Fix | Delete
return text.replace(/\r?\n/g, '<br>');
[209] Fix | Delete
};
[210] Fix | Delete
var openContainer = function (rootTag, rootAttrs) {
[211] Fix | Delete
var key;
[212] Fix | Delete
var attrs = [];
[213] Fix | Delete
var tag = '<' + rootTag;
[214] Fix | Delete
if (typeof rootAttrs === 'object') {
[215] Fix | Delete
for (key in rootAttrs) {
[216] Fix | Delete
if (rootAttrs.hasOwnProperty(key)) {
[217] Fix | Delete
attrs.push(key + '="' + global$6.encodeAllRaw(rootAttrs[key]) + '"');
[218] Fix | Delete
}
[219] Fix | Delete
}
[220] Fix | Delete
if (attrs.length) {
[221] Fix | Delete
tag += ' ' + attrs.join(' ');
[222] Fix | Delete
}
[223] Fix | Delete
}
[224] Fix | Delete
return tag + '>';
[225] Fix | Delete
};
[226] Fix | Delete
var toBlockElements = function (text, rootTag, rootAttrs) {
[227] Fix | Delete
var blocks = text.split(/\n\n/);
[228] Fix | Delete
var tagOpen = openContainer(rootTag, rootAttrs);
[229] Fix | Delete
var tagClose = '</' + rootTag + '>';
[230] Fix | Delete
var paragraphs = global$4.map(blocks, function (p) {
[231] Fix | Delete
return p.split(/\n/).join('<br />');
[232] Fix | Delete
});
[233] Fix | Delete
var stitch = function (p) {
[234] Fix | Delete
return tagOpen + p + tagClose;
[235] Fix | Delete
};
[236] Fix | Delete
return paragraphs.length === 1 ? paragraphs[0] : global$4.map(paragraphs, stitch).join('');
[237] Fix | Delete
};
[238] Fix | Delete
var convert = function (text, rootTag, rootAttrs) {
[239] Fix | Delete
return rootTag ? toBlockElements(text, rootTag, rootAttrs) : toBRs(text);
[240] Fix | Delete
};
[241] Fix | Delete
var Newlines = {
[242] Fix | Delete
isPlainText: isPlainText,
[243] Fix | Delete
convert: convert,
[244] Fix | Delete
toBRs: toBRs,
[245] Fix | Delete
toBlockElements: toBlockElements
[246] Fix | Delete
};
[247] Fix | Delete
[248] Fix | Delete
var global$7 = tinymce.util.Tools.resolve('tinymce.html.DomParser');
[249] Fix | Delete
[250] Fix | Delete
var global$8 = tinymce.util.Tools.resolve('tinymce.html.Serializer');
[251] Fix | Delete
[252] Fix | Delete
var global$9 = tinymce.util.Tools.resolve('tinymce.html.Node');
[253] Fix | Delete
[254] Fix | Delete
var global$a = tinymce.util.Tools.resolve('tinymce.html.Schema');
[255] Fix | Delete
[256] Fix | Delete
function filter(content, items) {
[257] Fix | Delete
global$4.each(items, function (v) {
[258] Fix | Delete
if (v.constructor === RegExp) {
[259] Fix | Delete
content = content.replace(v, '');
[260] Fix | Delete
} else {
[261] Fix | Delete
content = content.replace(v[0], v[1]);
[262] Fix | Delete
}
[263] Fix | Delete
});
[264] Fix | Delete
return content;
[265] Fix | Delete
}
[266] Fix | Delete
function innerText(html) {
[267] Fix | Delete
var schema = global$a();
[268] Fix | Delete
var domParser = global$7({}, schema);
[269] Fix | Delete
var text = '';
[270] Fix | Delete
var shortEndedElements = schema.getShortEndedElements();
[271] Fix | Delete
var ignoreElements = global$4.makeMap('script noscript style textarea video audio iframe object', ' ');
[272] Fix | Delete
var blockElements = schema.getBlockElements();
[273] Fix | Delete
function walk(node) {
[274] Fix | Delete
var name = node.name, currentNode = node;
[275] Fix | Delete
if (name === 'br') {
[276] Fix | Delete
text += '\n';
[277] Fix | Delete
return;
[278] Fix | Delete
}
[279] Fix | Delete
if (name === 'wbr') {
[280] Fix | Delete
return;
[281] Fix | Delete
}
[282] Fix | Delete
if (shortEndedElements[name]) {
[283] Fix | Delete
text += ' ';
[284] Fix | Delete
}
[285] Fix | Delete
if (ignoreElements[name]) {
[286] Fix | Delete
text += ' ';
[287] Fix | Delete
return;
[288] Fix | Delete
}
[289] Fix | Delete
if (node.type === 3) {
[290] Fix | Delete
text += node.value;
[291] Fix | Delete
}
[292] Fix | Delete
if (!node.shortEnded) {
[293] Fix | Delete
if (node = node.firstChild) {
[294] Fix | Delete
do {
[295] Fix | Delete
walk(node);
[296] Fix | Delete
} while (node = node.next);
[297] Fix | Delete
}
[298] Fix | Delete
}
[299] Fix | Delete
if (blockElements[name] && currentNode.next) {
[300] Fix | Delete
text += '\n';
[301] Fix | Delete
if (name === 'p') {
[302] Fix | Delete
text += '\n';
[303] Fix | Delete
}
[304] Fix | Delete
}
[305] Fix | Delete
}
[306] Fix | Delete
html = filter(html, [/<!\[[^\]]+\]>/g]);
[307] Fix | Delete
walk(domParser.parse(html));
[308] Fix | Delete
return text;
[309] Fix | Delete
}
[310] Fix | Delete
function trimHtml(html) {
[311] Fix | Delete
function trimSpaces(all, s1, s2) {
[312] Fix | Delete
if (!s1 && !s2) {
[313] Fix | Delete
return ' ';
[314] Fix | Delete
}
[315] Fix | Delete
return '\xA0';
[316] Fix | Delete
}
[317] Fix | Delete
html = filter(html, [
[318] Fix | Delete
/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/ig,
[319] Fix | Delete
/<!--StartFragment-->|<!--EndFragment-->/g,
[320] Fix | Delete
[
[321] Fix | Delete
/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,
[322] Fix | Delete
trimSpaces
[323] Fix | Delete
],
[324] Fix | Delete
/<br class="Apple-interchange-newline">/g,
[325] Fix | Delete
/<br>$/i
[326] Fix | Delete
]);
[327] Fix | Delete
return html;
[328] Fix | Delete
}
[329] Fix | Delete
function createIdGenerator(prefix) {
[330] Fix | Delete
var count = 0;
[331] Fix | Delete
return function () {
[332] Fix | Delete
return prefix + count++;
[333] Fix | Delete
};
[334] Fix | Delete
}
[335] Fix | Delete
var isMsEdge = function () {
[336] Fix | Delete
return domGlobals.navigator.userAgent.indexOf(' Edge/') !== -1;
[337] Fix | Delete
};
[338] Fix | Delete
var Utils = {
[339] Fix | Delete
filter: filter,
[340] Fix | Delete
innerText: innerText,
[341] Fix | Delete
trimHtml: trimHtml,
[342] Fix | Delete
createIdGenerator: createIdGenerator,
[343] Fix | Delete
isMsEdge: isMsEdge
[344] Fix | Delete
};
[345] Fix | Delete
[346] Fix | Delete
function isWordContent(content) {
[347] Fix | Delete
return /<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(content) || /class="OutlineElement/.test(content) || /id="?docs\-internal\-guid\-/.test(content);
[348] Fix | Delete
}
[349] Fix | Delete
function isNumericList(text) {
[350] Fix | Delete
var found, patterns;
[351] Fix | Delete
patterns = [
[352] Fix | Delete
/^[IVXLMCD]{1,2}\.[ \u00a0]/,
[353] Fix | Delete
/^[ivxlmcd]{1,2}\.[ \u00a0]/,
[354] Fix | Delete
/^[a-z]{1,2}[\.\)][ \u00a0]/,
[355] Fix | Delete
/^[A-Z]{1,2}[\.\)][ \u00a0]/,
[356] Fix | Delete
/^[0-9]+\.[ \u00a0]/,
[357] Fix | Delete
/^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/,
[358] Fix | Delete
/^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/
[359] Fix | Delete
];
[360] Fix | Delete
text = text.replace(/^[\u00a0 ]+/, '');
[361] Fix | Delete
global$4.each(patterns, function (pattern) {
[362] Fix | Delete
if (pattern.test(text)) {
[363] Fix | Delete
found = true;
[364] Fix | Delete
return false;
[365] Fix | Delete
}
[366] Fix | Delete
});
[367] Fix | Delete
return found;
[368] Fix | Delete
}
[369] Fix | Delete
function isBulletList(text) {
[370] Fix | Delete
return /^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(text);
[371] Fix | Delete
}
[372] Fix | Delete
function convertFakeListsToProperLists(node) {
[373] Fix | Delete
var currentListNode, prevListNode, lastLevel = 1;
[374] Fix | Delete
function getText(node) {
[375] Fix | Delete
var txt = '';
[376] Fix | Delete
if (node.type === 3) {
[377] Fix | Delete
return node.value;
[378] Fix | Delete
}
[379] Fix | Delete
if (node = node.firstChild) {
[380] Fix | Delete
do {
[381] Fix | Delete
txt += getText(node);
[382] Fix | Delete
} while (node = node.next);
[383] Fix | Delete
}
[384] Fix | Delete
return txt;
[385] Fix | Delete
}
[386] Fix | Delete
function trimListStart(node, regExp) {
[387] Fix | Delete
if (node.type === 3) {
[388] Fix | Delete
if (regExp.test(node.value)) {
[389] Fix | Delete
node.value = node.value.replace(regExp, '');
[390] Fix | Delete
return false;
[391] Fix | Delete
}
[392] Fix | Delete
}
[393] Fix | Delete
if (node = node.firstChild) {
[394] Fix | Delete
do {
[395] Fix | Delete
if (!trimListStart(node, regExp)) {
[396] Fix | Delete
return false;
[397] Fix | Delete
}
[398] Fix | Delete
} while (node = node.next);
[399] Fix | Delete
}
[400] Fix | Delete
return true;
[401] Fix | Delete
}
[402] Fix | Delete
function removeIgnoredNodes(node) {
[403] Fix | Delete
if (node._listIgnore) {
[404] Fix | Delete
node.remove();
[405] Fix | Delete
return;
[406] Fix | Delete
}
[407] Fix | Delete
if (node = node.firstChild) {
[408] Fix | Delete
do {
[409] Fix | Delete
removeIgnoredNodes(node);
[410] Fix | Delete
} while (node = node.next);
[411] Fix | Delete
}
[412] Fix | Delete
}
[413] Fix | Delete
function convertParagraphToLi(paragraphNode, listName, start) {
[414] Fix | Delete
var level = paragraphNode._listLevel || lastLevel;
[415] Fix | Delete
if (level !== lastLevel) {
[416] Fix | Delete
if (level < lastLevel) {
[417] Fix | Delete
if (currentListNode) {
[418] Fix | Delete
currentListNode = currentListNode.parent.parent;
[419] Fix | Delete
}
[420] Fix | Delete
} else {
[421] Fix | Delete
prevListNode = currentListNode;
[422] Fix | Delete
currentListNode = null;
[423] Fix | Delete
}
[424] Fix | Delete
}
[425] Fix | Delete
if (!currentListNode || currentListNode.name !== listName) {
[426] Fix | Delete
prevListNode = prevListNode || currentListNode;
[427] Fix | Delete
currentListNode = new global$9(listName, 1);
[428] Fix | Delete
if (start > 1) {
[429] Fix | Delete
currentListNode.attr('start', '' + start);
[430] Fix | Delete
}
[431] Fix | Delete
paragraphNode.wrap(currentListNode);
[432] Fix | Delete
} else {
[433] Fix | Delete
currentListNode.append(paragraphNode);
[434] Fix | Delete
}
[435] Fix | Delete
paragraphNode.name = 'li';
[436] Fix | Delete
if (level > lastLevel && prevListNode) {
[437] Fix | Delete
prevListNode.lastChild.append(currentListNode);
[438] Fix | Delete
}
[439] Fix | Delete
lastLevel = level;
[440] Fix | Delete
removeIgnoredNodes(paragraphNode);
[441] Fix | Delete
trimListStart(paragraphNode, /^\u00a0+/);
[442] Fix | Delete
trimListStart(paragraphNode, /^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/);
[443] Fix | Delete
trimListStart(paragraphNode, /^\u00a0+/);
[444] Fix | Delete
}
[445] Fix | Delete
var elements = [];
[446] Fix | Delete
var child = node.firstChild;
[447] Fix | Delete
while (typeof child !== 'undefined' && child !== null) {
[448] Fix | Delete
elements.push(child);
[449] Fix | Delete
child = child.walk();
[450] Fix | Delete
if (child !== null) {
[451] Fix | Delete
while (typeof child !== 'undefined' && child.parent !== node) {
[452] Fix | Delete
child = child.walk();
[453] Fix | Delete
}
[454] Fix | Delete
}
[455] Fix | Delete
}
[456] Fix | Delete
for (var i = 0; i < elements.length; i++) {
[457] Fix | Delete
node = elements[i];
[458] Fix | Delete
if (node.name === 'p' && node.firstChild) {
[459] Fix | Delete
var nodeText = getText(node);
[460] Fix | Delete
if (isBulletList(nodeText)) {
[461] Fix | Delete
convertParagraphToLi(node, 'ul');
[462] Fix | Delete
continue;
[463] Fix | Delete
}
[464] Fix | Delete
if (isNumericList(nodeText)) {
[465] Fix | Delete
var matches = /([0-9]+)\./.exec(nodeText);
[466] Fix | Delete
var start = 1;
[467] Fix | Delete
if (matches) {
[468] Fix | Delete
start = parseInt(matches[1], 10);
[469] Fix | Delete
}
[470] Fix | Delete
convertParagraphToLi(node, 'ol', start);
[471] Fix | Delete
continue;
[472] Fix | Delete
}
[473] Fix | Delete
if (node._listLevel) {
[474] Fix | Delete
convertParagraphToLi(node, 'ul', 1);
[475] Fix | Delete
continue;
[476] Fix | Delete
}
[477] Fix | Delete
currentListNode = null;
[478] Fix | Delete
} else {
[479] Fix | Delete
prevListNode = currentListNode;
[480] Fix | Delete
currentListNode = null;
[481] Fix | Delete
}
[482] Fix | Delete
}
[483] Fix | Delete
}
[484] Fix | Delete
function filterStyles(editor, validStyles, node, styleValue) {
[485] Fix | Delete
var outputStyles = {}, matches;
[486] Fix | Delete
var styles = editor.dom.parseStyle(styleValue);
[487] Fix | Delete
global$4.each(styles, function (value, name) {
[488] Fix | Delete
switch (name) {
[489] Fix | Delete
case 'mso-list':
[490] Fix | Delete
matches = /\w+ \w+([0-9]+)/i.exec(styleValue);
[491] Fix | Delete
if (matches) {
[492] Fix | Delete
node._listLevel = parseInt(matches[1], 10);
[493] Fix | Delete
}
[494] Fix | Delete
if (/Ignore/i.test(value) && node.firstChild) {
[495] Fix | Delete
node._listIgnore = true;
[496] Fix | Delete
node.firstChild._listIgnore = true;
[497] Fix | Delete
}
[498] Fix | Delete
break;
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function