1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-28 11:00:27 +00:00

Disable overriding core widgets in safe mode

This commit is contained in:
jeremy@jermolene.com 2022-09-03 12:58:10 +01:00
parent f6ee0cdf4c
commit 00b6645c94

View File

@ -503,8 +503,8 @@ Widget.prototype.makeChildWidget = function(parseTreeNode,options) {
var variableDefinitionName = "$" + parseTreeNode.type,
variableInfo = this.getVariableInfo(variableDefinitionName,{allowSelfAssigned: true}),
isOverrideable = function() {
// Widget is overrideable if it has a double dollar user defined name, or if it is an existing JS widget
return parseTreeNode.type.charAt(0) === "$" || !!self.widgetClasses[parseTreeNode.type];
// Widget is overrideable if it has a double dollar user defined name, or if it is an existing JS widget and we're not in safe mode
return parseTreeNode.type.charAt(0) === "$" || (!!self.widgetClasses[parseTreeNode.type] && !$tw.safeMode);
};
if(!parseTreeNode.isNotRemappable && isOverrideable() && variableInfo && variableInfo.srcVariable && variableInfo.srcVariable.value && variableInfo.srcVariable.isWidgetDefinition) {
var newParseTreeNode = {