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

Add "Remove" and "Replace" overlay buttons + "Remove" and "Clone" sidebar buttons #3845

Open
wants to merge 7 commits into
base: master-mysterious-egg
Choose a base branch
from

Conversation

sobo-odoo
Copy link

No description provided.

@robodoo
Copy link

robodoo commented Dec 26, 2024

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 branch 2 times, most recently from ca5091b to ca2410a Compare December 30, 2024 19:27
@sobo-odoo sobo-odoo marked this pull request as ready for review December 31, 2024 10:07
@robodoo
Copy link

robodoo commented Dec 31, 2024

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

Copy link

@loco-odoo loco-odoo left a comment

Choose a reason for hiding this comment

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

just a few nitpick stuffs ;) Also, I did not check deeper but I was wondering if hasOverlayOptions should be adapted with isRemovable and isReplaceable ?

Comment on lines +102 to +109
const previousSiblingEl = this.getPreviousOrNextVisibleSibling("prev");
const nextSiblingEl = this.getPreviousOrNextVisibleSibling("next");

Choose a reason for hiding this comment

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

Maybe you want to add the condition on o_snippet_invisible as in stable (or add a todo to do it later)

Copy link
Author

Choose a reason for hiding this comment

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

This part will be done later 😉 (there is a TODO above)

).click();
// Check that the snippet was replaced by the chosen one.
expect(":iframe section.s_text_image").toHaveCount(0);
expect(":iframe section.s_shape_image").toHaveCount(1);

Choose a reason for hiding this comment

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

Maybe something that can be interesting to test as well is that the overlay is still here and the "customize" tab displays the correct info of the updated snippet

Copy link
Author

Choose a reason for hiding this comment

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

I am not sure to keep this behavior yet, I will add a TODO to not forget if I keep it 🙂

@sobo-odoo sobo-odoo force-pushed the master-mysterious-egg-sobo branch 3 times, most recently from 00640b7 to 578176b Compare January 3, 2025 11:01
@sobo-odoo sobo-odoo force-pushed the master-mysterious-egg-sobo branch from 578176b to fe46e95 Compare January 3, 2025 19:19
@sobo-odoo sobo-odoo force-pushed the master-mysterious-egg-sobo branch from fe46e95 to 02a18f4 Compare January 3, 2025 19:36
@sobo-odoo sobo-odoo changed the title Add "Remove" overlay button Add "Remove" and "Replace" overlay buttons + "Remove" and "Clone" sidebar buttons Jan 3, 2025
Comment on lines +27 to +28
const root = undefined;
return !unremovableNodePredicates.some((p) => p(el, root));

Choose a reason for hiding this comment

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

you don t need "root" ?

Copy link

@FrancoisGe FrancoisGe left a comment

Choose a reason for hiding this comment

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

Good job :) Just small stuffs

};

setup() {
this.target = null;

Choose a reason for hiding this comment

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

I m not a big fan to have the target on this.

}

// TODO duplicated.
getPreviousOrNextVisibleSibling(direction) {

Choose a reason for hiding this comment

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

Maybe create an utils (target, direction). Rename getVisibleSibling ?

const targetMobileOrder = this.target.style.order;
// On mobile, if the target has a mobile order (which is independent
// from desktop), consider these orders instead of the DOM order.
if (targetMobileOrder && this.isMobileView) {

Choose a reason for hiding this comment

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

isMobileView is not define

import { Plugin } from "@html_editor/plugin";
import { resizeGrid } from "@html_builder/builder/utils/grid_layout_utils";
import { unremovableNodePredicates as deletePluginPredicates } from "@html_editor/core/delete_plugin";
import { isUnremovableQWebElement as qwebPluginPredicate } from "@html_editor/others/qweb_plugin";

Choose a reason for hiding this comment

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

You don t use isUnremovableQWebElement ?

</div>
</section>
`,
{ loadIframeBundles: true }

Choose a reason for hiding this comment

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

You need the style in your test ?

Comment on lines +44 to +46
callback: (snippet) => {
newSnippet = snippet;
resolve();

Choose a reason for hiding this comment

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

Why we need to pass a callback ?

};

setup() {
this.target = null;

Choose a reason for hiding this comment

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

I m not a big fan to have the target on this

};

setup() {
this.dialog = useService("dialog");
this.orm = useService("orm");
this.company = useService("company");
this.onClickInstall = this.props.onInstallSnippetClick;

Choose a reason for hiding this comment

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

Not a good practice to put a props in local var. If the props change, it will not work. 2 solutions, replace each onClickInstall by props.installSnippetModule or use a getter

Comment on lines +394 to +400
removeElement(el) {
this.editor.shared.remove.removeElement(el);
}

cloneElement(el) {
this.editor.shared.clone.cloneElement(el);
}

Choose a reason for hiding this comment

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

CustomTab could directly use it ? You don t need to pass it as props or I miss something ?

@@ -22,6 +26,37 @@ export class OptionsContainer extends Component {
}

get title() {
return this.env.getEditingElement().dataset.name;
const editingElement = this.env.getEditingElement();

Choose a reason for hiding this comment

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

Funny, i have a commit for this 7e563b8

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.

4 participants