From: Alexander Ebert Date: Fri, 6 Jan 2017 10:58:13 +0000 (+0100) Subject: Strip `data-title` in HTML view X-Git-Tag: 3.0.0~33 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d114665df37951cfe28529388717b36fb762209f;p=GitHub%2FWoltLab%2FWCF.git Strip `data-title` in HTML view This is a dynamic property used for visual purposes only and is computed on-the-fly when editing the other `data`-attributes. --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSource.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSource.js index 66ffc4f6a1..bd57c711b7 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSource.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSource.js @@ -3,6 +3,8 @@ $.Redactor.prototype.WoltLabSource = function() { return { init: function () { + var id = this.$element[0].id; + var fixQuotes = function(container) { // fix empty quotes suffering from a superfluous

elBySelAll('woltlab-quote', container, function(quote) { @@ -24,6 +26,14 @@ $.Redactor.prototype.WoltLabSource = function() { }); }; + var stripIntermediateCode = function(div) { + elBySelAll('pre, woltlab-quote, woltlab-spoiler', div, function (element) { + element.removeAttribute('data-title'); + }); + + WCF.System.Event.fireEvent('com.woltlab.wcf.redactor2', 'source_' + stripIntermediateCode + '_' + id, { div: div }); + }; + function stripIcons(div) { elBySelAll('.icon, .fa', div, function (element) { var classNames = element.className.split(' '); @@ -88,13 +98,14 @@ $.Redactor.prototype.WoltLabSource = function() { var div = elCreate('div'); div.innerHTML = textarea.value; fixQuotes(div); + stripIntermediateCode(div); textarea.value = this.WoltLabSource.format(div.innerHTML); textarea.selectionStart = textarea.selectionEnd = textarea.value.length; }).bind(this); - WCF.System.Event.addListener('com.woltlab.wcf.redactor2', 'validate_' + this.$element[0].id, (function (data) { + WCF.System.Event.addListener('com.woltlab.wcf.redactor2', 'validate_' + id, (function (data) { if (textarea.clientHeight) { data.api.throwError(this.$element[0], WCF.Language.get('wcf.editor.source.error.active')); data.valid = false;