if (this._fileListSelector.children('li:not(.uploadFailed)').length) {
this._insertAllButton.show();
}
+
+ if (this._wysiwygContainerID) {
+ WCF.System.Event.addListener('com.woltlab.wcf.messageOptionsInline', 'submit_' + this._wysiwygContainerID, $.proxy(this._submitInline, this));
+ WCF.System.Event.addListener('com.woltlab.wcf.redactor', 'reset', $.proxy(this._reset, this));
+ }
+ },
+
+ /**
+ * Adds parameters for the inline editor.
+ *
+ * @param object data
+ */
+ _submitInline: function(data) {
+ if (this._tmpHash) {
+ data.tmpHash = this._tmpHash;
+ }
+ },
+
+ /**
+ * Resets the attachment container.
+ */
+ _reset: function() {
+ this._fileListSelector.hide().empty();
+ this._insertAllButton.hide();
+ this._validateLimit();
},
/**
_initInputs: function() {
var self = this;
this._newIDInputs.change(function(event) {
- var newID = parseInt($(this).val())
+ var newID = parseInt($(this).val());
if ($(this).val() === 'current') newID = Infinity;
self._oldIDInputs.each(function(event) {
- var oldID = parseInt($(this).val())
+ var oldID = parseInt($(this).val());
if ($(this).val() === 'current') oldID = Infinity;
if (oldID >= newID) {
if ($(this).val() === 'current') oldID = Infinity;
self._newIDInputs.each(function(event) {
- var newID = parseInt($(this).val())
+ var newID = parseInt($(this).val());
if ($(this).val() === 'current') newID = Infinity;
if (newID <= oldID) {
if (this._container.is(':visible')) {
this._quickReplyButtons.hide();
- // TODO: Scrolling is anything but smooth, better use the init callback
- this._scroll.scrollTo(this._container, true);
+ var self = this;
+ window.setTimeout(function() { self._scroll.scrollTo(self._container, true); }, 100);
WCF.Message.Submit.registerButton('text', this._container.find('.formSubmit button[data-type=save]'));
},
lastPostTime: this._container.data('lastPostTime'),
pageNo: this._container.data('pageNo'),
- removeQuoteIDs: (this._quoteManager === null ? [ ] : this._quoteManager.getQuotesMarkedForRemoval()),
- tmpHash: this._container.data('tmpHash') || ''
+ removeQuoteIDs: (this._quoteManager === null ? [ ] : this._quoteManager.getQuotesMarkedForRemoval())
};
if (this._container.data('anchor')) {
$parameters.anchor = this._container.data('anchor');
if (this._quoteManager) {
this._quoteManager.setAlternativeEditor($element);
}
+
+ new WCF.Effect.Scroll().scrollTo(this._container[this._activeElementID], true);
}, this), 250);
}
else {
$parameters['removeQuoteIDs'] = (isset($parameters['removeQuoteIDs']) && is_array($parameters['removeQuoteIDs'])) ? ArrayUtil::trim($parameters['removeQuoteIDs']) : array();
// check for tmp hash (attachments)
- $parameters['tmpHash'] = (isset($parameters['tmpHash'])) ? StringUtil::trim($parameters['tmpHash']) : '';
+ $parameters['tmpHash'] = '';
+ if (isset($parameters['data']['tmpHash'])) {
+ $parameters['tmpHash'] = StringUtil::trim($parameters['data']['tmpHash']);
+ unset($parameters['data']['tmpHash']);
+ }
// message settings
$parameters['data'] = array_merge($parameters['data'], MessageFormSettingsHandler::getSettings($parameters));