summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/editor
AgeCommit message (Collapse)Author
2019-06-17[FIX] website: editor wysiwyg must remove edition flagsGorash
html is undefined then the content are not replaced by the cleaned dom. Change the _onActivateSnippet method to fix the previous error generated by the dom uncleaned. Issue introduced by https://github.com/odoo/odoo/commit/2e8222dee737215cbad0dd3556d6ec0ffe60bf00#diff-0f47e7e6900726ed7c5d97ff649ae05bR228 closes odoo/odoo#34181 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-03-25[MERGE] forward port branch saas-12.2 up to 230ad8c381eChristophe Simonis
closes odoo/odoo#32088 Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-03-21[MERGE] forward port branch saas-12.1 up to 6878c9f3424Christophe Simonis
2019-03-19[FIX] website: facebook page id regexpJulien (juc) Castiaux
Some valid facebook pages appear as broken by the preview although they load perfectly fine afterward. At facebook, an id is required to perform requests to their graphql endpoints. The ID is part of the URL of the page, sometime (like Odoo) the ID is the name of the page and sometime (like LACME France) it is a generated 9-digits id shown in the URL after the name of the page. Example of two valid page URL and their page ID: https://www.facebook.com/Odoo ^^^^ ---- https://www.facebook.com/LACME-France-910072559192969 ^^^^^^^^^^^^^^^ ---------------------------- `^` denotes the page id and what odoo uses as page id after the commit `-` denotes what odoo used as page id before the commit opw-19494444 closes odoo/odoo#31922 Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
2019-03-18[FIX] web_editor: properly start website edit mode as restricted editorAntoine Guenet
It was impossible to open the website's edit mode as a user with "restricted editor" permissions. The reason was that wysiwyg_multizone was trying to manipulate data that is not injected into the html node when `editable` is false (see `website.layout` template). closes odoo/odoo#31702 Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2019-03-15[FIX] website: restore broken promises in websiteqsm-odoo
Since the switch to jQuery 3, Odoo uses native promises in its JS. Some mistakes were made in the website app during conversion from old jQuery deferred to native promises. - `this` -> `self` when wrapping in a promise - `.always(fct)` -> `.then(fct).guardedCatch(fct)` - a function returned sometimes a jQuery deferred, sometimes a native promise. This made the caller fail when using `always` or fail when using `guardedCatch` closes odoo/odoo#31887 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-03-06[REF] website: 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-19[FIX] website: hide edit menu when the user click on save an wait reloadChristophe Matthieu
2019-02-19[FIX] website: remove 'enable_editor' from the URL before editionChristophe Matthieu
2019-02-19[FIX] web_editor: speeder edition of field char on website_blogChristophe Matthieu
Before this fix, the customize button was updated with each character, which slowed down the fast insertion of characters and used resources unnecessarily.
2019-02-18[FIX] website: don't not edit not editable contents or branded hr, br...Christophe Matthieu
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-26[REF] website, *: stop using 'animation' confusing nameqsm-odoo
* web, website_blog, website_sale, website_twitter Before this PR, all website widgets were named 'Animation'. Now that they are 'Public Widgets', we can at last stop using the confusing 'animation' name. Part of https://github.com/odoo/odoo/pull/29442 task-1932066
2019-02-26[REF] website, *: move and review the notion of edit modeqsm-odoo
* portal, sale, web, website_blog, website_crm_partner_assign, website_forum, website_event_track, website_links, website_mail, website_slides, website_mail_channel, website_mass_mailing, website_sale, website_sale_comparison, website_sale_delivery, website_sale_wishlist The `editableMode` option and its related options in public widget should only be part of website, this commit moves them there. This is also the occasion to implement something that is long overdue: stop creating 'animations' / public widgets in edit mode by default. Indeed, lots of 'animations' were defined by beginning with 'if not edit mode'. Now, if a public widget should be considered in edit mode, it must be defined explicitely through a property at *definition* of the widget. Part of https://github.com/odoo/odoo/pull/29442 task-1932066
2019-02-05[REF] website, *: remove 'website.context' moduleqsm-odoo
* website_forum, website_gengo, website_mail_channel, website_sale Retrieving the global context is now the root's job, this will prevent problems when trying to extend the values the context has. See upcoming improvements with https://github.com/odoo/odoo/pull/29442 closes odoo/odoo#30816
2019-01-31[FIX] website: prevent animation of anchor links with invalid fragmentqsm-odoo
Also secure the anchor creation to only allow valid names, that is letters, digits, underscores and hyphens. task-1913458 closes odoo/odoo#30701
2019-01-25[REF] website, *: remove 'web_editor.ready'qsm-odoo
* website_event Following the new editor's merge at https://github.com/odoo/odoo/pull/29775, 'web_editor.ready' was moved to website without being renamed. Following https://github.com/odoo/odoo/pull/30409, this will remove that 'web_editor.ready' module. See upcoming improvements with https://github.com/odoo/odoo/pull/29442 closes odoo/odoo#30548
2019-01-22[REF] website, *: rename and simplify web_editor.contextChristophe Matthieu
* website_forum, website_gengo, website_mail_channel, website_sale Following the new editor's merge at https://github.com/odoo/odoo/pull/29775, the web_editor.context module was moved to website without being renamed. This commit renames it to website.context but also merge the website extension that was made to that context directly within its definition. closes odoo/odoo#30409
2019-01-21[FIX] website, *: restore media dialog usesqsm-odoo
* web_editor, website_blog Following the new editor's merge at https://github.com/odoo/odoo/pull/29775, the media dialog was refactored but the code which used it outside of the editor was not adapted at all. Also, the selected image was not saved correctly anymore, making the media dialog useless outside the editor in the current implementation. - Adapted SEO image uploading and body image background choice which were not working anymore - Adapted blog cover choice and gallery snippet which were strangely still working even though there were sending wrong parameters during media dialog initialization closes odoo/odoo#30416
2019-01-18[FIX] web_editor, website: restore anchor link featureqsm-odoo
Following the new editor's merge at https://github.com/odoo/odoo/commit/22efdfbecc1e8c688000be98903a5a355d1ece8a, the anchor link feature was not working anymore. This commit also fixes a feature behavior: when editing a link which already contained an URL, the anchor field was not shown directly. closes odoo/odoo#30346
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.
2019-01-09[IMP] website, *: allow creating anchor linksAndrea Ulliana
* portal, web_editor Anchor Link: - Some visual improvements of the link dialog. - New 'Page Anchor' field. - System by default: top and bottom. - Shows existing anchors. Creation of the anchor: - New option 'Anchor Name' to be able to create an anchor. task-1913458 closes odoo/odoo#29150
2018-11-02[MERGE] forward port branch saas-11.4 up to f6ca72b3ce9Christophe Simonis
2018-10-29[MERGE] forward port branch saas-11.3 up to 6136f0c02e5Christophe Simonis
2018-10-25[MERGE] forward port branch 11.0 up to 84500c27b1cChristophe Simonis
2018-10-19[FIX] website: restore options active system for carouselqsm-odoo
2018-10-19[FIX] website: clone correct slide on additionqsm-odoo
When adding a new carousel item, the first one was duplicated instead of the active one.
2018-10-19[FIX] web_editor, website: remove traces of CKEqsm-odoo
2018-10-15[FIX] website: allow to add/remove tabs in the new "Tabs" snippetqsm-odoo
closes odoo/odoo#27815
2018-10-15[FIX] website: restore carousel item behaviorqsm-odoo
The animation that made all the carousel items have the same height automatically was broken. This commit fixes it and improves its behavior during edition. closes odoo/odoo#27801
2018-10-01[FIX] website: properly allow multiple s_tabs snippets per pageqsm-odoo
Before this commit, the nav-tabs IDs/urls/... were the same when that snippet was added multiple times or duplicated. Now, the IDs are recomputed everytime a new .nav-tabs appears.
2018-09-25[FIX] website: BS4, restore gallery snippetKishan Gajjar
2018-09-24[FIX] website: adapt column snippet option to BS4qsm-odoo
Broken because col-md-offset-* -> offset-lg-*.
2018-08-17[FIX] website: BS4, restore facebook snippet UIqsm-odoo
+ solve JS error introduced by a recent commit Thanks to @kig-odoo for original fix
2018-08-13[IMP] website, *: add header overlay and color optionsqsm-odoo
* web_editor, portal This commit introduces the first page options: header overlay and color. The website builder is improved to allow the management of those. With this commit, users can now click on the website header to make it go on top of the first snippet, with a chosen transparent color. This is a configuration that can be done on each page individually (as the feature is very dependent of the first snippet on the page, this is typically an option for homepages). task-32155
2018-08-13[REF] web_editor, website: improve animations' restartqsm-odoo
- Before this commit, when we asked to (re)start animations on an element, we checked the animations to be started on the element and started them after destroying the animations with the same name which were already running on that element. This is in fact not correct. Indeed, if an animation was running on element but that the conditions that made the animation start are now gone, asking to restart the animations on that element should destroy the deprecated ones. (e.g. an animation "A" is to be started on all elements which have a class "a", if we remove the class "a" on an element then restart animations, the animation "A" should be destroy). The implementation is in fact even simpler: when asking a restart, a full stop is performed then a simple start. Note: this does not need to be a fix as multiple animations on a same element was recently introduced and the described case never occurs with current features. - When stopping the animations on an element, stops the animations of all its descendants too. - Add an helper method in the `SnippetOption` class to restart the animations running on the `$target` element.
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-07[FIX] website, website_sale: BS4, adapt carousel controlsDeep Patel
Completes https://github.com/odoo/odoo/commit/20d033a782f4d85fdd6f15df68d116b2fd7a7dfd Closes https://github.com/odoo/odoo/pull/26077
2018-07-27[REF] *: BS4, review panel and well structureqsm-odoo
Panels and wells were dropped and replaced by the "Card" component.
2018-07-27[REF] *: BS4, adapt col-related classesqsm-odoo
col-lg-* -> col-xl-* col-md-* -> col-lg-* col-sm-* -> col-md-* col-xs-* -> col-* col-lg-offset-* -> offset-xl-* col-md-offset-* -> offset-lg-* col-sm-offset-* -> offset-md-* col-xs-offset-* -> offset-* col-lg-pull-* -> order-xl-1 col-md-pull-* -> order-lg-1 col-sm-pull-* -> order-md-1 col-xs-pull-* -> order-1 col-lg-push-* -> order-xl-2 col-md-push-* -> order-lg-2 col-sm-push-* -> order-md-2 col-xs-push-* -> order-2
2018-07-27[REF] *: BS4, 'img-responsive' -> 'img-fluid'qsm-odoo
2018-07-27[REF] *: BS4, adapt dropdowns and caretsqsm-odoo
- The dropdown structure was simplified, allowing to get rid of the 3-levels structure induced by <ul/> elements and dropdowns can now contain anything. The class 'dropdown-item' is now mandatory for each dropdown clickable element. The class 'dropdown-item-text' can be used to add same padding and style but without making the element have a clickable look. - Dividers now use the class 'dropdown-divider' - The way dropdowns are opened and hidden also changed (before the 'open' class was added on the `.dropdown-menu` parent, now the 'show' class is added on both the `.dropdown-menu` parent and the `.dropdown-menu` itself). - JS-wise, no click event handlers can be put on `.dropdown-toggle` elements anymore (instead, use handlers for dropdown events). - Carets are automatically put on `.dropdown-toggle` elements, so this commit replaces the `.caret` elements with this. This feature was possible to disable but would prevent us from adding a caret with scss. Also, this simplifies the DOM. The 'o-no-caret' class was also introduced to allow using the 'dropdown-toggle' class on non-caret elements. - Also adapt the scss to use $caret-width instead of $caret-width-base
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-06-21[FIX] web_editor, *: properly remove DOM portions in a snippetqsm-odoo
* website, website_mail_channel Before this commit, when using the 'number of columns' option from a column's snippet editor, the snippet overlay remained floating in the void if the current column was removed by the option. This was because the option did a simple "destroy" on the column without caring about the snippet editors. This commit introduces a new event which can be trigger_up'ed to ask the editor to properly remove a DOM portion (destroy related editors, call the 'onRemove' callbacks, ...).
2018-04-12[IMP] website: add new snippet option to control # of colsdbh
Note: original work of @dbh-odoo was to have + and - buttons on the editor overlay but specs changed to use a standard dropdown (the work of @dbh-odoo was thus adapted for this). See task-46094 Closes https://github.com/odoo/odoo/pull/22197
2018-03-20[MERGE] forward port branch 11.0 up to 2835d299792Christophe Simonis
2018-03-12[FIX] website: edit company dataNicolas Martinelli
- Go to 'Contact Us' page - Edit, then try to change company data - A dialog window asks if the user wants to edit the company data - Confirm It redirects to an unexisting page. opw-1825662
2018-01-16[REF] web_editor, website(_*): refactore media & link dialogsqsm-odoo
* blog, gengo, sale
2018-01-08[IMP] web_editor, *: change height/margin system to padding systemqsm-odoo
* web, website, mass_mailing Before this commit, the editor allowed defining the margin of some elements and the height of some elements. There were three main problems with this system: 1) When an user dragged the arrow, he often expected to change the size of the element while he was in fact changing the margin 2) When changing the margin, you increase the space between two elements but with a white space (while most users want a space with the same color of the block they are resizing = padding) 3) When changing the height, the user was able to hide snippet parts and the height was not consistent accross screen sizes Now, the only thing you can edit is padding. There is only one arrow for each direction, which allows increasing spacing and consistent dimension at the same time. The only feature that is lost with this change is the ability to control vertical alignement of colored columns. This is not a problem as colored columns are rare in our current snippets and there still have the possibility to add margin classes by hand if necessary (there are also plans to control vertical alignement another way). Note: margin classes are kept for compatibility.