When saving a canvas using canvas.toObject(), custom object attributes are skipped, but also some build in ones such as: borderColor. This can be quite annoying since saving the canvas using canvas.toObject() and loading it again using loadFromJson() can load something that is not the same.
Luckily there is a solution to define properties that should be included in canvas.toObject() which I found in a separate SO thread:
fabric.Object.prototype.toObject = (function (toObject) {
return function (propertiesToInclude) {
propertiesToInclude = (propertiesToInclude || []).concat(
['uuid','rt_attributes']
);
return toObject.apply(this, [propertiesToInclude]);
};
})(fabric.Object.prototype.toObject);
But however, since in my use case there are a lot of properties to include, I am wondering if there is a way to just include all object attributes when running canvas.toObject(), or in other words, is it possible to disable this filter?
My side question is if anyone knows where I can find this list of attributes that gets ignored when running canvas.toObject()?
Thanks