Skip to content

Commit

Permalink
Ensure segmentation form is correctly reset (#22047)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiehl committed Mar 28, 2024
1 parent ad484fb commit 1765f5f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions plugins/SegmentEditor/javascripts/Segmentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,9 +592,7 @@ Segmentation = (function($) {
var addForm = function(mode, segment){

self.target.find(".segment-element:visible").unbind().remove();
if (typeof self.form !== "undefined") {
closeForm();
}
closeForm();
// remove any remaining forms


Expand Down Expand Up @@ -670,19 +668,21 @@ Segmentation = (function($) {
});
app.mount(segmentGeneratorContainer);

this.addEventListener('matomoVueDestroy', function () {
segmentGeneratorContainer.addEventListener('matomoVueDestroy', function () {
app.unmount();
});
};

var closeForm = function () {
$(self.form).find('.segment-generator-container')[0].dispatchEvent(
new CustomEvent('matomoVueDestroy'),
);

self.currentSegmentStr = '';

$(self.form).unbind().remove();
if (typeof self.form !== "undefined") {
$(self.form).find('.segment-generator-container')[0].dispatchEvent(
new CustomEvent('matomoVueDestroy'),
);

$(self.form).unbind().remove();
}
self.target.closest('.segmentEditorPanel').removeClass('editing');
};

Expand Down

0 comments on commit 1765f5f

Please sign in to comment.