-
Notifications
You must be signed in to change notification settings - Fork 118
Add interactive previews to snippets #4482
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
Conversation
|
This PR targets the un-managed branch odoo-dev/odoo:master-mysterious-egg, it needs to be retargeted before it can be merged. |
| this.websiteEditService = this.websiteService.websiteRootInstance.bindService("website_edit"); | ||
|
|
||
| const updatePreview = () => { | ||
| const iframeDocument = document.querySelector("iframe.o_add_snippet_iframe").contentDocument; |
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.
it would be better to use a ref to directly access the target instead of doing this, in my opinion
| <t t-name="html_builder.SnippetViewer"> | ||
| <div class="row g-0 o_snippets_preview_row"> | ||
| <div class="col-lg-6" t-foreach="this.getSnippetColumns()" t-as="snippetsColumn" t-key="snippetsColumn_index"> | ||
| <t t-foreach="snippetsColumn" t-as="snippet" t-key="snippet.id"> |
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 can add a t-ref="content" on the root div from this template (the one with o_snippets_preview_row)
|
|
||
| setup() { | ||
| this.dialog = useService("dialog"); | ||
|
|
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.content = useRef("content");| this.dialog = useService("dialog"); | ||
|
|
||
| this.websiteService = useService("website"); | ||
| this.websiteEditService = this.websiteService.websiteRootInstance.bindService("website_edit"); |
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.
to avoid confusion, you should rename it this.innerWebsiteEditService maybe.
e5e4ed1 to
211fec6
Compare
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.
if root is created in onMounted, it should probably be destroyed in onWillUnmount
4f9d883 to
174fe6e
Compare
174fe6e to
ddc5f8d
Compare
No description provided.