1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-30 20:10:28 +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, var variableDefinitionName = "$" + parseTreeNode.type,
variableInfo = this.getVariableInfo(variableDefinitionName,{allowSelfAssigned: true}), variableInfo = this.getVariableInfo(variableDefinitionName,{allowSelfAssigned: true}),
isOverrideable = function() { isOverrideable = function() {
// Widget is overrideable if it has a double dollar user defined name, or if it is an existing JS widget // 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]; return parseTreeNode.type.charAt(0) === "$" || (!!self.widgetClasses[parseTreeNode.type] && !$tw.safeMode);
}; };
if(!parseTreeNode.isNotRemappable && isOverrideable() && variableInfo && variableInfo.srcVariable && variableInfo.srcVariable.value && variableInfo.srcVariable.isWidgetDefinition) { if(!parseTreeNode.isNotRemappable && isOverrideable() && variableInfo && variableInfo.srcVariable && variableInfo.srcVariable.value && variableInfo.srcVariable.isWidgetDefinition) {
var newParseTreeNode = { var newParseTreeNode = {