mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-11-02 13:04:27 +00:00
Freeze array or object tiddler fields
Previously object fields like the tags array weren’t frozen.
This commit is contained in:
1 parent
721e333a20
commit
279626a3e3
1 file changed
+9
-3
+9
-3
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user