summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/lib
AgeCommit message (Collapse)Author
2021-02-22[FIX] web_editor: fix anchor range selectionxO-Tx
When we double click a form submit anchor, and depending on the selected element before click, the selection range ("document.getSelection()") can start from a parent of the targeted node. This will send a wrong range to be used in LinkDialog widget. The goal of this commit is to prevent this behaviour by adjusting the range if it starts from anchor parent. Note: the bug only occurred in Firefox. Part of https://github.com/odoo/odoo/pull/62206 task-2381305 closes odoo/odoo#62206 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-02-22[FIX] website_form, *: allow to update buttons using link dialogxO-Tx
*: web_editor, website_mass_mailing When we double click a link/button, a link dialog appears to update the target properties, and since the current link dialog can only handle anchor targets, using it on buttons leads to some inconsistencies : - visible href options for button & url required to save changes. - missing preview when button style changed. ... The goal of this commit is to add a fix (with minimum of code) on summernote linkdialog to handle button elements using the same logic as anchor nodes. Also, update website form test tour to test those new changes. Part of https://github.com/odoo/odoo/pull/62206 task-2381305
2021-02-19[FIX] web_editor: fix anchor click on submit buttonxO-Tx
Context: 1) Edit mode 2) Click on anchor edition button of website form submit button 3) Traceback occurs The "focus" triggered on $editable element in editor's 'getLinkInfo()' discards user's text selection on submit button, as a result, 'range.create()' method returns null since no selection is found. Note: the bug only occurred in Chrome. Note 2: [1] apparently tried to solve the same issue but the fix was not solving it correctly, at least not in all cases. [1]: https://github.com/odoo/odoo/commit/da14e4449e5e318eb72e1b9f268fb797adb0c6a6 opw-2443441 closes odoo/odoo#66552 X-original-commit: d2f3c9e7975188753fa17c06db3fc5c73c773944 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-09-29[IMP] web_editor: add assets for jabberwock editorGoaman
This commit lays the groundwork for the new editor by adding empty files to the assets in order to change them later on. The new editor is not stable enough to be merged right now, but delaying it to 15.0 would be problematic as the current editor has many bugs that we are unable to fix because of how summernote interacts with browser-dependent code as well as all the hacks that were done on top of it for Odoo since 8.0. closes odoo/odoo#58678 Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2020-08-19[IMP] web_editor: add amount parameter to colorMatrixSamuel Degueldre
When compositing filters, it is often the case that you only want to partially apply a filter. This commit adds an optional "amount" parameter to the colorMatrix filter, and computes a weighted average between the identity matrix and the passed in colorMatrix. This parameter defaults to 1, meaning the effect is applied in full if no amount is specified. This is a change in the webgl-image-filter library, currently awaiting merge into upstream at https://github.com/phoboslab/WebGLImageFilter/pull/25 Part of https://github.com/odoo/odoo/pull/53114 task-2279190
2020-08-19[ADD] web_editor: add webgl-image-filter library for image filtersSamuel Degueldre
Part of https://github.com/odoo/odoo/pull/53114 task-2279190
2020-06-05[FIX] web_editor: fix duplicated pasted image summernotejvm-odoo
Issue - Windows > Chrome or Firefox - Any chatter > Open full screen - Paste any image The image is pasted twice Cause Summernote adds the image but the browser event adds it too Solution I applied the fix that summernote did summernote/summernote/commit/6e432941af17c5fee0877d9ff54b6ace65fbdb4b OPW-2267712 closes odoo/odoo#52532 X-original-commit: 2b4b2ce8660326b1cb53b5624690718b89aaceda Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-06-05[FIX] web_editor: fix layoutInfo is null tracebackSamuel Degueldre
When attempting to update its UI in reaction to events, summernote tries to make layout info for the event target, this relies on finding this information on one of the target's ancestors. In some cases, elements can be removed from the DOM between the moment the event was triggered, and the moment summernote attempts to create the layoutInfo, resulting in layoutInfo being null. This commit prevents tracebacks from happening in such cases by checking that a layoutInfo was actually returned, and if not, aborting the UI update that relies on it. closes odoo/odoo#52541 X-original-commit: 3e999db0c114d51102ae51f870f98a4cc276c4b4 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-05-20[REF] web(_editor): move jquery.nearest lib to webAaron Bohy
This lib is also used by the Gantt view, so we move it to the common basis between web_editor and web_gantt, which is web. Part of task 2205607 closes odoo/odoo#51606 Related: odoo/enterprise#9740 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-04-02[FIX] web_editor: fix makeLayoutInfojvm-odoo
Issue - Install Website - Edit your website Do this 8 times: - Add the block "Image - Text" under each product - Make image on left smaller and text longer - Edit the size/color of the title and the description There is some case where it will crash Cause We override the method who gets the editor: `x = $('[data-note-id="' + list.last($target.attr('id')) + '"]');` When there is more than 9 editors in the page (because we edited 10 different HTML fields), we reach the editor with ID 10 but the code erroneously will not find the editor with ID 0 Solution Use this instead: ``` x = $('[data-note-id="' + list.last($target.attr('id').split('-')) + '"]'); ``` OPW-2218467 closes odoo/odoo#48810 X-original-commit: c95fad77ea5b4663130e256f76031560171f09e6 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com> Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-01-29[FIX] web_editor: properly copy link URLAntoine Prieels
Avoid display errors with special characters when copying the href attribute of links in the web editor. opw-2078313 closes odoo/odoo#44176 X-original-commit: 19ebcdd20426406250174eb473b081a9e488e542 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-01-06[FIX] web_editor: fix summernote text drop on firefoxJason Van Malder
Issue - Have firefox - Go to any chatter - Open full editor - Write some "test" words with line breaks - Select one of your "test" words - Drag & drop it somewhere else in the editor Welcome on test.com! (redirected) Cause Summernote doesn't preventDefault on drop event, so firefox think we want to go to another URL. Solution Add the preventDefault manually. This reveals another issue which is solved by importing this PR's code https://github.com/summernote/summernote/pull/3327 (with adaptation for our dinosaurus version) OPW-2158112 closes odoo/odoo#42759 X-original-commit: 197145ac19fd65dcfbcbae81c8b5dd54025185a4 Signed-off-by: Jason Van Malder <jvm-odoo@users.noreply.github.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-10-09[FIX] web_editor: don't crash if anchorNode is Reserved.Victor Feyens
When on Firefox, with sale_product_matrix and sale_quotation_builder installed, clicking anywhere on the matrix (after opening it) raises a traceback. It is due to the fact that isBody tries to access anchorNode.nodeName, which is unexpectedly unaccessible as anchorNode is {Reserved}. Due to the absence of clear documentation of the possible reasons of this problem, it was decided to reuse the existing fallback on 'return null', which avoids the traceback. closes odoo/odoo#38277 X-original-commit: 70c484e72bffc9ab759df3c376ad9157acec3965 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2019-09-13[REF] web_editor: update the cropper libraryqsm-odoo
Just after we first added the library in Odoo (in april 2018), the library was released in its last and deprecated version (4.0.0). At the same time, the author indeed split its 'cropper' library into 2 parts: 'cropperjs' which is the core of the original library without jquery and 'jquery-cropper' which is a jquery wrapper of the 'cropperjs' library. This commit updates our code to use the latest version of those two libraries. Note: the commit also removes the lazy loading of the library which is useless and maybe breaking since it comes with the editor assets which are themself lazy loaded. Note 2: we may want to remove the jquery wrapper in another update and simply use the standard JS library. Part of https://github.com/odoo/odoo/pull/36880 task-2059480 closes odoo/odoo#36880 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-08-21[REV] web_editor: revert summernote updateGorash
Summernote was updated alongside the new editor of saas-12.2. However, since we are putting back the editor of 12.0, summernote needs to be downgraded back to the version that was compatible with the 12.0 editor. This is a revert of 17c6d005. 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-05-22[FIX] web_editor: don't close all modal on click an 'x' help modalGorash
We monkey patch summernote here to fix the issue, but the summernote will not update and are removed in V13.
2019-03-04[FIX] web_editor: Evoid the risk of deleting the summernote libraryGorash
For iframes, we need to inject summernote because there are references to "document" in it. When loading the iframe, if it is canceled, there is a risk that the library is erased and that it breaks the field html. We must also slightly modify the library to prevent it from making changes to the library of the main "window".
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-17[IMP] web_editor,*: Update the Summernote libraryChristophe Matthieu
The refactoring of the wysiwyg editor and 'html' field allow for the update of the Summernote library.
2018-11-22[MERGE] forward port branch saas-11.3 up to b09f624f207Christophe Simonis
2018-11-22[MERGE] forward port branch saas-15 up to e44c35f4074Christophe Simonis
2018-11-15[FIX] web_editor: firefox `´ accent no break positionNicolas Lempereur
On firefox if we do for example: ALT+GR + [ALT+GRable ´ key] Firefox may send keys "AltGr" and "Dead" instead of just "AltGr". This was possibly causing caret to go a position too low when writing speedily with diacritical marks. opw-1903865 closes #28739
2018-09-07[MERGE] forward port branch saas-11.4 up to d78f23df848Christophe Simonis
2018-09-07[MERGE] forward port branch saas-11.3 up to 4850fb08385Christophe Simonis
2018-09-03[FIX] web_editor: focus lost with inline editorNicolas Lempereur
When an inline editor is eg. in a form view, the focus is always stolen by it. This is because we trigger a mouseup on the editor to update its toolbars values and informations. In 10.0 this was not necessary since the default values were sanely set when the editor was inside the DOM. In 11.0 the editor is not in the DOM when this is being done and the info was wrong (eg. NaN for text size). With this commit, we don't steal the focus and get the default like it was done in 10.0 instead. fixes #26366 opw-1874880 closes #26582
2018-08-02[FIX] *: BS4, restore some popover designqsm-odoo
Completes commit https://github.com/odoo/odoo/commit/2d5595fcbad73ed0ce03f048fdd870d9659bcd5e
2018-07-31[FIX] *: BS4, restore modal headersqsm-odoo
Close icon should now be put after the modal title in the DOM. Completes commit https://github.com/odoo/odoo/commit/d9801c1abe06b4c20702c0e94c56eea6a3ed8327
2018-07-27[REF] web_editor: make our Summernote/BS3 work with BS4qsm-odoo
The big plan is to remove our current editor and its customization and replace it with an updated summernote. Meanwhile, we have to patch our current lib directly so that it works with BS4.
2018-07-27[REF] *: BS4, 'pull-left/right' -> 'float-left/right'qsm-odoo
2018-07-27[REF] *: BS4, replace img-rounded/img-circle classesqsm-odoo
'img-rounded' -> 'rounded' 'img-circle' -> 'rounded-circle'
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, rename btn-default to btn-secondaryqsm-odoo
BS4 "btn-default" class was replaced with "btn-secondary", which makes more sense.
2018-07-09[FIX] *: fix some side-effects of ↵qsm-odoo
https://github.com/odoo/odoo/commit/9de1bc0eef6f5bfaa2a8d745431caa361ae91548 - JS Modals were not correctly built anymore, their .modal-body element was duplicated and many without-effect JS lines were introduced (as a side effect, the form view design was broken when inside modals) - Tests were changed to make bugs go unnoticed. For example, the media dialog functionnality was entirely broken because the .modal-dialog element was not receiving the correct class anymore. - The JS translation function is _t, not _ - Do not use the <title/> tag as a regular DOM element, it is meant to be unique, in the <head/> section - CSS rules were added to the utils.scss file, which is meant to contain functions and mixins, otherwise, the rule is duplicated in every asset - Some icons were still broken, as missed by https://github.com/odoo/odoo/commit/f90cf060a3cfeb37a67bec83264c0aaab8892b56 - Tests were changed to use [role="dialog"]/footer/header in their selectors without any reason, this commit restores some of that to avoid rebase conflicts with the BS4 work. - ... Note: other elements should still be discussed, like the direct use of the 'o_form_label' class in views definition... but those do not cause direct problems.
2018-06-22[IMP] Improve compatibility with screen readers (accessibility) (#24574)kujiu
Today, Odoo is really tricky to use without seeing the screen, it must be improved to be usable. This PR forbid to use labels without a "for" attribute, add some title, rule and aria attributes in HTML. With that, Odoo will be fully usable with a screen reader. * [IMP] Labels must have a for attribute. Improve accessibility. * [IMP] Better error message when trying to read a missing cached value * [FIX] Add some aria-label and title attributes for screen readers. * [FIX] Template name is not included in the error message in case of SyntaxError in QWeb * [FIX] Improve the Tour failed at step error message to be more explicit. * [IMP] Add aria-labels * [FIX] Add missing aria-label on failing test * [IMP] aria-hidden means hidden. Fix all bad aria-hidden and hide aria-hidden for all. * [IMP] Color names on kanban views and many2many tags * [IMP] Add some checks on views for accessibility. * [IMP] Add `alt` attribute on `img` tags. * [IMP] Add aria-label and title on non-described icons * [IMP] Add button role to widgets with btn class * [IMP] Translate aria and formatted attributes. * [IMP] Remove wrong aria-labelledby * [IMP] Add menu role on dropdowns * [IMP] Buttons must be focusable * [IMP] Add aria attributes on progress bars * [IMP] Improve accessibility of basic widgets * [IMP] Change main layout to more semantic tags * [IMP] Add menuitem role when missing * [IMP] Remove wrong role='presentation' * [IMP] Improve accessibility of tab panels * [IMP] Add aria-invalid on invalid fields * [IMP] Add aria-sort on ordered columns * [IMP] Add role on alerts * [IMP] Use dialog role, header, main and footer tags for modals * [IMP] Add labels on o_status * [IMP] Improve accessibility of kanban view with feeds and articles * [IMP] Add alerts in case of new messages * [IMP] Add widget, navigation or img role to aria-labelled items
2018-06-15[MERGE] forward port branch saas-11.3 up to 50860317ccdChristophe Simonis
Note: 1aacc962620982528a3dfc90d2c1dd0027359375 has been ignored and will be forward-ported later
2018-06-14[MERGE] forward port branch saas-15 up to a53bea49fe4Christophe Simonis
2018-06-14[MERGE] forward port branch 9.0 up to 90165e2d96aChristophe Simonis
2018-06-13[FIX] web_editor: link don't duplicate child textNicolas Lempereur
If we applied a link eg. on: ``` <span>hello <b>world</b></span> ``` The system actually gets the "label": hello worldworld because there is 3 nodes: text node: hello element node: `<b>world</b>` text node: world Also since "hello worldworld" is different than "hello world", instead of just keeping existing nodes and adding the link, the system would replace the selected range by: `<span><a>hello worldworld</a></span>' instead of: `<span><a>hello </a><b><a>world</a></b></span>` This commit ignores element nodes when creating a new link, since when getting the label of the link from the selection, only the text nodes insides the element nodes have any interest. There was a second issue because if we had: ``` <i><a href="hello">world</a></i>! ``` and tried to put a link over "world!", the code would decide: "world" is inside a link so we will just update that link. Thus we would get: ``` <i><a href="hello">world!</a></i>! ``` instead of: ``` <i><a href="hello">world</a></i><a href="hello">!</a> ``` opw-1848351 closes #25187
2018-05-29[MERGE] forward port branch saas-11.3 up to 37eed7c509fChristophe Simonis
2018-05-18[ADD] web_editor: add new cropper libKishan Gajjar
2018-05-08[FIX] web_editor: drag and dropNicolas Martinelli
Commit 6494f511718 introduces an access token to read images inside an email. This avoids access errors when accessing the email through a proxy (e.g. Gmail). That implies that all images are added as attachments. When going through the usual media dialog, the form is submitted to action '/web_editor/attachment/add', creating the attachment. However, the copy or the drag and drop of an image completely fails. Indeed, the same method `_onImageUpload` is called, but with a completely different argument type: `attachments` is a `FileList`, not a list of attachments. To solve this, we only call `_onImageUpload` on a the custom `onUpload` callback, which is not triggered during a drag and drop or a copy. Any image included thanks to these methods will be post-processed in the `create` method of `mail.message` (`base64_to_boundary`). Unfortunately, it's not possible to simulate an actual drag and drop or a copy, so we cannot add a test. opw-1840237 opw-1840411
2018-05-02[MERGE] forward port branch saas-15 up to 810603f4ef0Christophe Simonis
2018-05-02[MERGE] forward port branch 9.0 up to 532b11ce415Christophe Simonis
2018-04-27[FIX] web_editor: update summernote copy-paste featureqsm-odoo
The copy-paste feature of summernote was messy and led most of the time to breaking the template you were trying to edit. While it is difficult to solve as it mostly comes from the lib itself and that the lib is in a complicated state as Odoo had to overridde part of its internal code for its own purposes, this commit hopes to solve the problem by updating only the copy-paste feature to the latest summernote version. Of course, as summernote changed a lot meanwhile, it was not possible to just take the up-to-date summernote file. This commit refactores the up-to-date summernote clipboard code so that it fits the old summernote version Odoo is using. Note: the main problems occurred while using Windows/Mac and not Linux. opw-1837818
2018-04-18[REF] web_editor: convert summernote less to cssqsm-odoo
Summernote is using LESS and no SCSS version exists (at least officially). As summernote is meant to be replaced in the future and that the LESS file was already overridden directly by Odoo, this commit converts the LESS file to CSS once and for all.
2017-10-17[MERGE] forward port branch saas-15 up to 8d0942380b5Christophe Simonis
2017-10-17[MERGE] forward port branch 9.0 up to d5c0cae60b5Christophe Simonis
2017-10-16[FIX] web_editor: do not break <p/> when pasting a <p/> elementqsm-odoo
This fixes a bug when pasting text in a paragraph, it was always creating a new paragraph for no reason.