Create document api in viewport controller
This commit is contained in:
parent
c4a2318c9c
commit
70ca82b0df
|
@ -97,38 +97,9 @@ define([
|
|||
'settings:apply': _.bind(this.applySettings, this)
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onLaunch: function() {
|
||||
var me = this;
|
||||
|
||||
this.stackLongActions = new Common.IrregularStack({
|
||||
strongCompare : function(obj1, obj2){return obj1.id === obj2.id && obj1.type === obj2.type;},
|
||||
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
|
||||
});
|
||||
|
||||
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false};
|
||||
this.languages = null;
|
||||
this.translationTable = [];
|
||||
this.isModalShowed = 0;
|
||||
// Initialize viewport
|
||||
|
||||
if (!Common.Utils.isBrowserSupported()){
|
||||
Common.Utils.showBrowserRestriction();
|
||||
Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText);
|
||||
return;
|
||||
}
|
||||
|
||||
var value = Common.localStorage.getItem("de-settings-fontrender");
|
||||
if (value === null)
|
||||
window.devicePixelRatio > 1 ? value = '1' : '0';
|
||||
Common.Utils.InternalSettings.set("de-settings-fontrender", value);
|
||||
|
||||
// Initialize api
|
||||
|
||||
window["flat_desine"] = true;
|
||||
|
||||
var styleNames = ['Normal', 'No Spacing', 'Heading 1', 'Heading 2', 'Heading 3', 'Heading 4', 'Heading 5',
|
||||
var me = this,
|
||||
styleNames = ['Normal', 'No Spacing', 'Heading 1', 'Heading 2', 'Heading 3', 'Heading 4', 'Heading 5',
|
||||
'Heading 6', 'Heading 7', 'Heading 8', 'Heading 9', 'Title', 'Subtitle', 'Quote', 'Intense Quote', 'List Paragraph', 'footnote text'],
|
||||
translate = {
|
||||
'Series': this.txtSeries,
|
||||
|
@ -164,16 +135,39 @@ define([
|
|||
"Hyperlink": this.txtHyperlink
|
||||
};
|
||||
styleNames.forEach(function(item){
|
||||
translate[item] = me.translationTable[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item;
|
||||
translate[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item;
|
||||
});
|
||||
me.translationTable['Header'] = this.txtHeader;
|
||||
me.translationTable['Footer'] = this.txtFooter;
|
||||
me.translationTable = translate;
|
||||
},
|
||||
|
||||
this.api = new Asc.asc_docs_api({
|
||||
'id-view' : 'editor_sdk',
|
||||
'translate': translate
|
||||
onLaunch: function() {
|
||||
var me = this;
|
||||
|
||||
this.stackLongActions = new Common.IrregularStack({
|
||||
strongCompare : function(obj1, obj2){return obj1.id === obj2.id && obj1.type === obj2.type;},
|
||||
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
|
||||
});
|
||||
|
||||
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false};
|
||||
this.languages = null;
|
||||
this.isModalShowed = 0;
|
||||
// Initialize viewport
|
||||
|
||||
if (!Common.Utils.isBrowserSupported()){
|
||||
Common.Utils.showBrowserRestriction();
|
||||
Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText);
|
||||
return;
|
||||
}
|
||||
|
||||
var value = Common.localStorage.getItem("de-settings-fontrender");
|
||||
if (value === null)
|
||||
window.devicePixelRatio > 1 ? value = '1' : '0';
|
||||
Common.Utils.InternalSettings.set("de-settings-fontrender", value);
|
||||
|
||||
// Initialize api
|
||||
window["flat_desine"] = true;
|
||||
this.api = this.getApplication().getController('Viewport').getApi();
|
||||
|
||||
if (this.api){
|
||||
this.api.SetDrawingFreeze(true);
|
||||
switch (value) {
|
||||
|
|
|
@ -116,11 +116,20 @@ define([
|
|||
Common.NotificationCenter.on('api:disconnect', this.onApiCoAuthoringDisconnect.bind(this));
|
||||
},
|
||||
|
||||
getApi: function() {
|
||||
return this.api;
|
||||
},
|
||||
|
||||
// When our application is ready, lets get started
|
||||
onLaunch: function() {
|
||||
// Create and render main view
|
||||
this.viewport = this.createView('Viewport').render();
|
||||
|
||||
this.api = new Asc.asc_docs_api({
|
||||
'id-view' : 'editor_sdk',
|
||||
'translate': this.getApplication().getController('Main').translationTable
|
||||
});
|
||||
|
||||
this.header = this.createView('Common.Views.Header', {
|
||||
headerCaption: 'Document Editor',
|
||||
storeUsers: DE.getCollection('Common.Collections.Users')
|
||||
|
|
|
@ -96,42 +96,10 @@ define([
|
|||
'settings:apply': _.bind(this.applySettings, this)
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onLaunch: function() {
|
||||
var me = this;
|
||||
|
||||
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false};
|
||||
this.languages = null;
|
||||
this.translationTable = [];
|
||||
this.isModalShowed = 0;
|
||||
|
||||
window.storagename = 'presentation';
|
||||
|
||||
this.stackLongActions = new Common.IrregularStack({
|
||||
strongCompare : function(obj1, obj2){return obj1.id === obj2.id && obj1.type === obj2.type;},
|
||||
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
|
||||
});
|
||||
|
||||
// Initialize viewport
|
||||
|
||||
if (!Common.Utils.isBrowserSupported()){
|
||||
Common.Utils.showBrowserRestriction();
|
||||
Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText);
|
||||
return;
|
||||
}
|
||||
|
||||
var value = Common.localStorage.getItem("pe-settings-fontrender");
|
||||
if (value===null) value = window.devicePixelRatio > 1 ? '1' : '3';
|
||||
Common.Utils.InternalSettings.set("pe-settings-fontrender", value);
|
||||
|
||||
// Initialize api
|
||||
|
||||
window["flat_desine"] = true;
|
||||
|
||||
this.api = new Asc.asc_docs_api({
|
||||
'id-view' : 'editor_sdk',
|
||||
'translate': {
|
||||
var me = this,
|
||||
themeNames = ['blank', 'pixel', 'classic', 'official', 'green', 'lines', 'office', 'safari', 'dotted', 'corner', 'turtle'],
|
||||
translate = {
|
||||
'Series': this.txtSeries,
|
||||
'Diagram Title': this.txtDiagramTitle,
|
||||
'X Axis': this.txtXAxis,
|
||||
|
@ -154,13 +122,43 @@ define([
|
|||
'Loading': this.txtLoading,
|
||||
'Click to add notes': this.txtAddNotes,
|
||||
'Click to add first slide': this.txtAddFirstSlide
|
||||
}
|
||||
};
|
||||
|
||||
themeNames.forEach(function(item){
|
||||
translate[item] = me['txtTheme_' + item.replace(/ /g, '_')] || item;
|
||||
});
|
||||
me.translationTable = translate;
|
||||
},
|
||||
|
||||
onLaunch: function() {
|
||||
var me = this;
|
||||
|
||||
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false};
|
||||
this.languages = null;
|
||||
this.isModalShowed = 0;
|
||||
|
||||
window.storagename = 'presentation';
|
||||
|
||||
this.stackLongActions = new Common.IrregularStack({
|
||||
strongCompare : function(obj1, obj2){return obj1.id === obj2.id && obj1.type === obj2.type;},
|
||||
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
|
||||
});
|
||||
|
||||
var themeNames = ['blank', 'pixel', 'classic', 'official', 'green', 'lines', 'office', 'safari', 'dotted', 'corner', 'turtle'];
|
||||
themeNames.forEach(function(item){
|
||||
me.translationTable[item] = me['txtTheme_' + item.replace(/ /g, '_')] || item;
|
||||
});
|
||||
// Initialize viewport
|
||||
|
||||
if (!Common.Utils.isBrowserSupported()){
|
||||
Common.Utils.showBrowserRestriction();
|
||||
Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText);
|
||||
return;
|
||||
}
|
||||
|
||||
var value = Common.localStorage.getItem("pe-settings-fontrender");
|
||||
if (value===null) value = window.devicePixelRatio > 1 ? '1' : '3';
|
||||
Common.Utils.InternalSettings.set("pe-settings-fontrender", value);
|
||||
|
||||
// Initialize api
|
||||
window["flat_desine"] = true;
|
||||
this.api = this.getApplication().getController('Viewport').getApi();
|
||||
|
||||
if (this.api){
|
||||
this.api.SetDrawingFreeze(true);
|
||||
|
|
|
@ -1942,7 +1942,7 @@ define([
|
|||
this._state.clrtext_asccolor = undefined;
|
||||
},
|
||||
|
||||
_onInitEditorThemes: function(editorThemes, documentThemes) {
|
||||
_onInitEditorThemes: function(editorThemes/*array */, documentThemes) {
|
||||
var me = this;
|
||||
window.styles_loaded = false;
|
||||
|
||||
|
|
|
@ -123,11 +123,20 @@ define([
|
|||
Common.NotificationCenter.on('api:disconnect', this.onApiCoAuthoringDisconnect.bind(this));
|
||||
},
|
||||
|
||||
getApi: function() {
|
||||
return this.api;
|
||||
},
|
||||
|
||||
// When our application is ready, lets get started
|
||||
onLaunch: function() {
|
||||
// Create and render main view
|
||||
this.viewport = this.createView('Viewport').render();
|
||||
|
||||
this.api = new Asc.asc_docs_api({
|
||||
'id-view' : 'editor_sdk',
|
||||
'translate': this.getApplication().getController('Main').translationTable
|
||||
});
|
||||
|
||||
this.header = this.createView('Common.Views.Header', {
|
||||
headerCaption: 'Presentation Editor',
|
||||
storeUsers: PE.getCollection('Common.Collections.Users')
|
||||
|
|
|
@ -99,6 +99,32 @@ define([
|
|||
'settings:apply': _.bind(this.applySettings, this)
|
||||
}
|
||||
});
|
||||
|
||||
var me = this,
|
||||
styleNames = ['Normal', 'Neutral', 'Bad', 'Good', 'Input', 'Output', 'Calculation', 'Check Cell', 'Explanatory Text', 'Note', 'Linked Cell', 'Warning Text',
|
||||
'Heading 1', 'Heading 2', 'Heading 3', 'Heading 4', 'Title', 'Total', 'Currency', 'Percent', 'Comma'],
|
||||
translate = {
|
||||
'Series': this.txtSeries,
|
||||
'Diagram Title': this.txtDiagramTitle,
|
||||
'X Axis': this.txtXAxis,
|
||||
'Y Axis': this.txtYAxis,
|
||||
'Your text here': this.txtArt,
|
||||
'Table': this.txtTable,
|
||||
'Print_Area': this.txtPrintArea
|
||||
};
|
||||
styleNames.forEach(function(item){
|
||||
translate[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item;
|
||||
});
|
||||
translate['Currency [0]'] = me.txtStyle_Currency + ' [0]';
|
||||
translate['Comma [0]'] = me.txtStyle_Comma + ' [0]';
|
||||
|
||||
for (var i=1; i<7; i++) {
|
||||
translate['Accent'+i] = me.txtAccent + i;
|
||||
translate['20% - Accent'+i] = '20% - ' + me.txtAccent + i;
|
||||
translate['40% - Accent'+i] = '40% - ' + me.txtAccent + i;
|
||||
translate['60% - Accent'+i] = '60% - ' + me.txtAccent + i;
|
||||
}
|
||||
me.translationTable = translate;
|
||||
},
|
||||
|
||||
onLaunch: function() {
|
||||
|
@ -106,7 +132,6 @@ define([
|
|||
var me = this;
|
||||
|
||||
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false};
|
||||
this.translationTable = [];
|
||||
this.isModalShowed = 0;
|
||||
|
||||
if (!Common.Utils.isBrowserSupported()){
|
||||
|
@ -123,35 +148,7 @@ define([
|
|||
Common.Utils.InternalSettings.set("sse-settings-fontrender", value);
|
||||
|
||||
// Initialize api
|
||||
var styleNames = ['Normal', 'Neutral', 'Bad', 'Good', 'Input', 'Output', 'Calculation', 'Check Cell', 'Explanatory Text', 'Note', 'Linked Cell', 'Warning Text',
|
||||
'Heading 1', 'Heading 2', 'Heading 3', 'Heading 4', 'Title', 'Total', 'Currency', 'Percent', 'Comma'],
|
||||
translate = {
|
||||
'Series': this.txtSeries,
|
||||
'Diagram Title': this.txtDiagramTitle,
|
||||
'X Axis': this.txtXAxis,
|
||||
'Y Axis': this.txtYAxis,
|
||||
'Your text here': this.txtArt,
|
||||
'Table': this.txtTable,
|
||||
'Print_Area': this.txtPrintArea
|
||||
};
|
||||
styleNames.forEach(function(item){
|
||||
translate[item] = me.translationTable[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item;
|
||||
});
|
||||
translate['Currency [0]'] = me.translationTable['Currency [0]'] = me.txtStyle_Currency + ' [0]';
|
||||
translate['Comma [0]'] = me.translationTable['Comma [0]'] = me.txtStyle_Comma + ' [0]';
|
||||
|
||||
for (var i=1; i<7; i++) {
|
||||
translate['Accent'+i] = me.translationTable['Accent'+i] = me.txtAccent + i;
|
||||
translate['20% - Accent'+i] = me.translationTable['20% - Accent'+i] = '20% - ' + me.txtAccent + i;
|
||||
translate['40% - Accent'+i] = me.translationTable['40% - Accent'+i] = '40% - ' + me.txtAccent + i;
|
||||
translate['60% - Accent'+i] = me.translationTable['60% - Accent'+i] = '60% - ' + me.txtAccent + i;
|
||||
}
|
||||
|
||||
this.api = new Asc.spreadsheet_api({
|
||||
'id-view' : 'editor_sdk',
|
||||
'id-input' : 'ce-cell-content',
|
||||
'translate': translate
|
||||
});
|
||||
this.api = this.getApplication().getController('Viewport').getApi();
|
||||
this.api.asc_setFontRenderingMode(parseInt(value));
|
||||
|
||||
this.api.asc_registerCallback('asc_onOpenDocumentProgress', _.bind(this.onOpenDocument, this));
|
||||
|
|
|
@ -130,6 +130,10 @@ define([
|
|||
Common.NotificationCenter.on('api:disconnect', this.onApiCoAuthoringDisconnect.bind(this));
|
||||
},
|
||||
|
||||
getApi: function() {
|
||||
return this.api;
|
||||
},
|
||||
|
||||
onAppShowed: function (config) {
|
||||
var me = this;
|
||||
me.appConfig = config;
|
||||
|
@ -318,6 +322,13 @@ define([
|
|||
onLaunch: function() {
|
||||
// Create and render main view
|
||||
this.viewport = this.createView('Viewport').render();
|
||||
|
||||
this.api = new Asc.spreadsheet_api({
|
||||
'id-view' : 'editor_sdk',
|
||||
'id-input' : 'ce-cell-content',
|
||||
'translate': this.getApplication().getController('Main').translationTable
|
||||
});
|
||||
|
||||
this.header = this.createView('Common.Views.Header', {
|
||||
headerCaption: 'Spreadsheet Editor',
|
||||
storeUsers: SSE.getCollection('Common.Collections.Users')
|
||||
|
|
Loading…
Reference in a new issue