summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/widgets
AgeCommit message (Collapse)Author
2019-07-18[FIX] web_editor: remove "missing `class` on parent"Julien Castiaux
On a chromium based browser. Install theme_treehouse, add the "Step" widget. Double click on the FA-icon, error in log. The parent element of `self.$media` does not have a `class` attribute, accessing that attribute returns `undefined` and `cannot call match on undefined` error. closes odoo/odoo#34946 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-07-04[MERGE] forward port branch saas-11.3 up to 1debaa89f14Christophe Simonis
2019-07-04[MERGE] forward port branch 11.0 up to 56ce29e71f7Christophe Simonis
2019-06-28[FIX] web_editor: restore broken VideoDialog optionsKishan Gajjar
- To enable loop on a video, only setting the 'loop' URL parameter to 1 will not work anymore. We also need to set the playlist parameter to the video ID. - Sound is no longer allowed in autoplay because of new autoplay policies of most browsers. To make autoplay work, the video must be explicitely muted. closes odoo/odoo#34323 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-06-07[MERGE] forward port branch 11.0 up to bdc62d80314Christophe Simonis
2019-06-03[FIX] web_editor: modal open>save document keep itNicolas Lempereur
When we add a document with the "Select a Media" modal, if we reopen the modal then click on "Save" without modfiying anything, the element is broken since we do not have the data saying it is a document and the code try to display it as image. With this changeset, we keep the information that the attachment is a document and when saving it works as expected. opw-2004064 closes #33844 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-06-03[FIX] web_editor: restoreRange on invalid nodePriyanka Kakadiya
In a web editor, add some text, select the text, add a link and immediately discard the link modal. Traceback. The traceback is a execute `setEnd` on `Range`, that error is thrown because editable DIV doesn't save old range Odoo wrap code does some text node split in order to attach the link just on the selected text. If it correctly re-set the underlying structure, it does not update the $(editable) structure used to restore ranges. After this commit, editable div will use newly created range for the element for ex: -> content: test -> selected content "test" when click on link dialog: ec: test , eo: 4, sc: test, so: 0 selected content -> start 0, end 4 -> "test" like this after clicking on discard: ec: null text element, eo: 4, sc: null text element, so: 0 selected content -> ec and sc both are null, so it will throw an error while setting cursor position after applying fix when click on discard: ec: test, eo: 4, sc: test, so: 0 selected content -> start 0, end 4 -> "test" task - 1955863 closes odoo/odoo#33692 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-06-07[MERGE] forward port branch saas-11.3 up to a2582c4252aChristophe Simonis
2019-05-31[FIX] web_editor: image modal nochange close on saveNicolas Lempereur
When you open the image modal of the website editor the selected image is the current image. But if the image is not an attachment with an `url` field set (eg. it has been uploaded and is not a file in a /static/ folder) the match between image modal and current did not work and to close it we need to: - actively select the current image then click "Save" - use the X button to close the modal without saving With this changeset, the match of current image with image list is done on the attachment `url` and if unavailable with /web/image/ID/name.jpg path which cover both possibilities. opw-2004073 closes #33799 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-04-08[MERGE] forward port branch 11.0 up to 9a7e3c8b498Christophe Simonis
2019-04-04[MERGE] forward port branch saas-15 up to 214e819c1bbChristophe Simonis
2019-01-09[FIX] web_editor: icon widget complies to apiLucas Perais (lpe)
the search method should return a Deferred as explicit in MediaDialog OPW 1919549 closes odoo/odoo#30077
2019-05-09[FIX] web_editor: restoreRange on invalid nodeJulien Castiaux
In a web editor, add some text, select the text, add a link and immediately discard the link modal. Traceback. The traceback is a DOM `IndexSizeError`, that error is thrown when the boundaries of a DOM Range (`document.createRange`) are outside of the ranged elements. In this context, the error happens because the element is empty and the range has an end bound set to the size of the selected text. Odoo wrap code does some text node split in order to attach the link just on the selected text. If it correctly re-set the underlying structure, it does not update the $(editable) structure used to restore ranges. opw-1981751 closes odoo/odoo#33257 Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
2019-04-08[MERGE] forward port branch saas-11.3 up to 4c61621efbbChristophe Simonis
2019-01-29[FIX] web_editor, website: consider COW view when loading viewRomain Derie
Before this commit: 1. If we were editing a template with no xml_id, typically the case when editing a specific view (COW'd), the 'Template ID' label would be left empty as the view does not have an xml_id but only a key. 2. If we were editing a generic view, the template would be COW'd and replaced by the specific one created during the save. After the save, the page would be reload and will try to reopen the edited template (stored in url `res=123`). But as this template would be replaced by the COW'd view, the JS would crash trying to access an inexisting view. The HTML editor would then open in a very thin modal, barely editable. Now: 1. Display the template's key instead of its xml_id. The key is basically a duplicate of the xml_id, mainly used in website. 2. If we are saving a generic view, we search for its newly created specific view to upload the URL hash before reloading. task-1934279 Fix #30447
2019-01-29[FIX] web_editor: send the html editor writes one after anotherRomain Derie
With the following view hierarchy: A | B' (oe_structure_ID view) Before this fix, when saving multiple templates at once from the same hierarchy the COW views (website) would not be saved correctly as the first call to `write` would COW the parent view, then the second concurent call to `write` would create the child specific view under the generic parent view. Instead, the generic parent should have been cloned to a specific parent view and then the child view should be COW under the specific parent. A A' | | B' B*' (This one is the old B', without B' changes in the html editor) Instead of A A' | B' Calling the `write` one after another will do the trick. Indeed, when the second call is fired, the first call has already triggered the COW behavior. Thus, the second call correctly retrieves the COW view. Another issue might still appear, if the parent view write is sent first. Indeed, the parent view will be COW, thus the specific child view (second write waiting to be fired) will be deleted to be added on the new specific hierarchy. Thus, that write will then raise an error since the view does not exist anymore. task-1934279 Fix #30447
2019-01-11[MERGE] forward port branch saas-11.3 up to e033114879cChristophe Simonis
2019-01-09[FIX] web_editor: Media dialog next btn reload pageJorge Pinna Puissant
opw-1910505 Before this commit, the next button in the media dialog widget reloaded the page and opened only the iframe of the widget. Now, the button only update the media dialog widget. closes odoo/odoo#29981
2018-10-31[FIX] web_editor: fix automatic editor context for RPCsqsm-odoo
With https://github.com/odoo/odoo/commit/55131b8f5becdd3d4776f4c3e7e4288a0b185706, we automatically add the known editor context (containing lang, website_id, etc) when using the `this._rpc` method. Some RPCs needed however to explicitely not send a value from this automatic context... but this was not correctly implemented. This can now be achieved by using the `noContextKeys` key in the `this._rpc`'s *options* parameter. closes odoo/odoo#28322
2018-10-22[MERGE] forward port branch saas-11.4 up to 3c108977c1eChristophe Simonis
2018-10-19[FIX] web_editor: hide link buttons duplicates instead of removing themqsm-odoo
For example, if primary = alpha, the primary button option is removed in the link dialog. When editing a primary button, this lead to broken behaviors. Hiding the button does the trick.
2018-10-10[FIX] web_editor: properly show all website attachmentsqsm-odoo
Correct commit https://github.com/odoo/odoo/commit/a9366de8f90ea4106d306c585043a42f089c86d4 Indeed some attachments may not have a datas_fname field, like URL attachments created before saas-11.4 and theme attachments from 12.0. Closes https://github.com/odoo/odoo/pull/27610
2018-10-03[ADD] *: support SVG imagesPedro M. Baeza
Introduce official support for SVG files in the framework, including the following parts: 1. When client-side SVG images are uploaded, the content is displayed until you save using data URI scheme according RFC 2397 [1]. This scheme requires to specify content format. Using hardcoded "image/png" works for all images types except SVG. Type-sniffing is done using "magic byte" detection via the first base64 encode byte, so that the proper data URI scheme can be used. This should not cause SVG-related security problems as the file is displayed through `<img>` tag, which does not allow SVG scripting [2]. 2. Make /web/image controller compatible with SVG 3. Add support for SVG files for company logo, which uses a dedicated controller. 4. Resizing of SVG files is a no-op, as it makes little sense for a vector-based format. We also want to avoid micro-alterations to the SVG document (in "natural" viewport parameters) as we would store multiple copies of the files in the filestore. 5. Because SVG files are inherently dangerous, upload of SVG files is restricted to administrators, either by blocking it directly before saving it in the database (binary fields with attachment=False), or by neutering them to text/plain mimetype (for binary fields with attachment=True) 6. Add tests for the SVG upload cases and for the non-admin uploads. [1] https://tools.ietf.org/html/rfc2397 [2] https://www.w3.org/wiki/SVG_Security Closes #26635
2018-09-30[REF] website, *: add automatic context for call_kw rpcqsm-odoo
* web_editor, website_blog, website_crm_partner_assign, website_links, website_livechat, website_mail_channel, website_mass_mailing, website_slides Calling a model's method thanks to an RPC will now always send the web_editor context automatically, making sure the method gets the website_id all the time, removing the need to guess the current website (now the get_current_website method uses the context website_id if any). Note: other routes already have the website_id via request.env.context if they correctly set website=True (this commit also adds website=True for scss files customization routes).
2018-11-23[FIX] web_editor: remove video option when composing emaillen-odoo
Embedding a video can't work because it embeds an iframe, which is not supported by most email clients for security reasons. (What happens when Gmail shows embedded videos in displayed emails, is that you send a link in the email body, and it is at rendering that Gmail adds the iframe into the page.) So the bugfix solution is to hide the button. Since there is an option "res_model" that allows us to know when we are in that case, we remove the video option. opw 1905497 closes odoo/odoo#28911
2018-09-13[FIX] web_editor: fix and improve AltDialogJeremy Kersten
Ref label Add tooltip Fix title from modal -> before this commit, modal title was wrongly replaced by title of image :/ task-1878245
2018-09-12[FIX] web_editor: restore link dialog previewqsm-odoo
By default, all btn colors are suggested in the link dialog (alpha, beta, gamma, delta, epsilon, link, primary, secondary, success, info, warning and danger). In lots of themes (and the default one), primary = alpha and secondary = beta, which led to having two suggestion with the same apparent color. A new system was introduced to automatically remove the duplicates... but this system also removed the button preview as it considered it to be a duplicate. This commit also adapts the preview to BS4. task-1878245
2018-09-07[MERGE] forward port branch saas-11.4 up to d78f23df848Christophe Simonis
2018-09-07[MERGE] forward port branch saas-11.3 up to 4850fb08385Christophe Simonis
2018-09-05[MERGE] forward port branch 11.0 up to 213759b03e5Christophe Simonis
2018-09-05[FIX] web_editor: image nameNicolas Martinelli
Add the image name when the image is uploaded. Complement of commits 886c07dabb6367 and 152e3f8686ec4f48ba2 opw-1880472
2018-08-30[REF] web_editor, *: review color theming systemqsm-odoo
* web, website - Introduce gray color palettes (needed for themes migration) - Synchronize BS4 color maps with individual variables (see comments about this in the code). - Review alpha/primary, beta/secondary matching: Before this commit, we decided that the common way to define a color palette was defining primary, secondary, gamma, delta and epsilon. alpha and beta were then forced to primary and secondary without other possibility. The new system makes more sense: 1) define alpha, beta, gamma, delta and epsilon 2) primary and secondary will automatically be set to your alpha and beta (allowing to style the default UI with BS4-independant variables) 3) if you are not happy with (2), you can define primary / secondary in your color palette so that they are not automatically set to alpha / beta This commit also changes what classes the editor uses. Background colors and text colors will now use alpha/beta/gamma/delta/epsilon (not primary and secondary anymore). For buttons, all the possibilities are suggested but color duplicates are hidden (so if your primary and alpha are equal, only one button color is suggested).
2018-08-14[MERGE] forward port branch saas-11.4 up to dabe59df9c8Christophe Simonis
2018-08-14[MERGE] forward port branch saas-11.3 up to 27d8daf8a75Christophe Simonis
2018-08-14[MERGE] forward port branch 11.0 up to 51225c9b9f2Christophe Simonis
2018-08-13[IMP] website, *: review snippets and colorsCocographique
* web, web_editor, website_hr_recruitment, website_mail_channel, website_mass_mailing - Review all snippets and add new ones - Add lots of new options - Use odoo colors as default theme colors task-38878
2018-08-10[FIX] web_editor: remove related videos at the end of youtube embedslen-odoo
If a user embeds a youtube video on his website, he has no option to remove the suggestion of related videos at the end of playback. Since there is no good reason to have it, we disable the related videos in all cases. opw 1868380
2018-08-02[FIX] web_editor: activate image tab by default in media dialogqsm-odoo
2018-08-02[FIX] web_editor: BS4, restore crop dialog UIKishan Gajjar
2018-08-01[MERGE] forward port branch saas-11.4 up to 8d9366197e1Christophe Simonis
2018-07-30[MERGE] forward port branch saas-11.3 up to b4555df336dChristophe Simonis
2018-07-30[MERGE] forward port branch saas-11.2 up to 3376bad191dChristophe Simonis
2018-07-30[FIX] web_editor: link creation: @ not necessarily a mailtoLucas Perais (lpe)
In the field HTML, click on create hyperlink as its url, put in http://hell-broke-luce.waits/?param=tom@waits.com Before this commit, since the url merely contains a @, it was considered as a mailto: link After this commit, if the url starts with a flavor of http, it is considered as a standard http link OPW 1869087 closes #26012
2018-07-27[REF] web_editor: BS4, review media dialog layoutqsm-odoo
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, 'img-responsive' -> 'img-fluid'qsm-odoo
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] *: BS4, adapt display classesqsm-odoo
The system completely changed. I also had to adapt classes to new screen breakpoints. hidden/hide -> d-none show -> d-block hidden-xs -> d-none d-md-(block/inline/...) hidden-sm -> d-md-none d-lg-(block/inline/...) hidden-md -> d-lg-none d-xl-(block/inline/...) hidden-lg -> d-xl-none visible-xs-* -> d-* d-md-none visible-sm-* -> d-none d-md-* d-lg-none visible-md-* -> d-none d-lg-* d-xl-none visible-lg-* -> d-none d-xl-* hidden-print -> d-print-none visible-print-* -> d-none d-print-* ... and all possible combination of those had to be handled too.
2018-07-20[ADD] web_unsplash: Find free high-resolution images from UnsplashDeep Patel
This commit: 1. Adds settings to install the new `web_unsplash` enterprise module. See counterpart commit on enterprise for details. 2. Export `ImageWidget` and `update_control_panel` to be able to override them. 3. Add the unsplash access key rights to website designer. (see related OE commit) task-35060 Closes #25825, closes #25637
2018-07-09[FIX] *: fix some side-effects of ↵qsm-odoo
https://github.com/odoo/odoo/commit/9de1bc0eef6f5bfaa2a8d745431caa361ae91548 - JS Modals were not correctly built anymore, their .modal-body element was duplicated and many without-effect JS lines were introduced (as a side effect, the form view design was broken when inside modals) - Tests were changed to make bugs go unnoticed. For example, the media dialog functionnality was entirely broken because the .modal-dialog element was not receiving the correct class anymore. - The JS translation function is _t, not _ - Do not use the <title/> tag as a regular DOM element, it is meant to be unique, in the <head/> section - CSS rules were added to the utils.scss file, which is meant to contain functions and mixins, otherwise, the rule is duplicated in every asset - Some icons were still broken, as missed by https://github.com/odoo/odoo/commit/f90cf060a3cfeb37a67bec83264c0aaab8892b56 - Tests were changed to use [role="dialog"]/footer/header in their selectors without any reason, this commit restores some of that to avoid rebase conflicts with the BS4 work. - ... Note: other elements should still be discussed, like the direct use of the 'o_form_label' class in views definition... but those do not cause direct problems.