Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught rangy-selectionsaverestore.js are required for textAngular to work correctly. #382

Closed
18601673727 opened this issue Nov 1, 2014 · 4 comments

Comments

@18601673727
Copy link

angular.module 'myapp', [
  'ui.router',
  'ui.bootstrap',
  'ngCookies',
  'ngSanitize',
  'ngResource',
  'angular-loading-bar',
  'angularFileUpload',
  'textAngular'
]
      <!-- bower:js -->
      <script src="bower_components/lodash/dist/lodash.compat.js"></script>
      <script src="bower_components/angular/angular.js"></script>
      <script src="bower_components/angular-resource/angular-resource.js"></script>
      <script src="bower_components/angular-cookies/angular-cookies.js"></script>
      <script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
      <script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
      <script src="bower_components/angular-loading-bar/build/loading-bar.js"></script>
      <script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script>
      <script src="bower_components/angular-file-upload/angular-file-upload.js"></script>
      <script src="bower_components/rangy/rangy-core.js"></script>
      <script src="bower_components/textAngular/src/textAngular.js"></script>
      <script src="bower_components/textAngular/src/textAngularSetup.js"></script>
      <!-- endbower -->

I guess it's some integration issue with the framework(angular-fullstack) which I am using, this framework would inject every bower components automatically so I use your way:

<script src='/bower_components/textAngular/dist/textAngular-rangy.min.js'></script>
<script src='/bower_components/textAngular/dist/textAngular-sanitize.min.js'></script>
<script src='/bower_components/textAngular/dist/textAngular.min.js'></script>

But since then, every time I redo grunt serve, I have to change this again.


chrome#39.0.2171.36
#1.3.0-pre11

@SimeonC
Copy link
Collaborator

SimeonC commented Nov 2, 2014

You're missing: <script src="bower_components/rangy/rangy-selectionsaverestore.js"></script> in your script loading.
The textAngular-rangy.min.js is the minified and concatenated version of rangy-core and rangy-selectionsaverestore.js.

How could I make this more clear in the readme/docs?

@18601673727
Copy link
Author

Yes, you're right, I'm missing that tag in my script loading, but the reason I missing that is angular-fullstack's grunt flow always grab main from rangy/bower.json, and rangy-selectionsaverestore.js is an optional dependency.

So thanks but I would like to suggest we change our bower.json like this:

"main": ["./src/textAngular.js", "./src/textAngularSetup.js", "../rangy/rangy-selectionsaverestore.js", "./src/textAngular.css"],

@18601673727
Copy link
Author

Excuse me report another error, it's maybe the same issue here.

I removed "angular-sanitize": "1.2.27-build.536+sha.7809e75", from my project's bower.json and shows this error.

Uncaught Error: [$injector:modulerr] Failed to instantiate module myapp due to:
Error: [$injector:modulerr] Failed to instantiate module textAngular due to:
Error: [$injector:modulerr] Failed to instantiate module ngSanitize due to:
Error: [$injector:nomod] Module 'ngSanitize' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

So why not stop recommending people to choice sanitizers, just add "./src/textAngular-sanitize.js" in your bower.json?

If someone prefer to use angular's native sanitizer, he can following a readme/docs like this:

We highly recommend using textAngular-sanitize.js as it loosens some parts of the sanitizer that are far too strict for our uses and adds some more features we need. But if you want to use angular's native sanitizer please remove "./src/textAngular-sanitize.js" from your bower_components/textAngular/bower.json.

@SimeonC
Copy link
Collaborator

SimeonC commented Nov 3, 2014

Thanks for your notes on bower, I've updated these and they should be live in the next version or two. With the exception of updating the docs with your text as that assumes they are using bower which may not allways be true.

@SimeonC SimeonC closed this as completed in 00954fa Nov 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants