I’m trying to conditionally import the ckeditor 5 npm package so that my site will still work with IE 11 and having some difficulties.
I have this included in the client:
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
// If Internet Explorer, return version number
//alert(parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))));
console.log('IE11 does not support ckeditor5');
}
else {
import CKEDITOR from '@ckeditor/ckeditor5-build-classic';
App.CKEDITOR = CKEDITOR;
App.getEditor = function(selector) {
<snip>
‘App’ is a global object that I put common functions and objects in.
Is it possible for this to work or do I just have the whole concept of imports/transpiling/babel/es6 wrong?
Is there another way?
thanks,
Cliff