var $parent = this.getParent();
$parent = ($parent) ? $($parent) : $parent;
var $quote = ($parent) ? $parent.closest('blockquote.quoteBox', this.$editor.get()[0]) : { length: 0 };
- console.clear();
- console.debug($current);
- console.debug($parent);
+
switch (data.event.which) {
// arrow down
case $.ui.keyCode.DOWN:
var $container = $current.closest('div', $quote[0]);
if (!$container.next().length) {
this.insertingAfterLastElement($quote);
- console.debug("case#0");
data.cancel = true;
}
- else {
- console.debug("case#1");
- }
}
else if ($parent.next('blockquote.quoteBox').length) {
this.selectionStart($parent.next().find('> div > div:first'));
- console.debug("case#2");
+
data.cancel = true;
}
- else {
- console.debug("case#3");
- }
}
else if ($current.next('blockquote.quoteBox').length) {
this.selectionStart($current.next().find('> div > div:first'));
- console.debug("case#4");
+
data.cancel = true;
}
- else {
- console.debug("case#5");
- }
break;
// arrow up
var $previousElement = $quote.prev();
if ($previousElement.length === 0) {
- console.debug("case#1");
var $node = $(this.opts.emptyHtml);
$node.insertBefore($quote);
this.selectionStart($node);
*
* @param string author
* @param string link
+ * @param string html
+ * @param string plainText
*/
- insertQuoteBBCode: function(author, link) {
+ insertQuoteBBCode: function(author, link, html, plainText) {
if (this.inWysiwygMode()) {
var $html = '<blockquote class="quoteBox" cite="' + link + '" data-author="' + author + '" id="redactorInsertedQuote">'
+ '<div class="container containerPadding">'
this.insertHtml($html);
var $quote = $('#redactorInsertedQuote');
- var $container = $('<div>' + this.opts.invisibleSpace + '</div>').insertAfter($quote.find('> div > header'));
+ var $container = $('<div>' + (html ? html : this.opts.invisibleSpace) + '</div>').insertAfter($quote.find('> div > header'));
$quote.removeAttr('id');
this.selectionStart($container[0]);
this._observeQuotes();
}
else {
- var $bbcode = '[quote][/quote]';
+ var $bbcode = '[quote]';
if (author) {
if (link) {
- $bbcode = "[quote='" + author + "','" + link + "'][/quote]";
+ $bbcode = "[quote='" + author + "','" + link + "']";
}
else {
- $bbcode = "[quote='" + author + "'][/quote]";
+ $bbcode = "[quote='" + author + "']";
}
}
+ if (plainText) $bbcode += plainText;
+ $bbcode += '[/quote]';
+
this.insertAtCaret($bbcode);
}
},
}
if ($.browser.redactor) {
- this._messageField.redactor('insertDynamic', data.returnValues.template);
+ var $html = WCF.String.unescapeHTML(data.returnValues.template);
+ $html = this._messageField.redactor('transformQuote', $html);
+
+ this._messageField.redactor('selectionEndOfEditor');
+ this._messageField.redactor('insertDynamic', $html, data.returnValues.template);
}
else {
this._messageField.val(data.returnValues.template);
var $quote = $.trim($listItem.children('div.jsFullQuote').text());
var $message = $listItem.parents('article.message');
- // build quote tag
- $quote = "[quote='" + $message.attr('data-username') + "','" + $message.data('link') + "']" + $quote + "[/quote]";
-
// insert into editor
if ($.browser.redactor) {
if (this._editorElementAlternative === null) {
- this._editorElement.redactor('insertDynamic', $quote);
+ this._editorElement.redactor('insertQuoteBBCode', $message.attr('data-username'), $message.data('link'), $quote, $quote);// $quote);
}
else {
- this._editorElementAlternative.redactor('insertDynamic', $quote);
+ this._editorElementAlternative.redactor('insertQuoteBBCode', $message.attr('data-username'), $message.data('link'), $quote, $quote);// $quote);
}
}
else {
+ // build quote tag
+ $quote = "[quote='" + $message.attr('data-username') + "','" + $message.data('link') + "']" + $quote + "[/quote]";
+
// plain textarea
var $textarea = (this._editorElementAlternative === null) ? this._editorElement : this._editorElementAlternative;
var $value = $textarea.val();