summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/wysiwyg/plugin/media.js
AgeCommit message (Collapse)Author
2019-08-21[REV] wev_editor, website: revert saas-12.2 editorGorash
This commit reverts the saas-12.2 editor by putting back the editor of Odoo 12. The saas-12.2 editor was an intermediate work between the previous editor of Odoo 12 and the new one slated for Odoo 13. It was unstable but it was supposed to be replaced by the new editor of version 13. However, since the new editor has been postponed to Odoo 14, the saas-12.2 one would have been staying in Odoo 13, which would have been a nightmare to maintain. To avoid this outcome, we chose to put back the 12.0 editor in its place. This has the particular advantage that Odoo 13 will share the same bugfixes as Odoo 12 and 11 as they all run under the same core editor, while the saas-12.2 one would have been an entirely different beast to maintain. This is a partial revert of f2969923. Part of PR 35677. Co-authored-by: Nicolas Bayet <nby@odoo.com> Co-authored-by: Antoine Guenet <age@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com>
2019-08-08[MERGE] forward port branch saas-12.3 up to 752b2553c6fChristophe Simonis
2019-08-07[FIX] web_editor: fix snippets preview on drop not displayingDavid Monjoie
2019-06-06[MERGE] forward port branch saas-12.3 up to 409679866b2Christophe Simonis
2019-06-03[MERGE] forward port branch saas-12.2 up to 995aa1685eeChristophe Simonis
2019-06-05[REF] *: removes datas_fname from ir.attachmentThanh Dodeur
This commit removes the field `datas_fname` from `ir.attachment` as it was unnecessary and most of the time the duplicate of `name` or `url`. Task #1909865 closes odoo/odoo#32976 Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>
2019-06-04[IMP] web, web_editor, *: add media image optimize dialogSébastien Theys
* = website, website_blog The goal is to give the user an opportunity to optimize his images before using them. For this we introduce a preview/configuration dialog after every image upload, where appropriate default values are filled for the quality and resolution, based on where the image is going to be used. Since this is not going to be perfect all the time, we still allow the user to configure them, and we display a preview to ease this process. Indeed it is important for SEO and for usability in general that the images are as light as possible in size. Technically the original image is uploaded and saved first, and then it can be optimized. This way the upload only happens once, and the preview can be computed from the already saved image. task-1930726 PR: #31208
2019-05-13[MERGE] forward port branch saas-12.2 up to 243a4ae5cbcChristophe Simonis
2019-05-06[FIX] web_editor: drop an image in the editable areaGorash
Issue: can't drop a image if the editor is not focused or if the editor is empty
2019-04-19[FIX] web_editor: disable tooltips in keyboard tests and on option offAntoine Guenet
The link and media tooltips were not taking Summernote's `tooltip` option into account. That option ensures that tooltips are disabled if the option is off (which is for instance the case on mobile). This fix ensures that these tooltips are disabled when the option is set to `false`. It also disables tooltips in the keyboard tests. They are not relevant to the keyboard tests and occasionally caused the DOM to not be properly cleaned after the tests were run (most likely due to their 2000ms `setTimeout`).
2019-05-22[FIX] web_editor: avoid double open of media modal when slow networkGorash
closes odoo/odoo#33327 Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2019-05-27[IMP] web_editor, website_blog: clean up save/saved eventsSébastien Theys
The web_editor had two different events `save` and `saved` doing more or less the same thing but with a different signature. In this commit we keep only the `save` event and adapt the code accordingly. PR: #33509
2019-03-06[FIX] web_editor: properly set media dialog `onlyImages` and find videoAntoine Guenet
Media dialog was trying to reach the current media's parent node, which was not possible as it was cloned on instantiation. To fix this, the `showImageDialog` now passes the `onlyImages` option upon instantiation, checking the parent's data. It also passes the media's parent if said parent is a video. This way, neither of these two things need to be done in media dialog. closes odoo/odoo#31634 Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2019-03-06[FIX] web_editor: wrong focus detection in the editorGorash
Issue detected with tests in the branch that replace deferred by native Promise. Need to add isMedia to detect if the target is already a media when focus the editor. closes odoo/odoo#31632 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-02-21[FIX] web_editor: do nothing on save if no media was selected in modalAntoine Guenet
When in the media modal, if one selected no media but clicked the "ADD" button it resulted in an error and a failed RPC instead of simply closing the modal without doing anything. v12 behavior is now restored. closes odoo/odoo#31308
2019-03-13[MERGE] forward port branch saas-12.2 up to c9f832d9f03Christophe Simonis
closes odoo/odoo#31790 Signed-off-by: Christophe Simonis <chs@odoo.com>
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-03-06[FIX] web_editor: wrong focus detection in the editorGorash
Issue detected with tests in the branch that replace deferred by native Promise. Need to add isMedia to detect if the target is already a media when focus the editor. This is a manual forwardport of PR odoo/odoo#31632. closes odoo/odoo#31633 Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2019-02-19[FIX] web_editor: clean or hide image handle data according to image sizeChristophe Matthieu
closes odoo/odoo#31183
2019-02-19[FIX] web_editor: properly position image handle in product configuratorAntoine Guenet
The image handle (grey overlay over the image) was not properly repositioning on scroll in the product configurator (a side effect of not having a popover). closes odoo/odoo#31226
2019-02-18[FIX] web_editor: remove invisible space on insert media where forbiddenAntoine Guenet
The web editor inserts zero-width characters (unicode 200B) around media when inserting them in the DOM so as to be able to edit before and after said media (contenteditable caveat). It should however not do so in fake not-editable nodes - such as the navbar - given that we do not expect to edit in them but only to replace the media. This ensures that behaviour. closes odoo/odoo#31200
2019-02-04[FIX] web_editor: reapply the classes of ANY type of media on replaceAntoine Guenet
closes odoo/odoo#30801
2019-01-29[FIX] web_editor: preserve image classes when replacing imageAntoine Guenet
closes odoo/odoo#30661
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>