diff --git a/app/bower.json b/app/bower.json index fd5ee28..13161eb 100644 --- a/app/bower.json +++ b/app/bower.json @@ -7,6 +7,7 @@ "bootstrap": "^3.2.0", "font-awesome": "~4.5.0", "fabric": "1.7.3", + "fingerprintjs2": "^1.5.1", "lodash": "~4.0.0", "x2js": "./libs/xml2json.js", "eventbus": "./libs/eventbus.min.js", @@ -38,4 +39,4 @@ "devDependencies": { "jasmine-jquery": "^2.1.1" } -} +} \ No newline at end of file diff --git a/app/index.html b/app/index.html index 2df8dfe..77c05d5 100644 --- a/app/index.html +++ b/app/index.html @@ -15,7 +15,7 @@ - + @@ -63,8 +63,8 @@ - - + + @@ -72,11 +72,19 @@ - + + \ No newline at end of file diff --git a/app/scripts/angular/controller/main.js b/app/scripts/angular/controller/main.js index 6781179..137ea68 100644 --- a/app/scripts/angular/controller/main.js +++ b/app/scripts/angular/controller/main.js @@ -5,7 +5,7 @@ angular.module('editorApp', ['ngDialog', 'oc.lazyLoad', 'Scope.safeApply']).factory('cacheBustInterceptor', ['$templateCache', function($templateCache) { return { - request : function(config) { + request: function(config) { config.alreadyCached = $templateCache.get(config.url); if (!config.alreadyCached) { config.url = config.url + '?' + ecEditor.getConfig('build_number'); @@ -20,12 +20,22 @@ angular.module('editorApp', ['ngDialog', 'oc.lazyLoad', 'Scope.safeApply']).fact }); $httpProvider.interceptors.push('cacheBustInterceptor'); }]); -angular.module('editorApp').controller('popupController', ['ngDialog', '$ocLazyLoad', function(ngDialog, $ocLazyLoad) { - function loadNgModules(templatePath, controllerPath) { - return $ocLazyLoad.load([ - { type: 'html', path: templatePath }, - { type: 'js', path: controllerPath + '?' + ecEditor.getConfig('build_number')} - ]); +angular.module('editorApp').controller('popupController', ['ngDialog', '$ocLazyLoad', '$templateCache', function(ngDialog, $ocLazyLoad, $templateCache) { + function loadNgModules(templatePath, controllerPath, allowTemplateCache) { + if (!allowTemplateCache) { + return $ocLazyLoad.load([ + { type: 'html', path: templatePath }, + { type: 'js', path: controllerPath + '?' + ecEditor.getConfig('build_number') } + ]); + } else { + if (angular.isString(templatePath) && templatePath.length > 0) { + angular.forEach(angular.element(templatePath), function(node) { + if (node.nodeName === "SCRIPT" && node.type === "text/ng-template") { + $templateCache.put(node.id, node.innerHTML); + } + }); + } + } }; function openModal(config, callback) { @@ -35,24 +45,23 @@ angular.module('editorApp').controller('popupController', ['ngDialog', '$ocLazyL org.ekstep.contenteditor.api.getService('popup').initService(loadNgModules, openModal); }]); angular.module('editorApp').controller('MainCtrl', ['$scope', '$ocLazyLoad', '$location', - function($scope, $ocLazyLoad, $location) { - + function($scope, $ocLazyLoad, $location) { $scope.loadNgModules = function(templatePath, controllerPath) { var files = []; if (templatePath) files.push({ type: 'html', path: templatePath }); if (controllerPath) files.push({ type: 'js', path: controllerPath + '?' + ecEditor.getConfig('build_number') }); if (files.length) return $ocLazyLoad.load(files) - }; - org.ekstep.contenteditor.containerManager.initialize({loadNgModules: $scope.loadNgModules, scope: $scope }); + }; + org.ekstep.contenteditor.containerManager.initialize({ loadNgModules: $scope.loadNgModules, scope: $scope }); // container scope starts $scope.editorContainer = undefined; $scope.addToContainer = function(container) { - $scope.editorContainer = container; - $scope.$safeApply(); - } - // container scope ends + $scope.editorContainer = container; + $scope.$safeApply(); + } + // container scope ends document.title = 'Generic-Editor'; @@ -63,17 +72,17 @@ angular.module('editorApp').controller('MainCtrl', ['$scope', '$ocLazyLoad', '$l context.etags.app = context.app || context.etags.app || []; context.etags.partner = context.partner || context.etags.partner || []; context.etags.dims = context.dims || context.etags.dims || []; - + var config = org.ekstep.contenteditor.getWindowConfig(); config.absURL = $location.protocol() + '://' + $location.host() + ':' + $location.port() // Required config.genericeditorPlugins = config.plugins || org.ekstep.contenteditor.config.plugins; - config.plugins = [ + config.plugins = [ { "id": "org.ekstep.genericeditor", "ver": "1.1", "type": "plugin" } ] org.ekstep.contenteditor.init(context, config, $scope, undefined, function() { - $scope.contentService = org.ekstep.contenteditor.api.getService(ServiceConstants.CONTENT_SERVICE); - $scope.popupService = org.ekstep.contenteditor.api.getService(ServiceConstants.POPUP_SERVICE); - }); + $scope.contentService = org.ekstep.contenteditor.api.getService(ServiceConstants.CONTENT_SERVICE); + $scope.popupService = org.ekstep.contenteditor.api.getService(ServiceConstants.POPUP_SERVICE); + }); } -]); +]); \ No newline at end of file diff --git a/app/scripts/coreplugins.js b/app/scripts/coreplugins.js index bb77cf3..d7b5609 100644 --- a/app/scripts/coreplugins.js +++ b/app/scripts/coreplugins.js @@ -1,16 +1,19 @@ -org.ekstep.contenteditor.jQuery("body").append($("