Skip to content
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

max-w cloning issue #2354

Closed
DigitagDev opened this issue May 31, 2023 · 3 comments · Fixed by #2362
Closed

max-w cloning issue #2354

DigitagDev opened this issue May 31, 2023 · 3 comments · Fixed by #2362
Labels

Comments

@DigitagDev
Copy link
Contributor

DigitagDev commented May 31, 2023

Hello. It seems that I have found a bug in the object cloning area from a template to the grid. Following the example from the documentation, it is possible to observe that an element containing the attribute gs-max-w or gs-max-h, when cloned to the grid and then deleted from the grid using .trash or another class, any elements cloned by the same grid lose the gs-max-w or gs-max-h attribute. This can be observed even in the example documentation for two grids.

Bring the element to the grid and confirm that it has the max3 attr(on the dom the element lose this attr, but seems to work fine without it)
Sem título2

Removes the element from the dom dropping over a .trash class
Sem título3

Bring the same element to the grid again , and its lose the max-w.
Sem título4

@adumesny
Copy link
Member

adumesny commented Jun 1, 2023

good catch. yeah we don't write gs-max-w to dom as it's not used for rendering (only creation initial value).

actually don't need to delete. inserting second one looses.

@adumesny
Copy link
Member

adumesny commented Jun 12, 2023

the issue was caused by this in 8.x

protected _readAttr(el: HTMLElement): GridStackWidget {
...
if (n.maxW) el.removeAttribute('gs-max-w');

but I don't know why we don't clone the entire griditem and just the content below. related to #1840 and #2231

adumesny added a commit to adumesny/gridstack.js that referenced this issue Jun 12, 2023
* fix gridstack#2354
* external items (like toolbar) might have grid-item attr we want to clone, so don't clear them
@adumesny
Copy link
Member

fixed in next release. don't forget to doinate if you find this lib useful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants