From: Alexander Ebert Date: Fri, 20 Oct 2017 12:07:01 +0000 (+0200) Subject: Updated monkeypatch to support `opts.keepStyleAttr` X-Git-Tag: 3.1.0_Beta_2~8^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=397ddd51e94ce533b9dd965be728494756837763;p=GitHub%2FWoltLab%2FWCF.git Updated monkeypatch to support `opts.keepStyleAttr` --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabKeydown.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabKeydown.js index 4375491f70..15d8adab8b 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabKeydown.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabKeydown.js @@ -691,8 +691,14 @@ $.Redactor.prototype.WoltLabKeydown = function() { this.code.syncFire = false; this.keydown.removeEmptyLists(); + var filter = ''; + if (this.opts.keepStyleAttr.length !== 0) { + filter = ',' + this.opts.keepStyleAttr.join(','); + } + // WoltLab modification: allow style tag on `` - this.core.editor().find('*[style]').not('span, img, #redactor-image-box, #redactor-image-editter').removeAttr('style'); + var $styleTags = this.core.editor().find('*[style]'); + $styleTags.not('span, img, figure, iframe, #redactor-image-box, #redactor-image-editter, [data-redactor-style-cache], [data-redactor-span]' + filter).removeAttr('style'); this.keydown.formatEmpty(e);