/** * ExternalDiagramEditor.js * * Created by Julia Radzhabova on 4/08/14 * Copyright (c) 2014 Ascensio System SIA. All rights reserved. * */ if (Common === undefined) var Common = {}; Common.Controllers = Common.Controllers || {}; define([ 'core', 'common/main/lib/view/ExternalDiagramEditor' ], function () { 'use strict'; Common.Controllers.ExternalDiagramEditor = Backbone.Controller.extend(_.extend((function() { var appLang = 'en', customization = undefined, externalEditor = null; var createExternalEditor = function() { externalEditor = new DocsAPI.DocEditor('id-diagram-editor-placeholder', { width : '100%', height : '100%', documentType: 'spreadsheet', document : { url : '_offline_', permissions : { edit : true, download: false } }, editorConfig: { mode : 'editdiagram', lang : appLang, canCoAuthoring : false, canBackToFolder : false, canCreateNew : false, customization : customization, user : {id: ('uid-'+Date.now())} }, events: { 'onReady' : function() {}, 'onDocumentStateChange' : function() {}, 'onError' : function() {}, 'onInternalMessage' : _.bind(this.onInternalMessage, this) } }); Common.Gateway.on('processmouse', _.bind(this.onProcessMouse, this)); }; return { views: ['Common.Views.ExternalDiagramEditor'], initialize: function() { this.addListeners({ 'Common.Views.ExternalDiagramEditor': { 'setchartdata': _.bind(this.setChartData, this), 'drag': _.bind(function(o, state){ externalEditor.serviceCommand('window:drag', state == 'start'); },this), 'show': _.bind(function(cmp){ var h = this.diagramEditorView.getHeight(); if (window.innerHeight>h && h<700 || window.innerHeight