Skip to content
Snippets Groups Projects
Commit d0bd8945 authored by Tim Bozeman's avatar Tim Bozeman
Browse files

Fix media edits sometime not being centered

parent 920f55b9
No related branches found
No related tags found
No related merge requests found
Pipeline #446901 passed with warnings
......@@ -338,13 +338,16 @@ export class FieldPluginBase {
sizedPlaceholder.classList.add('sized-placeholder');
pageElement.parentElement.insertBefore(sizedPlaceholder, pageElement);
this.positionFormItemOverPageElement();
document.addEventListener('scroll', this.positionFormItemOverPageElement);
window.addEventListener('resize', this.positionFormItemOverPageElement);
pageElement.classList.add('edit-plus-hidden');
formItem.classList.add('edit-plus-editing');
// Make the sized placeholder the same height as the form item.
sizedPlaceholder.style.height = formItem.getBoundingClientRect().height + 'px';
this.positionFormItemOverPageElement();
document.addEventListener('scroll', this.positionFormItemOverPageElement);
window.addEventListener('resize', this.positionFormItemOverPageElement);
// Ensure the sizedPlaceholder height stays in sync with the formItem height.
// As items are added or removed from the form item via ajax, the sizedPlaceholder
// should grow or shrink accordingly.
......@@ -358,8 +361,6 @@ export class FieldPluginBase {
});
Drupal.EditPlus.CurrentlyEditingElement.sizedPlaceholderHeightObserver.observe(formItem);
pageElement.classList.add('edit-plus-hidden');
formItem.classList.add('edit-plus-editing');
formItem.classList.remove('edit-plus-hidden');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment