Closed thenitai closed 9 years ago
Hi thenitai,
I've been having the same issue you are having, and i think i found why it has been happening. It turns out that the module 'rangy-selectionsaverestore' wasn't loaded in my case, and that's where rangy's method saveSelection is defined.
Try and define the 'rangy-selectionsaverestore' as a dependency to the 'bootstrap.wysihtml5' module and the problem will disappear.
Hope that helps.
Sounding like a ignorant here, but how to define it as a dependency?
Thank you :-)
You can do that in the main.js file (where you list all the require.js modules) using the shim http://requirejs.org/docs/api.html#config-shim . Here's an example (your paths probably are different):
require.config({
paths: {
'bootstrap.wysihtml5': '../editor/bootstrap3-wysihtml5',
'rangy': '../editor/rangy-core',
'rangy-selectionsaverestore': '../editor/rangy-selectionsaverestore',
},
shim: {
'bootstrap.wysihtml5' : { deps: ['rangy-selectionsaverestore'] }
}
Or you can just add the 'rangy-selectionsaverestore' in the define of the module where you are using the editor itself.
Ah... I've already had the rangy-core in there, never thought about to add the other one.
Thank you! :+1:
For the after world here is my config:
paths: {
...
'rangy': 'rangy-1.3/rangy-core',
'rangy-selectionsaverestore': 'rangy-1.3/rangy-selectionsaverestore',
'bootstrap.wysihtml5': 'wysiwyg/amd/bootstrap3-wysihtml5.all',
'bootstrap.wysihtml5.en-US': 'wysiwyg/locales/bootstrap-wysihtml5.en-US',
...
},
shim: {
...
'bootstrap.wysihtml5' : { deps: ['rangy','rangy-selectionsaverestore'] },
...
}
Hi there,
Loading your library with require.js. Everything works fine except header selection. Throws above error at line 8835:
Hope this helps.