From f7da24396edd1f800e8691dd47b4b57ec521fa60 Mon Sep 17 00:00:00 2001 From: Tim Fischbach Date: Thu, 28 Sep 2023 07:10:46 +0200 Subject: [PATCH] Update section item when inserting sections When inserting a section at the beginning of the entry, we need to update the transition of the previously first section. Also the section might no longer be the active section, even though currentSectionIndex did not change. REDMINE-20217 --- .../scrolled/package/src/editor/views/SectionItemView.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/entry_types/scrolled/package/src/editor/views/SectionItemView.js b/entry_types/scrolled/package/src/editor/views/SectionItemView.js index f99add0b7..61861e865 100644 --- a/entry_types/scrolled/package/src/editor/views/SectionItemView.js +++ b/entry_types/scrolled/package/src/editor/views/SectionItemView.js @@ -68,6 +68,11 @@ export const SectionItemView = Marionette.ItemView.extend({ }); } }); + + this.listenTo(this.options.entry.sections, 'add', () => { + this.updateActive(); + this.updateTransition(); + }); }, onRender() { @@ -78,10 +83,6 @@ export const SectionItemView = Marionette.ItemView.extend({ } this.$el.toggleClass(styles.invert, !!this.model.configuration.get('invert')); - this.ui.transition.text( - I18n.t(this.getTransition(), - {scope: 'pageflow_scrolled.editor.section_item.transitions'}) - ); this.subview(new SectionThumbnailView({ el: this.ui.thumbnail,