-
Notifications
You must be signed in to change notification settings - Fork 114
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
base: master-mysterious-egg
Are you sure you want to change the base?
Conversation
This PR targets the un-managed branch odoo-dev/odoo:master-mysterious-egg, it needs to be retargeted before it can be merged. |
ca5091b
to
ca2410a
Compare
This PR targets the un-managed branch odoo-dev/odoo:master-mysterious-egg, it needs to be retargeted before it can be merged. |
There was a problem hiding this 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
?
addons/html_builder/static/src/builder/plugins/remove/remove_plugin.js
Outdated
Show resolved
Hide resolved
const previousSiblingEl = this.getPreviousOrNextVisibleSibling("prev"); | ||
const nextSiblingEl = this.getPreviousOrNextVisibleSibling("next"); |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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)
addons/html_builder/static/src/builder/plugins/replace/replace_plugin.js
Outdated
Show resolved
Hide resolved
addons/html_builder/static/src/builder/plugins/remove/remove_plugin.js
Outdated
Show resolved
Hide resolved
addons/html_builder/static/src/builder/builder_sidebar/tabs/block_tab/block_tab.js
Outdated
Show resolved
Hide resolved
addons/html_builder/static/src/builder/plugins/overlay_buttons/overlay_buttons.xml
Show resolved
Hide resolved
).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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 🙂
00640b7
to
578176b
Compare
578176b
to
fe46e95
Compare
fe46e95
to
02a18f4
Compare
const root = undefined; | ||
return !unremovableNodePredicates.some((p) => p(el, root)); |
There was a problem hiding this comment.
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" ?
There was a problem hiding this 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; |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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 } |
There was a problem hiding this comment.
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 ?
callback: (snippet) => { | ||
newSnippet = snippet; | ||
resolve(); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
removeElement(el) { | ||
this.editor.shared.remove.removeElement(el); | ||
} | ||
|
||
cloneElement(el) { | ||
this.editor.shared.clone.cloneElement(el); | ||
} |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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
No description provided.