getChildrenDim skips children whose DOM element does not match the itemSel
(e.g. comment nodes rendered as nodeType=8). findPosition returns an index
into the filtered dims array, which was used directly as the model-space
insert index — off by however many children were skipped earlier in the list.
Fix: stamp each Dimension with its unfiltered position (indexEl) in
getChildrenDim, then translate in getDropPosition via
`(dimension.indexEl ?? dimensionIndex)`.
Also guards getDropPosition against the crash that occurred when all
children were filtered (childrenDimensions.length === 0) but the parent
still had model children.
Fixes drops being off-by-N when MSO conditional comment siblings exist
(e.g. content produced by grapesjs-mjml).
The `prevent` option delegated to `CanvasView.preventDefault`, resolved
through `Canvas.getCanvasView()` with optional chaining, so the default
browser action was silently kept whenever the canvas view was not
available (editor not rendered yet, canvas removed). `Commands`,
`Canvas` and the editor instance were also captured when the keymap was
added instead of when it runs.
Move the prevention to a shared `preventDefault` DOM util, which also
handles the original event of the canvas frame (`_parentEvent`), and
resolve the modules inside the handler.
Removing a component (directly or via replaceWith) left it in the
editor's Selected collection, since only the core:component-delete
command deselected explicitly. The stale entry breaks anything
iterating the selection and, with UndoManager's trackSelection,
lets undo restore a selection pointing at removed components.
Deselect in Components.removeChildren so every non-temporary removal
path is covered. Temporary and undo-driven removals are unaffected.
The stale-target cache in DropLocationDeterminer#getValidParent compared
the current drop-bounds check (container-relative coords) against one
computed from the last mouse event's clientX/clientY (viewport coords),
making the comparison meaningless. On slow drags, where the hovered node
and index stay the same between move samples, the cached target was
returned even after the pointer entered an edge band that should
escalate the target to the parent.
Store the drop-bounds result of each move in lastMoveData and compare
against it, keeping the whole check in a single coordinate space.
Introduced in #6542 (0.22.10).
* Add skipFromStorage support to page and frames
* Add custom wrapper support to frames and refComponent
* Fix Component TS
* Ensure frame reference in components
* Add SelectComponentCommandOptions
* Update runDefault/stopDefault
* Fix component add event with page cloning
* Up TS
fix(parser): don't drop @container/@layer at-rules on CSS parse
The browser CSS parser only recognised nestable at-rules (@container,
@layer, ...) when the CSSOM reported a falsy rule `type`. That happened
to work in Chrome, where the legacy `CSSRule.type` is `0` for newer
at-rules, but engines that expose a real numeric type (jsdom reports
`17` for `CSSContainerRule`) fell through every branch and the whole
rule — selectors, styles and condition — was silently discarded.
Detect nestable at-rules via `getNestableAtRule` regardless of the
numeric `type`. `getNestableAtRule` already matches only when the rule's
`cssText` starts with the exact `@<name>`, so normal style/keyframe
rules are unaffected. The parsed condition keeps the container name and
its query separated by a space, so the exported CSS is valid again
(e.g. `@container somename (min-width: 300px){...}`).
Fixes#5969
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Browsers don't apply the input `accept` attribute to dropped files, so
videos dropped on an image upload zone were uploaded and selectable.
Filter dropped files against `accept` in FileUploader.uploadFile().
Closes#6032
* Initial setup for custom code parser
* Update ParserHtml
* Move methods
* Up
* Move utils
* Fix tests
* Up sanitize
* Up domToParsedNode
* Up fragment node
* Remove node cloning
* Convert ParserHtml to class
* Convert ParserCss to a class
* Update Custom CSS/HTML docs
* Always use isParsedNode if available
* Update API
* Update docs for isParserNode
* Add support for nested CSS rules
* Update undo test
* Cleanup resolutions and TS config
* Update jest
* Normalize tests for the latest jsdom version
* Parse nested CSS rules
* Add hidden test for @page at-rule
* Fix VuePress build
* Up CI nodejs
* Cache list counter
* Skip model resolver when possible
* Clean up Component.getView
* Cleanup SelectComponent
* Update Component getView
* Check in CommandAbstract
* Start data source import policy implementation
* Fix TS
* Update applyImportPolicy
* Up TS naming
* Up test file
* Improve applyImportPolicy
* Add more use cases to data binding import policy tests
* Add support per-call dataBindingImportPolicy
* Up JSDoc
* Fix tests
* Format
* Allow skipping nodes during HTML parsing
* Type canvas events
* Type commands event callbacks
* Type device event callbacks
* Add callback events to i18n
* Add callbacks types to keymaps
* Add callback types to modal
* Add callback types to layers
* Add callback types for pages
* Add callback types to parser
* Add callback type to RTE
* Add callback types to selectors
* Add callback types for storage
* Add callback types to StyleManager
* Add callback types to traits
* Add callback events to Components
* Add callbacks types to editor
* Up types
* Fix API docs generation
* Format
* Add tests for component wrapper
* Refactor component data collection
* Add data resolver to wrapper component
* Fix types
* Add collection data source to page
* refactor get and set DataResolver to componentWrapper
* Rename key to __rootData
* add resolverCurrentItem
* Make _resolverCurrentItem private
* update ComponentWrapper tests
* Fix componentWithCollectionsState
* remove collectionsStateMap from Page
* update component wrapper tests
* fix component wrapper tests
* return a copy of records for DataSource.getPath
* Move all collection listeners to component with collection state
* fix style sync in collection items
* fix loop issue
* update data collection tests
* cleanup
* update collection statemap on wrapper change
* Add object test data for wrapper data resolver
* cleanup
* up unit test
* remove duplicated code
* cleanup event path
* update test data to better names
* improve component data collection performance
* cleanup tests and types
* fix performance issue for the new wrapper datasource
* Undo updating component with datacolection tests
* apply comments
* Skip same path update
---------
Co-authored-by: Artur Arseniev <artur.catch@hotmail.it>
* Fix saving dynamic values for cssRules
* Allow using collectionStateMap for styleable models
* Fix bug with undo manager
* refactor resolverWatcher
* Allow CssRules to use collection variable
* Fix undoManager issue for binding data to a component
* update returned value for adding props
* Revert a change to fix tests
* move test files
* Add tests for undomanager with datasources
* update clone and toJSON for cssRule
* Refactor Model data resolver
* update test setup function
* Refactor datasources logic to styleable model
* Add clone and update toJSON in styleableModel
* Refactor CssRule to use styleableModel methods
* Add undomanager to datasources
* refactor component class to use styleableModel methods
* update unit tests for undo manager
* Refactor data resolver watcher
* Fix undoManager in test enviroment
* Remove destroy test editor
* Update Data resolver watchers
* Remove setTimeout from undo manager unit tests
* Fix Selection tracking tests
* Fix missing id in `component.toJSON()`
* Fix styles as string for cssRules
* Fix CssRule type
* Add string style support for ModelResolver.getProps()
* Cleanup ( rename dynamic to data resolver )
* Use fake timers in undo manager tests
* Remove checking duplicated object in undomanager registry
* Fix typescript checks
* Fix lint
* Emit event on setting a style with dynamic value
* Fix event when binding to a data value equals to the previous static value
* Fix dataResolver listening bug after loading a project
* Add style watchers to modelResolverWatcher class
* Remove watcher init from Component
* Add watcher init to styleableModel and refactor styleableModel
* Fix global styles listening to datasources
* cleanup
* fix initial styles not working bug
* Add skip resolve option to component.getStyle
* Add more global styles unit tests
* Improve serialization test
* Add component:input to ComponentsEvents
* Add additional `data:path` events
* Add CssRule mount event
* Switch to a new pathSource event.
The `data:path:SOURCE_ID` doesn't work as it triggers rebuilds of symbols in ComponentDataCollection
* Up comment
* Up data_sources docs
* Up data_sources jsdoc
* Up Module.events TS
* Export types data components
* More TS export
* Up TS
* Up docs API
* fixe ComponentDataVariable dataResolver type 'data-variable' issue
* Improve some types in data resolvers
* Add an options to add dynamic values as plain text 'asPlainText: boolean'
* Make collections loop over objects
* update getItemsCount method
* Trigger `component:styleUpdate` also on the component itself
* Up
* Add type getter to the Component
* Add isVisible property to Property class in StyleManager
* Fix unstylable
* Remove type getter