From: Alexander Ebert Date: Tue, 10 Jan 2017 19:21:03 +0000 (+0100) Subject: Fixed missing existence check X-Git-Tag: 3.0.0~5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2e7c219b0be015f345e1cec51acdbb173a79fed9;p=GitHub%2FWoltLab%2FWCF.git Fixed missing existence check --- diff --git a/com.woltlab.wcf/templates/wysiwyg.tpl b/com.woltlab.wcf/templates/wysiwyg.tpl index c0f187b7ec..34786632c3 100644 --- a/com.woltlab.wcf/templates/wysiwyg.tpl +++ b/com.woltlab.wcf/templates/wysiwyg.tpl @@ -28,6 +28,7 @@ '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabInlineCode.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabInsert.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabKeydown.js?v={@LAST_UPDATE_TIME}', + '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabLine.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabLink.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabMedia.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabMention.js?v={@LAST_UPDATE_TIME}', @@ -202,6 +203,7 @@ {if $__wcf->getBBCodeHandler()->isAvailableBBCode('img')}'WoltLabImage',{/if} 'WoltLabInlineCode', 'WoltLabInsert', + 'WoltLabLine', {if $__wcf->getBBCodeHandler()->isAvailableBBCode('url')}'WoltLabLink',{/if} 'WoltLabModal', 'WoltLabObserve', diff --git a/wcfsetup/install/files/acp/templates/wysiwyg.tpl b/wcfsetup/install/files/acp/templates/wysiwyg.tpl index c0f187b7ec..34786632c3 100644 --- a/wcfsetup/install/files/acp/templates/wysiwyg.tpl +++ b/wcfsetup/install/files/acp/templates/wysiwyg.tpl @@ -28,6 +28,7 @@ '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabInlineCode.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabInsert.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabKeydown.js?v={@LAST_UPDATE_TIME}', + '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabLine.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabLink.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabMedia.js?v={@LAST_UPDATE_TIME}', '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabMention.js?v={@LAST_UPDATE_TIME}', @@ -202,6 +203,7 @@ {if $__wcf->getBBCodeHandler()->isAvailableBBCode('img')}'WoltLabImage',{/if} 'WoltLabInlineCode', 'WoltLabInsert', + 'WoltLabLine', {if $__wcf->getBBCodeHandler()->isAvailableBBCode('url')}'WoltLabLink',{/if} 'WoltLabModal', 'WoltLabObserve', diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabLine.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabLine.js new file mode 100644 index 0000000000..0ed6403283 --- /dev/null +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabLine.js @@ -0,0 +1,29 @@ +$.Redactor.prototype.WoltLabLine = function() { + "use strict"; + + return { + init: function() { + this.line.removeOnBackspace = (function () { + if (!this.utils.isCollapsed()) + { + return; + } + + var $block = $(this.selection.block()); + if ($block.length === 0 || !this.utils.isStartOfElement($block)) + { + return; + } + + // if hr is previous element + var $prev = $block.prev(); + // WoltLab modification: check was for `$prev` (always true) instead of `$prev.length` + if ($prev.length && $prev[0].tagName === 'HR') + { + e.preventDefault(); + $prev.remove(); + } + }).bind(this); + } + }; +};