bootstrap-wysiwyg/bootstrap3-wysiwyg

[CLOSED] RequireJS - Errors after updating from 0.2.6 to 0.2.9 via bower

Waxolunist opened this issue · 8 comments

Issue by larryisthere
Thursday Feb 27, 2014 at 12:46 GMT
Originally opened as Waxolunist/bootstrap3-wysihtml5-bower#40


With 0.2.6 everything worked just fine, but errors below come with 0.2.9.
Anyone knows how to fix them?

[Error] TypeError: 'undefined' is not an object (evaluating 'a.commands') (bootstrap3-wysihtml5.all.min.js, line 2)
[Debug] Locale 'en' not found. Available locales are: . Falling back to 'en'. (bootstrap3-wysihtml5.all.min.js, line 2)
[Error] TypeError: 'undefined' is not a constructor (evaluating 'new b.Editor(this.el[0],c)')
createEditor (bootstrap3-wysihtml5.all.min.js, line 2)
d (bootstrap3-wysihtml5.all.min.js, line 2)
(anonymous function) (bootstrap3-wysihtml5.all.min.js, line 2)
each (jquery.js, line 590)
each (jquery.js, line 237)
bypassDefaults (bootstrap3-wysihtml5.all.min.js, line 2)
shallowExtend (bootstrap3-wysihtml5.all.min.js, line 2)
init (bootstrap3-wysihtml5.all.min.js, line 2)
wysihtml5 (bootstrap3-wysihtml5.all.min.js, line 2)
initEls (modalLayer.js, line 78)
ModalAritcle (modalLayer.js, line 19)
data (_player.js, line 24)
(anonymous function) (main.js, line 8)
execCb (require.js, line 1650)
check (require.js, line 866)
(anonymous function) (require.js, line 1113)
(anonymous function) (require.js, line 132)
(anonymous function) (require.js, line 1156)
each (require.js, line 57)
emit (require.js, line 1155)
check (require.js, line 917)
(anonymous function) (require.js, line 1113)
(anonymous function) (require.js, line 132)
(anonymous function) (require.js, line 1156)
each (require.js, line 57)
emit (require.js, line 1155)
check (require.js, line 917)
(anonymous function) (require.js, line 1113)
(anonymous function) (require.js, line 132)
(anonymous function) (require.js, line 1156)
each (require.js, line 57)
emit (require.js, line 1155)
check (require.js, line 917)
enable (require.js, line 1143)
init (require.js, line 774)
callGetModule (require.js, line 1170)
completeLoad (require.js, line 1564)
onScriptLoad (require.js, line 1671)

Comment by Waxolunist
Friday Feb 28, 2014 at 14:43 GMT


First, 0.2.9 is still alpha. 0.2.8 should be stable.
Can you give an example or better a fiddle, how you are using the library?

Comment by larryisthere
Tuesday Mar 04, 2014 at 12:32 GMT


Using requirejs to manage modules, I got following structure and correlative files.

main.js

requirejs.config({
  "paths": {
    ...
    'datetimepicker': 'bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min',
    'myModule': 'path/to/myModule',
    ...
  },  
  shim: {
    'wysihtml5': ['handlebars', 'bootstrap'],
  }

myModule.js

define(['bootstrap', 'wysihtml5', 'datetimepicker'], function(){
  ...
  var _editor  = $(element).wysihtml5();
  var editor   = _editor.data('wysihtml5').editor;
  ...
});

Even if I use 0.2.9 stable or 0.3.0 alpha, the precedent exception is there, so I've to specific the version of 0.2.8 to avoid that.

Comment by Waxolunist
Wednesday Mar 05, 2014 at 08:49 GMT


I will have a look, how to add amd support.

Comment by Waxolunist
Thursday Mar 06, 2014 at 07:29 GMT


Please have a look at the latest v0.3.0 version. RequireJS support is now built in.
Don't be afraid of the alpha status.
It's stable, it just does not have the features and the clean code base I want.

If you want to add requirejs support to the maintenance versions 0.2.x you are on your own.

Comment by pradius-fut
Tuesday Mar 11, 2014 at 16:19 GMT


I don't seem to be able to figure out how to use this v.0.3.0 version with bower and RequireJS support.
I've added

'wysihtml5': '../vendor/bower/bootstrap3-wysihtml5-bower/dist/bootstrap3-wysihtml5.all.min'

to my paths and

but when i try to initialize a wysiwyg instance i get:
undefined is not a funtction on the line that says:

this.$element.wysihtml5('deepExtend',{

Also, i use github.com/yeoman/grunt-bower-requirejs to automatically include the bower dependencies in requirejs config.
But by default it includes

../vendor/bower/bootstrap3-wysihtml5-bower/dist/bootstrap3-wysihtml5.min

and not

../vendor/bower/bootstrap3-wysihtml5-bower/dist/bootstrap3-wysihtml5.all.min

Comment by pradius-fut
Tuesday Mar 11, 2014 at 23:02 GMT


ah yes, i think it works now, sorry about that

Comment by Waxolunist
Tuesday Mar 11, 2014 at 21:25 GMT


Have you seen the version in examples of the 0.3 branch? https://github.com/Waxolunist/bootstrap3-wysihtml5-bower/tree/v0.3.0-wip/examples

It uses the amd-versions in the folder amd.

I also updated the readme and added examples for requirejs to it.

The automatic include is because the all-inclusive version is not the main of this package.

Comment by Waxolunist
Friday Mar 14, 2014 at 09:58 GMT


no problem