vue-codemirror
vue-codemirror copied to clipboard
getSearchCursor is not a function
Describe the bug
Get error when using getSearchCursor function
Reproduction
code:
import 'codemirror/addon/search/search'
import 'codemirror/addon/search/searchcursor'
require('codemirror/addon/search/search')
require('codemirror/addon/search/searchcursor')
var cursor = this.$refs.sqlEditor.codemirror.getSearchCursor(item.matching_substring, false)
while (cursor.findNext()) {
this.$refs.sqlEditor.codemirror.markText(
cursor.from(),
cursor.to(),
{ css: 'color: red' }
)
}
Error:
this.$refs.sqlEditor.codemirror.getSearchCursor is not a function"
found in
---> <Index> at src/views/sql/index.vue
<AppMain> at src/layout/components/AppMain.vue
<Layout> at src/layout/index.vue
<App> at src/App.vue
<Root>
System Info
npx: installed 1 in 1.293s
System:
OS: macOS 12.5.1
CPU: (12) x64 Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz
Memory: 153.31 MB / 32.00 GB
Shell: 3.4.1 - /usr/local/bin/fish
Binaries:
Node: 14.9.0 - /usr/local/bin/node
Yarn: 1.22.11 - /usr/local/bin/yarn
npm: 6.14.8 - /usr/local/bin/npm
Browsers:
Safari: 15.6.1
npmPackages:
@vue/cli-plugin-babel: 4.4.4 => 4.4.4
@vue/cli-plugin-eslint: 4.4.4 => 4.4.4
@vue/cli-plugin-unit-jest: 4.4.4 => 4.4.4
@vue/cli-service: 4.4.4 => 4.4.4
@vue/composition-api: ^1.0.0-rc.2 => 1.7.0
@vue/test-utils: 1.0.0-beta.29 => 1.0.0-beta.29
autoprefixer: 9.5.1 => 9.5.1
axios: 0.18.1 => 0.18.1
babel-eslint: 10.1.0 => 10.1.0
babel-jest: 23.6.0 => 23.6.0
babel-plugin-dynamic-import-node: 2.3.3 => 2.3.3
chalk: 2.4.2 => 2.4.2
codemirror: 5.41.0 => 5.41.0
connect: 3.6.6 => 3.6.6
core-js: 3.6.5 => 3.6.5
echarts: ^5.0.2 => 5.3.3
element-ui: 2.15.5 => 2.15.5
eslint: 6.7.2 => 6.7.2
eslint-plugin-vue: 6.2.2 => 6.2.2
highlight.js: ^10.7.1 => 10.7.3
html-webpack-plugin: 3.2.0 => 3.2.0
js-cookie: 2.2.0 => 2.2.0
js-md5: ^0.7.3 => 0.7.3
mockjs: 1.0.1-beta3 => 1.0.1-beta3
moment: ^2.27.0 => 2.29.4
normalize.css: 7.0.0 => 7.0.0
nprogress: 0.2.0 => 0.2.0
path-to-regexp: 2.4.0 => 2.4.0
runjs: 4.3.2 => 4.3.2
sass: 1.26.8 => 1.26.8
sass-loader: 8.0.2 => 8.0.2
script-ext-html-webpack-plugin: 2.1.3 => 2.1.3
serve-static: 1.13.2 => 1.13.2
sql-formatter: ^4.0.2 => 4.0.2
svg-sprite-loader: 4.1.3 => 4.1.3
svgo: 1.2.2 => 1.2.2
vue: 2.6.10 => 2.6.10
vue-clipboard2: ^0.3.1 => 0.3.3
vue-codemirror: 4.0.6 => 4.0.6
vue-demi: ^0.7.0 => 0.7.5
vue-echarts: ^6.0.0 => 6.2.3
vue-router: 3.0.6 => 3.0.6
vue-template-compiler: 2.6.10 => 2.6.10
vuex: 3.1.0 => 3.1.0
Used Package Manager
npm
Validations
- [X] Read the the documentation in detail.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.