Skip to content Skip to sidebar Skip to footer

Typeerror: G.rangy.saveselection Is Not A Function Using Textangular + Rangy + Browserify

I am trying to implement textAngular into my Angular.js project that is packaged using browserify. I installed rangy and textAngular via npm. They are included like this: global.ra

Solution 1:

I can only include alex88s answer from Github:

(() => {
  window.taTools = {};
  window.rangy = require('rangy/lib/rangy-core');
})();

require('rangy/lib/rangy-selectionsaverestore');
require('textangular/dist/textAngular-sanitize');
require('textAngular/dist/textAngularSetup');
require('textAngular/dist/textAngular');

https://github.com/fraywing/textAngular/issues/1056

However we are using ES6 imports with Babel, and this is our working version as of 1.5.0 (both angular and textAngular versions are set to this).

import rangy from'rangy/lib/rangy-core';

(() => {
  window.taTools = {};
  window.rangy = rangy;
})();

import'rangy/lib/rangy-selectionsaverestore';
import'textangular/dist/textAngular-sanitize';
import'textAngular/dist/textAngularSetup';
import'textAngular/dist/textAngular';
import'textAngular/dist/textAngular.css';

However we truly think that this should be really simplified to just 2 lines (one is for loading the minified version and the other should be optional for the CSS).

Post a Comment for "Typeerror: G.rangy.saveselection Is Not A Function Using Textangular + Rangy + Browserify"