From 07c4210ab3da04f546a1d1928776732166914808 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 20 Dec 2017 13:27:15 +0100 Subject: [PATCH] Update editor integration --- .../redactor2/plugins/WoltLabClean.js | 6 +- .../3rdParty/redactor2/plugins/WoltLabList.js | 86 ------------------- 2 files changed, 3 insertions(+), 89 deletions(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js index 33cf7f26cc..3f22275ab2 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js @@ -414,7 +414,7 @@ $.Redactor.prototype.WoltLabClean = function() { if (data.links && this.opts.pasteLinks) { elBySelAll('a', div, function(link) { if (link.href) { - link.outerHTML = '##%%a href="' + link.href + '"%%##' + link.innerHTML + '##%%/a%%##'; + link.outerHTML = '#####[a href="' + link.href + '"]#####' + link.innerHTML + '#####[/a]#####'; } }); @@ -426,7 +426,7 @@ $.Redactor.prototype.WoltLabClean = function() { if (data.images && this.opts.pasteImages) { elBySelAll('img', div, function(image) { if (image.src) { - var tmp = '##%%img src="' + image.src + '"'; + var tmp = '#####[img src="' + image.src + '"'; var attr; for (var j = 0, length = image.attributes.length; j < length; j++) { attr = image.attributes.item(j); @@ -435,7 +435,7 @@ $.Redactor.prototype.WoltLabClean = function() { } } - image.outerHTML = tmp + '%%##'; + image.outerHTML = tmp + ']#####'; } }); diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabList.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabList.js index 66db75d53a..b881f1c3e3 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabList.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabList.js @@ -3,92 +3,6 @@ $.Redactor.prototype.WoltLabList = function() { return { init: function () { - this.list.toggle = (function(cmd) { - if (this.utils.inBlocks(['table', 'td', 'th', 'tr'])) { - return; - } - - var tag = (cmd === 'orderedlist' || cmd === 'ol') ? 'OL' : 'UL'; - cmd = (tag === 'OL') ? 'orderedlist' : 'unorderedlist'; - - var $list = $(this.selection.current()).parentsUntil('.redactor-in', 'ul, ol').first(); - - this.placeholder.hide(); - this.buffer.set(); - - if ($list.length !== 0 && $list[0].tagName === tag && this.utils.isRedactorParent($list)) { - this.selection.save(); - - // remove list - $list.find('ul, ol').each(function () { - var parent = $(this).closest('li'); - $(this).find('li').each(function () { - $(parent).after(this); - }); - }); - - $list.find('ul, ol').remove(); - $list.find('li').each(function () { - return $(this).replaceWith(function () { - return $('

').append($(this).contents()); - }); - }); - - $list.replaceWith(function () { - return $(this).contents(); - }); - - this.selection.restore(); - return; - } - - - this.selection.save(); - - if ($list.length !== 0 && $list[0].tagName !== tag) { - $list.each($.proxy(function (i, s) { - this.utils.replaceToTag(s, tag); - - }, this)); - } - else { - document.execCommand('insert' + cmd); - } - - this.selection.restore(); - - var $insertedList = this.list.get(); - if (!$insertedList) { - if (!this.selection.block()) { - document.execCommand('formatblock', false, 'p'); - } - - return; - } - - // clear span - // WoltLab modification: do not remove - /*$insertedList.find('span').replaceWith(function () { - return $(this).contents(); - });*/ - - // remove style - $insertedList.find(this.opts.inlineTags.join(',')).each(function () { - // WoltLab modification: exclude spans - if (this.nodeName !== 'SPAN') $(this).removeAttr('style'); - }); - - // remove block-element list wrapper - var $listParent = $insertedList.parent(); - if (this.utils.isRedactorParent($listParent) && $listParent[0].tagName !== 'LI' && this.utils.isBlock($listParent)) { - this.selection.save(); - - $listParent.replaceWith($listParent.contents()); - - this.selection.restore(); - } - }).bind(this); - var mpCombineAfterAndBefore = this.list.combineAfterAndBefore; this.list.combineAfterAndBefore = (function(block) { var returnValue = mpCombineAfterAndBefore.call(this, block); -- 2.20.1