mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-02-10 18:05:32 +08:00
Move files
This commit is contained in:
@ -155,7 +155,6 @@
|
||||
<script type="text/javascript" src="../../common/Gateway.js"></script>
|
||||
<script type="text/javascript" src="../../common/main/lib/util/LocalStorage.js"></script>
|
||||
<script type="text/javascript" src="../../common/main/lib/util/utils.js"></script>
|
||||
<script type="text/javascript" src="../../common/main/lib/view/LoadMask.js"></script>
|
||||
|
||||
<script type="text/javascript" src="js/CellEditorView.js"></script>
|
||||
<script type="text/javascript" src="js/CellEditorController.js"></script>
|
||||
|
||||
@ -51,7 +51,6 @@ SSE.ApplicationController = new(function(){
|
||||
// -------------------------
|
||||
|
||||
if (typeof isBrowserSupported !== 'undefined' && !isBrowserSupported()){
|
||||
//Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText);
|
||||
console.error( this.unsupportedBrowserErrorText);
|
||||
return;
|
||||
}
|
||||
@ -65,8 +64,8 @@ SSE.ApplicationController = new(function(){
|
||||
|
||||
function loadConfig(data) {
|
||||
config = $.extend(config, data.config);
|
||||
config.canBackToFolder = (config.canBackToFolder!==false) && config.customization && config.customization.goback &&
|
||||
(config.customization.goback.url || config.customization.goback.requestClose && config.canRequestClose);
|
||||
/*config.canBackToFolder = (config.canBackToFolder!==false) && config.customization && config.customization.goback &&
|
||||
(config.customization.goback.url || config.customization.goback.requestClose && config.canRequestClose);*/
|
||||
}
|
||||
|
||||
function loadDocument(data) {
|
||||
@ -104,16 +103,8 @@ SSE.ApplicationController = new(function(){
|
||||
docInfo.put_Lang(config.lang);
|
||||
docInfo.put_Mode(config.mode);
|
||||
|
||||
docInfo.asc_putIsEnabledMacroses(false);
|
||||
docInfo.asc_putIsEnabledPlugins(false);
|
||||
/*var enable = !config.customization || (config.customization.macros!==false);
|
||||
docInfo.asc_putIsEnabledMacroses(!!enable);
|
||||
enable = !config.customization || (config.customization.plugins!==false);
|
||||
docInfo.asc_putIsEnabledPlugins(!!enable);*/
|
||||
|
||||
if (api) {
|
||||
api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions);
|
||||
// api.asc_registerCallback('asc_onRunAutostartMacroses', onRunAutostartMacroses);
|
||||
api.asc_setDocInfo(docInfo);
|
||||
api.asc_getEditorPermissions(config.licenseUrl, config.customerId);
|
||||
api.asc_enableKeyEvents(false);
|
||||
@ -157,18 +148,12 @@ SSE.ApplicationController = new(function(){
|
||||
setActiveWorkSheet(api.asc_getActiveWorksheetIndex());
|
||||
}
|
||||
|
||||
function hidePreloader() {
|
||||
$('#loading-mask').fadeOut('slow');
|
||||
}
|
||||
|
||||
function onDocumentContentReady() {
|
||||
hidePreloader();
|
||||
onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
|
||||
api.asc_registerCallback('asc_onHyperlinkClick', common.utils.openLink);
|
||||
api.asc_registerCallback('asc_onStartAction', onLongActionBegin);
|
||||
|
||||
Common.Gateway.on('processmouse', onProcessMouse);
|
||||
Common.Gateway.on('downloadas', onDownloadAs);
|
||||
//Common.Gateway.on('processmouse', onProcessMouse);
|
||||
//Common.Gateway.on('downloadas', onDownloadAs);
|
||||
Common.Gateway.on('requestclose', onRequestClose);
|
||||
|
||||
|
||||
@ -189,36 +174,17 @@ SSE.ApplicationController = new(function(){
|
||||
}
|
||||
|
||||
function onEditorPermissions(params) {
|
||||
api.asc_SetFastCollaborative(true);
|
||||
api.asc_setAutoSaveGap(1);
|
||||
|
||||
onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
|
||||
|
||||
//api.asc_setViewMode(true);
|
||||
api.asc_LoadDocument();
|
||||
}
|
||||
|
||||
function onOpenDocument(progress) {
|
||||
var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount());
|
||||
me.loadMask && me.loadMask.setTitle(me.textLoadingDocument + ': ' + common.utils.fixedDigits(Math.min(Math.round(proc*100), 100), 3, " ") + '%');
|
||||
}
|
||||
|
||||
function onLongActionBegin(type, id){
|
||||
var text = '';
|
||||
switch (id)
|
||||
{
|
||||
case LoadingDocument:
|
||||
text = me.textLoadingDocument + ' ';
|
||||
break;
|
||||
default:
|
||||
text = me.waitText;
|
||||
break;
|
||||
}
|
||||
|
||||
if (type == Asc.c_oAscAsyncActionType['BlockInteraction']) {
|
||||
if (!me.loadMask)
|
||||
me.loadMask = new common.view.LoadMask();
|
||||
me.loadMask.setTitle(text);
|
||||
me.loadMask.show();
|
||||
console.log('Action begin');
|
||||
}
|
||||
}
|
||||
|
||||
@ -237,23 +203,16 @@ SSE.ApplicationController = new(function(){
|
||||
break;
|
||||
}
|
||||
|
||||
me.loadMask && me.loadMask.hide();
|
||||
console.log('Action end');
|
||||
}
|
||||
}
|
||||
|
||||
function onError(id, level, errData) {
|
||||
if (id == Asc.c_oAscError.ID.LoadingScriptError) {
|
||||
/*$('#id-critical-error-title').text(me.criticalErrorTitle);
|
||||
$('#id-critical-error-message').text(me.scriptLoadError);
|
||||
$('#id-critical-error-close').text(me.txtClose).off().on('click', function(){
|
||||
window.location.reload();
|
||||
});
|
||||
$('#id-critical-error-dialog').css('z-index', 20002).modal('show');*/
|
||||
console.error(me.scriptLoadError);
|
||||
console.error(id,me.scriptLoadError);
|
||||
return;
|
||||
}
|
||||
|
||||
hidePreloader();
|
||||
onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
|
||||
|
||||
var message;
|
||||
@ -311,41 +270,18 @@ SSE.ApplicationController = new(function(){
|
||||
}
|
||||
|
||||
if (level == Asc.c_oAscError.Level.Critical) {
|
||||
|
||||
// report only critical errors
|
||||
//Common.Gateway.reportError(id, message);
|
||||
console.error(id,message);
|
||||
|
||||
/* $('#id-critical-error-title').text(me.criticalErrorTitle);
|
||||
$('#id-critical-error-message').html(message);
|
||||
$('#id-critical-error-close').text(me.txtClose).off().on('click', function(){
|
||||
window.location.reload();
|
||||
});*/
|
||||
}
|
||||
else {
|
||||
// Common.Gateway.reportWarning(id, message);
|
||||
console.warn(id,message);
|
||||
|
||||
/*$('#id-critical-error-title').text(me.notcriticalErrorTitle);
|
||||
$('#id-critical-error-message').html(message);
|
||||
$('#id-critical-error-close').text(me.txtClose).off().on('click', function(){
|
||||
$('#id-critical-error-dialog').modal('hide');
|
||||
});*/
|
||||
}
|
||||
|
||||
//$('#id-critical-error-dialog').modal('show');
|
||||
|
||||
//Common.Analytics.trackEvent('Internal Error', id.toString());
|
||||
}
|
||||
|
||||
function onExternalMessage(error) {
|
||||
if (error) {
|
||||
hidePreloader();
|
||||
$('#id-error-mask-title').text(me.criticalErrorTitle);
|
||||
$('#id-error-mask-text').text(error.msg);
|
||||
$('#id-error-mask').css('display', 'block');
|
||||
|
||||
//Common.Analytics.trackEvent('External Error');
|
||||
}
|
||||
}
|
||||
|
||||
@ -364,26 +300,9 @@ SSE.ApplicationController = new(function(){
|
||||
Common.Gateway.requestClose();
|
||||
}
|
||||
|
||||
function onDownloadAs() {
|
||||
if ( permissions.download === false) {
|
||||
//Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny);
|
||||
console.error(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny);
|
||||
return;
|
||||
}
|
||||
api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.XLSX, true));
|
||||
}
|
||||
|
||||
|
||||
function onRunAutostartMacroses() {
|
||||
if (!config.customization || (config.customization.macros!==false))
|
||||
if (api) api.asc_runAutostartMacroses();
|
||||
}
|
||||
|
||||
function onBeforeUnload () {
|
||||
common.localStorage.save();
|
||||
}
|
||||
// Helpers
|
||||
// -------------------------
|
||||
|
||||
function onDocumentResize() {
|
||||
if (api) api.asc_Resize();
|
||||
@ -412,14 +331,12 @@ SSE.ApplicationController = new(function(){
|
||||
if (api){
|
||||
api.asc_registerCallback('asc_onEndAction', onLongActionEnd);
|
||||
api.asc_registerCallback('asc_onError', onError);
|
||||
api.asc_registerCallback('asc_onOpenDocumentProgress', onOpenDocument);
|
||||
api.asc_registerCallback('asc_onSheetsChanged', onSheetsChanged);
|
||||
api.asc_registerCallback('asc_onActiveSheetChanged', setActiveWorkSheet);
|
||||
|
||||
if(common.controller.CellEditor ) {
|
||||
common.controller.CellEditor.create();
|
||||
common.controller.CellEditor.setApi(api)
|
||||
common.controller.CellEditor.setMode(config);
|
||||
if(SSE.CellEditorController ) {
|
||||
SSE.CellEditorController.create();
|
||||
SSE.CellEditorController.setApi(api);
|
||||
}
|
||||
// Initialize api gateway
|
||||
Common.Gateway.on('init', loadConfig);
|
||||
@ -428,6 +345,18 @@ SSE.ApplicationController = new(function(){
|
||||
Common.Gateway.appReady();
|
||||
}
|
||||
|
||||
api.asc_enableKeyEvents(true);
|
||||
var ismodalshown = false;
|
||||
$(document.body).on('blur', 'input, textarea',
|
||||
function(e) {
|
||||
if ( !ismodalshown ) {
|
||||
if (!/area_id/.test(e.target.id) ) {
|
||||
api.asc_enableKeyEvents(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return me;
|
||||
}
|
||||
|
||||
|
||||
@ -41,24 +41,19 @@ SSE.ApplicationView = new(function(){
|
||||
// Initialize view
|
||||
|
||||
function createView(){
|
||||
$btnTools = $('#box-tools button');
|
||||
/*$btnTools = $('#box-tools button');
|
||||
|
||||
$btnTools.addClass('dropdown-toggle').attr('data-toggle', 'dropdown').attr('aria-expanded', 'true');
|
||||
$btnTools.parent().append(
|
||||
'<ul class="dropdown-menu pull-right">' +
|
||||
'</ul>');
|
||||
'</ul>');*/
|
||||
}
|
||||
|
||||
function getTools(name) {
|
||||
return $btnTools.parent().find(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return {
|
||||
create: createView
|
||||
, tools: {
|
||||
get: getTools
|
||||
},
|
||||
create: createView,
|
||||
|
||||
txtDownload: 'Download',
|
||||
txtPrint: 'Print',
|
||||
|
||||
@ -1,47 +1,11 @@
|
||||
!window.common && (window.common = {});
|
||||
!common.controller && (common.controller = {});
|
||||
if (SSE === undefined) {
|
||||
var SSE = {};
|
||||
}
|
||||
SSE.Keys={RETURN: 13};
|
||||
|
||||
common.ui = _.extend(common.ui || {}, {
|
||||
Keys : {
|
||||
BACKSPACE: 8,
|
||||
TAB: 9,
|
||||
RETURN: 13,
|
||||
SHIFT: 16,
|
||||
CTRL: 17,
|
||||
ALT: 18,
|
||||
ESC: 27,
|
||||
LEFT: 37,
|
||||
UP: 38,
|
||||
RIGHT: 39,
|
||||
DOWN: 40,
|
||||
DELETE: 46,
|
||||
HOME: 36,
|
||||
END: 35,
|
||||
SPACE: 32,
|
||||
PAGEUP: 33,
|
||||
PAGEDOWN: 34,
|
||||
INSERT: 45,
|
||||
EQUALITY_FF:61,
|
||||
NUM_PLUS: 107,
|
||||
NUM_MINUS: 109,
|
||||
F1: 112,
|
||||
F2: 113,
|
||||
F3: 114,
|
||||
F4: 115,
|
||||
F5: 116,
|
||||
F6: 117,
|
||||
F7: 118,
|
||||
F8: 119,
|
||||
F9: 120,
|
||||
F10: 121,
|
||||
F11: 122,
|
||||
F12: 123,
|
||||
MINUS_FF: 173,
|
||||
EQUALITY: 187,
|
||||
MINUS: 189
|
||||
}});
|
||||
|
||||
common.controller.CellEditor = new(function(){
|
||||
SSE.CellEditorController = new(function(){
|
||||
var me,
|
||||
api,
|
||||
editor,
|
||||
@ -49,7 +13,7 @@ common.controller.CellEditor = new(function(){
|
||||
created=false;
|
||||
|
||||
function onCellName(e){
|
||||
if (e.keyCode == common.ui.Keys.RETURN){
|
||||
if (e.keyCode == SSE.Keys.RETURN){
|
||||
var name = editor.$cellname.val();
|
||||
if (name && name.length) {
|
||||
api.asc_findCell(name);
|
||||
@ -58,7 +22,7 @@ common.controller.CellEditor = new(function(){
|
||||
}
|
||||
|
||||
function onKeyupCellEditor(e) {
|
||||
if(e.keyCode == common.ui.Keys.RETURN && !e.altKey){
|
||||
if(e.keyCode == SSE.Keys.RETURN && !e.altKey){
|
||||
api.isCEditorFocused = 'clear';
|
||||
}
|
||||
}
|
||||
@ -70,11 +34,7 @@ common.controller.CellEditor = new(function(){
|
||||
api.isCEditorFocused = true;
|
||||
}
|
||||
|
||||
function onLayoutResize(o, r) {
|
||||
if (r == 'cell:edit') {
|
||||
o && common.localStorage.setBool('sse-celleditor-expand', false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function events() {
|
||||
editor.$el.find('#ce-cell-name').on( 'keyup', onCellName);
|
||||
@ -83,17 +43,16 @@ common.controller.CellEditor = new(function(){
|
||||
}
|
||||
|
||||
function onLaunch(){
|
||||
common.view.CellEditor.create();
|
||||
editor = common.view.CellEditor;
|
||||
SSE.CellEditorView.create();
|
||||
editor = SSE.CellEditorView;
|
||||
events();
|
||||
|
||||
editor.$el.parent().find('.after').css({zIndex: '4'}); // for spreadsheets - bug 23127
|
||||
|
||||
var val = common.localStorage.getItem('sse-celleditor-height');
|
||||
editor.keep_height = (val!==null && parseInt(val)>0) ? parseInt(val) : 19;
|
||||
editor.keep_height = 19;//(val!==null && parseInt(val)>0) ? parseInt(val) : 19;
|
||||
if (common.localStorage.getBool('sse-celleditor-expand')) {
|
||||
editor.$el.height(editor.keep_height);
|
||||
onLayoutResize(undefined, 'cell:edit');
|
||||
}
|
||||
this.namedrange_locked = false;
|
||||
}
|
||||
@ -126,10 +85,6 @@ common.controller.CellEditor = new(function(){
|
||||
}
|
||||
}
|
||||
|
||||
function onLockDefNameManager(state) {
|
||||
this.namedrange_locked = (state == Asc.c_oAscDefinedNameReason.LockDefNameManager);
|
||||
}
|
||||
|
||||
function onApiDisconnect() {
|
||||
mode.isEdit = false;
|
||||
}
|
||||
@ -141,20 +96,9 @@ common.controller.CellEditor = new(function(){
|
||||
api.asc_registerCallback('asc_onSelectionNameChanged', onApiCellSelection);
|
||||
api.asc_registerCallback('asc_onEditCell', onApiEditCell);
|
||||
api.asc_registerCallback('asc_onCoAuthoringDisconnect', onApiDisconnect);
|
||||
api.asc_registerCallback('asc_onLockDefNameManager', onLockDefNameManager);
|
||||
}
|
||||
|
||||
function onApiSelectionChanged(info) {
|
||||
if (this.viewmode) return; // signed file
|
||||
}
|
||||
|
||||
function setMode(modeF) {
|
||||
mode = modeF;
|
||||
|
||||
if ( mode.isEdit ) {
|
||||
api.asc_registerCallback('asc_onSelectionChanged', onApiSelectionChanged);
|
||||
}
|
||||
}
|
||||
|
||||
function setPreviewMode(mode) {
|
||||
if (this.viewmode === mode) return;
|
||||
@ -165,7 +109,6 @@ common.controller.CellEditor = new(function(){
|
||||
return {
|
||||
create: createController,
|
||||
setApi: setApi,
|
||||
setMode: setMode,
|
||||
setPreviewMode: setPreviewMode
|
||||
}
|
||||
|
||||
|
||||
@ -30,12 +30,11 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
if (SSE === undefined) {
|
||||
var SSE = {};
|
||||
}
|
||||
|
||||
|
||||
!window.common && (window.common = {});
|
||||
!common.view && (common.view = {});
|
||||
|
||||
common.view.CellEditor = new(function (){
|
||||
SSE.CellEditorView = new(function (){
|
||||
var me;
|
||||
|
||||
function createView()
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
// Common styles
|
||||
@import "../../../../common/main/resources/less/colors-table-ie-fix.less";
|
||||
@import "../../../../common/main/resources/less/variables.less";
|
||||
@import "../../../../common/main/resources/less/colors-table.less";
|
||||
@import "../../../../common/main/resources/less/asc-mixins.less";
|
||||
@import "../../../../common/main/resources/less/buttons.less";
|
||||
@import "../../../../documenteditor/main/resources/less/colors-table-ie-fix.less";
|
||||
@import "../../../../documenteditor/main/resources/less/variables.less";
|
||||
@import "../../../../documenteditor/main/resources/less/colors-table.less";
|
||||
@import "../../../../documenteditor/main/resources/less/asc-mixins.less";
|
||||
@import "../../../../documenteditor/main/resources/less/buttons.less";
|
||||
#cell-editing-box {
|
||||
border-bottom: solid @scaled-one-px-value-ie @border-toolbar-ie;
|
||||
border-bottom: solid @scaled-one-px-value @border-toolbar;
|
||||
|
||||
Reference in New Issue
Block a user