summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/scss/web_editor.ui.scss
AgeCommit message (Collapse)Author
2019-01-17[IMP] web_editor,*: Refactoring the wysiwyg editor and 'html' fieldChristophe Matthieu
* Creating a new structure by transforming all the plugins in the library using the odoo inheritance system. Plugins are easier to implement with the AbstractPlugin to add Odoo behaviors. * From now on, the methods of the library (in this case Summernote) can no longer be called by other modules or files. Only the wysiwyg widgets can access it, to simplify the updating process. The wysiwyg object serves as an interface. * Depending on the options the snippets will be loaded or not, the editor will be in an iframe or not... all of this is transparent from the outside. * Regarding iframes, all controllers related to editing have been removed: the new API no longer needs them. This speeds up loading, eases testing and removes complexity for the same features. PUBLIC FEATURES There are several public methods on the Wysiwyg class: * Wysiwyg.prepare (WidgetParent): returns a deferred resolved when the library (xml, lazy, assets...) is loaded. * Wysiwyg.getRange (DOM): returns the range (selection in the dom) * Wysiwyg.setRange (startNode, startOffset, endNode, endOffset): creates a range (selection in the dom) * Wysiwyg.setRangeFromNode (DOM, options) that creates a range from an element (option available to select all, start or end) A jQuery selector was added: :o_editable, which indicates whether the current element is editable. That is, if it is contained in a tag with the attribute 'contentEditable = "true"' or in a tag with the class o_editable. Several methods are also present: * focusIn: makes a focus and places the cursor at the beginning of the element * focusInEnd: makes a focus and places the cursor at the end of the element * selectContent: makes a focus and selects the content HTML FIELD The HTML field can receive different options: * style-inline: {boolean} transforms a class into an inline style when saving and vice versa when reading. * no-attachment: {boolean} prevents the use of attachments (in media dialog) * cssEdit: {xml_id} to use a template containing the css to loaded in an iframe when editing * cssReadonly: {xml_id} to use a template containing the css to load into an iframe when viewing in readonly * snippets: {xml_id} snippets template (can be used with or without cssEdit) * wrapper: {template} qweb static template (containing a tag: id = "wrapper") that will include the content during editing (removed on save) MASS MAILING A widget was created for mass mailing. There are now two fields: body_html and body_arch. body_arch contains the code with the class without conversion into inline style, useful when editing and one with the inline style that is visible in readonly mode and sent by email. Advantage: no spreading errors, able to update css/theme, able to do more changes when converting to inline style so that a maximum of mail clients have an impeccable rendering. Co-authored-by: Antoine Guenet <age@odoo.com>
2018-12-12[MERGE] forward port branch 12.0 up to 047e2b28de4Christophe Simonis
2018-12-10[FIX] web_editor: ace have line number+resizeNicolas Lempereur
After 11.0, in a code editor (ace editor) on the frontend we could not resize the editor or see line numbers. This happen since: - in 64d47c0bc5 ace editor (used when editing code) was updated. - in ajaxorg/ace@5bf78e09 the line number bar was set aria-hidden - in 9de1bc0ee aria-hidden element were forcibly hidden Thus the column of line number (and used for resizeing) in the code editor was unwillingly hidden. Since we don't want to make change in library, we fix this in our custom CSS for the code editor. opw-1912824 closes #29399
2018-12-04[REF] web_editor, web_unsplash: review load more featureqsm-odoo
* Simplify the code * Make the feature mork without unsplash * Handle corner cases task-1896705
2018-12-04[IMP] web_editor, *: improve media dialogAndrea Ulliana
* web_unsplash, website_sale - Visual improvements and cleaning in each tab: video, documents, pictogram, images. - Only one search input for both the local library and unsplash. - Replace the idea of multiple pages by adding a 'Load More' button. task-1896705
2018-10-22[MERGE] forward port branch saas-11.4 up to 3c108977c1eChristophe Simonis
2018-10-17[MERGE] forward port branch saas-11.3 up to 0de06a41326Christophe Simonis
2018-10-10[FIX] web_editor, website: review graysqsm-odoo
What was designed as a new feature appeared as a regression: users were not able to choose a bootstrap gray as a background color anymore but instead got the possibiility to choose a hardcoded gray. This commit restores the use of the custom gray palette that themes can customize and which automatically uses the correct text color when used as a background. This also allows to remove ugly inline style from snippet definitions and allows to solve bugs like the described below one: --------------------------------------- Also add bg-* classes on snippet cards: --------------------------------------- Snippet cards are often put (or may be put by the user) in an element which have a bg-* class on it. This means that the card will still have a white background (as chosen by BS4 by default) but the text color will be adapted to that ancestor bg-* classed element. This commit forces the card background color (as suggested by BS4) with bg-* classes. closes odoo/odoo#27637
2018-09-28[FIX] web_editor: restore white color for discard buttonqsm-odoo
Fixing BS behavior in https://github.com/odoo/odoo/commit/e24c3409d915ed73d86077b723b6e0cd77134e80 broke that button color as the button bg was set to transparent, so the text color was computed to dark instead of light (as it should).
2018-09-05[FIX] web_editor: adapt 'small' colorpicker button UIqsm-odoo
2018-08-22[REF] web_editor: review some dropzone codeqsm-odoo
- Remove useless code - Make searching for the nearest dropzone more efficient
2018-08-20[IMP] web_editor, website: review we options' styleCocographique
2018-08-13[FIX] web_editor: review snippets "Customize" dropdown styleCocographique
2018-08-12[IMP] web_editor: change UI for snippet background color menuDipalee Bhalodia
Replace current UI of the snippet background options with the same one as the standard editor colorpicker task-37974 Closes #26274
2018-08-12[IMP] web_editor: add custom colors for editor colorpickerDipalee Bhalodia
- Custom color can now be applied to elements - Find used custom colors in the page and add them as colorpicker suggestions - Current color is selected in the picker when you open the custom color wizard task-37974 Closes #26274
2018-08-12[IMP] web_editor: improve text colorpickerDipalee Bhalodia
- Split editor button: one for font color and one for background color - Remove recent color button feature - Add only theme colors and remove other color sections like graypalette/standard colors - Button's icon for font color and background color buttons have the same color of currently selected element task-37974 Closes #26274
2018-08-02[FIX] *: BS4, restore some popover designqsm-odoo
Completes commit https://github.com/odoo/odoo/commit/2d5595fcbad73ed0ce03f048fdd870d9659bcd5e
2018-07-27[REF] web_editor, website: BS4, adapt website UIqsm-odoo
2018-07-27[REF] web_editor: make our Summernote/BS3 work with BS4qsm-odoo
The big plan is to remove our current editor and its customization and replace it with an updated summernote. Meanwhile, we have to patch our current lib directly so that it works with BS4.
2018-07-27[REF] web_editor: BS4, review media dialog layoutqsm-odoo
2018-07-27[REF] web, *: BS4, use custom BS4 checkbox everywhereqsm-odoo
Before this commit, Odoo used checkboxes in three different ways: - A simple <input type="checkbox"/>, mainly in the frontend. The style is browser dependant. - Same as above but with the BS3, checkbox structure. The style is still the same, but the alignement is supposed to be better (which is not always the case). - The Odoo official structure: ``` <div class="o_checkbox"> <input type="checkbox"/> <span/> </div> ``` which allows to have a cross-browser checkbox style and correct alignements. The goal after this commit is to only use the BS4 *custom* checkbox structure to achieve the same goal as our official structure (and remove that one): ``` <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" id="customCheck1"> <label class="custom-control-label" for="customCheck1">...</label> </div> ``` /!\ Labels are now required (use a zero-width space if necessary)
2018-07-27[REF] *: BS4, adapt formsqsm-odoo
The 'form-horizontal' class have been removed; the '.form-group' elements must now use the 'row' class for an horizontal layout. The 'control-label' class was renamed to 'col-form-label'. The 'help-block' class was renamed to 'form-text'. The 'has-error' and 'has-success' classes have been removed and replaced by a new system using the :valid and :invalid pseudo-classes, when a parent has the 'was-validated' class. While this system is great, it is not straightforward to use it in Odoo. Fortunately, BS4 provides the 'is-valid' and 'is-invalid' classes as fallback. This commit replaces the 'has-error' and 'has-success' classes by 'o_has_error' and 'o_has_success' classes (for JS compatibility) and use the 'is-*' fallback classes. (The 'has-warning' class has no equivalent but was unused in Odoo anyway).
2018-07-27[REF] *: BS4, review panel and well structureqsm-odoo
Panels and wells were dropped and replaced by the "Card" component.
2018-07-27[REF] *: BS4, review color systemqsm-odoo
Odoo used to declare two main colors: primary and optional (which are purple and turquoise in enterprise). Those were respectively assigned to the 'primary' bootstrap variable and the 'btn-primary' bootstrap variable. BS4, however, does not allow to have a different primary color for buttons. Instead, the 'primary' color is used for all 'primary' related components and utility classes, same as for all other colors. So, if we want to keep our enterprise buttons green, our 'optional' colors had to become our 'primary' color. The old odoo primary is then renamed to the 'odoo' color. The palette of grays is now larger by default and is numbered from 100 to 900 alongside the $black and $white variables. The equivalence for older variables and the way we used them is: $gray-darker -> gray 900 (unused before) $gray-dark -> gray 900 $gray -> gray 700 $gray-light -> gray 600 $gray-lighter-darker -> gray 400 (the old variable was created by us) $gray-lighter-dark -> gray 300 (the old variable was created by us) $gray-lighter -> gray 200 Fortunately, the 'lighter' variations we created fit well in the default BS4 system ! Unfortunately, our $gray-lighter which carried the same function as $gray-200 (see above) is very close to the new default $gray-100 and quite distant from the new $gray-200. This will be handled in the next commit.
2018-07-27[REF] *: BS4, adapt font-size and padding variablesqsm-odoo
BS variables were renamed or changed and all (most) variables now use 'rem' units instead of 'px' unit.
2018-07-27[REF] *: BS4, adapt dropdowns and caretsqsm-odoo
- The dropdown structure was simplified, allowing to get rid of the 3-levels structure induced by <ul/> elements and dropdowns can now contain anything. The class 'dropdown-item' is now mandatory for each dropdown clickable element. The class 'dropdown-item-text' can be used to add same padding and style but without making the element have a clickable look. - Dividers now use the class 'dropdown-divider' - The way dropdowns are opened and hidden also changed (before the 'open' class was added on the `.dropdown-menu` parent, now the 'show' class is added on both the `.dropdown-menu` parent and the `.dropdown-menu` itself). - JS-wise, no click event handlers can be put on `.dropdown-toggle` elements anymore (instead, use handlers for dropdown events). - Carets are automatically put on `.dropdown-toggle` elements, so this commit replaces the `.caret` elements with this. This feature was possible to disable but would prevent us from adding a caret with scss. Also, this simplifies the DOM. The 'o-no-caret' class was also introduced to allow using the 'dropdown-toggle' class on non-caret elements. - Also adapt the scss to use $caret-width instead of $caret-width-base
2018-07-27[REF] *: BS4, rename btn-default to btn-secondaryqsm-odoo
BS4 "btn-default" class was replaced with "btn-secondary", which makes more sense.
2018-07-27[REF] *: get rid of vendor prefixesqsm-odoo
BS4 do not provide vendor prefixes scss mixins anymore as it is meant to be used with the 'autoprefixer' library. As we only support the last version of every major browsers in Odoo, we took the decision to not use the library as it was also complex to integrate in Odoo. We decided to do the library's work by hand if it ever become necessary.
2018-06-18[FIX] web_editor: properly compute scss filesKishan Gajjar
In LESS, 'fadeOut' function is used to make a color more transparent. In SCSS, that function is called 'fade-out'. Closes https://github.com/odoo/odoo/pull/25233
2018-05-23[IMP] web_editor: highlight the selected image/iconKishan Gajjar
When we selected an image/icon, there was no visual feedback explaining to the user that the image/icon had been selected (except for images on chrome). task-35020 Closes https://github.com/odoo/odoo/pull/24160
2018-05-18[IMP] web_editor: allow cropping content imagesKishan Gajjar
2018-04-18[FIX] *: wrap negated variables with parenthesisqsm-odoo
* mail, web, web_editor, website_sale Tricky difference between LESS and SCSS: `0 -$var` will be one value in SCSS (the result of 0 - $var) but two space-separated values in LESS.
2018-04-18[REF] *: review scss variables handlingqsm-odoo
Unlike LESS, SCSS variables are not lazy loaded. Our system has thus to be updated. This commit creates new templates which are t-called in assets bundles (to replace the old less_helpers template): - web._assets_utils: regroups the mixins and functions which *can* (and so should) be available in every asset bundle - web._assets_primary_variables: regroups the variables (or mixins used as variables) which *can* (and so should) be available in every asset bundle - web._assets_secondary_variables: same as above but provides an environnement where all the 'primary' ones are accessible. This is for example useful to handle the community/enterprise split: // Community primary variables $o-pink-color: pink; // enterprise color $o-brand-primary: blue; // Enterprise primary variables $o-brand-primary: $o-pink-color; // Community secondary variables $o-my-darker-primary: darken($o-brand-primary, 5%); => If there was only one variable template, enterprise edition would have been able to define its primary color at the end but the darker primary would not have been updated. Using the "!default" system and putting enterprise definition above would not have solved the problem as the $o-pink-color would not have been accessible. - web._assets_backend_helpers: regroups the variables, mixins and functions which *can* (and so should) be available in the backend asset bundle only. This is especially (only?) useful for bootstrap variables overriddes. - web._assets_frontend_helpers: regroups the variables, mixins and functions which *can* (and so should) be available in the frontend asset bundle only. This is especially (only?) useful for bootstrap variables overriddes. Note: bootstrap variables are not accessible in any of those anymore. If you have variables that should depend on bootstrap, you have 3 solutions: - Find another way: your variable is probably useless, use bootstrap variables directly or create a variable that will influence the value of bootstrap variables. E.g. instead of declaring: `$myvar: $bootstrapvar * 3` and using $myvar alone, declare: `$myvar: 3` and use `$myvar * $bootstrapvar` where needed. - Declare a copy of the bootstrap variable and use that one. In that case, you should also force-set the real bootstrap one to be sure they match (this should be done in appropriate templates mentioned above). E.g. ``` $o-boostrapvar: 5; ... $boostrapvar: $o-bootstrapvar; ``` - Set your variable to null and set it to your bootstrap expression in the file you will need it (where bootstrap variables are accessible) without forgetting to add the !default flag to allow overriddes. ``` $myvar: null; ... $myvar: $bootstrapvar * 5 !default; ``` This commit also partly changes the variable names to follow the convention: $o-<app_id>-<name> where 'app_id' is the current's app name or a meaningful unique identifier ("theme" for all themes for example, as no multiple themes can be installed).
2018-04-18[REF] *: convert less content to scss contentqsm-odoo
Convert content so that the assets compile on app installation. The style is still broken after this as the variables/mixins/... are not defined in the right order (as it did not matter in LESS but does in SCSS). This commit basically changes: - Variables: @​var_hello -> $var-hello - Mixins: .mixin_world() {} -> @​mixin mixin-world {} - Classes used as mixin: .my_class() -> @​extend .my_class - Here there were no other solution than to convert the use of a mixin call by the use of an extend as a first approximation - LESS functions -> SCSS functions (e.g. fade -> rgba) - Move first variable definition before the variable is used - Still need to make sure last variable definition is at the right place
2018-04-18[REF] *: rename all LESS files to SCSSqsm-odoo
This is a simple renaming without adaptation.