summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/wysiwyg/plugin
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-14[MERGE] forward port branch saas-12.4 up to 98a55917a60Christophe Simonis
2019-08-08[MERGE] forward port branch saas-12.3 up to 752b2553c6fChristophe Simonis
2019-08-07[FIX] web_editor: Do not remove blockGoaman
Do not remove block in _removeNextEmptyUnbreakable. Before this commit, when you tried to remove insert a character in a td, with an empty td after the first one. The function _removeNextEmptyUnbreakable removed the empty td. It was for example breaking snippet in the website and mass_mailing. closes odoo/odoo#32096 Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2019-08-07[FIX] web_editor: disable custom handling for Safari MacOSDavid Monjoie
2019-08-07[FIX] web_editor: fix snippets preview on drop not displayingDavid Monjoie
2019-08-06[FIX] web_editor: remove virtual corrector/completion keyboard glitchGorash
For the ours need, we can not let the contentEditable behavior. Indeed, this one does not have the same behavior according to the browser. The DOM node could be erase, merge, cut, in them according to the keyboard interactions. The problem is that if we have to manage these behaviors, we have to manage everything. It was already the case in the previous version, however before we created an editor by zone and by a hack we mix the history. In the case of the virtual keyboard of some OS / Phone, the events are different and the autocompletion does not update (bug that prevents modification interactions with javascript). In order to solve these problems, we use another event for the insertion of the characters. However, we must also force the update of the corrector by forcing a blur and a focus. The current version is a temporary version. We are currently working on a version that uses a virtual dom and does not need to do excessive prevent default.
2019-07-26[MERGE] forward port branch saas-12.3 up to 40e8b67179fChristophe Simonis
2019-07-24[MERGE] Forward port of saas-12.2 to saas-12.3 up to 860ab5a1c28baMartin Trigaux
closes odoo/odoo#35119 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-22[MERGE] Forward port of saas-12.3 to saas-12.4 up to fe4caecb59dMartin Trigaux
closes odoo/odoo#35059 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-15[FIX] web_editor: avoid dialog error on email editionGorash
Under certain unknown conditions, the range cannot be applied and triggered an error. In order to allow the user to keep editing, we need to prevent the dialog from showing, hence the use of `console.error`. If this error appears, the carret is moved to the beginning of the focused node. If this error appears, then bullet can generate an error (I managed to have the bug once or simulate it by manually breaking the dom and range) We suspect a wrong snippet custom javascript code. see: https://github.com/odoo/odoo/pull/34188 closes odoo/odoo#34871 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-07-15[FIX] web_editor: can use copy-past as html with only textGorash
Some browser can send text content without tag when past html. To avoid this error we wrap the content before parse it with jQuery.
2019-07-16[MERGE] Forward port of saas-12.3 to saas-12.4 up to 40421be73c94551bMartin Trigaux
2019-07-16[MERGE] Forward port of saas-12.2 to saas-12.3 up to cf8e74a1a7d34Martin Trigaux
closes odoo/odoo#34907 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-18[FIX] web_editor, website: consistently apply undo on CTRL-ZAntoine Guenet
This fixes a bug in Website, that can be reproduced like so: - insert a snippet - insert a char in it - 2x CTRL-Z The second CTRL-Z didn't do anything because Summernote moved the range to the header, which is not editable. This fix moves the range to the first editable element in the editor in these cases, thereby keeping the focus in an editable area, and ensuring that hotkeys still function. The history feature being non-tested as of this version, no test could be added for this fix. closes odoo/odoo#34834 Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2019-07-11[FIX] web_editor: properly insert character in empty nested listAntoine Guenet
Fix a bug that can be reproduced like so: - Insert list - Type char - ENTER - TAB - Type char The character gets inserted _after_ the `br` instead of replacing it. closes odoo/odoo#34805 Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2019-06-25[MERGE] forward port branch saas-12.3 up to 793933a1287Christophe Simonis
2019-06-17[FIX] web_editor: avoid dialog error on email editionGorash
Under certain unknown conditions, the range cannot be applied and triggered an error. In order to allow the user to keep editing, we need to prevent the dialog from showing, hence the use of `console.error`. If this error appears, the carret is moved to the beginning of the focused node. If this error appears, then bullet can generate an error (I managed to have the bug once or simulate it by manually breaking the dom and range) closes odoo/odoo#34188 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-06-06[MERGE] forward port branch saas-12.3 up to 409679866b2Christophe Simonis
2019-06-04[FIX] web_editor: escape html tag when copy paste code and text contentGorash
closes odoo/odoo#33859 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-06-20[FIX] web_editor: avoid dialog error on email editionGorash
Under certain unknown conditions, the range cannot be applied and triggered an error. In order to allow the user to keep editing, we need to prevent the dialog from showing, hence the use of `console.error`. If this error appears, the carret is moved to the beginning of the focused node. If this error appears, then bullet can generate an error (I managed to have the bug once or simulate it by manually breaking the dom and range) closes odoo/odoo#34284 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
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-06-04[IMP] web_editor, *: improve media dialog attachment uploadSébastien Theys
* = web_unsplash, website Remove iframe upload and replace it with a proper RPC. The route is now only accepting one file at a time, which makes it easier to maintain, and allows to process the first file as soon as it is ready, instead of having to wait on everything. Also fix a bug where a document could not be uploaded because it would try to parse it as an image. Remove filter after search result from the JS and add the corresponding conditions in the domain to avoid processing and returning unnecessary records. If multiple attachments exist with the same URL, now display them all to avoid confusion. Compute all the necessary values in the python model instead of in the JS. Allow SVG in the widget (the server already accepted them before). Disable multiple image upload when not in multiImages mode. task-1930726 PR: #31208
2019-07-29[MERGE] forward port branch saas-12.4 up to cda4f3c308cChristophe Simonis
2019-07-29[REF] web,web_editor: moved ColorpickerDialog to webJulien Mougenot
The reason this widget was moved is that the next improvement ([IMP] base: Configure document layout) defines a new field (FieldColor) which needs to call the colorpicker dialog inside of the base module. This couldn't be done while the dialog was located in the wysiwyg assets.
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 'mail.compose.message' modalGorash
Issue: Can not drop an image into the modal's editor because the server request a positional res_id arguments. closes odoo/odoo#33232 Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
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-05-06[MERGE] forward port branch saas-12.2 up to 78b3b650b0dChristophe Simonis
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-13[FIX] web_editor: indent multiple lines at a time with editable as parentGorash
2019-05-22[FIX] web_editor: remove o_checklist class on convert to ordered listAntoine Guenet
Converting a checklist into an ordered list didn't remove the o_checklist class. In consequence, converting a checklist to an ordered list and then to an unordered list failed as the unordered list with the o_checklist class is effectively a checklist. This fixes that bug. closes odoo/odoo#31432 Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2019-04-30[FIX] web_editor: properly unformat text at the start of the DOMAntoine Guenet
When trying to remove a format (bold, italic, underline), collapsed at the start of the DOM, an error occurred because of a wrong range. Ex.: `<p><b>Odoo</b></p>` -> when clicking before the word "Odoo", then clicking the "bold" button, we expect to be able to start writing in plain (not bold) text (for that, the DOM has to look like this: `<p>\u200B<b>Odoo</b></p>`). We now have that proper behavior without the accompanying error message and loss of selection. Task ID: 1978515 closes odoo/odoo#33038 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-05-21[IMP] web, *: add utils to get dataURL (base64) from file/blobSébastien Theys
* = partner_autocomplete, point_of_sale, web_editor, website_forum, website_slides This can be used for example to preview an image from a file input field. It can also be used to send the base64 content of the input by RPC instead of having to rely on form submit as POST with multipart/form-data. Technically wrap FileReader.readAsDataURL in a Promise. This will also be used in task-1930726 PR: #33508 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-04-05[MERGE] forward port branch saas-12.2 up to f2be461f090Christophe Simonis
2019-04-01[FIX] web_editor: do nothing on select all with empty editableAntoine Guenet
Ctrl-A on an empty editable threw an error. This fixes it. closes odoo/odoo#32301 Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
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-04-25[FIX] web_editor, website: never indent/outdent list groupsAntoine Guenet
The "comparisons" website snippet uses a list group with the class set on a UL. In consequence, the web editor considers it as a regular list and may try to outdent it, which is not the expected behavior with a list group. This fix ensures that ULs with the `list-group` class cannot be in/outdented. closes odoo/odoo#32709 Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2019-04-25[FIX] web_editor: properly merge a LI with text with a LI with text in PAntoine Guenet
A list item with text can be written as <li>text</li> or as <li><p>text</p></li>. Issues occurred when both syntaxes need to be merged together. Namely, the <p>text</p> was being appended to the other list item, thereby creating a visible new line.
2019-04-25[FIX] web_editor: properly handle delete in nested lists of all syntaxesAntoine Guenet
This addresses various bugs that occured with nested lists - including lists that are nested with a UL within a LI (as opposed to a UL directly within another UL).
2019-04-25[FIX] web_editor: properly convert a checklist to an ordered listAntoine Guenet
The `o_checklist` class was preserved when converting a checklist to an ordered list.
2019-04-25[FIX] web_editor: properly paste text in non-HTML fieldsAntoine Guenet
This resolves an issue with pasting in text only mode (no HTML): the list of nodes to paste was being modified with the `_mergeAdjacentULs` method which is irrelevant to text nodes. Because of that, a corrupted list of nodes was inserted into the DOM. opw-1962743 closes odoo/odoo#32454 Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2019-04-15[FIX] web_editor: uncheck new checklist item on splitAntoine Guenet
On ENTER in a checklist item, a new checklist item is created. The new one should never be checked. This ensures that ENTER in a checked checklist item never creates a checked checklist item but instead cleans the class. closes odoo/odoo#32684 Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2019-02-21[FIX] web_editor: stop removing empty block after deleting its contentsAntoine Guenet
Deleting all the contents of a block node replaced it with a blank paragraph node. To restore v12 behavior, it should only do that when pressing backspace in an already empty block, which is now what it does.
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