mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-28 02:50:27 +00:00
Freeze array or object tiddler fields
Previously object fields like the tags array weren’t frozen.
This commit is contained in:
parent
721e333a20
commit
279626a3e3
12
boot/boot.js
12
boot/boot.js
@ -743,12 +743,18 @@ $tw.Tiddler = function(/* [fields,] fields */) {
|
||||
}
|
||||
} else {
|
||||
// Parse the field with the associated field module (if any)
|
||||
var fieldModule = $tw.Tiddler.fieldModules[t];
|
||||
var fieldModule = $tw.Tiddler.fieldModules[t],
|
||||
value;
|
||||
if(fieldModule && fieldModule.parse) {
|
||||
this.fields[t] = fieldModule.parse.call(this,src[t]);
|
||||
value = fieldModule.parse.call(this,src[t]);
|
||||
} else {
|
||||
this.fields[t] = src[t];
|
||||
value = src[t];
|
||||
}
|
||||
// Freeze the field to keep it immutable
|
||||
if(typeof value === "object") {
|
||||
Object.freeze(value);
|
||||
}
|
||||
this.fields[t] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user