[FIX] website: stop messing up countdown snippets on undo
Like any snippet creating dynamic elements on page load, we need to use a special class on those elements to mitigate the undo/redo system's imperfections. closes odoo/odoo#64893 X-original-commit: 0d9a782681fcbd50ca687ae3158dc12f5b3571cb Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -125,7 +125,7 @@ const CountdownWidget = publicWidget.Widget.extend({
|
||||
this.diff = [];
|
||||
if (this._isUnitVisible('d') && !(this.onlyOneUnit && delta < 86400)) {
|
||||
this.diff.push({
|
||||
canvas: $('<canvas/>').appendTo(this.$wrapper)[0],
|
||||
canvas: $('<canvas/>', {class: 'o_temp_auto_element'}).appendTo(this.$wrapper)[0],
|
||||
// There is no logical number of unit (total) on which day units
|
||||
// can be compared against, so we use an arbitrary number.
|
||||
total: 15,
|
||||
@@ -135,7 +135,7 @@ const CountdownWidget = publicWidget.Widget.extend({
|
||||
}
|
||||
if (this._isUnitVisible('h') || (this.onlyOneUnit && delta < 86400 && delta > 3600)) {
|
||||
this.diff.push({
|
||||
canvas: $('<canvas/>').appendTo(this.$wrapper)[0],
|
||||
canvas: $('<canvas/>', {class: 'o_temp_auto_element'}).appendTo(this.$wrapper)[0],
|
||||
total: 24,
|
||||
label: _t("Hours"),
|
||||
nbSeconds: 3600,
|
||||
@@ -143,7 +143,7 @@ const CountdownWidget = publicWidget.Widget.extend({
|
||||
}
|
||||
if (this._isUnitVisible('m') || (this.onlyOneUnit && delta < 3600 && delta > 60)) {
|
||||
this.diff.push({
|
||||
canvas: $('<canvas/>').appendTo(this.$wrapper)[0],
|
||||
canvas: $('<canvas/>', {class: 'o_temp_auto_element'}).appendTo(this.$wrapper)[0],
|
||||
total: 60,
|
||||
label: _t("Minutes"),
|
||||
nbSeconds: 60,
|
||||
@@ -151,7 +151,7 @@ const CountdownWidget = publicWidget.Widget.extend({
|
||||
}
|
||||
if (this._isUnitVisible('s') || (this.onlyOneUnit && delta < 60)) {
|
||||
this.diff.push({
|
||||
canvas: $('<canvas/>').appendTo(this.$wrapper)[0],
|
||||
canvas: $('<canvas/>', {class: 'o_temp_auto_element'}).appendTo(this.$wrapper)[0],
|
||||
total: 60,
|
||||
label: _t("Seconds"),
|
||||
nbSeconds: 1,
|
||||
|
||||
Reference in New Issue
Block a user