refactory-id / bootstrap-markdown

Bootstrap plugin for markdown editing
Apache License 2.0
1.99k stars 371 forks source link

Support for requireJS and backbone.js #208

Closed acrobat closed 8 years ago

acrobat commented 8 years ago

With this code change we add support for requireJS and backbone.js and a fallback for jquery

Fixes: #196

toopay commented 8 years ago

@acrobat I'm not sure if we are going to support requirejs/backbone per-se - as there will be tons of other js frameworks out there. Do you have any references of bootstrap plugin that also support multiple frameworks? Also, does bootstrap itself indicate that it is compatible with them?

I'm not against supporting more platforms, just want to weight in the possible side-effect of doing so.

Thought?

acrobat commented 8 years ago

twitter bootstrap 4 (currently in alpha) does fully support umd/amd

Rewrote all our JavaScript plugins. Every plugin has been rewritten in ES6 to take advantage of the newest JavaScript enhancements. They also now come with UMD support, generic teardown methods, option type checking, and tons more.

I'm also a contributor on the eternicode/bootstrap-datepicker and there we have introduced requirejs support some time ago on request of our users (PR #1196). Without any problems so far, that's why I introduced it here as we can support more ways of using the library without much effort

Just my opinion, you have the final call!

DeneroWatz commented 6 years ago

Hello, This seems to be still not ready for requirejs/umd support. Just found that the 'preview' does not render the html in markdown editor(uses angular-markdown-editor) if markdown js(https://github.com/chjj/marked) is loaded as a UMD module using requirejs.

The code snippet in this snapshot shows that it expects 'marked' as a global variable, which will not be the case when loaded via require js: image

So, as a workaround I had to initialize 'window.marked' once require js loads the module and that solved the issue.

I am not familiar with the markdown code but was trying help someone who was using a framework built by us to build an application. The framework loads dependencies using requirejs and they reported that under this framework, the preview functionality was not working as expected. The reason was that due to the above code, markdown parser was not getting called. It should have ideally used require('marked') to get it.

Please confirm if this is an issue in bootstrap-markdown or are we missing something here?