summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/widgets/ace.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-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-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-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-04-18[REF] web, web_editor, website: convert LESS editor to SCSS editorqsm-odoo
2018-03-14[IMP] update ace editor to v1.3.1Géry Debongnie
Note that we do not do a custom build anymore, since we lazyload the files anyway. A custom build will save a few kb, but will not do any meaningful change to the user experience. However, it dies impact negatively our ease of maintenance, so standard build it is.
2018-02-22[MERGE] forward port branch saas-11.1 up to e750bb6e114Christophe Simonis
2018-02-20[FIX] web_editor: correct frenglishMartin Trigaux
Courtesy of e2f translators
2018-02-20[FIX] web_editor: don't format xml with script tagNicolas Lempereur
It happens from time to time that someone use "Format" on the web.layout template. Thus: ``` <script type="text/javascript"> var odoo = { csrf_token: "<t t-esc="request.csrf_token(None)"/>", }; </script> ``` becomes: ``` <script type="text/javascript"> var odoo = { csrf_token: " <t t-esc="request.csrf_token(None)"/>", }; </script> ``` breaking a number of things on the frontend and everything on the backend. On a pure javascript content, we could wrap it with: ``` //<![CDATA[ /* javascript content */ //]]> ``` but in this instance we still want the xml to be processed. This commit avoids formatting XML containing a script tag. opw-815865 closes #23164
2018-02-12[FIX] web_editor: regression less editor 5af122387Nicolas Lempereur
In 5af12238 a change was made to have the correct hierarchy levels, but this can cause an issue when editing less files. This is because we now had "undefined + 1" which gives NaN which breaks Array constructor. opw-814579 opw-815397 opw-814322 opw-815265 opw-814021 closes #23006
2018-02-01[FIX] web_editor: xml editor first level not shownNicolas Lempereur
There is a slight visual inconsistency since: 9af8d5e6 the xml/less editor for first level of descendants were just prefixed by an invisible space. opw-807624 closes #22704
2018-01-25Revert "[FIX] base: bad back-port"Christophe Simonis
This reverts commit 0ac6043ec746ef4c4d4ddb66edc93c0ae098ca0b.
2017-10-27[MERGE] forward port branch saas-16 up to 8fdac4b6b2fChristophe Simonis
2017-09-29[FIX] web_editor: HTML/CSS Editor save feedbackNicolas Lempereur
The save on the frontend worked, but there was no feedback that it worked if the identifier of the file currently edited broke a jQuery attribute selector value (eg. /test.less breaks it).
2017-09-18[FIX] *: fix a bunch of incorrectly documented docstringXavier Morel
Fix a bunch of ill-documented/incomplete/incorrect method docs Without this, the automatic doc generation does not work.
2017-08-31[IMP] web: lazy load nvd3, ace and fullCalendar lib to reduce asset sizeChristophe Matthieu
2017-08-24[MERGE] forward port branch saas-17 up to 877e7098719Christophe Simonis
2017-08-21[IMP] web_editor: make HTML editor select2 dropdown betterqsm-odoo
In saas-15, the LESS editor was introduced alongside the use of the select2 library to style the <select/> element which allows to choose the view / less file to edit. The problem is that the default behavior of the select2 library is to open a dropdown with a max-height of 200px and a width equals to the <select/> element (with no regards to the dropdown content). In most cases, the dropdown was then displaying only a few results, broken over multiple lines. Now, the dropdown is restyled so that it has no maximum height, no set width and more readable content.
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