+
+ this.getPlugins = function() {
+ return plugins;
+ };
+
+ this.getConfig = function() {
+ return config;
+ };
+
+ this.createAction = function(fqName, config) {
+ var definition = actionDefinitions[fqName];
+ if(!definition) {
+ throw new Error('Invalid action: ' + fqName);
+ }
+ return new actions.Action(fqName, definition, config, actionsAppObject);
+ };
+
+ this.registerKeyHandler = function(eventName, handler) {
+ $('body').on(eventName, function(e) {
+ handler(e);
+ });
+ };
+
+ this.registerActionsAppObject = function(_actionsAppObject) {
+ actionsAppObject = _actionsAppObject;
+ };
+
+ this.showContextMenu = function(menu, coors) {
+ if(currentContextMenu) {
+ currentContextMenu.close();
+ }
+ currentContextMenu = menu;
+ $(config.rootSelector).append(menu.dom);
+ menu.dom.css({top: coors.y, left: coors.x});
+ menu.show();
+ };
+
+ this.getTutorialItem = function(name) {
+ var tutorial = this.getConfig().tutorial;
+ var tutorialText, index;
+ tutorial.some(function(item, i) {
+ if(item.name === name) {
+ tutorialText = item.text;
+ index = i;
+ return true;
+ }
+ });
+ if(!tutorialText)
+ return;
+ return {index: index + 1, text: tutorialText};
+ }