'{@$__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/WoltLabLink.js?v={@LAST_UPDATE_TIME}',
+ '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabList.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}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabModal.js?v={@LAST_UPDATE_TIME}',
'WoltLabInlineCode',
'WoltLabInsert',
'WoltLabLink',
+ 'WoltLabList',
'WoltLabModal',
'WoltLabPaste',
'WoltLabQuote',
'{@$__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/WoltLabLink.js?v={@LAST_UPDATE_TIME}',
+ '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabList.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}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabModal.js?v={@LAST_UPDATE_TIME}',
element.value = autosave.getInitialValue();
}
+ var placeholderCallback = null, replyContainer = element.closest('.messageQuickReplyContent');
+ if (replyContainer) {
+ var container = elById('messageQuickReply');
+ if (container.classList.contains('messageQuickReplyCollapsed')) {
+ placeholderCallback = function (event) {
+ if (event instanceof Event) {
+ event.preventDefault();
+ }
+
+ if (container.classList.contains('messageQuickReplyCollapsed')) {
+ container.classList.remove('messageQuickReplyCollapsed');
+ $(element).redactor('focus.end');
+
+ replyContainer.removeEventListener(WCF_CLICK_EVENT, placeholderCallback);
+ }
+
+ return null;
+ };
+
+ replyContainer.addEventListener(WCF_CLICK_EVENT, placeholderCallback);
+ }
+ }
+
var config = {
buttons: buttons,
formatting: ['p', 'h2', 'h3', 'h4'],
linkify: false,
linkSize: 0xBADC0DED, // some random value to disable truncating
minHeight: 200,
- placeholder: elData(element, 'placeholder') || '',
+ //placeholder: elData(element, 'placeholder') || '',
plugins: [
// Imperavi
'alignment',
'WoltLabInlineCode',
'WoltLabInsert',
'WoltLabLink',
+ 'WoltLabList',
'WoltLabModal',
'WoltLabPaste',
'WoltLabQuote',
buttons: buttonOptions,
buttonMobile: buttonMobile,
customButtons: customButtons,
- highlighters: highlighters
+ highlighters: highlighters,
+ placeholderCallback: placeholderCallback
}
};
config.callbacks = config.callbacks || { };
config.callbacks.init = function() {
+ var editor = element.previousElementSibling;
+ if (replyContainer) {
+ elData(editor, 'reply-placeholder', elData(element, 'reply-placeholder'));
+ }
+
// slight delay to allow Redactor to initialize itself
window.setTimeout(function() {
$(element).redactor('code.set', content);
- $(element).redactor('core.editor')[0].classList.add('redactorReady');
+ editor.classList.add('redactorReady');
}, 10);
};
--- /dev/null
+$.Redactor.prototype.WoltLabCaret = function() {
+ "use strict";
+
+ return {
+ init: function () {
+ this.list.combineAfterAndBefore = (function (block) {
+ var $prev = $(block).prev();
+ var $next = $(block).next();
+ var isEmptyBlock = (block && block.tagName === 'P' && (block.innerHTML === '<br>' || block.innerHTML === ''));
+
+ // WoltLab fix: closest() was missing the 2nd parameter causing
+ // it to match on lists being Redactor's ancestor
+ var isBlockWrapped = ($prev.closest('ol, ul', this.core.editor()[0]).length === 1 && $next.closest('ol, ul', this.core.editor()[0]).length === 1);
+
+ if (isEmptyBlock && isBlockWrapped)
+ {
+ $prev.children('li').last().append(this.marker.get());
+ $prev.append($next.contents());
+ this.selection.restore();
+
+ return true;
+ }
+
+ return false;
+ }).bind(this);
+ }
+ };
+};