mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 07:12:26 +02:00
N°3549 - Activity panel: Fix drag / drop of images during object edition
This commit is contained in:
@@ -84,11 +84,12 @@ $(function() {
|
|||||||
_bindEvents: function() {
|
_bindEvents: function() {
|
||||||
let me = this;
|
let me = this;
|
||||||
|
|
||||||
// Enable send button only when content
|
// Handlers for the CKEditor itself
|
||||||
CKEDITOR.on('instanceReady', function(oEvent){
|
CKEDITOR.on('instanceReady', function (oEvent) {
|
||||||
// Handle only the current CKEditor instance
|
// Handle only the current CKEditor instance
|
||||||
if(oEvent.editor.name === me.options.text_input_id) {
|
if (oEvent.editor.name === me.options.text_input_id) {
|
||||||
// Update depending elements on change
|
// Update depending elements on change
|
||||||
|
// Note: That when images are uploaded, the "change" event is triggered before the image upload is complete, meaning that we don't have the <img> tag yet.
|
||||||
me._GetCKEditorInstance().on('change', function () {
|
me._GetCKEditorInstance().on('change', function () {
|
||||||
const bWasDraftBefore = me.is_draft;
|
const bWasDraftBefore = me.is_draft;
|
||||||
const bIsDraftNow = !me._IsInputEmpty();
|
const bIsDraftNow = !me._IsInputEmpty();
|
||||||
@@ -102,15 +103,19 @@ $(function() {
|
|||||||
me._UpdateSubmitButtonState();
|
me._UpdateSubmitButtonState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to keep this out of the draft check as we need to update the bridge input at character change, otherwise, only the first character will be sent
|
|
||||||
if (false === me._IsSubmitAutonomous()) {
|
|
||||||
me._UpdateBridgeInput();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (false === this._IsSubmitAutonomous()) {
|
||||||
|
// Update the general form input on submit.
|
||||||
|
// This cannot be "completely" done in the "change" handler above because we don't have an event for when
|
||||||
|
// the image has been uploaded and its HTML markup added to the data. The "change" event occurs too early.
|
||||||
|
this._GetGeneralFormElement().on('submit', function () {
|
||||||
|
me._UpdateBridgeInput();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Form buttons
|
// Form buttons
|
||||||
this.element.find(this.js_selectors.cancel_button).on('click', function (oEvent) {
|
this.element.find(this.js_selectors.cancel_button).on('click', function (oEvent) {
|
||||||
me.element.trigger('cancelled_form.caselog_entry_form.itop');
|
me.element.trigger('cancelled_form.caselog_entry_form.itop');
|
||||||
|
|||||||
Reference in New Issue
Block a user