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

Do not open the option containers after dropping a snippet + Fix and improve the drag and drop from right panel and dropzones + on snippet preview resource + ImageSnippet option #4259

Merged
merged 4 commits into from
Apr 2, 2025

Conversation

sobo-odoo
Copy link

No description provided.

@robodoo
Copy link

robodoo commented Mar 27, 2025

This PR targets the un-managed branch odoo-dev/odoo:master-mysterious-egg, it needs to be retargeted before it can be merged.

@sobo-odoo sobo-odoo changed the title Master mysterious egg sobo 2 Do not open the option containers after dropping a snippet + Fix and improve the drag and drop from right panel and dropzones Mar 27, 2025
@sobo-odoo sobo-odoo force-pushed the master-mysterious-egg-sobo-2 branch 2 times, most recently from f7df808 to 35f3199 Compare March 27, 2025 15:33
@ged-odoo ged-odoo force-pushed the master-mysterious-egg branch from 27a1402 to 8c6b756 Compare March 27, 2025 20:00
@sobo-odoo sobo-odoo force-pushed the master-mysterious-egg-sobo-2 branch 6 times, most recently from 6d52155 to c9af27a Compare April 1, 2025 17:16
@sobo-odoo sobo-odoo marked this pull request as ready for review April 1, 2025 22:12
@robodoo
Copy link

robodoo commented Apr 1, 2025

This PR targets the un-managed branch odoo-dev/odoo:master-mysterious-egg, it needs to be retargeted before it can be merged.

@sobo-odoo sobo-odoo force-pushed the master-mysterious-egg-sobo-2 branch from c9af27a to 0373a5b Compare April 2, 2025 09:31
@sobo-odoo sobo-odoo changed the title Do not open the option containers after dropping a snippet + Fix and improve the drag and drop from right panel and dropzones Do not open the option containers after dropping a snippet + Fix and improve the drag and drop from right panel and dropzones + on snippet preview resource + ImageSnippet option Apr 2, 2025
dropzoneEls = this.shared.dropzone.activateDropzones(selectors, {
toInsertInline: isInlineSnippet,
});
this.onDropzoneStart();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should probably call this.dispatchTo("on_dropzone_start_handlers") here. it is more robust than relying on monkey patches

/**
* Hooks allowing other modules to react to drop zones being enabled.
*/
onDropzoneStart() {}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you should dispatch events instead

this.hideSnippetToolTip?.();

this.shared.operation.next(async () => {
await new Promise((resolve) => (dragAndDropResolve = () => resolve()));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use a deferred instead (from web/utils/concurrency). maybe it would be clearer

// Preview the snippet correctly.
// Note: no async previews, in order to not slow down the drag.
this.cancelSnippetPreview = this.shared.history.makeSavePoint();
this.resources["on_snippet_preview_handlers"]?.forEach((onSnippetPreview) =>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe, it would be better to call a shared function from dropzoneplugin instead. and that's a more general statement. the dropzone plugin should be the main coordinator of the drag and drop process, not the block tab.

Copy link

@ged-odoo ged-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice

@ged-odoo ged-odoo merged commit 963d4d5 into master-mysterious-egg Apr 2, 2025
@ged-odoo ged-odoo deleted the master-mysterious-egg-sobo-2 branch April 2, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants