2

Does anyone able to get textAngular.js with RequireJS(even if someone has working example I will replicate the settings)?

I am able to load editor but when applying h1 tags I get $window.rangy.saveSelection is not a function on textAngular.js file with _savedSelection = $window.rangy.saveSelection();

Here are versions I am using.

Angular 1.4.8 textAngular 1.4.6 Rangy 1.3.1-dev RequireJS 2.1.22

user1269989
  • 117
  • 1
  • 5

1 Answers1

2

The issue is textAngular in its core, expects a variable rangy to be available globally (https://github.com/aaronroberson/textAngular/blob/master/src/main.js#L69).

So to fix this problem, we combined the rangy-core and rangy-selectionsaverestore into our window.rangy at the beginning of the bootstrap of our application before we initialise the app with angular.module('appname', [modules...])

define(["angular", "ngRoute", "jquery", "rangy-core", "rangy-selectionsaverestore"], function(angular, ngRoute, $j, rangyCore, rangySelectionSavereStore) { window.rangy = $j.extend(rangyCore, rangySelectionSavereStore); });

Configuration for requirejs to load these two modules,

'rangy-core': '../bower_components/rangy/rangy-core', 'rangy-selectionsaverestore': '../bower_components/rangy/rangy-selectionsaverestore'

Anik
  • 2,692
  • 2
  • 22
  • 25