Closed (fixed)
Project:
Entity Browser
Version:
8.x-2.x-dev
Component:
Widget plugins
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 May 2019 at 10:06 UTC
Updated:
18 Jul 2019 at 11:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
pivica commentedHere is the first patch for this.
There is probably a similar problem with Drupal.behaviors.entityBrowserModal - that code will run on each behaviour trigger but I don't have time right now to check it.
Comment #3
oknateThanks, I'll take a look as soon as possible.
Comment #4
sasanikolic commentedThis definition is causing some trouble in one of our projects. Not sure why, but the $document is not set correctly and the call
$document.on('dialogopen', '.ui-dialog',...does not get executed, hence the height of the entity browser does not get set. If I change $document to $(document) on that call it works fine.See the expected vs actual images attached.
Comment #5
sasanikolic commentedComment #6
pivica commentedTook a new look into this after this bug and, hmmm, it seems i messed a stuff a bit. The idea is good, but execution not that good ;)
On top of this, it seems when the behaviour context is an iframe then `context.contentDocument.defaultView` will sometimes be set but sometimes it will be null so we can not use it in this case.
But after taking a second look on this, really there is no point using context to get a document and then use it. What we need is to always operate on the window which is a global object and its document, because here we need to do `once('fluid-modal')` check. The rest is not important.
Here is a new patch which should hopefully work now.
One more thing, i've noticed we could use https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimation... inside $window.resize() to optimize things even more, but that should be a follow-up.
Comment #7
sasanikolic commentedAgree that the context was a bit of a messup.
Tested locally and works fine, thanks for fixing @pivica.
Comment #8
oknateThanks, I'll review ASAP.
Comment #9
oknateManually testing, it's easy to see it fires multiple times. On a clean install, if you enable the entity_browser_example module:
It fires for each of the fields, so it shows in the console it fires seven times.
and the events fire six times when opening the dialog:
Comment #10
oknateWith patch applied, the events fire only once each.
Comment #13
oknateCommitted, thanks.