Problem/Motivation
Steps to reproduce:
- Use experimental paragraph widget with a modal window
- Create a container paragraph
- Create a text paragraph inside the container
- Promote container to library
- Edit library item
- Switch to Behavior tabs
The problem is that `switchActiveClass()` function in paragrpahs.admin.js has an if condition is using `content` and `behavior` id:
if ($parWidget.find('#content').hasClass('is-active')) {
$parWidget.addClass('content-active');
$parWidget.find('.paragraphs-add-wrapper').parent().removeClass('hidden');
}
else if ($parWidget.find('#behavior').hasClass('is-active')) {
$parWidget.addClass('behavior-active');
$parWidget.find('.paragraphs-add-wrapper').parent().addClass('hidden');
}
and in library modal, we could have two elements with content id:
li#content.tabs__tab
ul#content.paragraphs-add-dialog-list.is-active
This will make this if condition unstable.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | library-modal-behavior-switching-3114847-2.patch | 1.47 KB | pivica |
Comments
Comment #2
pivica commentedHere is a patch that is improving if condition. Reformated code and removed extra space indentation.
And i removed next line:
Because this selector is always returning empty.
Comment #3
mbovan commentedTested #2 with the described steps to reproduce as well as with Content/Behavior tabs on the main entity form, paragraphs library modal and the main paragraphs library edit form. Works great!
Comment #4
berdirOverlooked this one, committed.