Skip to content

Commit b00fc62

Browse files
committed
use _.escapeRegExp since RegExp.escape seems to be not always there...
SQUASHED: AUTO-COMMIT-src-components-tools-lively-container-navbar.js,AUTO-COMMIT-src-components-tools-lively-index-search.js,
1 parent 394dd36 commit b00fc62

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/components/tools/lively-container-navbar.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import Strings from "src/client/strings.js"
1111

1212
import FileIndex from "src/client/fileindex.js"
1313
import SearchRoots from "src/client/search-roots.js"
14+
import _ from 'src/external/lodash/lodash.js'
15+
1416
/*MD # Navbar
1517
1618
![](lively-container-navbar.png){width=300px}
@@ -537,7 +539,7 @@ export default class LivelyContainerNavbar extends Morph {
537539
if (prefix.length < 4) {
538540
prefix = ""
539541
}
540-
link.innerHTML = icon + title.replace(new RegExp("^" + RegExp.escape(prefix)), "<span class='prefix'>" +prefix +"</span>")
542+
link.innerHTML = icon + title.replace(new RegExp("^" + _.escapeRegExp(prefix)), "<span class='prefix'>" +prefix +"</span>")
541543
this.lastTitle = title
542544

543545
var href = ea.href || ea.name;

src/components/tools/lively-index-search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ export default class IndexSearch extends Morph {
271271

272272
var newText = file.text.replace(new RegExp(this.pattern, "g"), this.replace)
273273
file.replaced = newText
274-
var replacedText = this.hightlightPattern(newText, RegExp.escape(this.replace))
274+
var replacedText = this.hightlightPattern(newText, _.escapeRegExp(this.replace))
275275
var replacePreviewColumn = <td id="replace">{replacedText}</td>
276276
file.item.appendChild(replacePreviewColumn)
277277

0 commit comments

Comments
 (0)