Commit Graph
1864 Commits
Author SHA1 Message Date
Thanh Dodeur 900dad016d [IMP] website, web_editor: add options to fully control shadows
task-2182909

closes odoo/odoo#46816

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-24 10:47:05 +00:00
Benjamin Vray 1e35fffc89 [FIX] web_editor: get size of resizable elements on mouse down
Get the elements size also on mousedown. Because before that, the
size was only obtained on the start method when some elements did not
yet have its actual size. Example: elements in inactive slides in the
carousel snippet.

task-2162952

closes odoo/odoo#48193

X-original-commit: 2a36c684bb33704e46a6f30b5c501043683da67d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-23 12:42:02 +00:00
fja-odoo 36269c5660 [FIX] web_editor: revert datepicker font awesome 5
datetimepicker today button used a font awesome 5 icon.
Font Awesome 5 was reverted to 4.7 but not this line.

introduced by: 699890d3f0

task-2211899

closes odoo/odoo#48135

X-original-commit: 083f7bb3e1b8aef9e2ebd86bc8c059d39473fe6b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-20 16:55:30 +00:00
Ravi Singh 4511098d19 [FIX] web_editor: properly hide custom opt from colorpalette if required
Part of https://github.com/odoo/odoo/pull/45093
task-2151408

closes odoo/odoo#45093

closes odoo/odoo#47961

X-original-commit: b5ee7905cd08c9a4d18dbe55f52b9f8ea84d23d3
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-18 19:52:33 +00:00
Nicolas Lempereur 375179ed54 [FIX] web_editor: relative URL in background snippet
When the backround is set with the media modal, directly get the URL of
the IMG element (equivalent to `.getAttribute('src')`) instead of doing
`.src` which returns absolute URI.

This fix uses jQuery wrapper so it still works if called with object:

  $({src: 'test.jpg'}).attr('src') === 'test.jpg'

note: before 17237ff31 we already used `.attr('src')`.

opw-2215103
closes #47797

closes odoo/odoo#47872

X-original-commit: f04133d24b2271c0bc465f1628281b19d3656271
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-03-18 08:55:07 +00:00
Samuel Degueldre 7ae7f47cd7 [FIX] web_editor: stop base 64 being saved in the DOM when recropping
When saving after cropping an attachment, a new cropped attachment is
created, and the temporary base64 URL is replaced by the url of the new
attachment. However, when cropping an image for a second time, the
original image is recropped, and the cropped image attachment that was
created previously is overriden with the new data.

Previously, the step that overrides the temporary base64 url with the
url of the croppped attachment was not present when overriding a
previously cropped attachment, meaning it would be saved as is in the
DOM, and the overriden attachment would no longer have any links
pointing to it. This commit fixes that by overriding the temporary
base64 url both when cropping for the first time, but also for
subsequent re-crops of the same image.

closes odoo/odoo#47836

X-original-commit: 3b23f137a2b519b88087452fa4c33a9f97ccdf61
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-17 15:17:30 +00:00
Samuel Degueldre d4a83593c6 [FIX] web_editor: use media client width as default mediaWidth
Previously, when trying to compute the optimized width for an image,
if the mediaWidth option was unspecified, _computeOptimizedWidth would
return NaN, and in all the places where it was specified, it was
specified as 1920 meaning it was essentially useless.

This commit makes the media's clientWidth the default value for
mediaWidth, meaning that if options.mediaWidth is unspecified, the size
of the element in the page (if one exists) is used. This allows the
suggested width to be actually useful, instead of always suggesting
1920. Specifying a mediaWidth in the options overrides this value.

task-2215913

closes odoo/odoo#47767

X-original-commit: 644572819ab9a1525af6077dd20c63957eb9271c
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-17 09:22:05 +00:00
Julien Mougenot 384e516218 [REF] web: Update generic files
General cleaning of some helpers and generic files. The idea is that they are
less likely to be entirely re-written in the near future so this is a way to
keep the code clean, readable and compliant to the current standards. Changes include:
- Use of async/await when possible
- Use of const/let instead of var
- Removal of underscore.js
- Use of native JS instead of jQuery when possible

The logic of the affected code remains the same.
2020-03-13 09:37:29 +00:00
Thanh Dodeur 14c0550b29 [FIX] web_editor: fixes the rgb/rgba color selection
Before this commit, `selectStyle` could incorrectly split the
widgetValue (as described below) which resulted in invalid CSS.

widgetValue: `"rgba(55, 12, 99, 0.7) 55px"`
result: `["rgba(55,", "12,", "99,", "0.7)", "55px"]`
expected: `["rgba(55, 12, 99, 0.7)", "55px"]`
fixed: `["rgba(55,12,99,0.7)", "55px"]`

This commit fixes the issue.

closes odoo/odoo#47515

X-original-commit: 37e6b87341e58769ec2c1d080986e84286d84978
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-12 14:24:38 +00:00
Krupa Patel 703a9c48e9 [FIX] web_editor: close widgets by clicking outside of them
task-2196789

closes odoo/odoo#46298

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-11 10:18:30 +00:00
fja-odoo 5d8367747c [REF] web_editor: remove useless code in palette
Previously the widget was not refreshed everytime it was opened.
Now that it is the case and since the color picker rerenders every time
we select a color:
It is no longer required to select/unselect the colors.
It is no longer required to add custom colors to existing colors.

Part of: https://github.com/odoo/odoo/pull/45872

task-2212288

closes odoo/odoo#47355

X-original-commit: 481fe703e9400fb64e96291914f76d4dca883e29
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-11 09:57:53 +00:00
fja-odoo 2c1ebbf89e [FIX] web_editor: fix select theme color if match
When a default color matches a theme color it will now select the theme
color class instead of a css attribute when clicked.

Part of: https://github.com/odoo/odoo/pull/45872

task-2212288

X-original-commit: d7b3538a814f0e53cd3c5816f8296ad5e4c5f41a
2020-03-11 09:57:52 +00:00
Benjamin Vray ed1a39c618 [FIX] website: avoid error if click on edit when nothing is editable
Avoid traceback when click on edit and nothing is editable on the
page.

task-2199214

closes odoo/odoo#47328

X-original-commit: fd92a78bd18a0fd765d9c3a857adc10e29c025dd
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-10 18:08:20 +00:00
Benjamin Vray 4e48c3ce0f [FIX] web_editor: allow non-alphabetic unit in data-unit
Allow non-alphabetic unit (like percentage) as data-unit value.

task-2194309

closes odoo/odoo#47325

X-original-commit: 1f3dd221134b7b5e5b0eac0ab2ffe447771998b9
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-10 17:33:21 +00:00
fja-odoo 38781f1649 [FIX] web_editor: fix laggy option sections
Some option sections are feeling really laggy (especialy the theme ones
we now have in master/13.2). This was due to the "preview" activation of
the snippet being triggered on mouseover and not on mouseenter.

Introduced by: https://github.com/odoo/odoo/pull/36068

task-2198177

closes odoo/odoo#47303

X-original-commit: d85d912de513de5c81c85a8ff814e0af1e13cefd
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-10 16:02:07 +00:00
David Monjoie 24d69567e5 [FIX] web_editor: fix pictograms in rte
The content of the "wysiwyg.fonts" module is duplicated in
"web_editor.base". This is a mistake that was introduced with the
revert of the saas-12.2 editor.

This duplication is the cause of github issue https://github.com/odoo/odoo/issues/44689.

This commit fixes the issue by requiring the correct module in rte.

closes odoo/odoo#46865

X-original-commit: 8bc3fd2c41c1d0fc1fa22e0849a7204b6712d7b2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-04 11:57:25 +00:00
qsm-odoo 05d17089c4 [FIX] web_editor, website: review default palette system
Before this commit, this was done:

1) Primary variables (app order):

(a) web_editor: define palettes (color + theme + gray), only 1 empty
                one. Mark the first ones as the selected ones.

(b) website: fill all defined palettes with the website-related
             color key and values (body, menu, logo-height, etc).
             + define "website values" palette.

2) Secondary variables (reverse app order):

(c) website: merge the user palettes on top of the selected palettes
             (so user values overriding values added in (a) and (b)),
             the resulting palettes are added in palettes lists and the
             selected palette numbers are set to select those ones.
             + final selection of "website values" palette.

(d) web_editor: final selection of the selected color palette amongst
                the color palettes.

--

The problem with all of this is that the definition of palettes
in themes (occuring between step (b) and (c)) never received the
website-related color key and values of step (b) and were thus forced
to redefine all of those by themself even if they wanted to use the
default website one.

This commit changes the system so that step (a) and (b) now define
"base" palettes (color, theme, gray, website values) and step (c) and
(d) now merge the final selected palettes with those "base" palettes.
This is in fact theoratically more efficient and allows to not force
themes to define every possible palette value we might introduce.

closes odoo/odoo#47097

Related: odoo/design-themes#216
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-07 11:09:36 +00:00
fja-odoo b943dd83f6 [IMP] web_editor: add default opt selectAttribute
Add default option selectAttribute
Most of the logic is shared with selectDataAttribute

part of: https://github.com/odoo/odoo/pull/45397

task-2197008
2020-03-06 16:25:34 +00:00
jpr-odoo 223038682f [FIX] web_editor: correct parsing of dailymotion URL
The parsing of dailymotion URL was not done correctly. This made the
media dialog duplicate the URL params if such an URL was re-edited.

task-2159152

closes odoo/odoo#47102

X-original-commit: 8d8f442f62919b1cee595ed1fae2c6e4f05eb8fa
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-06 14:55:03 +00:00
Krupa Patel 5f85a7605a [FIX] web_editor: add focus in url input of link dialog
Before this commit, when clicking on the link button after focusing a
link, the first input of the link dialog was hidden (label), and the
second input (URL) was not focused.

In this commit, we focus the first *visible* input so users are able to
directly copy-paste URL.

task-2083209

closes odoo/odoo#44931

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-06 13:47:16 +00:00
fja-odoo c730da7197 [FIX] website, *: fix placeholder translate
* = web_editor

InputUserValueWidget's data-placeholder where not translatable.

task-2210358

closes odoo/odoo#47029

X-original-commit: dfaf497de5eb95f1ba65e927631cc48d97ca6127
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-05 17:10:50 +00:00
Samuel Degueldre 5033b870b6 [IMP] web_editor, website: improve border and border radius options
Previously, the border radius option was only available when there was a
border width, but in some cases you want no border, a background color,
and still have rounded corners. This commit makes the option available
when there is either a border OR a background color.

This commit also adds an option to choose the border style between
solid, dashed, dotted and double. The other styles have been left out as
they look very different browser to browser and are not very useful.

task-2195429

closes odoo/odoo#46625

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-04 13:15:01 +00:00
Samuel Degueldre 4e14151465 [FIX] web_editor: stop media-dialog from loading all db attachments
Before this commit, the media-dialog was reading all attachments that
matched certain criteria for each tab. On large databases, this results
in the search_read call timing out, preventing the media-dialog from
opening and making all images and documents un-editable.

One unfortunate consequence of this is that we can no longer use the
firstFilter and lastFilter features, as those rely on fetching all
records and sorting them client-side, as such, this feature has been
removed entirely.

task-2198527
closes https://github.com/odoo/odoo/issues/43113

closes odoo/odoo#46895

X-original-commit: 1e91a89b78ff6019c6120c73ea1eab09b3d58d2f
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-04 14:31:06 +00:00
Jeremy Kersten 67868583ac [FIX] web_editor: avoid traceback on error
Revert of old editor (35b6182) has reintroduce code invalid.
Now the data is wrapped in message (f8fe314e7)

Remove guarded that raise a warning, it is the default behavior now.

closes odoo/odoo#46870

X-original-commit: 9d3a2903fd7bf946c033ec78e959e3ed86754845
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-04 12:34:31 +00:00
Samuel Degueldre 56cddd70d1 [FIX] web_editor: stop snippet editors from finding widget in parent
Because of the event propagating to an option's parent, a snippet option
requesting a uservalue widget would also get back the corresponding
widgets on the parent snippetEditor, this has the potential to cause
unforeseen problems. This commit fixes that by stopping the event's
propagation.

closes odoo/odoo#46724

X-original-commit: 1441b3c2f4f935771b3210be82f7b471aa028b64
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-03-03 11:28:16 +00:00
Thanh Dodeur 560e3af48a [IMP] web_editor, website: adds custom code to head and footer
This commit adds two buttons on the Theme side menu that allow users to
add custom XML to the head and to the footer of the website.

Part of #44633
task-2168391

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-28 13:48:39 +00:00
Jérémy Hennecart 3abf0e7df1 [IMP] web_editor: increase height of iframe
The heigth of the iframe for editing a mail template
was to small, which makes it quite uncovenient.
The height has been raised to improve the usability
of the editing feature.

task-2198656
2020-02-27 09:59:24 +00:00
Kishan Gajjar a4451579bc [FIX] web_editor: do not store base64 of cropped image to html field
On crop dialog save, the image src is set to the base64.
We are creating an attachment for the cropped image if the user save the changes
and after that, we set the newly created image as the src of that image.

Meanwhile, when the user save the 'html' field, it is not creating
any attachment for the cropped image and also it leaves base64 as it is.
Due to that field store large data into the database.

this commit makes sure that attachment is created for cropped images
and update src before storing field value to the database.

closes odoo/odoo#46455

X-original-commit: 2bcaa25e67260e3013d4400d1b3ce380ba5cbd1d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-27 13:53:25 +00:00
Romain DerieandJeremy Kersten 4eafd78847 [FIX] web_editor, website: handle date edition in all lang and format
Before d00c0e317, `Datetime` fields would be editable in frontend but would
have unexpected results, especially in non-English languages, for when the
english lang format had been changed.
It would also crash when saving non-English strings, such as `Lundi`.
For more details, see https://github.com/odoo/odoo/pull/44484#issuecomment-586850490

Since d00c0e317, only date displayed in lang format would be editable, which
case is Event page in Odoo 12.0. Everywhere else, the format is changed for a
nicer layout, either with `widget=XXX` or `t-options=YYY`, such as:
`<time t-field="record.date" t-options='{"format": "MMM d, yyyy"}'/>`
`<time t-field="record.date" t-options="{'time_only': 'true', 'format': 'short'}"/>`

When a date parsing crashes during editor save, the problem is not only that
the date can be saved, but the whole changes of the page are lost, as they
won't be saved either.

This commit attempts to fix every languages cases, regardless of the website
lang or user lang.
To do so, we store the date in the user lang format in a data attribute of
every date field in the DOM. Once the field is clicked (to edit probably),
that value will replace the one displayed according to the widget/options.
That way, dates will always be sent to the server in the user lang format,
avoiding any possible mismatch.

This whole fix apply to `Datetime` and `Date` fields.

opw-2183055
Closes #44484
Closes #45555
Fixes #44047

closes odoo/odoo#45725

closes odoo/odoo#45997

X-original-commit: c0db9bb8027ff926c619aebe6e0a5cdd05808232
Original-signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Co-authored-by: Romain Derie <rde@odoo.com>
Co-authored-by: Jeremy Kersten <jke@odoo.com>
2020-02-21 18:57:59 +00:00
Harpritsinh SisodiyaandMohammed Shekha 7639f7fbcb [IMP] web_editor: check resource is custom or not to display warning on editor
adds _isCustomResource method which will check whether resource is custom or
not, this method checks for JS and SCSS resource, if resource is custom then
do not show "No Update" warning inside ace editor.

task-2167570

closes odoo/odoo#44536

Related: odoo/enterprise#8368
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-02-21 08:34:24 +00:00
Romain Estievenart 4582f4ade3 [FIX] web_editor: add scope to apply z-index web-editor dialog on mobile
this bug was introduce by the inline z-index define inside the template 'web_editor.FieldTextHtml.fullscreen' (https://github.com/odoo/odoo/commit/912996fe902c41cafa12dcfe09713ce9857f95ab#diff-76a385e3a3e67f1b88b34afd8181f732R13)

This was breaking the z-index web-editor dialog (using inside mass-mailing), so a first fix using a new z-index was made for the web-editor dialog (https://github.com/odoo/odoo/commit/65c8d33c2922bd90e2755cff0a6751c8b3b130d8)

But we a missing a scope to identifiable a web-editor dialog was missing. So this commit add a class to allow target only the web_editor dialog.

Task ID: 2198649

closes odoo/odoo#45702

X-original-commit: 441a5fa5a67f25398744ea18860eebdc4d17dddb
Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2020-02-19 11:21:39 +00:00
Andrea Grazioso (agr-odoo) 3ee9a9fbdc [FIX] web_editor: deny videos in mass mailing
Create a new mass mailing, add a video via youtube embed link, save.
Send email.

Embedding a video can't work because it embeds an iframe, which is not
supported by most email clients for security reasons.
Extending the noVideo flag also to mass_mailing

opw-2179665

closes odoo/odoo#45104

X-original-commit: f9f8c9cc4075fdc5fd4556aa49c914054469198a
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-02-11 14:44:01 +00:00
Samuel Degueldre 416500f6e3 [IMP] web_editor, website: add callback to editor clone and remove
We recently transitioned to async option methods, this allows us to have
better control on the order of execution in the edition workflow, and
among other things, keep the editor's UI in sync with the current state
of the DOM.

However, some snippet options (such as the number of columns option)
need to remove or clone portions of the DOM, and as such, trigger the
onClone or onRemove methods of the snippets contained in that portion if
applicable. Because these methods are defined on other options, we first
need to make sure all the snippetEditors for this portion are created,
which is asynchronous.

This commit adds support for an onSuccess callback to the
'clone_snippet' and 'remove_snippet' event handlers, such that options
can choose to be notified when the work has been done, allowing them to
wait for it before proceeding.

This commit also adapts the layout_column snippet option to make use of
that new feature, and remove code that was used as a workaround before,
ie: precomputing the expected number of columns after the clone/remove,
and using that number to adjust the width of the columns and update the
UI. We can now just wait for the clone/remove, and use the real number
of columns currently in the DOM.

closes odoo/odoo#45343

X-original-commit: c159d58ce9cfca4a44f159b18eb10d1138977e23
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-13 18:02:48 +00:00
fja-odoo 1262648486 [FIX] web_editor, website_form: fix submit btn edit
The edition of the submit button's text was broken.

Part of https://github.com/odoo/odoo/pull/44907

closes odoo/odoo#45124

X-original-commit: 85966ac29b53d9e1c2ad1efb2c35ab13c9baae89
Related: odoo/enterprise#8360
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-11 17:35:07 +00:00
qsm-odoo 0ac7d67c5f [FIX] web_editor: fix gallery blocking the editor after image reordering
When snippets deeply alter the DOM (e.g. image reordering in gallery),
the related option might be destroyed since they are referencing old
DOM. If such a case occurred, the destroyed option was still waiting for
an option update response by the editor before being considered as
finished... which then never occurred and blocked the editor.

closes odoo/odoo#44998

X-original-commit: 9eeea4c4107dc15984c475582d5ee58a17cd2568
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-10 14:28:34 +00:00
Samuel Degueldre 99427c2c5a [FIX] web_editor: fix apply-to methods not being awaited
When the apply-to data attribute was first introduced, a mistake was
made when storing the results of the methods calls, using _.each instead
of _.map to associate each target element with the promise of the method
execution, as a result, Promise.all would resolve immediately instead of
waiting. While there are no currently documented bug caused by this,
they are just waiting to happen.

This commit fixes that.

closes odoo/odoo#44988

X-original-commit: 32271be1f696c11b3e5157426b8f7c9efa93134b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-10 13:48:40 +00:00
fja-odoo 574bf9bb12 [FIX] web_editor: fix color palette custom color behaviors
Selecting a css color equals to a theme color via the custom color
was not selecting the theme color.

Opening and closing the custom color without picking a color was
unselecting the selected color.

Now the custom color picker has the selected color as default even if it
does not appear in the palette as selected. This was appearing in the
parallax snippet as no custom color is displayed.

closes odoo/odoo#44986

X-original-commit: 0c8be24ac72c223c12eadbdcf635628f203a6766
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-10 13:48:19 +00:00
qsm-odooandfja-odoo ed999bc88e [FIX] web_editor: fix image removal inside image gallery
Since we use Promise instead of jQuery deferred, the onRemove method
class was no longer triggered before the actual removal of the elements.

Original fix with https://github.com/odoo/odoo/pull/43918
This PR is the same with the async/await form, not breaking the history
of half of the removeSnippet method's lines.

closes odoo/odoo#44963

X-original-commit: 37941159c82d487ff172f0e6b27028f23ab32810
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: fja-odoo <fja@odoo.com>
2020-02-10 11:43:00 +00:00
fja-odoo 1ebc4661dc [FIX] web_editor, *: unblock editor after any option dialog closing
*: website

Some dialog promises were not resolved on close, blocking the editor.

closes odoo/odoo#44953

X-original-commit: 20f97470cdc59a817526305806e94b222f26a0f2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-10 10:54:02 +00:00
jvm-odoo fe6a45945a [FIX] web_editor: trigger content_changed when updating alt or title
Issue

	- Install Website
	- Go on your website
	- Add text block with image
	- Change ONLY the image's alt and/or the image's title text
	- Save dialog
	- Save page

	Not saved

Cause

	The element doesn't become dirty after changes in alt dialog.

Solution

	Trigger content_changed to make the element become dirty.

OPW-2189909

closes odoo/odoo#44885

X-original-commit: 4f1712075fbc4d95d83690fbcfe72f9b72260254
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-02-07 15:04:57 +00:00
qsm-odoo ef03b02af6 [FIX] web_editor, website, *: editor notify method must be synchronous
* website_form

Some technical explanations:

The method became async because the `setTarget` call which was in there
became `async` since it performed an UI update. As this method being
async is a problem with some snippets, it is best to keep it synchronous
for now. For this, the UI update in `setTarget` is removed and becomes
the responsibility of the caller. Nothing relied on it except one code,
which is solved by calling `onFocus` before the UI update which occurs
on focus, as it is already the case in master.

closes odoo/odoo#44850

X-original-commit: 53bba0660237abbcadc9675fd89ec94a2a31e130
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-07 12:43:25 +00:00
qsm-odoo 6fb4ed44a0 [IMP] website, *: make theme custo options act as simple snippet options
* web_editor, theme_bootswatch

Instead of having an entirely dedicated system for theme options in a
third tab of the left panel, those theme options are now simple snippet
options. See the customizeWebsite generic method.

This allows to make any option available in the third tab or on any
meaningful element like the header or the footer. This also allows to
take advantage of all the features of the left panel: dependencies,
visibility update, etc.

Note: same as before, those changes do apply the color/size/layout
immediately on the website, even if not saved. Changing that behavior
is complex and might be the job of another task.

Part of https://github.com/odoo/odoo/pull/41166
task-2088298
2020-02-05 23:49:53 +00:00
Samuel Degueldre 3bb666c226 [REF] website, web_editor: move theme customization to edit mode
Previously, theme customization was done through a modal dialog in the
website module, this was not very user friendly since the rest of the
customization for the website design was done from edit mode, meaning
the user had to exit edit mode to customize things such as theme colors
or fonts. It was also rather confusing to have these seemingly related
things in completely unrelated places.

This commit moves all of the options that used to be in the theme
customization modal into a new tab in the editor's left panel.

This commit is mainly just about rendering the old modal as a third left
panel content. See next commit for deeper changes.

Note: same as before, those changes do apply the color/size/layout
immediately on the website, even if not saved. Changing that behavior
is complex and might be the job of another task.

Part of https://github.com/odoo/odoo/pull/41166
task-2088298
2020-02-05 23:49:53 +00:00
qsm-odoo 1e576ee899 [FIX] web_editor: consider negative values in the left panel
A negative value, even if legit, was not understood by the editor and
induced empty inputs in the left panel.

closes odoo/odoo#44683

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-05 21:39:22 +00:00
fja-odoo 617eba9417 [IMP] website_form, *: entirely review s_website_form snippet
*: web_editor, website_crm, website_form_project,
website_hr_recruitment, website_sale

The form builder is now using the left panel option system. Many new
options are introduced to build better forms more quickly.

The tests are now running with the new website_form implementation.

Part of: https://github.com/odoo/odoo/pull/42189
task-2092425

closes odoo/odoo#42189

Related: odoo/enterprise#7365
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-05 16:13:25 +00:00
Jeremy Kersten 537644ec3e [IMP] website_blog: activate cover snippet on edit mode enter
As this is the first thing you want to do when creating a blog, it will ease
the onboarding.

task-2144335
2020-02-04 10:59:22 +00:00
Romain Derie b3ffb756a2 [IMP] web: restore blockquote style lost with BS4
Before this commit, the web_editor option 'Style' which has a `Quote` entry
would not do anything visually.

Indeed, what it does is inserting a `<blockquote/>` element in the DOM but is
has no style anymore in BS4.

This commit restore the style we had with BS3.

task-2144335
2020-02-03 15:25:20 +00:00
qsm-odoo a5281de40e [FIX] web_editor: always notify snippet option 'reset' after 'preview'
Some code was added to prevent notifying a 'reset' if there was no
'preview' before. Unfortunately, checking "if there was a 'preview'
before" cannot be done properly so some 'reset' were stopped while they
should not have. This commit simply removes the code which is in fact
not needed.

closes odoo/odoo#44499

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-03 13:58:38 +00:00
fja-odoo c547d7c1c5 [FIX] web_editor: fix input selection not supported
Some elements like the file input are not compatible with selection.
Since there is no reliable way of figuring out if the element is
compatible or not we will simply try catch it.

closes odoo/odoo#44470

X-original-commit: 1f0a0b380c2738795b0b5a7976692d9e9cd88583
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-03 11:07:15 +00:00
Jason Van Malder cf2f53e4cf [FIX] web_editor: fix required html fields
Issue

    - Studio
    - Add an required html field
    - Create new record
    - Leave it empty

    It is saved

Cause

    The isSet function of FieldHtml widget, have a "/" in the <br> tag
    and summernote empty = <p><br></p>. If you add a space, the value
    becomes <p>&nbsp;&nbsp;   <p>.

Solution

    Remove the "/" and the spaces, check if value != <p></p> &&
    <p><br></p>

OPW-2183687

closes odoo/odoo#44427

X-original-commit: c984b1b1210cea1e63f3bc66cec2120554c76c2a
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-31 17:20:34 +00:00