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',
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);
};
return {
init: function () {
+ var callback = this.opts.woltlab.placeholderCallback;
+
var mpHtml = this.insert.html;
this.insert.html = (function (html, data) {
+ if (callback) callback = callback();
+
this.placeholder.hide();
this.core.editor().focus();
elRemove(block);
}
}).bind(this);
+
+ var mpText = this.insert.text;
+ this.insert.text = (function (text) {
+ if (callback) callback = callback();
+
+ mpText.call(this, text);
+ }).bind(this);
}
};
};
height: 238px;
width: 100%;
}
+
+.messageQuickReplyCollapsed {
+ .messageSidebar {
+ pointer-events: none;
+
+ @include screen-sm-down {
+ opacity: .6;
+ }
+
+ @include screen-md-up {
+ > .messageAuthor {
+ > :not(.userAvatar),
+ .badgeOnline {
+ display: none;
+ }
+ }
+
+ > .userCredits {
+ display: none;
+ }
+ }
+ }
+
+ .messageQuickReplyContent {
+ // simulate clickable area
+ cursor: pointer;
+
+ .wysiwygTextarea {
+ height: 138px;
+ }
+
+ > .messageBody,
+ > .messageFooter {
+ pointer-events: none;
+ }
+
+ .redactor-editor {
+ max-height: 100px !important;
+ min-height: 100px !important;
+ overflow: hidden;
+ position: relative;
+
+ &::before {
+ color: rgb(169, 169, 169);
+ content: attr(data-reply-placeholder);
+ display: block;
+ left: 20px;
+ position: absolute;
+ top: 50%;
+ transform: translateY(-50%);
+ }
+
+ > * {
+ visibility: hidden;
+ }
+ }
+
+ .redactor-toolbar > li,
+ .messageTabMenu li {
+ opacity: .5;
+ }
+
+ > .messageFooter {
+ display: none;
+ }
+ }
+}