changeset 6441e153032d in sao:5.2
details: https://hg.tryton.org/sao?cmd=changeset;node=6441e153032d
description:
Always normalize RichText values when comparing
issue8582
review262011002
(grafted from eb479dcafcda7153661ac6d15a1a405071cd631f)
diffstat:
src/view/form.js | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diffs (34 lines):
diff -r 98b19b2d0a1b -r 6441e153032d src/view/form.js
--- a/src/view/form.js Sun Sep 01 23:40:39 2019 +0200
+++ b/src/view/form.js Sun Aug 25 12:46:56 2019 +0200
@@ -1973,18 +1973,23 @@
focus: function() {
this.input.focus();
},
+ get_value: function() {
+ return this._normalize_markup(this.input.html());
+ },
set_value: function() {
// avoid modification of not normalized value
- this._normalize(this.input);
- var value = this.input.html() || '';
- var previous = this.field.get_client(this.record);
- var previous_el = jQuery('<div/>').html(previous || '');
- this._normalize(previous_el);
- if (value == previous_el.html()) {
- value = previous;
+ var value = this.get_value();
+ var prev_value = this.field.get_client(this.record);
+ if (value == this._normalize_markup(prev_value)) {
+ value = prev_value;
}
this.field.set_client(this.record, value);
},
+ _normalize_markup: function(content) {
+ var el = jQuery('<div/>').html(content || '');
+ this._normalize(el);
+ return el.html();
+ },
_normalize: function(el) {
// TODO order attributes
el.find('div').each(function(i, el) {