/** * 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/ExternalMergeEditor' ], function () { 'use strict'; Common.Controllers.ExternalMergeEditor = Backbone.Controller.extend(_.extend((function() { var appLang = 'en', customization = undefined, externalEditor = null; var createExternalEditor = function() { externalEditor = new DocsAPI.DocEditor('id-merge-editor-placeholder', { width : '100%', height : '100%', documentType: 'spreadsheet', document : { url : '_offline_', permissions : { edit : true, download: false } }, editorConfig: { mode : 'editmerge', 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.ExternalMergeEditor'], initialize: function() { this.addListeners({ 'Common.Views.ExternalMergeEditor': { 'setmergedata': _.bind(this.setMergeData, this), 'drag': _.bind(function(o, state){ externalEditor.serviceCommand('window:drag', state == 'start'); },this), 'show': _.bind(function(cmp){ var h = this.mergeEditorView.getHeight(); if (window.innerHeight>h && h<700 || window.innerHeight