diff --git a/client/index.jsx b/client/index.jsx index 4b79e95f12..9bae4e5a01 100644 --- a/client/index.jsx +++ b/client/index.jsx @@ -23,7 +23,10 @@ const store = setupStore(initialState); const DONATE_LOGO_IMAGE_URL = 'https://donorbox.org/images/white_logo.svg'; +const showDonateCampaign = false; + if ( + showDonateCampaign && window.location.href.indexOf('full') === -1 && window.location.href.indexOf('embed') === -1 ) { diff --git a/client/utils/rename-variable.js b/client/utils/rename-variable.js index 68557365b8..2cbd5904cf 100644 --- a/client/utils/rename-variable.js +++ b/client/utils/rename-variable.js @@ -46,9 +46,6 @@ function startRenaming(cm, ast, fromPos, newName, oldName) { const startIndex = node.start; const endIndex = node.end; - - if (node.name !== oldName) return; - const pos = cm.posFromIndex(startIndex); if ( @@ -57,9 +54,7 @@ function startRenaming(cm, ast, fromPos, newName, oldName) { parent.type === 'ArrowFunctionExpression') && parent.params.some((p) => p.type === 'Identifier' && p.name === oldName) ) { - if (!parent.params.includes(node)) { - return; - } + if (!parent.params.includes(node)) return; } if ( @@ -67,9 +62,7 @@ function startRenaming(cm, ast, fromPos, newName, oldName) { parent.property === node && !parent.computed ) { - if (parent.object.type === 'ThisExpression' && !isBaseThis) { - return; - } + if (parent.object.type === 'ThisExpression' && !isBaseThis) return; } const thisContext = getContext( @@ -84,6 +77,8 @@ function startRenaming(cm, ast, fromPos, newName, oldName) { let shouldRenameGlobalVar = false; const isThis = isThisReference(cm, ast, pos, oldName); + shouldRenameGlobalVar = isGlobal && thisContext === 'global'; + // Handle renaming inside classes if (isInsideClassContext) { const tempPos = { @@ -121,14 +116,6 @@ function startRenaming(cm, ast, fromPos, newName, oldName) { isThis === isBaseThis && baseContext === thisContext ) { - Object.entries(classMeta.methodVars || {}).forEach( - ([methodName, vars]) => { - if (!vars.includes(oldName) && thisContext === methodName) { - const shouldRenameMethodVar = true; - } - } - ); - shouldRename = thisContext === baseContext && (currentMethodName === 'constructor' || shouldRenameGlobalVar); @@ -162,7 +149,6 @@ function startRenaming(cm, ast, fromPos, newName, oldName) { isGlobal && !Object.prototype.hasOwnProperty.call(thisScopeVars, oldName); } - shouldRenameGlobalVar = isGlobal && thisContext === 'global'; } // Handle renaming outside classes else { @@ -201,15 +187,13 @@ function startRenaming(cm, ast, fromPos, newName, oldName) { isBaseThis ); - if ( - isThisGlobal && - thisContext in userDefinedFunctionMetadata && - userDefinedFunctionMetadata[thisContext].params.some( - (param) => param.p === oldName - ) - ) { - return; - } + const params = userDefinedFunctionMetadata[thisContext]?.params || []; + const hasParamNamedOldName = params.some((param) => + typeof param === 'string' + ? param === oldName + : param?.name === oldName || param?.p === oldName + ); + if (isThisGlobal && hasParamNamedOldName) return; const methodPath = path.findParent((p) => p.isClassMethod()); let currentMethodName = null; diff --git a/client/utils/showRenameDialog.jsx b/client/utils/showRenameDialog.jsx index 4d069ed7bb..47514a6044 100644 --- a/client/utils/showRenameDialog.jsx +++ b/client/utils/showRenameDialog.jsx @@ -1,6 +1,6 @@ import announceToScreenReader from './ScreenReaderHelper'; import p5CodeAstAnalyzer from './p5CodeAstAnalyzer'; -import { getClassContext, getContext, getAST } from './renameVariableHelper'; +import { getContext, getAST } from './renameVariableHelper'; const allFuncs = require('./p5-reference-functions.json'); diff --git a/common/p5Versions.js b/common/p5Versions.js index a4368ac147..60fe10cf16 100644 --- a/common/p5Versions.js +++ b/common/p5Versions.js @@ -1,4 +1,4 @@ -export const currentP5Version = '1.11.10'; // Don't update to 2.x until 2026 +export const currentP5Version = '1.11.11'; // Don't update to 2.x until 2026 // Generated from https://www.npmjs.com/package/p5?activeTab=versions // Run this in the console: