From f2db0265d4133f18ac100c6be250302582a84581 Mon Sep 17 00:00:00 2001 From: Adam Blake Date: Sat, 20 Jun 2020 13:05:57 -0700 Subject: [PATCH] Respect cell.is_editable during find-and-replace Find and replace (searchandreplace.js) will overwrite the contents of cells even if they are marked as non-editable. Add a check against the cell's is_editable() method to ensure this only happens for editable cells. --- notebook/static/notebook/js/searchandreplace.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/notebook/static/notebook/js/searchandreplace.js b/notebook/static/notebook/js/searchandreplace.js index 1b2187a36..07a20dc5b 100644 --- a/notebook/static/notebook/js/searchandreplace.js +++ b/notebook/static/notebook/js/searchandreplace.js @@ -308,6 +308,10 @@ define([ var cells = get_cells(env); for (var c = 0; c < cells.length; c++) { var cell = cells[c]; + if (!cell.is_editable()) { + continue; + } + var oldvalue = cell.code_mirror.getValue(); var newvalue = oldvalue.replace(reg , replaceValue); cell.code_mirror.setValue(newvalue);