Commit Graph
752 Commits
Author SHA1 Message Date
Kishan Gajjar d66e260391 [IMP] web_editor: allow cropping content images 2018-05-18 12:15:42 +02:00
Kishan Gajjar fd5cffe235 [ADD] web_editor: add new cropper lib 2018-05-18 12:15:42 +02:00
Christophe Simonis b192431aee [MERGE] forward port branch saas-11.3 up to ec5e27bb7c 2018-04-24 17:42:41 +02:00
Christophe Simonis 1f22b81203 [MERGE] forward port branch saas-11.2 up to 7113b70762 2018-04-23 19:36:25 +02:00
Christophe Simonis e8bf128318 [MERGE] forward port branch 11.0 up to 3ab25b60bc 2018-04-23 18:15:25 +02:00
Christophe Simonis 3ab25b60bc [MERGE] forward port branch saas-15 up to cae950e826 2018-04-23 17:59:59 +02:00
Christophe Matthieu e94702d8b9 [FIX] web_editor: wrong display of the link buttons (btn) in outlook 2013
The css generates all the attributes separately and not in simplified form.
In order to have a better compatibility we simplify the css tags.
e.g. border-left-style: none; border-bottom-s .... will be simplified in border-style = none

We convert the link.btn into a table to have a good rendering in outlook, and revert the
change when the user edit the content.
2018-04-23 16:44:57 +02:00
Christophe Matthieu db37f9c4ef [FIX] web_editor: wrong display for td in Apple Mail
the td are displayed with wrong background color if the td tag is empty
2018-04-23 16:44:57 +02:00
Christophe Simonis 0bf642cb27 [MERGE] forward port branch saas-14 up to 2bc3fd89f2 2018-04-23 14:47:23 +02:00
Christophe Simonis 2bc3fd89f2 [MERGE] forward port branch 10.0 up to 2d12ae3202 2018-04-23 14:39:41 +02:00
Christophe Simonis 2d12ae3202 [MERGE] forward port branch 9.0 up to c9e7433c23 2018-04-23 14:07:12 +02:00
qsm-odoo 61c32429a6 [FIX] web, web_editor: restore report edition feature
Since 11.0, reports could not be edited at all anymore. This is due to
the fact the editor files were refactored but the report feature is not
correctly organized since it was merged with the 'web' app. Indeed, the
'web' app is still calling files and assets of the 'web_editor' app which
is not a dependency (but it is working as 'web_editor' is auto-installed
with 'web').

opw-1826599
opw-1834971
Closes https://github.com/odoo/odoo/issues/24034
2018-04-23 12:57:51 +02:00
qsm-odoo c9e7433c23 [FIX] web_editor: prevent crash on outside-iframe click
The editor is performing text selection check when clicking on the
window. However, when clicking outside the iframe an editor is running
in, a crash may occur as the editor was trying to check a range outside
of its environment (the iframe).

Related to opw-1837818
2018-04-23 12:56:34 +02:00
Christophe Simonis e56be854ab [MERGE] forward port branch saas-11.3 up to 204935119d 2018-04-19 11:58:44 +02:00
Christophe Simonis c309ccd7b3 [MERGE] forward port branch saas-11.2 up to fed775bc0c 2018-04-18 18:30:35 +02:00
Christophe Simonis fed775bc0c [MERGE] forward port branch 11.0 up to 8c64159b88 2018-04-18 18:20:40 +02:00
qsm-odoo e5b268827f [REF] web, web_editor, website: convert LESS editor to SCSS editor 2018-04-18 15:59:25 +02:00
qsm-odoo cd2504c75f [FIX] *: wrap negated variables with parenthesis
* mail, web, web_editor, website_sale

Tricky difference between LESS and SCSS:
`0 -$var` will be one value in SCSS (the result of 0 - $var) but
two space-separated values in LESS.
2018-04-18 15:59:21 +02:00
qsm-odoo 6e4db7d13a [REF] *: review scss variables handling
Unlike LESS, SCSS variables are not lazy loaded. Our system has thus
to be updated. This commit creates new templates which are t-called
in assets bundles (to replace the old less_helpers template):

- web._assets_utils: regroups the mixins and functions which *can*
  (and so should) be available in every asset bundle

- web._assets_primary_variables: regroups the variables (or mixins
  used as variables) which *can* (and so should) be available in
  every asset bundle

- web._assets_secondary_variables: same as above but provides an
  environnement where all the 'primary' ones are accessible. This is
  for example useful to handle the community/enterprise split:

  // Community primary variables
  $o-pink-color: pink; // enterprise color
  $o-brand-primary: blue;

  // Enterprise primary variables
  $o-brand-primary: $o-pink-color;

  // Community secondary variables
  $o-my-darker-primary: darken($o-brand-primary, 5%);

  => If there was only one variable template, enterprise edition would
     have been able to define its primary color at the end but the
     darker primary would not have been updated. Using the "!default"
     system and putting enterprise definition above would not have
     solved the problem as the $o-pink-color would not have been
     accessible.

- web._assets_backend_helpers: regroups the variables, mixins and
  functions which *can* (and so should) be available in the backend
  asset bundle only. This is especially (only?) useful for bootstrap
  variables overriddes.

- web._assets_frontend_helpers: regroups the variables, mixins and
  functions which *can* (and so should) be available in the frontend
  asset bundle only. This is especially (only?) useful for bootstrap
  variables overriddes.

Note: bootstrap variables are not accessible in any of those anymore.
If you have variables that should depend on bootstrap, you have 3
solutions:

- Find another way: your variable is probably useless, use bootstrap
  variables directly or create a variable that will influence the
  value of bootstrap variables. E.g. instead of declaring:
  `$myvar: $bootstrapvar * 3`
  and using $myvar alone, declare:
  `$myvar: 3` and use `$myvar * $bootstrapvar` where needed.

- Declare a copy of the bootstrap variable and use that one. In that
  case, you should also force-set the real bootstrap one to be sure
  they match (this should be done in appropriate templates mentioned
  above). E.g.
  ```
  $o-boostrapvar: 5;
  ...
  $boostrapvar: $o-bootstrapvar;
  ```

- Set your variable to null and set it to your bootstrap expression
  in the file you will need it (where bootstrap variables are accessible)
  without forgetting to add the !default flag to allow overriddes.
  ```
  $myvar: null;
  ...
  $myvar: $bootstrapvar * 5 !default;
  ```

This commit also partly changes the variable names to follow the
convention:
$o-<app_id>-<name> where 'app_id' is the current's app name or a
meaningful unique identifier ("theme" for all themes for example, as
no multiple themes can be installed).
2018-04-18 15:59:19 +02:00
qsm-odoo 97aa0a8dec [REF] *: convert less content to scss content
Convert content so that the assets compile on app installation. The
style is still broken after this as the variables/mixins/... are not
defined in the right order (as it did not matter in LESS but does in
SCSS).

This commit basically changes:
- Variables: @​var_hello -> $var-hello
- Mixins: .mixin_world() {} -> @​mixin mixin-world {}
- Classes used as mixin: .my_class() -> @​extend .my_class
    - Here there were no other solution than to convert the use of
      a mixin call by the use of an extend as a first approximation
- LESS functions -> SCSS functions (e.g. fade -> rgba)
- Move first variable definition before the variable is used
    - Still need to make sure last variable definition is at the
      right place
2018-04-18 15:59:16 +02:00
qsm-odoo b04dec4025 [REF] *: rename all LESS files to SCSS
This is a simple renaming without adaptation.
2018-04-18 15:59:15 +02:00
qsm-odoo 9435fe110c [REF] web_editor: convert summernote less to css
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.
2018-04-18 15:59:12 +02:00
qsm-odoo 1a007c1a96 [REF] *: stop mentioning "LESS" where this is not required
* web, web_editor, website, im_livechat
2018-04-18 15:59:07 +02:00
Christophe Matthieu b26ad79a8c [FIX] web_editor,mail: send email's attachments without write access
Before this fix, when a user don't have write access on a document, he
can't send an email with attachment because, the attachments is added on
the document.

The change improving security was introduced by the commit:
https://github.com/odoo/odoo/commit/6494f511718893eec3573c60c0a62e04d386359d

With this fix, for mail, the attachments is added on the
'mail.compose.message' and re-render the fields attachments displayed in
the current view. This change respect the access rules like all others
attachment of 'mail.compose.message' (can send an email when the user have
read access on the document).
The media dialog of the html widget display all documents attachments and
the added attachments Allowing users to use these in the body of their
message.
2018-04-17 09:26:06 +02:00
Christophe Simonis 74033eb007 [MERGE] forward port branch saas-11.2 up to 90f8f17fb4 2018-04-16 19:50:50 +02:00
Christophe Simonis 5f2d080cf8 [MERGE] forward port branch 11.0 up to ad825b673b 2018-04-16 18:34:56 +02:00
Christophe Simonis ad825b673b [MERGE] forward port branch saas-15 up to bfa5af45df 2018-04-16 17:10:23 +02:00
Christophe Simonis bfa5af45df [MERGE] forward port branch saas-14 up to aab0908818 2018-04-16 14:21:00 +02:00
Christophe Simonis 412501a5dc [MERGE] forward port branch 10.0 up to 7147622665 2018-04-16 11:18:08 +02:00
Nicolas Lempereur 2b380e4e39 [FIX] web_editor: indent just a line inside table
Inside the cell of a table, indenting had several behaviors:

- if the selection is contained in several nodes elements: indent the
  element child nodes of common ancestor

- if the selection is contained in one or more list items: indent these
  list items

- if the selection is contained in one 'content block': indent the whole
  cell content

The two first behaviors are expected, but the third one is a little odd
and unexpected next to other existing editors behaviors.

With this commit, the third behavior becomes:

- if the selection is contained in one `content block`: indent this
  content block

note: 'content block' is defined as p, pre, h1, h2, ..., blockquote, td

opw-1824647
closes #24182
2018-04-12 10:10:05 +02:00
Romain Derie 474f6cfdd8 [FIX] web_editor: changes lost on forward port of 744af2db
Fix of 744af2db that got lost during forward port, this is just rewriting the
diff for the new widget syntax.
2018-04-11 15:02:11 +02:00
Vincent Schippefilt fba356c080 [FIX] web_editor: fix crash when hitting SHIFT+TAB on an empty editor
repro : open any editor (like tasks), empty its content and hit SHIFT+TAB
before this fix: you get a traceback
after this fix: you don't get a traceback
2018-04-10 09:39:08 +02:00
Vincent Schippefilt 02a063fd73 [IMP] web: keyboard navigation in form view
The goal of this commit is to allow fast entry of the same model using
the keyboard for navigating through the form once, by blocking the user
from advancing in the form if there is a required field or once they
went through the form once to get them to a primary action (button)

This commit includes the following changes
    1) Enable moving forward from field to field using the TAB key
    2) Entering the one to many and many to many using the TAB key
        a. When entering it, set the focus on the "add new line" link or
            button
		b. When adding a new line, set the focus on the field visible
            editable field of the new line
        c. Discard adding a new line with ESC key
        d. If the user leaves the first field empty and uses TAB, we
            will cancel the adding of a new line and move to the next
            field of the form
    3) When a field is required and not filled in, do not allow the user
        to move out of the field using the TAB key (the user is still
        allowed to use the mouse though), mark the field as invalid
        instead
    4) After going though the form once, using the TAB key on the last
        field will move the focus to the first primary button of the page
    5) When the focus is on a primary button (EDIT/SAVE), the user cannot
        move the focus forward using the TAB key. Hitting TAB again will
        display a tooltip telling to hit ENTER to activate the button.
        The mouse is still available to move the focus.
    6) When the user saves, the focus is placed on the first primary
        button of the form renderer (like VALIDATE for a new invoice)
    7) On dialogs, primary buttons should stop the users from moving out
        of them, and showing a popup if the user tries
    8) When closing a dialog, the focus will be moved back to the widget
        that opened it.

This commit does not include the following features
    1) Navigation with the keyboard on a selection one to man
    2) Navigate between tabs in a form using the keyboard
    3) Cancelling the adding of a new line in a many to many using the
        ESC key do not set the focus correctly
    4) Enhancing the focusses fields (like blue underline)
2018-04-10 09:39:08 +02:00
Christophe Simonis 860dfb5586 [MERGE] forward port branch 11.0 up to d277adf4d5 2018-04-06 15:36:10 +02:00
Romain Derie 64ef2b396b [FIX] web_editor: same style on div and p in backend in edit mode
Before this commit:
In the web_editor in backend, entering edit mode would display differently text
in `div` and text in `p` but not when viewing the content outside edit mode.

Now, `div` and `p` won't have different style when entering edit mode.
2018-04-04 22:56:45 +02:00
Romain Derie 6be3a2a2a0 [FIX] web_editor: Reduce interline in web editor html lists
Backport of 2b575e9 that landed in master
2018-04-04 22:56:28 +02:00
Christophe Simonis b7f35428f4 [MERGE] forward port branch saas-14 up to c1c10e2c4c 2018-03-29 17:56:29 +02:00
Christophe Simonis c1c10e2c4c [MERGE] forward port branch 10.0 up to 2b4bc45e58 2018-03-29 17:09:37 +02:00
Lucas Perais (lpe) bed33e1ca2 [FIX] web_editor: block only the form's buttons
Commit cae188514f was largely incomplete
and inaccurate in fixing the issue at hand

The aim of this commit is to deactivate the form buttons when the Html field is not completely loaded
thus preventing the temporary value of the iframe to be saved

OPW 1824545
closes #23905
2018-03-28 09:36:33 +02:00
Christophe Simonis 845f4ef7d3 [MERGE] forward port branch saas-11.2 up to 8a7b845353 2018-03-23 10:31:00 +01:00
Christophe Simonis cdbee48888 [MERGE] forward port branch 11.0 up to 39d9c362c5 2018-03-22 20:05:14 +01:00
Romain Derie f5912cbcb3 [IMP] website: make it more noticeable when a page is unpublished
Before this commit, 2 usability issues were reported:
1. Some people would get stuck with unpublished content without even knowing it
   since they would not understand the page is unpublished.
2. People would have a hard time finding the publish button (small toggle on
   the navbar).

Now:
1. We now display a red ribbon on the top right corner specifying the page is
   unpublished. Hopefully it can't be missed.
2. This publish button will be more visible for unpublished content since it
   will be red (danger) color. Hopefully people will notice it at first look.
   Note: It is implemented in a generic way so any 'o_switch' can be turned
   into this version by simply adding the 'o_switch_danger' class to it.

task-44005
Closes #23282
2018-03-22 16:32:51 +01:00
Romain Derie 744af2db60 [FIX] web_editor: correctly set image on double click
Commit 321486851a fixed double click on media dialog when multiple selection is
allowed.
Still, it needs a deeper fix to ensure that the image is/remains selected when
double clicking no matter it's state (selected or not) before the clicks.
Double click should always force the image to be selected before saving.

Step to reproduce:
  - Drop the Image Gallery snippet
  - Open new images manager (Customize > Add images or Add Images directly if no
    images set yet
  - Select an image (simple click)
  - Now double click on it

It won't set the image since when double clicking, it:
1. Unselected the image on the first click (click event)
2. Selected the image on the second click (click event)
3. Unselected the image and saved (dblclick event)
2018-03-22 14:38:17 +01:00
Christophe Simonis 76027a6e12 [MERGE] forward port branch saas-11.2 up to 6773bdbe32 2018-03-21 19:42:34 +01:00
Pratima Gupta 9239ec7de8 [FIX] web_editor: set correct zindex on translation navbar
Commit c06f0f3a35 changed the base navbar zindex.
But the navbar of the translation mode still had old zindex values making the
navbar invisible, in fact under the base navbar.

task-1804662
2018-03-21 19:09:51 +01:00
Romain Derie 321486851a [FIX] web_editor: correctly set image on double click
Commit e011d58bee add the possibility to unselect images on the media dialog.
But it introduced a collateral bug preventing double click to set the image.
Indeed, double click event triggers not only the double click event but also
twice the single click event.

Before commit e011d58bee, it would work fine and as intented on double click:
1. It would trigger twice the single click, selecting twice the image.
2. Then, it would trigger the double click that would save the selected image.

But after the commit:
1. It triggers twice the single click, selecting and then deselecting the image.
2. Then, it triggers the double click that saves nothing since the image got
   unselected on second single click event.

Now, before saving on double click event, we select the image.

task-1815165
2018-03-21 14:18:45 +01:00
Christophe Simonis b51f2d38c2 [MERGE] forward port branch saas-11.2 up to 500e3f4970 2018-03-21 11:04:48 +01:00
Christophe Simonis e0345a4a3f [MERGE] forward port branch 11.0 up to 2835d29979 2018-03-20 11:45:11 +01:00
Nicolas Lempereur 7f216f62b6 [FIX] web_editor: modal fullscreen is fullscreen
Depending on CSS surrounding the editor, the fullscreen component could
fail to set the editor fullscreen.

eg. if the editor is in a modal in a modal (ie. when editing a mail
template when adding an activity and creating a marketing automation
campaign) the fullscreen function would set it to 184px height away 30px
to the screen top.

With this change, `transform` css property is unset on parent elements
of the editor, this was causing the absolute editor to have an offset
parent that was not the body tag.

opw-1824605
closes #23682
2018-03-15 17:12:57 +01:00
Géry Debongnie 64d47c0bc5 [IMP] update ace editor to v1.3.1
Note that we do not do a custom build anymore, since we lazyload the
files anyway.  A custom build will save a few kb, but will not do any
meaningful change to the user experience.  However, it dies impact
negatively our ease of maintenance, so standard build it is.
2018-03-14 09:02:16 +01:00