-
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
Master snippet options owl bso #3299
base: master-snippet-options-owl-ard
Are you sure you want to change the base?
Master snippet options owl bso #3299
Conversation
This PR targets the un-managed branch odoo-dev/odoo:master-snippet-options-owl-ard, it needs to be retargeted before it can be merged. |
6e6892f
to
9153992
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.
Thanks for your work! I just have a couple questions on the few commits I reviewed, and maybe it can also guide the next commits?
Mostly surface things, the rest seems to be good 👍🏻
const themeFontsNb = nbFonts - (this.googleLocalFonts.length + this.googleFonts.length); | ||
const googleLocalFontsOffset = nbFonts - this.googleLocalFonts.length; | ||
for (let fontNb = 0; fontNb < nbFonts; fontNb++) { | ||
const realFontNb = fontNb + 1; | ||
const fontKey = weUtils.getCSSVariableValue(`font-number-${realFontNb}`, style); | ||
this.allFonts.push(fontKey); | ||
let fontName = fontKey.slice(1, -1); // Unquote | ||
let fontFamily = fontName; | ||
const isSystemFonts = fontName === "SYSTEM_FONTS"; | ||
if (isSystemFonts) { | ||
fontName = _t("System Fonts"); |
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 was copied from WeFontFamilyPicker widget, but the code was not removed, shouldn't it be?
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 actually forgot to get rid of the component's start
method which did build the buttons "manually" - because this is now done in the template using the data structure built in the FontFamilyUserValue
.
if (htmlContent && htmlContent !== this.state.textContent) { | ||
const markupContent = markup(htmlContent); | ||
// Avoid converting the markup back to a string. | ||
markupContent.trim = () => markupContent; | ||
this.state.textContent = markupContent; |
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.
Actually, why does this happen? After thinking a bit about it, we might want to make sure the markup is not trimmed where it currently is, in case we need to perform other string operations, we would have to void the methods here as well. What do you think?
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 tried to do that, but I found no way to "safely" determine if something is a markup.
IMO (but yours might differ), checking .constructor.name === "Markup"
looks like an even worse hack.
Or we could go for a distinct state field markupContent
? And handle it differently on the other side ?
0c65909
to
d11fc02
Compare
d11fc02
to
a44ba52
Compare
this.state.option.instance._onGoogleFontsCustoRequest({ | ||
// TODO: @owl-options should we allow something else that "variable" ? (most likely not) | ||
values: {[this.props.variable]: `'${font}'`}, |
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 huge fan of this, but OK for now. Let's just keep in mind that we should maybe have a way for widgets to request something from the option.
fb98eb8
to
50c6b00
Compare
b384892
to
dd127ca
Compare
Includes header, footer, copyright and theme options. task-3850413
task-3850413
task-3850413
task-3850413
task-3850413
06f3c99
to
3de47f4
Compare
633ee8d
to
1240c73
Compare
PR created to ease discussion during the conversion of snippet options to Owl
Local temporary work based on ARD's branch