This commit is contained in:
OVSharova 2021-09-10 09:26:28 +03:00
parent 4fad22e95a
commit 94f7ec00e9
7 changed files with 34 additions and 175 deletions

View file

@ -62,10 +62,10 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
//logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null;
lang = (params["lang"] || 'en').split(/[\-\_]/)[0];
logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null;
/*window.frameEditorId = params["frameEditorId"];
window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"];
var elem = document.querySelector('.loading-logo');
@ -74,10 +74,10 @@
var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo);
img.style.opacity = 1;
}*/
}
</script>
<div id="editor_sdk" class="viewer top" style="overflow: hidden;" tabindex="-1"></div>
<div id="editor_sdk" class="viewer" style="overflow: hidden;" tabindex="-1"></div>

View file

@ -84,60 +84,29 @@
}
var params = getUrlParams(),
lang = (params["lang"] || 'en').split(/[\-\_]/)[0],
logo = params["headerlogo"] ? encodeUrlParam(params["headerlogo"]) : null;
lang = (params["lang"] || 'en').split(/[\-\_]/)[0];
window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"];
var elem = document.querySelector('.loading-logo');
if (elem && logo) {
elem.style.backgroundImage= 'none';
/*var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo);
img.style.opacity = 1;*/
}
</script>
<div class="viewer">
<div class="layout-resizer befor" style="top: 20px; height: 4px; "></div>
<div id="cell-editing-box">
<div class="ce-group-name">
<input id="ce-cell-name" class="aslabel form-control" type="text">
<div id="ce-cell-name-menu" class="layout-item" style="height: 20px; top: 0px; border-left: none;"></div>
<!-- <button id="ce-func-label" type="button" class="btn small btn-toolbar"><i class="icon toolbar__icon btn-function"></i></button>
--></div>
<!--<div class="ce-group-expand">
<button id="ce-btn-expand" type="button" class="btn"><span class="caret">&nbsp;</span></button>
</div>-->
</div>
<div class="ce-group-content">
<textarea id="ce-cell-content" class="form-control" spellcheck="false" rows="1" cols="20"></textarea>
</div>
</div>
<div class="layout-resizer after" style="top: 20px; height: 4px; z-index: 4;"></div>
<div class="layout-resizer after" style="top: 20px; height: 4px; "></div>
<div id="editor_sdk" class="sdk-view" style="overflow: hidden;" tabindex="-1"></div>
<ul id="worksheets" class="worksheet-list"></ul>
</div>
<div class="overlay-controls" style="margin-left: -32px">
<ul class="left">
<li id="id-btn-zoom-in"><button class="overlay svg-icon zoom-up"></button></li>
<li id="id-btn-zoom-out"><button class="overlay svg-icon zoom-down"></button></li>
</ul>
</div>
<div class="toolbar" id="toolbar">
<div class="group left">
<div class="margin-right-large"><a id="header-logo" class="brand-logo" href="http://www.onlyoffice.com/" target="_blank"></a></div>
</div>
<div class="group center">
<span id="title-doc-name"></span>
</div>
<div class="group right">
<div id="box-tools" class="dropdown">
<button class="control-btn svg-icon more-vertical"></button>
</div>
</div>
</div>
<div class="modal fade error" id="id-critical-error-dialog" tabindex="-1" role="dialog">
<div class="modal-dialog">

View file

@ -75,7 +75,7 @@ SSE.ApplicationController = new(function(){
//common.controller.modals.init(embedConfig);
// Docked toolbar
if (embedConfig.toolbarDocked === 'bottom') {
/*if (embedConfig.toolbarDocked === 'bottom') {
$('#toolbar').addClass('bottom');
$('.viewer').addClass('bottom');
$('#box-tools').removeClass('dropdown').addClass('dropup');
@ -83,7 +83,7 @@ SSE.ApplicationController = new(function(){
} else {
$('#toolbar').addClass('top');
$('.viewer').addClass('top');
}
}*/
config.canBackToFolder = (config.canBackToFolder!==false) && config.customization && config.customization.goback &&
(config.customization.goback.url || config.customization.goback.requestClose && config.canRequestClose);
@ -138,8 +138,8 @@ SSE.ApplicationController = new(function(){
}
embedConfig.docTitle = docConfig.title;
labelDocName = $('#title-doc-name');
labelDocName.text(embedConfig.docTitle || '')
/* labelDocName = $('#title-doc-name');
labelDocName.text(embedConfig.docTitle || '')*/
}
}
@ -185,11 +185,11 @@ SSE.ApplicationController = new(function(){
function onPrint() {
if ( permissions.print!==false )
api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera || $.browser.mozilla && $.browser.versionNumber>86));
api.asc_Print(new Asc.asc_CDownloadOptions(null, true));
}
function onPrintUrl(url) {
common.utils.dialogPrint(url, api);
//common.utils.dialogPrint(url, api);
}
function hidePreloader() {
@ -201,7 +201,7 @@ SSE.ApplicationController = new(function(){
onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
if ( permissions.print === false)
/*if ( permissions.print === false)
$('#idt-print').hide();
if ( !embedConfig.saveUrl && permissions.print === false)
@ -222,7 +222,7 @@ SSE.ApplicationController = new(function(){
if ( !embedConfig.saveUrl && permissions.print === false && !embedConfig.shareUrl && !embedConfig.embedUrl && !embedConfig.fullscreenUrl && !config.canBackToFolder)
$('#box-tools').addClass('hidden');
else if (!embedConfig.embedUrl && !embedConfig.fullscreenUrl)
$('#box-tools .divider').hide();
$('#box-tools .divider').hide();*/
/*common.controller.modals.attach({
share: '#idt-share',
@ -232,8 +232,8 @@ SSE.ApplicationController = new(function(){
api.asc_registerCallback('asc_onMouseMove', onApiMouseMove);
api.asc_registerCallback('asc_onHyperlinkClick', common.utils.openLink);
api.asc_registerCallback('asc_onDownloadUrl', onDownloadUrl);
api.asc_registerCallback('asc_onPrint', onPrint);
api.asc_registerCallback('asc_onPrintUrl', onPrintUrl);
//api.asc_registerCallback('asc_onPrint', onPrint);
//api.asc_registerCallback('asc_onPrintUrl', onPrintUrl);
api.asc_registerCallback('asc_onStartAction', onLongActionBegin);
Common.Gateway.on('processmouse', onProcessMouse);
@ -243,7 +243,7 @@ SSE.ApplicationController = new(function(){
SSE.ApplicationView.tools.get('#idt-fullscreen')
/*SSE.ApplicationView.tools.get('#idt-fullscreen')
.on('click', function(){
common.utils.openLink(embedConfig.fullscreenUrl);
});
@ -256,8 +256,6 @@ SSE.ApplicationController = new(function(){
if (permissions.print!==false){
api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera || $.browser.mozilla && $.browser.versionNumber>86));
}
//Common.Analytics.trackEvent('Save');
});
SSE.ApplicationView.tools.get('#idt-print')
@ -310,7 +308,7 @@ SSE.ApplicationController = new(function(){
ismoved = false;
}, 2000);
}
});
});*/
var ismodalshown = false;
$(document.body).on('show.bs.modal', '.modal',
@ -352,33 +350,10 @@ SSE.ApplicationController = new(function(){
});
Common.Gateway.documentReady();
//Common.Analytics.trackEvent('Load', 'Complete');
}
function onEditorPermissions(params) {
api.asc_setAutoSaveGap(1);
if ( (params.asc_getLicenseType() === Asc.c_oLicenseResult.Success) && (typeof config.customization == 'object') &&
config.customization && config.customization.logo ) {
var logo = $('#header-logo');
if (config.customization.logo.imageEmbedded) {
logo.html('<img src="'+config.customization.logo.imageEmbedded+'" style="max-width:124px; max-height:20px;"/>');
logo.css({'background-image': 'none', width: 'auto', height: 'auto'});
}
if (config.customization.logo.url) {
logo.attr('href', config.customization.logo.url);
}
}
var $parent = labelDocName.parent();
var _left_width = $parent.position().left,
_right_width = $parent.next().outerWidth();
if ( _left_width < _right_width )
$parent.css('padding-left', _right_width - _left_width);
else
$parent.css('padding-right', _left_width - _right_width);
onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
@ -430,8 +405,6 @@ SSE.ApplicationController = new(function(){
}
me.loadMask && me.loadMask.hide();
/* if (type == Asc.c_oAscAsyncActionType.BlockInteraction && !( (id == Asc.c_oAscAsyncAction['LoadDocumentFonts'] || id == Asc.c_oAscAsyncAction['ApplyChanges']) && (this.dontCloseDummyComment || this.inTextareaControl || Common.Utils.ModalWindow.isVisible() || this.inFormControl) ))
this.onEditComplete(this.loadMask, {restorefocus:true});*/
}
}

View file

@ -46,14 +46,7 @@ SSE.ApplicationView = new(function(){
$btnTools.addClass('dropdown-toggle').attr('data-toggle', 'dropdown').attr('aria-expanded', 'true');
$btnTools.parent().append(
'<ul class="dropdown-menu pull-right">' +
'<li><a id="idt-print"><span class="mi-icon svg-icon print"></span>' + this.txtPrint + '</a></li>' +
'<li><a id="idt-download"><span class="mi-icon svg-icon download"></span>' + this.txtDownload + '</a></li>' +
'<li><a id="idt-share" data-toggle="modal"><span class="mi-icon svg-icon share"></span>' + this.txtShare + '</a></li>' +
'<li><a id="idt-close" data-toggle="modal"><span class="mi-icon svg-icon go-to-location"></span>' + this.txtFileLocation + '</a></li>' +
'<li class="divider"></li>' +
'<li><a id="idt-embed" data-toggle="modal"><span class="mi-icon svg-icon embed"></span>' + this.txtEmbed + '</a></li>' +
'<li><a id="idt-fullscreen"><span class="mi-icon svg-icon fullscr"></span>' + this.txtFullScreen + '</a></li>' +
'</ul>');
'</ul>');
}
function getTools(name) {

View file

@ -1,7 +1,7 @@
!window.common && (window.common = {});
!common.controller && (common.controller = {});
Common.UI = _.extend(Common.UI || {}, {
common.ui = _.extend(common.ui || {}, {
Keys : {
BACKSPACE: 8,
TAB: 9,
@ -49,17 +49,16 @@ common.controller.CellEditor = new(function(){
created=false;
function onCellName(e){
if (e.keyCode == Common.UI.Keys.RETURN){
if (e.keyCode == common.ui.Keys.RETURN){
var name = editor.$cellname.val();
if (name && name.length) {
api.asc_findCell(name);
}
//Common.NotificationCenter.trigger('edit:complete', editor);
}
}
function onKeyupCellEditor(e) {
if(e.keyCode == Common.UI.Keys.RETURN && !e.altKey){
if(e.keyCode == common.ui.Keys.RETURN && !e.altKey){
api.isCEditorFocused = 'clear';
}
}
@ -71,28 +70,10 @@ common.controller.CellEditor = new(function(){
api.isCEditorFocused = true;
}
function expandEditorField() {
if ( Math.floor(editor.$el.height()) > 19) {
editor.keep_height = editor.$el.height();
editor.$el.height(19);
editor.$el.removeClass('expanded');
editor.$btnexpand['removeClass']('btn-collapse');
common.localStorage.setBool('sse-celleditor-expand', false);
} else {
editor.$el.height(editor.keep_height);
editor.$el.addClass('expanded');
editor.$btnexpand['addClass']('btn-collapse');
common.localStorage.setBool('sse-celleditor-expand', true);
}
}
function events() {
editor.$el.find('#ce-cell-name').on( 'keyup', onCellName);
editor.$el.find('textarea#ce-cell-content').on( 'keyup', onKeyupCellEditor);
editor.$el.find('textarea#ce-cell-content').on('blur', onBlurCellEditor);
//editor.$el.find('button#ce-btn-expand').on('click', expandEditorField);/*,
/*'click button#ce-func-label': onInsertFunction*/
}
function createController() {
@ -100,7 +81,6 @@ common.controller.CellEditor = new(function(){
if (created)
return me;
created = true;
onLaunch();
return me;
@ -108,39 +88,23 @@ common.controller.CellEditor = new(function(){
function onLayoutResize(o, r) {
if (r == 'cell:edit') {
/*if (Math.floor(editor.$el.height()) > 19) {
if (!editor.$btnexpand.hasClass('btn-collapse')) {
editor.$el.addClass('expanded');
editor.$btnexpand['addClass']('btn-collapse');
}
o && common.localStorage.setItem('sse-celleditor-height', editor.$el.height());
o && common.localStorage.setBool('sse-celleditor-expand', true);
} else {*/
editor.$el.removeClass('expanded');
editor.$btnexpand['removeClass']('btn-collapse');
o && common.localStorage.setBool('sse-celleditor-expand', false);
//}
}
}
function onLaunch(){
common.view.CellEditor.create();
editor = common.view.CellEditor;
//me.bindViewEvents(editor, events);
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) : 74;
editor.keep_height = (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');
}
/* editor.btnNamedRanges.menu.on('item:click', _.bind(this.onNamedRangesMenu, this))
.on('show:before', _.bind(this.onNameBeforeShow, this));*/
this.namedrange_locked = false;
}
@ -161,7 +125,6 @@ common.controller.CellEditor = new(function(){
api.isCEditorFocused = false;
editor.cell.nameDisabled(false);
}
editor.$btnfunc.toggleClass('disabled', state == Asc.c_oAscCellEditorState.editText);
}
function onLockDefNameManager(state) {
@ -169,27 +132,17 @@ common.controller.CellEditor = new(function(){
}
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 ||
Common.UI.Keys.LEFT === e.keyCode || Common.UI.Keys.RIGHT === e.keyCode) {
/*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 ||
common.ui.Keys.LEFT === e.keyCode || common.ui.Keys.RIGHT === e.keyCode) {
var menu = $('#menu-formula-selection'); // for formula menu
if (menu.hasClass('open'))
menu.find('.dropdown-menu').trigger('keydown', e);
}
}*/
}
function onApiDisconnect() {
mode.isEdit = false;
var controller = this.getApplication().getController('FormulaDialog');
if (controller) {
controller.hideDialog();
}
if (!mode.isEdit) {
$('#ce-func-label', editor.$el).addClass('disabled');
editor.btnNamedRanges.setVisible(false);
}
}
function setApi(apiF){
@ -205,25 +158,11 @@ common.controller.CellEditor = new(function(){
function onApiSelectionChanged(info) {
if (this.viewmode) return; // signed file
var seltype = info.asc_getSelectionType(),
coauth_disable = (!mode.isEditMailMerge && !mode.isEditDiagram) ? (info.asc_getLocked() === true || info.asc_getLockedTable() === true || info.asc_getLockedPivotTable()===true) : false;
var is_chart_text = seltype == Asc.c_oAscSelectionType.RangeChartText,
is_chart = seltype == Asc.c_oAscSelectionType.RangeChart,
is_shape_text = seltype == Asc.c_oAscSelectionType.RangeShapeText,
is_shape = seltype == Asc.c_oAscSelectionType.RangeShape,
is_image = seltype == Asc.c_oAscSelectionType.RangeImage || seltype == Asc.c_oAscSelectionType.RangeSlicer,
is_mode_2 = is_shape_text || is_shape || is_chart_text || is_chart;
editor.$btnfunc.toggleClass('disabled', is_image || is_mode_2 || coauth_disable);
}
function setMode(modeF) {
mode = modeF;
editor.$btnfunc[mode.isEdit?'removeClass':'addClass']('disabled');
if ( mode.isEdit ) {
api.asc_registerCallback('asc_onSelectionChanged', onApiSelectionChanged);
}
@ -232,7 +171,6 @@ common.controller.CellEditor = new(function(){
function setPreviewMode(mode) {
if (this.viewmode === mode) return;
this.viewmode = mode;
//editor.$btnfunc[!mode && mode.isEdit?'removeClass':'addClass']('disabled');
editor.cell.nameDisabled(mode && !(mode.isEdit && !mode.isEditDiagram && !mode.isEditMailMerge));
}

View file

@ -30,25 +30,13 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* CellEditor.js
*
* Displays loading mask over selected element(s) or component. Accepts both single and multiple selectors.
*
* Created by Sharova Olga 07.09.2021
* Copyright (c) 2021 Ascensio System SIA. All rights reserved.
*
*/
!window.common && (window.common = {});
!common.view && (common.view = {});
common.view.CellEditor = new(function (){
var me
,$cellname
,$cellcontent
,$btnexpand
,$btnfunc;
var me;
function createView()
{
@ -56,9 +44,6 @@ common.view.CellEditor = new(function (){
me.$el = $('#cell-editing-box');
me.$cellcontent=$('#ce-cell-content');
me.$cellname = $('#ce-cell-name');
me.$btnexpand = $('#ce-btn-expand');
me.$btnfunc = $('#ce-func-label');
me.$btnfunc.addClass('disabled');
me.$cellname.on('focus', function(e){
var txt = me.$cellname[0];

View file

@ -97,7 +97,8 @@
padding: 0;
left: 0;
right: 0;
top: 0;
bottom: 0;
&.top {
top: 48px;
bottom: 0;