summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/common/ace.js
AgeCommit message (Collapse)Author
2021-03-30[FIX] web_editor: show XML editor error if rejection valueNicolas Lempereur
Override in enterprise web_studio of _saveView on error never rejected promises. But now it does so the XML editor interface is not blocked after error. But we were already showing the correct error in web_studio use case, so we don't want another one and this change allow that by only showing an error if we received rejection value. opw-2460081 closes odoo/odoo#68554 Related: odoo/enterprise#17381 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-02-16[FIX] web_editor: stop loading button once ace savedNicolas Lempereur
When we edit a view with ace in eg. studio, if it works the saved button would never be enabled again because of missing callback. Match the behavior of dom.addButtonLoadingEffect other usage (80592abd). opw-2457046 closes odoo/odoo#66269 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-01-11[FIX] web_editor, website: prevent multiple click on saveRomain Derie
Clicking on save on html editor is taking quite some time. The user might think something is not happening and need to click again. If he does click again, 2 write RPC will be sent, making the COW business code being triggered twice, ultimately leading to create 2 COW. Instead of A / \ B B' It will be A / | \ B B' B' With as many B' than there is click on save. This commit adds a generic helper to make a button load/spin. closes odoo/odoo#63417 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-21[IMP] web_editor: check resource is custom or not to display warning on editorHarpritsinh Sisodiya
adds _isCustomResource method which will check whether resource is custom or not, this method checks for JS and SCSS resource, if resource is custom then do not show "No Update" warning inside ace editor. task-2167570 closes odoo/odoo#44536 Related: odoo/enterprise#8368 Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com>
2019-12-09[REV] web: reverts update to fontawesome 5.11.2Kevin Baptiste
This reverts commit ff1c35513aecef5fbc30f7c2f3834450e719714e. closes odoo/odoo#41480 X-original-commit: 116057b26e71db4692280463669f3e80d813ddcc Related: odoo/enterprise#7110 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-28[IMP] web: update to fontawesome 4.7.0 to 5.11.2Kevin Baptiste
FontAwesome 5 introduced new names for some icons as described on https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4#name-changes This commit replaces the old names to the new ones. closes odoo/odoo#35826 Taskid: 2050241 Related: odoo/enterprise#5180 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-06-05[IMP] *: use new helper config.isDebug()Romain Derie
Before this commit, both config and session were aliases to odoo.debug. Now, config.isDebug() should be call, with possibility to pass a parameter to check if we are in a specific debug mode such as 'tests' or 'assets'. task-1934445 Coming with https://github.com/odoo/enterprise/pull/4281 Closes https://github.com/odoo/odoo/pull/33213
2019-03-06[REF] web_editor: adapt code after jQuery updateVincent Schippefilt
Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2019-02-14[IMP] web_editor: lazy load the wysiwygChristophe Matthieu
Issue: wysiwyg asset slow down the loading of the website, error inadvertently introduced: https://github.com/odoo/odoo/pull/29775 The assets are now loaded assynchroneously, when the editor is needed, its assets will be loaded. closes odoo/odoo#30700
2019-02-08[IMP] website, *: optimize scss customizationsqsm-odoo
* web_editor This commit's goal is to optimize the delay to make a scss customization thanks to the website customize dialog. Before this commit, the JS code took advantage of existing web_editor routes but this was far from efficient as this was done: 1) PY: Load all scss files used in the page 2) JS: Find the one we want to customize and adapt the scss content 3) PY: Create the scss customization with the new content (So two RPC (including one very slow) and content building in javascript) After this commit, this is done: 1) PY: Load the scss file being customized, adapt its content according to the new values and save the customization (So the whole logic is in python, requiring only one small RPC) This commit also take the opportunity to review the web_editor ace editor loading code (the logic is shared with website customizations). PR https://github.com/odoo/odoo/pull/29624 task-1904244
2019-02-05[IMP] website, *: improve CSS edition usability + add JS editionAndrea Ulliana
* web_editor Currently, when an user wants to edit the css of its website, he has access to lots of files and, in debug mode, to even more files. While the feature is nice for people who know what they are doing, a lambda person can easily break its website by changing the wrong files. Also, nothing warns the user that the files that are edited will never receive updates anymore (unless if they are reset). The goal is to prevent those behavior while still allowing the add custom css. Another goal is to be able to *add* custom javascript. Custom files created for the user: SCSS: user_custom_rules.scss, user_custom_bootstrap_overridden.scss JS: user_custom_javascript.js See https://github.com/odoo/odoo/pull/29999 task-1919350
2019-02-04[MERGE] forward port branch saas-12.1 up to 4524ad06a8aChristophe Simonis
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>
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.