summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/widgets.js
AgeCommit message (Collapse)Author
2019-04-04[FIX] web_editor: support youtube-nocookie.comqsm-odoo
closes odoo/odoo#32332 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2018-09-05[FIX] web_editor: image nameNicolas Martinelli
Add the image name in the website for SEO purpose. This is a backport of: 88a5d9a0000a5ea43afdc00ed 886c07dabb636767b80abb849 152e3f8686ec4f48ba22e5c13 opw-1880472
2018-06-14[MERGE] forward port branch 9.0 up to 90165e2d96aChristophe Simonis
2018-06-14[FIX] web_editor: properly save media dialog without any imageqsm-odoo
When saving the media dialog without any selected image, a crash occurred. Now, it properly closes the dialog. opw-1858614
2018-06-13[FIX] web_editor: link don't duplicate child textNicolas Lempereur
If we applied a link eg. on: ``` <span>hello <b>world</b></span> ``` The system actually gets the "label": hello worldworld because there is 3 nodes: text node: hello element node: `<b>world</b>` text node: world Also since "hello worldworld" is different than "hello world", instead of just keeping existing nodes and adding the link, the system would replace the selected range by: `<span><a>hello worldworld</a></span>' instead of: `<span><a>hello </a><b><a>world</a></b></span>` This commit ignores element nodes when creating a new link, since when getting the label of the link from the selection, only the text nodes insides the element nodes have any interest. There was a second issue because if we had: ``` <i><a href="hello">world</a></i>! ``` and tried to put a link over "world!", the code would decide: "world" is inside a link so we will just update that link. Thus we would get: ``` <i><a href="hello">world!</a></i>! ``` instead of: ``` <i><a href="hello">world</a></i><a href="hello">!</a> ``` opw-1848351 closes #25187
2018-03-02[FIX] web_editor: show 'open in new window' on link editJeremy Kersten
Before this commit, when a user open an existing link in the editor he cannot check/uncheck the option "Open in new Window" while he don't update the url. The field was hidden while keyup was not called. After this commit, if the url contains a url, we show directly the checkbox. This commit fixes opw-1819601
2018-02-21[MERGE] forward port branch 9.0 up to e544ec8df70Christophe Simonis
2018-02-20[FIX] web, web_editor: Better email validation with regex (JS)Romain Derie
This commit improves link creation in web editor. Before this commit, anything with a @​ would be considered as valid email which is obviously not the case. It would then be prefixed by 'mailto:'. This was causing 2 issues: - URL with @​ symbol in it would have 'mailto:' added as prefix, like google maps coordinates. eg: mailto:http://www.google.com/maps/whatever/@​312211.22,321321 - Incorrect emails would go through (eg: @​@​@​, ko@​k@​k@​, mail@​mail) Now, we will try to detect and identify valid emails from invalid emails from URLs. It will also handle 'mailto:' directly typed in the input. This commit comes with it's counterpart in enterprise https://github.com/odoo/enterprise/pull/1859 This closes #11984, closes #22936 Note that there is a WIP in master to use this new is_email function everywhere we try to validate emails. It will aim to uniformize email validation in odoo's javascript that are often performed with different mean here and there, some more permissive than others, some only checking for @​.
2018-02-13[MERGE] forward port branch 9.0 up to 2d73ea9bed1Christophe Simonis
2018-02-12[FIX] web_editor: error on cross domain stylesheetNicolas Lempereur
On latest chromium (as of version 64), accessing rules of a stylesheet is forbidden for cross-domain. This commit catch and ignores the error when that happened. chromium commit: https://chromium.googlesource.com/chromium/src/+/a4ebe08c91 opw-813480 opw-815860 closes #23009
2017-12-06[FIX] web_editor: show proper video on existing video editionjat-odoo
See https://github.com/odoo/odoo/commit/5e38bef5a5ededb28707af44a19caaec2af2d682 and especially https://github.com/odoo/odoo/commit/45e0cd564afdae71e9525193250744e88076da71 Closes #19673
2017-11-20[FIX] web_editor: highlight selected fa icon on media dialog startqsm-odoo
When editing a fa icon in the editor, the current fa icon was not properly selected anymore. Note: the code is still to be improved to handle all cases but this will be done in master.
2017-09-06[FIX] web_editor, website_forum: allow to post videos on the forumLucas Perais (lpe)
The commit 8749410b1033ddec1207ce1db42d1889a0d2ea33 corrected the way the iframe was rendered to display a video in v9.0. In v10 though, the html sanitizer is a bit more severe and cleans data-src attributes, preventing the iframe to have a src This commit works around that and allows the src of the video to be saved in db OPW 761424 closes #19125
2017-04-07[FIX] web_editor: allow to save unchanged icons with media dialogqsm-odoo
There was a bug with the icon edition when following these steps: - Open the Media dialog to edit an existing icon - Hit the "save" button in the dialog without choosing the icon - The edited icon disappears This happenned for icons whose original values were aliases of the related icon. Indeed, following these steps to edit an "fa-facebook-f" was leaving the icon unchanged as expected but doing it for a "fa-facebook" icon made the icon disappeared. This is because the last one is an alias of the first one and that the media dialog was ignoring aliasies when saving the original value. opw-725813
2017-03-28[MERGE] forward port branch saas-11 up to c2569b9df1bChristophe Simonis
2017-03-24[MERGE] forward port branch 9.0 up to 8376f538b56Christophe Simonis
2017-03-22[FIX] web_editor: properly transcode `fa` alias iconsqsm-odoo
When adding a font-awesome icon to a mail template, the icon is converted to an image once the template is saved. To do that, the code checks all the `.fa-XXX` definitions in the stylesheets to know which content the image have to use. The problem is that this was not considering the font-awesome aliases. Indeed, the `fa-facebook-f` icon was able to be used while its alias `fa-facebook` was not working.
2017-01-02[MERGE] forward port branch saas-11 up to b844d938890Christophe Simonis
2017-01-02[MERGE] forward port branch 9.0 up to 3805eb620aaChristophe Simonis
2016-12-19[FIX] web_editor: do not focus or set an empty imageDenis Ledoux
When editing the website, adding a gallery, choosing the grid mode and then adding images, an extra, empty, image was added to the grid, in the first position, making it looking weird or at least not aligned. This was due to the `start` method of the widget, which is trying to focus the image in the images browser when you double click on an image (in the big image building block for instance) and set an image without url in the case where `o.url` was undefined, and the url of one of the records was also undefined. opw-692205
2016-11-15[MERGE] forward port branch saas-12 up to ca20038Christophe Simonis
2016-11-14[FIX] web_editor: allow vimeo, youku and undefined video sources againqsm-odoo
The refactoring made with https://github.com/odoo/odoo/commit/62fb1bb92493b00bd45ed3f4eced5ca8b23f81d6#diff-2b3acc31ced2b1e9f7522a3e29f33c22L825 broke the possibility to add vimeo, youku or other undefined video sources. This is because of jQuery. With jQuery you can create elements thanks to multiple methods. From least efficient to most efficient: - All in a string: $("<tag attr1='value1' attr2='value2'/>"); - Tag in a string, attrs thanks to methods: $("<tag/>").attr("attr1", "value1").attr("attr2", "value2"); - Tag in a string, attrs in second arg: $("<tag/>", {attr1: "value1", attr2: "value2"}); The mentionned refactoring transformed the use of the second method into the use of the last one. But there is a bug in jQuery: you cannot use the first method and the last one all together. So: $("<tag attr1='value1'/>", {attr2: "value2"}); will create a tag with attr1 but will totally ignore the attr2 part. It happens that the allowfullscreen attr was left directly in the creation string for vimeo and youku, preventing the src to be added. This commit removes the use of allowfullscreen attr as fullscreen is already handled by source players anyway.
2016-10-13[FIX] web_editor: improve web_editor UI style preservationstefanorigano
* add and use preservation mixins to prevent undesired customizations made by themes * remove some style preservation code (and use the mixins instead) * add UI states' colour variables
2016-09-28[MERGE] forward port branch saas-12 up to 7134affChristophe Simonis
2016-09-27[FIX] website, *: properly process saving from editor dialogsqsm-odoo
* web_editor, website_blog Since recent refactoring, web editor dialogs automatically trigger an event when closed (saved or cancel). The problem is that there still was manual trigger of those events or variants ("save" instead of "saved"). To prevent multi-saving and be consistent, all save events are now automatically triggered on save/close (no more manual) and the event name is "save".
2016-09-22[MERGE] forward port branch saas-12 up to b1b700aChristophe Simonis
2016-09-22[MERGE] forward port branch saas-11 up to 6854887Christophe Simonis
2016-09-22[MERGE] forward port branch saas-10 up to 477482eChristophe Simonis
2016-09-22[MERGE] forward port branch 9.0 up to 78f6117Christophe Simonis
2016-09-21[FIX] mass_mailing: can't change color button snippet when edit mass mailingChristophe Matthieu
2016-09-20[FIX] web_editor: adapt code which updates editor bar after image editionqsm-odoo
This fixes a bug where the media dialog reopened after closing after edition of a t-field="image_small" block.
2016-09-20[FIX] web_editor: activate autoplay feature for videosqsm-odoo
The checkbox was there to activate autoplay... but was not doing anything since the web_editor/website split.
2016-08-31[IMP] web_editor: improve usability to select image in media dialogqsm-odoo
Before this commit, we had to click on the image we want, then click on save in the modal footer. Now we can also double click on the image we want, with the same result. Same goes for icons.
2016-08-19[FIX] web_editor,website: stop closing web_editor dialog two timesqsm-odoo
This commit fixes two problems: * Clicking on the save button of a web_editor dialog closed the dialog two times because the button was created with the flag "close: true" and binded to a handler which closes the dialog. This also prevented to extend this handler by placing the this._super call in a deferred. * Some web_editor dialog extended the save callback but forgot to use the this._super, which prevents the "saved" event to be triggered (currently not used anywhere but useful for custo and master).
2016-08-19[FIX] web_editor,website: stop closing web_editor dialog two timesqsm-odoo
This commit fixes two problems: * Clicking on the save button of a web_editor dialog closed the dialog two times because the button was created with the flag "close: true" and binded to a handler which closes the dialog. This also prevented to extend this handler by placing the this._super call in a deferred. * Some web_editor dialog extended the save callback but forgot to use the this._super, which prevents the "saved" event to be triggered (currently not used anywhere but useful for custo and master).
2016-07-25[MERGE] forward port branch saas-11 up to 7ae5121Christophe Simonis
2016-07-25[MERGE] forward port branch 9.0 up to 1089dcfChristophe Simonis
2016-07-20[FIX] web_editor,website: allow creating pages from edit menuqsm-odoo
The code for page creation from menu edition dialog was there but invisible to the user because of a wrong qweb template inheritance. Indeed, the edit menu dialog relies on an extension of the link dialog template. But this one is extended in-place in another location and that extension is not considered when the second extension is made because a t-extend always use the base template. The only solution to achieve the same result is to copy the edit menu dialog qweb extension in Javascript. Note: the feature was still available from the link dialog in page edition though because this was not concerned by the wrong qweb extension. However, adding a page by this way would create multiple pages because one was created each time a page name was entered (and not only on save !). So typing "test", then changing its mind and typing "hello", then rechanging to "test", then hitting the save button created the "test, "test-1", "test-2" and "hello" pages. This fix takes advantage of an already present parameter which can determine if a new page should be created or not. However, a code refactoring should be done in master for these classes.
2016-07-04[REF] web_editor: code refactoring and simplificationqsm-odoo
* Remove dead code + optimization * Use Dialog API from web module * Reorganize files * Correct buggy $() function for snippet option class * Add comments * Fix the snippet parent navigation : If a page contained a three level snippet structure (i.e A contains B contains C), when editing the following bug occured : If B or C was selected first, parenting buttons were correctly set. But if selecting A then C, clicking on the parent lead to going back on A instead of going on B. * Fix snippet thumbnail layout * Better isolate ui css from themes * MediaDialog image list : prevent displaying empty attachments * ...
2016-05-13[MERGE] forward port of branch saas-9 up to 087729fChristophe Simonis
2016-05-13[FIX] web_editor: video - allow to add video from unknown sourceJeremy Kersten
There are not cat... but you cannot know all the existing website in the world... So, have faith in the user ! To do: allow to customize size or get it from iframe provided
2016-05-12[FIX] web_editor: scroll and editing menu modalNicolas Lempereur
The class modal-open on body tag allow to scroll on the modal content which is useful if the content is taller than the window viewport. When closing the modal, this class is removed but there may be another modal open on which we will not be able to scroll to view buttons/content if too big. This commit check if a modal is still opened after closing an editor modal and in the affirmative add back the modal-open class. opw-674475 note : was already present in 8.0 with ec47493, it is also present for web.Dialog (but the modal of the editor do not inherit from web.Dialog)
2016-02-24[REF] web_editor,website,mass_mailing: JS/XML updateqsm-odoo
* Adapt DOM selectors * Refactore dialog XMLs to have odoo styling * New editor options (background-position, ...) * Various improvements
2015-12-03[FIX] web_editor: img classname is removed when change the urlChristophe Matthieu
2015-12-02[FIX] website, web_editor: open in new windowNicolas Martinelli
The field `isNewWindow` is used to open a link in a new tab. In this case, the field newWindow was used, and therefore the property was not applied. opw-657510
2015-11-04[FIX] web_editor: don't change the image style when change srcChristophe Matthieu
2015-11-04[FIX] web_editor: remove editor bar flickering when edit a qweb fieldChristophe Matthieu
Issue: When the user click on a field (like monetary, text...) the editor bar appear and disappear. The undo buton is hidden for this fields.
2015-11-04[FIX] web_editor: edition of monetary valueChristophe Matthieu
Issue: if the currency is before the value and we try to add a number at the begin of the value, the number is not saved (because the browser insert the number before the span). Add a onEnableEditableArea in the rte to change the contenteditable value and the default behavior.
2015-10-29[FIX] web{site,_editor}: gallery upload imageNicolas Lempereur
* when getting the src of an uploaded attachment we have to use src which is by default url, * in a MediaDialog the pager is shared between the document and image dialog, but when changing page, it was done for both (even if not displayed), * select the image after uploading it in the ImageDialog. closes #9284 opw-653061 opw-653167
2015-10-26[FIX] web_editor: add image display in width:100% by defaultChristophe Matthieu