mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-14 18:49:02 +08:00
add option to disable regex searches
This commit is contained in:
parent
0476d35599
commit
0e5aa7f116
@ -175,7 +175,9 @@ export default {
|
||||
new HardBreak(),
|
||||
new Heading({ levels: [1, 2, 3] }),
|
||||
new HorizontalRule(),
|
||||
new Search(),
|
||||
new Search({
|
||||
disableRegex: false,
|
||||
}),
|
||||
new ListItem(),
|
||||
new OrderedList(),
|
||||
new TodoItem(),
|
||||
|
@ -24,6 +24,7 @@ export default class Search extends Extension {
|
||||
findClass: 'find',
|
||||
searching: false,
|
||||
caseSensitive: false,
|
||||
disableRegex: true,
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,7 +104,7 @@ export default class Search extends Extension {
|
||||
find(searchTerm) {
|
||||
return ({ tr }, dispatch) => {
|
||||
this.options.searching = true
|
||||
this.searchTerm = searchTerm
|
||||
this.searchTerm = (this.options.disableRegex) ? searchTerm.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&') : searchTerm
|
||||
|
||||
dispatch(tr)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user