From d92c3b00c3faee309d2751c3d2349a438a6b68ad Mon Sep 17 00:00:00 2001 From: mattpass Date: Thu, 1 Jul 2021 21:13:30 +0100 Subject: [PATCH] Now displaying Replaced text when successfully replaced --- assets/js/icecoder.js | 8 ++++++++ lib/multiple-results.php | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/assets/js/icecoder.js b/assets/js/icecoder.js index c566993..a6cffe1 100644 --- a/assets/js/icecoder.js +++ b/assets/js/icecoder.js @@ -32,6 +32,7 @@ var ICEcoder = { resultsLines: [], // Array of lines containing results (simpler version of results) findResult: 0, // Array position of current find in results findRegex: false, // If find attempts are done using regex + findUpdateMultiInfoID: [], // ID of multiple results modal elem to update & text, when rename/replace is successful scrollbarVisible: false, // Indicates if the main pane has a scrollbar mouseDown: false, // If the mouse is down mouseDownInCM: false, // If the mouse is down within CodeMirror instance (can be false, 'editor' or 'gutter') @@ -3596,8 +3597,15 @@ var ICEcoder = { console.log(statusObj); ICEcoder.serverMessage(); ICEcoder.serverQueue('del'); + // Successful, process the requested action to take now } else { eval(statusObj.action.doNext); + // If we need to update the multiple results pane with new info now a task is done successfully + if (ICEcoder.findUpdateMultiInfoID[0]) { + get('multipleResultsIFrame').contentWindow.document.getElementById(ICEcoder.findUpdateMultiInfoID[0]) + .innerHTML = ICEcoder.findUpdateMultiInfoID[1]; + ICEcoder.findUpdateMultiInfoID = []; + } } // Some other response? Display a message about that } else { diff --git a/lib/multiple-results.php b/lib/multiple-results.php index e990db1..3d518ed 100644 --- a/lib/multiple-results.php +++ b/lib/multiple-results.php @@ -266,9 +266,10 @@ if (true === isset($_GET['target']) && false !== strpos($_GET['target'], "filena const renameSingle = function(arrayRef) { fileRef = spansArray[arrayRef].id.replace(/\|/g, "/").replace(/_perms/g, ""); const rExp = new RegExp(true === parent.ICEcoder.findRegex ? findText : parent.ICEcoder.escapeRegex(findText), "gi"); - // TODO: get this working + // TODO: get this working with regex newName = spansArray[arrayRef].id.replace(/\|/g, "/").replace(/_perms/g, "").replace(rExp, ""); parent.ICEcoder.renameFile(fileRef,newName); + parent.ICEcoder.findUpdateMultiInfoID = ['foundCount' + arrayRef, 'Renamed']; }; const renameAll = function() {