summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/backend/fields.js
AgeCommit message (Collapse)Author
2019-01-17[REF] web_editor,*: Move and rename files to prepare refactoringChristophe Matthieu
The refactoring of the wysiwyg editor and 'html' field allows us to move some of the code that was in web_editor but only used in website or in mass_mailing. Some parts are still in web_editor but will be moved at a later time.
2018-09-05[MERGE] forward port branch 11.0 up to 213759b03e5Christophe Simonis
2018-09-03[FIX] web_editor: focus lost with inline editorNicolas Lempereur
When an inline editor is eg. in a form view, the focus is always stolen by it. This is because we trigger a mouseup on the editor to update its toolbars values and informations. In 10.0 this was not necessary since the default values were sanely set when the editor was inside the DOM. In 11.0 the editor is not in the DOM when this is being done and the info was wrong (eg. NaN for text size). With this commit, we don't steal the focus and get the default like it was done in 10.0 instead. fixes #26366 opw-1874880 closes #26582
2018-07-13[MERGE] forward port branch saas-11.2 up to 87dadc5bc83Christophe Simonis
2018-07-11[FIX] mail: remove attachment feature in add followers modalChristophe Matthieu
Before this fix, the attachments are don't save to the record and are remove with the wizard. We can't add the attachments to mail.message (like 'mail.compose.message') because it's auto_delete/unlink and the attachments are removed before the recipient can read it.
2018-07-11[FIX] web_editor: display record linked to the record when add followersChristophe Matthieu
2018-07-11[FIX] web_editor: send an image thumbnail for attachment link in mailChristophe Matthieu
Before this fix attachmentThumbnailToLinkImg is not called for style-inline options. The mail received does not have thumbnail and the user can't click on the invisible link. opw-1863659
2018-05-09[MERGE] forward port branch saas-11.2 up to aae54ecc159Christophe Simonis
2018-05-08[FIX] web_editor: drag and dropNicolas Martinelli
Commit 6494f511718 introduces an access token to read images inside an email. This avoids access errors when accessing the email through a proxy (e.g. Gmail). That implies that all images are added as attachments. When going through the usual media dialog, the form is submitted to action '/web_editor/attachment/add', creating the attachment. However, the copy or the drag and drop of an image completely fails. Indeed, the same method `_onImageUpload` is called, but with a completely different argument type: `attachments` is a `FileList`, not a list of attachments. To solve this, we only call `_onImageUpload` on a the custom `onUpload` callback, which is not triggered during a drag and drop or a copy. Any image included thanks to these methods will be post-processed in the `create` method of `mail.message` (`base64_to_boundary`). Unfortunately, it's not possible to simulate an actual drag and drop or a copy, so we cannot add a test. opw-1840237 opw-1840411
2018-04-18[MERGE] forward port branch saas-11.2 up to fed775bc0c2Christophe Simonis
2018-04-17[FIX] web_editor,mail: send email's attachments without write accessChristophe Matthieu
Before this fix, when a user don't have write access on a document, he can't send an email with attachment because, the attachments is added on the document. The change improving security was introduced by the commit: https://github.com/odoo/odoo/commit/6494f511718893eec3573c60c0a62e04d386359d With this fix, for mail, the attachments is added on the 'mail.compose.message' and re-render the fields attachments displayed in the current view. This change respect the access rules like all others attachment of 'mail.compose.message' (can send an email when the user have read access on the document). The media dialog of the html widget display all documents attachments and the added attachments Allowing users to use these in the body of their message.
2018-04-10[IMP] web: keyboard navigation in form viewVincent Schippefilt
The goal of this commit is to allow fast entry of the same model using the keyboard for navigating through the form once, by blocking the user from advancing in the form if there is a required field or once they went through the form once to get them to a primary action (button) This commit includes the following changes 1) Enable moving forward from field to field using the TAB key 2) Entering the one to many and many to many using the TAB key a. When entering it, set the focus on the "add new line" link or button b. When adding a new line, set the focus on the field visible editable field of the new line c. Discard adding a new line with ESC key d. If the user leaves the first field empty and uses TAB, we will cancel the adding of a new line and move to the next field of the form 3) When a field is required and not filled in, do not allow the user to move out of the field using the TAB key (the user is still allowed to use the mouse though), mark the field as invalid instead 4) After going though the form once, using the TAB key on the last field will move the focus to the first primary button of the page 5) When the focus is on a primary button (EDIT/SAVE), the user cannot move the focus forward using the TAB key. Hitting TAB again will display a tooltip telling to hit ENTER to activate the button. The mouse is still available to move the focus. 6) When the user saves, the focus is placed on the first primary button of the form renderer (like VALIDATE for a new invoice) 7) On dialogs, primary buttons should stop the users from moving out of them, and showing a popup if the user tries 8) When closing a dialog, the focus will be moved back to the widget that opened it. This commit does not include the following features 1) Navigation with the keyboard on a selection one to man 2) Navigate between tabs in a form using the keyboard 3) Cancelling the adding of a new line in a many to many using the ESC key do not set the focus correctly 4) Enhancing the focusses fields (like blue underline)
2018-02-08[FIX] web_editor: add thumbnail image to send attachmentChristophe Matthieu
2018-02-08[FIX] base/mail: Added an access_token on the attachments urlChristophe Matthieu
The access_token is automatically added by the media editor. It's added on the website and by the html editor to send by email. The widget display the attachments from 'ir.ui.view' (public attachment) and the attachment from the current record. Issue: can't load image in gmail or mobile because the client mail use a proxy who avoid ours odoo access.
2018-02-01[MERGE] forward port branch saas-16 up to 920aa6174c9Christophe Simonis
2018-01-02[MERGE] forward port branch saas-16 up to 0af13af5de4Christophe Simonis
2017-12-06[MERGE] forward port branch saas-16 up to b8540eefe3bChristophe Simonis
2017-11-30[MERGE] forward port branch saas-16 up to 5d7ad2b16ccChristophe Simonis
2017-10-19[FIX] web_editor: crashNicolas Martinelli
- Open Point of Sale > Configuration > Point of Sale - Edit, change anything - Save - Crash
2017-08-23[FIX] web_editor, *: allow editor dialogs in simple HTML areasqsm-odoo
* website_forum Summernote is instantiated as a simple text editor for 'simple' HTML backend fields and in website_forum. In those cases, the user was not able to open editor dialogs anymore as their opening was now handled by the RTE widget in web_editor since the recent website refactoring. The goal was to use `this._rpc` in these dialogs (and this required the dialogs to be attached to the widget parenting system). As a fix, a new component was implemented to handle these dialog openings and this component is thus created by the RTE widget and the other places that need the feature. The right fix would be a better integration of the summernote editor in the parenting system but this requires a lot more work than this commit, this will be the goal of the future editor refactoring.
2017-08-16[REF] web_editor, website, *: complete refactoringqsm-odoo
* mass_mailing, payment, point_of_sale, portal, survey, web, web_tour, website_blog, website_crm_partner_assign, website_event, website_event_questions, website_form, website_forum, website_gengo, website_hr_recruitment, website_links, website_mail, website_mail_channel, website_mass_mailing, website_quote, website_sale, website_sale_options, website_slides, website_twitter This commit reviews the whole "JS side" of the web_editor and website apps. This is a first step to be able to improve them with new and better functionnalities; this commit is not supposed to change any visual behavior. The main goal was to achieve a structure similar to the backend one. Now, the frontend side also has a root widget (like the WebClient) and all other widgets are attached to it one way or another. This allows the benefits of using the 'trigger_up' functionnality for example. As RPC are now mainly done with the `this._rpc` functionnality (being possible thanks to the parent hierarchy), the frontend will also be possible to test thanks to QUnit in a future update (besides the "text" editor side which still requires a refactoring to be able to do that). --- Here are some of the changes: (-) conventions and documentation The code has been updated to follow JS conventions and a lot of code has been commented (around +2000 lines of comment). This also means that lots of functions have been renamed to use camelCase or simply to make their name understandable. See https://github.com/odoo/odoo/wiki/Javascript-coding-guidelines. (-) deprecated: web_editor.base The "web_editor.base" module has been split and does not force the modules which require it to wait for DOM ready anymore. This was indeed slowing loading times, but also prevented to use some modules in some contexts (see the LESS editor use in web_studio which is the subject of another task). Now the "editor context" can be got thanks to the "web_editor.context" JS module with its "get" function. The "web_editor.base" module should probably not be used anymore (see its code and recent updates). (-) new: web.dom_ready If a JS module should wait for the DOM to be ready to be executed, a new JS module has been created: "web.dom_ready". This should always be used in a module which only want to instantiate stuff. Do not extend (or worst, include) classes after DOM ready. (-) website.website The "website.website" module has been split. "website.website" does not return anything useful anymore, it just initialize some miscellaneous stuff, without waiting for the DOM to be ready. You might want to check "website.utils", "website.content.compatibility" or `WebsiteRoot`. Also `website.form` has been deleted (use `this._rpc`), so has been `website.error`. `website.prompt` will be removed in a future update to be replaced by `Dialog.prompt`. (-) widgets are great Many classes which were not widgets are now widgets. This allows them to use the 'events', the 'xmlDependencies' and the 'this._rpc' features for example. Here are some of the main ones: - Snippet options: these were classes with a `$el` for the menu element and `$target` for the customized element. This is still the case but following standard `Widget` structure (one exception: using `this.$(...)` searches in the `$target` as before this update). - Snippet animations: instead of class instances with a `$target` element which can be `start` and `stop`, these are now standard widgets which can be `start` and `destroy`. `this.$target` is an alias to `this.$el` for ease of compatibility. - Snippet editors: instead of class instances in charge of an editor overlay, these are now widgets. Each "child" snippet editor is properly attached as a "child", which allows editors to communicate and to be properly destroyed. (-) root widgets and website navbar The frontend is different of the backend. In the backend, the page has an empty <body/> element and all the components are instantiated from parent to children (i.e. the `WebClient` is instantiated and is in charge of instantiating the `ControlPanel`, etc). The frontend cannot work like that on page loadings as they are way more frequent than in the backend and we do not want them to flicker. A frontend page is loaded as a <body/> element which already contains the website navbar and its menus and the whole content page. JS code has to be "attached" to these existing elements. This is possible thanks to the `RootWidget` instances and the specialized `WebsiteRoot`, `IframeRoot` and `WebsiteNavbar` (see code for details). (-) lazy loading No more (or at least a lot less) XML/JS has to be loaded on page loading, thanks to the use of the `Widget.xmlDependencies` feature. XML which have to be lazy loaded is loaded only on related Widget instantiation if necessary, which allows to execute a lot of JS code before the DOM is ready and to start many widgets on DOM ready (not later). A visual benefit of this is clicking on the 'edit' button as soon as it is possible: before this commit, this was sometimes not doing anything as event handlers were not binded yet. Still a possible exception: loading the session and locales. This may be asynchronous stuff which is still required before widget instantiations but this will be the subject of another task. (-) deprecated code and code location More than reviewing code and organizing it, many apparent dead code was removed. More importantly, mislocated code was put in the right app. This is the case for snippet animations which is a concept for website apps but was defined in the web_editor app, or some translation concepts which were part of website but should have been part of web_editor. --- There are probably more things to say about this commit but I will let the comments speak for those.
2017-08-16[MOV] web_editor, website: reorganize filesqsm-odoo