-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: ColorPicker Offset incorrect when Panels are outside of Editor Container #5746
Comments
@bernesto can you check this one as it seems to be related to your changes |
Yes, I see the issue. The logic needs to account for when the parent is outside of the container. Let me see what I can do there. |
Hi @artf, The root issue is that we are trying to place a popover palette absolutely positioned over another element at an arbitrary location on the page. And we need to do this even when the origin element is outside of the editor container node. To meet this requirement, the popover palette can not be contained anywhere within an In my prior patch, it appeared to work because the example editor took up the full window, and thus, At the time, I didn't consider that the StyleManager may not be within the editor element; and that we'd never find the root element as we climbed the tree. This resulted in the coordinates of the palette relative to the origin input being inaccurately calculated in In To resolve this, we need to move the Spectrum palette container all the way to the body instead. var colorEl = $(`<div class="${this.ppfx}field-color-picker"></div>`);
var cpStyle = colorEl.get(0)!.style;
//var elToAppend = em && em.config ? em.config.el : '';
var elToAppend = $('body');
var colorPickerConfig = (em && em.getConfig && em.getConfig().colorPicker) || {}; That said, and as expected... appending Spectrum's parent container at the body has the cascading effect of not inheriting the editor styles either. As shown below: vs. We'd need to remove all of the Do you have any issues with these changes? |
GrapesJS version
What browser are you using?
Chrome v122
Reproducible demo link
https://grapesjs.com/docs/getting-started.html#style-manager
Describe the bug
How to reproduce the bug?
What is the expected behavior?
the color picker shows up next to the corresponding input
What is the current behavior?
the relative offset is calculated incorrectly and the colorpicker sits outside of the editor window
Code of Conduct
The text was updated successfully, but these errors were encountered: