1๐
โ
I had to use rangy.init()
which initializes Rangy if it has not already been initialized:
https://github.com/timdown/rangy/wiki/Rangy-Object#rangyinit
๐คPida
2๐
I would recommend making a Vue plugin out of this to make it easier:
// plugins/vue-rangy.js
import rangy from 'rangy'
const VueRangy = {
install (Vue, options) {
if (options.hasOwnProperty('init') && options.init) {
rangy.init()
}
Vue.prototype.$rangy = rangy
}
}
export default VueRangy
Then use it like any other plugin:
import VueRangy from 'plugins/vue-rangy'
Vue.use(VueRangy, {
init: true
})
Then just use this.$rangy
in your components.
๐คOhgodwhy
Source:stackexchange.com