From 4fad22e95a7b72b2578fff576690b47a303ebbfd Mon Sep 17 00:00:00 2001 From: OVSharova Date: Thu, 9 Sep 2021 05:55:43 +0300 Subject: [PATCH] change style celleditor --- .../main/js/ApplicationController.js | 3 +- .../main/js/ApplicationController.js | 214 +++++++++--------- test/spreadsheeteditor/main/index.html | 120 +--------- .../main/js/ApplicationController.js | 14 +- .../main/resources/less/celleditor.less | 18 +- .../common/main/lib/controller/CellEditor.js | 32 ++- 6 files changed, 152 insertions(+), 249 deletions(-) diff --git a/test/documenteditor/main/js/ApplicationController.js b/test/documenteditor/main/js/ApplicationController.js index d35f68d6b..f15c0fc5d 100644 --- a/test/documenteditor/main/js/ApplicationController.js +++ b/test/documenteditor/main/js/ApplicationController.js @@ -402,7 +402,8 @@ DE.ApplicationController = new(function(){ window["flat_desine"] = true; api = new Asc.asc_docs_api({ - 'id-view' : 'editor_sdk' + 'id-view' : 'editor_sdk', + 'embedded' : true }); if (api){ diff --git a/test/presentationeditor/main/js/ApplicationController.js b/test/presentationeditor/main/js/ApplicationController.js index 39f3f6688..efd87a6dc 100644 --- a/test/presentationeditor/main/js/ApplicationController.js +++ b/test/presentationeditor/main/js/ApplicationController.js @@ -72,16 +72,7 @@ PE.ApplicationController = new(function(){ //common.controller.modals.init(embedConfig); - // Docked toolbar - /*if (embedConfig.toolbarDocked === 'bottom') { - $('#toolbar').addClass('bottom'); - $('#editor_sdk').addClass('bottom'); - $('#box-tools').removeClass('dropdown').addClass('dropup'); - ttOffset[1] = -40; - } else { - $('#toolbar').addClass('top'); - $('#editor_sdk').addClass('top'); - }*/ + config.canBackToFolder = (config.canBackToFolder!==false) && config.customization && config.customization.goback && (config.customization.goback.url || config.customization.goback.requestClose && config.canRequestClose); @@ -362,123 +353,122 @@ PE.ApplicationController = new(function(){ //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');*/ - console.error(error.msg); + 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');*/ + console.error(error.msg); -//Common.Analytics.trackEvent('External Error'); -} -} + //Common.Analytics.trackEvent('External Error'); + } + } -function onProcessMouse(data) { -if (data.type == 'mouseup') { -var e = document.getElementById('editor_sdk'); -if (e) { - var r = e.getBoundingClientRect(); - api.OnMouseUp( - data.x - r.left, - data.y - r.top - ); -} -} -} + function onProcessMouse(data) { + if (data.type == 'mouseup') { + var e = document.getElementById('editor_sdk'); + if (e) { + var r = e.getBoundingClientRect(); + api.OnMouseUp( + data.x - r.left, + data.y - r.top + ); + } + } + } -function onRequestClose() { -Common.Gateway.requestClose(); -} + function onRequestClose() { + 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; -} -if (api) api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PPTX, false)); -} + 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; + } + if (api) api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PPTX, false)); + } -function onRunAutostartMacroses() { -if (!config.customization || (config.customization.macros!==false)) -if (api) api.asc_runAutostartMacroses(); -} + function onRunAutostartMacroses() { + if (!config.customization || (config.customization.macros!==false)) + if (api) api.asc_runAutostartMacroses(); + } -function onBeforeUnload () { -common.localStorage.save(); -} -// Helpers -// ------------------------- + function onBeforeUnload () { + common.localStorage.save(); + } -function onDocumentResize() { -if (api) { -api.Resize(); -} -} + // Helpers + // ------------------------- -function createController(){ -if (created) -return me; + function onDocumentResize() { + if (api) { + api.Resize(); + } + } -me = this; -created = true; + function createController(){ + if (created) return me; -// popover ui handlers + me = this; + created = true; -$(window).resize(function(){ -onDocumentResize(); -}); -window.onbeforeunload = onBeforeUnload; + // popover ui handlers -api = new Asc.asc_docs_api({ -'id-view' : 'editor_sdk', -'embedded' : true -}); + $(window).resize(function(){ + onDocumentResize(); + }); + window.onbeforeunload = onBeforeUnload; -if (api){ -api.SetThemesPath("../../../../sdkjs/slide/themes/"); + api = new Asc.asc_docs_api({ + 'id-view' : 'editor_sdk', + 'embedded' : true + }); -api.asc_registerCallback('asc_onError', onError); -api.asc_registerCallback('asc_onDocumentContentReady', onDocumentContentReady); -api.asc_registerCallback('asc_onOpenDocumentProgress', onOpenDocument); -//api.asc_registerCallback('asc_onCountPages', onCountPages); -//api.asc_registerCallback('asc_onCurrentPage', onCurrentPage); + if (api){ + api.SetThemesPath("../../../../sdkjs/slide/themes/"); -// Initialize api gateway -Common.Gateway.on('init', loadConfig); -Common.Gateway.on('opendocument', loadDocument); -Common.Gateway.on('showmessage', onExternalMessage); -Common.Gateway.appReady(); -} + api.asc_registerCallback('asc_onError', onError); + api.asc_registerCallback('asc_onDocumentContentReady', onDocumentContentReady); + api.asc_registerCallback('asc_onOpenDocumentProgress', onOpenDocument); -return me; -} + // Initialize api gateway + Common.Gateway.on('init', loadConfig); + Common.Gateway.on('opendocument', loadDocument); + Common.Gateway.on('showmessage', onExternalMessage); + Common.Gateway.appReady(); -return { -create : createController, -errorDefaultMessage : 'Error code: %1', -unknownErrorText : 'Unknown error.', -convertationTimeoutText : 'Conversion timeout exceeded.', -convertationErrorText : 'Conversion failed.', -downloadErrorText : 'Download failed.', -criticalErrorTitle : 'Error', -notcriticalErrorTitle : 'Warning', -scriptLoadError: 'The connection is too slow, some of the components could not be loaded. Please reload the page.', -errorFilePassProtect: 'The file is password protected and cannot be opened.', -errorAccessDeny: 'You are trying to perform an action you do not have rights for.
Please contact your Document Server administrator.', -errorUserDrop: 'The file cannot be accessed right now.', -unsupportedBrowserErrorText: 'Your browser is not supported.', -textOf: 'of', -downloadTextText: 'Downloading presentation...', -waitText: 'Please, wait...', -textLoadingDocument: 'Loading presentation', -txtClose: 'Close', -errorFileSizeExceed: 'The file size exceeds the limitation set for your server.
Please contact your Document Server administrator for details.', -errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.
Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.', -textGuest: 'Guest', -textAnonymous: 'Anonymous', -errorForceSave: "An error occurred while saving the file. Please use the 'Download as' option to save the file to your computer hard drive or try again later.", -errorLoadingFont: 'Fonts are not loaded.
Please contact your Document Server administrator.' -} + } + + return me; + } + + return { + create : createController, + errorDefaultMessage : 'Error code: %1', + unknownErrorText : 'Unknown error.', + convertationTimeoutText : 'Conversion timeout exceeded.', + convertationErrorText : 'Conversion failed.', + downloadErrorText : 'Download failed.', + criticalErrorTitle : 'Error', + notcriticalErrorTitle : 'Warning', + scriptLoadError: 'The connection is too slow, some of the components could not be loaded. Please reload the page.', + errorFilePassProtect: 'The file is password protected and cannot be opened.', + errorAccessDeny: 'You are trying to perform an action you do not have rights for.
Please contact your Document Server administrator.', + errorUserDrop: 'The file cannot be accessed right now.', + unsupportedBrowserErrorText: 'Your browser is not supported.', + textOf: 'of', + downloadTextText: 'Downloading presentation...', + waitText: 'Please, wait...', + textLoadingDocument: 'Loading presentation', + txtClose: 'Close', + errorFileSizeExceed: 'The file size exceeds the limitation set for your server.
Please contact your Document Server administrator for details.', + errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.
Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.', + textGuest: 'Guest', + textAnonymous: 'Anonymous', + errorForceSave: "An error occurred while saving the file. Please use the 'Download as' option to save the file to your computer hard drive or try again later.", + errorLoadingFont: 'Fonts are not loaded.
Please contact your Document Server administrator.' + } })(); diff --git a/test/spreadsheeteditor/main/index.html b/test/spreadsheeteditor/main/index.html index 908cce40a..5736cbbdd 100644 --- a/test/spreadsheeteditor/main/index.html +++ b/test/spreadsheeteditor/main/index.html @@ -16,113 +16,7 @@ - @@ -199,9 +93,9 @@ var elem = document.querySelector('.loading-logo'); if (elem && logo) { elem.style.backgroundImage= 'none'; - var img = document.querySelector('.loading-logo img'); + /*var img = document.querySelector('.loading-logo img'); img && img.setAttribute('src', logo); - img.style.opacity = 1; + img.style.opacity = 1;*/ } @@ -212,13 +106,14 @@
-
+
+
@@ -290,7 +185,6 @@ - diff --git a/test/spreadsheeteditor/main/js/ApplicationController.js b/test/spreadsheeteditor/main/js/ApplicationController.js index 48e6a58ff..5c0ad2d3a 100644 --- a/test/spreadsheeteditor/main/js/ApplicationController.js +++ b/test/spreadsheeteditor/main/js/ApplicationController.js @@ -135,8 +135,6 @@ SSE.ApplicationController = new(function(){ api.asc_setDocInfo(docInfo); api.asc_getEditorPermissions(config.licenseUrl, config.customerId); api.asc_enableKeyEvents(false); - - // Common.Analytics.trackEvent('Load', 'Start'); } embedConfig.docTitle = docConfig.title; @@ -243,11 +241,7 @@ SSE.ApplicationController = new(function(){ Common.Gateway.on('requestclose', onRequestClose); - if(common.controller.CellEditor ) { - common.controller.CellEditor.create(); - common.controller.CellEditor.setApi(api) - common.controller.CellEditor.setMode(config); - } + SSE.ApplicationView.tools.get('#idt-fullscreen') .on('click', function(){ @@ -362,6 +356,7 @@ SSE.ApplicationController = new(function(){ } function onEditorPermissions(params) { + api.asc_setAutoSaveGap(1); if ( (params.asc_getLicenseType() === Asc.c_oLicenseResult.Success) && (typeof config.customization == 'object') && config.customization && config.customization.logo ) { @@ -654,6 +649,11 @@ SSE.ApplicationController = new(function(){ 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); + } // Initialize api gateway Common.Gateway.on('init', loadConfig); Common.Gateway.on('opendocument', loadDocument); diff --git a/test/spreadsheeteditor/main/resources/less/celleditor.less b/test/spreadsheeteditor/main/resources/less/celleditor.less index ee2d65154..a8b5b3c18 100644 --- a/test/spreadsheeteditor/main/resources/less/celleditor.less +++ b/test/spreadsheeteditor/main/resources/less/celleditor.less @@ -16,8 +16,6 @@ .ce-group-name { float: left; height: 20px; - //border-bottom: @scaled-one-px-value-ie solid @border-toolbar-ie; - //border-bottom: @scaled-one-px-value solid @border-toolbar; background-color: @background-toolbar-ie; background-color: @background-toolbar; @@ -100,11 +98,10 @@ } .ce-group-content { - margin: 0 16px 0 120px; + margin: 0 2px 0 120px; height: 100%; border-left: @scaled-one-px-value-ie solid @border-toolbar-ie; border-left: @scaled-one-px-value solid @border-toolbar; - #ce-cell-content { height: 100%; resize: none; @@ -113,7 +110,7 @@ font-size: 12px; line-height: 18px; padding-bottom: 0; - + padding-top: 0; &[disabled] { color: @border-preview-select-ie; color: @border-preview-select; @@ -158,3 +155,14 @@ } } } + +.layout-resizer { + z-index: @zindex-dropdown - 10; + background: @background-toolbar-ie; + background: @background-toolbar; + border: 0 none; + + &.move { + opacity: 0.4; + } +} diff --git a/test/unit-tests/common/main/lib/controller/CellEditor.js b/test/unit-tests/common/main/lib/controller/CellEditor.js index fe5ba2879..695834e05 100644 --- a/test/unit-tests/common/main/lib/controller/CellEditor.js +++ b/test/unit-tests/common/main/lib/controller/CellEditor.js @@ -1,5 +1,6 @@ !window.common && (window.common = {}); !common.controller && (common.controller = {}); + Common.UI = _.extend(Common.UI || {}, { Keys : { BACKSPACE: 8, @@ -39,6 +40,7 @@ Common.UI = _.extend(Common.UI || {}, { EQUALITY: 187, MINUS: 189 }}); + common.controller.CellEditor = new(function(){ var me, api, @@ -55,17 +57,20 @@ common.controller.CellEditor = new(function(){ //Common.NotificationCenter.trigger('edit:complete', editor); } } + function onKeyupCellEditor(e) { if(e.keyCode == Common.UI.Keys.RETURN && !e.altKey){ api.isCEditorFocused = 'clear'; } } + function onBlurCellEditor() { if (api.isCEditorFocused == 'clear') api.isCEditorFocused = undefined; else if (api.isCellEdited) api.isCEditorFocused = true; } + function expandEditorField() { if ( Math.floor(editor.$el.height()) > 19) { editor.keep_height = editor.$el.height(); @@ -80,9 +85,8 @@ common.controller.CellEditor = new(function(){ common.localStorage.setBool('sse-celleditor-expand', true); } - //Common.NotificationCenter.trigger('layout:changed', 'celleditor'); - //Common.NotificationCenter.trigger('edit:complete', editor, {restorefocus:true}); } + function events() { editor.$el.find('#ce-cell-name').on( 'keyup', onCellName); editor.$el.find('textarea#ce-cell-content').on( 'keyup', onKeyupCellEditor); @@ -90,6 +94,7 @@ common.controller.CellEditor = new(function(){ //editor.$el.find('button#ce-btn-expand').on('click', expandEditorField);/*, /*'click button#ce-func-label': onInsertFunction*/ } + function createController() { me = this; if (created) @@ -100,6 +105,7 @@ common.controller.CellEditor = new(function(){ onLaunch(); return me; } + function onLayoutResize(o, r) { if (r == 'cell:edit') { /*if (Math.floor(editor.$el.height()) > 19) { @@ -117,6 +123,7 @@ common.controller.CellEditor = new(function(){ //} } } + function onLaunch(){ common.view.CellEditor.create(); editor = common.view.CellEditor; @@ -140,6 +147,7 @@ common.controller.CellEditor = new(function(){ function onApiCellSelection(info){ editor.cell.updateInfo(info); } + function onApiEditCell(state) { if (this.viewmode) return; // signed file @@ -155,9 +163,11 @@ common.controller.CellEditor = new(function(){ } editor.$btnfunc.toggleClass('disabled', state == Asc.c_oAscCellEditorState.editText); } + function onLockDefNameManager(state) { this.namedrange_locked = (state == Asc.c_oAscDefinedNameReason.LockDefNameManager); } + function onInputKeyDown(e) { if (Common.UI.Keys.UP === e.keyCode || Common.UI.Keys.DOWN === e.keyCode || Common.UI.Keys.TAB === e.keyCode || Common.UI.Keys.RETURN === e.keyCode || Common.UI.Keys.ESC === e.keyCode || @@ -167,6 +177,7 @@ common.controller.CellEditor = new(function(){ menu.find('.dropdown-menu').trigger('keydown', e); } } + function onApiDisconnect() { mode.isEdit = false; @@ -180,10 +191,7 @@ common.controller.CellEditor = new(function(){ editor.btnNamedRanges.setVisible(false); } } - function onCellsRange(status) { - editor.cell.nameDisabled(status != Asc.c_oAscSelectionDialogType.None); - editor.$btnfunc.toggleClass('disabled', status != Asc.c_oAscSelectionDialogType.None); - } + function setApi(apiF){ api=apiF; @@ -191,11 +199,10 @@ common.controller.CellEditor = new(function(){ api.asc_registerCallback('asc_onSelectionNameChanged', onApiCellSelection); api.asc_registerCallback('asc_onEditCell', onApiEditCell); api.asc_registerCallback('asc_onCoAuthoringDisconnect', onApiDisconnect); - //Common.NotificationCenter.on('api:disconnect', onApiDisconnect); - //Common.NotificationCenter.on('cells:range', onCellsRange); api.asc_registerCallback('asc_onLockDefNameManager', onLockDefNameManager); api.asc_registerCallback('asc_onInputKeyDown', onInputKeyDown); } + function onApiSelectionChanged(info) { if (this.viewmode) return; // signed file @@ -211,26 +218,29 @@ common.controller.CellEditor = new(function(){ editor.$btnfunc.toggleClass('disabled', is_image || is_mode_2 || coauth_disable); } + function setMode(modeF) { mode = modeF; editor.$btnfunc[mode.isEdit?'removeClass':'addClass']('disabled'); - //editor.btnNamedRanges.setVisible(mode.isEdit && !mode.isEditDiagram && !mode.isEditMailMerge); if ( mode.isEdit ) { api.asc_registerCallback('asc_onSelectionChanged', onApiSelectionChanged); } } + function setPreviewMode(mode) { if (this.viewmode === mode) return; this.viewmode = mode; - editor.$btnfunc[!mode && mode.isEdit?'removeClass':'addClass']('disabled'); + //editor.$btnfunc[!mode && mode.isEdit?'removeClass':'addClass']('disabled'); editor.cell.nameDisabled(mode && !(mode.isEdit && !mode.isEditDiagram && !mode.isEditMailMerge)); } + return { create: createController, setApi: setApi, - setMode: setMode + setMode: setMode, + setPreviewMode: setPreviewMode } })(); \ No newline at end of file