Fix rich text loss of data #1074

This commit is contained in:
yflory 2023-06-30 13:09:31 +02:00
parent b2788744de
commit 89e08b08bf
1 changed files with 3 additions and 1 deletions

View File

@ -108,11 +108,13 @@ define([
var contentGetter = function () { return UNINITIALIZED; };
var cursorGetter;
var normalize0 = function (x) { return x; };
var EMPTY = {};
var normalize = function (x) {
x = normalize0(x);
if (Array.isArray(x)) {
var outa = Array.prototype.slice.call(x);
EMPTY = [];
if (typeof(outa[outa.length-1].metadata) === 'object') { outa.pop(); }
return outa;
} else if (typeof(x) === 'object') {
@ -239,7 +241,7 @@ define([
var sNew = JSONSortify(newContent);
if (sNew === JSONSortify(oldContent)) { return; }
try {
if (sNew !== JSONSortify(normalize(oldContent || {}))) {
if (integration && sNew !== JSONSortify(normalize(oldContent || EMPTY))) {
evIntegrationSave.fire();
}
evContentUpdate.fire(newContent, waitFor);