Commit eba4f24b authored by Julia Radzhabova's avatar Julia Radzhabova

Merge branch 'develop' into refactor

parents e0737d18 cbd1e0d8
......@@ -461,6 +461,8 @@ define([
updateHint: function(hint) {
this.options.hint = hint;
if (!this.rendered) return;
var cmpEl = this.cmpEl,
modalParents = cmpEl.closest('.asc-window');
......
......@@ -312,6 +312,8 @@ define([
me._skipInputChange = true;
me.cmpEl.find('ul li:first a').focus();
}, 10);
} else if (e.keyCode == Common.UI.Keys.RETURN && $(e.target).val() === me.lastValue){
this._input.trigger('change', { reapply: true });
} else
me._skipInputChange = false;
},
......@@ -333,7 +335,7 @@ define([
var val = $(e.target).val(),
record = {};
if (this.lastValue === val) {
if (this.lastValue === val && !(extra && extra.reapply)) {
if (extra && extra.onkeydown)
this.trigger('combo:blur', this, e);
return;
......
......@@ -154,7 +154,8 @@ define([
maxwidth: undefined,
maxheight: undefined,
minwidth: 0,
minheight: 0
minheight: 0,
enableKeyEvents: true
};
var template = '<div class="asc-window<%= modal?" modal":"" %><%= cls?" "+cls:"" %>" id="<%= id %>" style="width:<%= width %>px;">' +
......@@ -182,7 +183,7 @@ define([
}
function _keydown(event) {
if (!this.isLocked() && this.isVisible()) {
if (!this.isLocked() && this.isVisible() && this.initConfig.enableKeyEvents) {
switch (event.keyCode) {
case Common.UI.Keys.ESC:
if ( $('.asc-loadmask').length<1 ) {
......
......@@ -198,7 +198,8 @@ define([
var _options = {};
_.extend(_options, {
cls: 'advanced-settings-dlg',
header: true
header: true,
enableKeyEvents: false
}, options);
var header_footer = (_options.buttons && _.size(_options.buttons)>0) ? 85 : 34;
......
......@@ -274,7 +274,7 @@ define([
this.api.SetTextBoxInputMode(parseInt(value) == 1);
/** coauthoring begin **/
if (this.mode.isEdit && this.mode.canLicense && !this.mode.isOffline) {
if (this.mode.isEdit && this.mode.canLicense && !this.mode.isOffline && this.mode.canCoAuthoring) {
value = Common.localStorage.getItem("de-settings-coauthmode");
var fast_coauth = (value===null || parseInt(value) == 1);
this.api.asc_SetFastCollaborative(fast_coauth);
......
......@@ -791,7 +791,7 @@ define([
me.api.SetTextBoxInputMode(value!==null && parseInt(value) == 1);
/** coauthoring begin **/
if (me.appOptions.isEdit && me.appOptions.canLicense && !me.appOptions.isOffline) {
if (me.appOptions.isEdit && me.appOptions.canLicense && !me.appOptions.isOffline && me.appOptions.canCoAuthoring) {
value = Common.localStorage.getItem("de-settings-coauthmode");
me._state.fastCoauth = (value===null || parseInt(value) == 1);
me.api.asc_SetFastCollaborative(me._state.fastCoauth);
......@@ -842,7 +842,8 @@ define([
if (me.appOptions.isEdit) {
value = Common.localStorage.getItem("de-settings-autosave");
value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : 1;
value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : (me.appOptions.canCoAuthoring ? 1 : 0);
me.api.asc_setAutoSaveGap(value);
if (me.needToUpdateVersion)
......@@ -1662,7 +1663,7 @@ define([
},
applySettings: function() {
if (this.appOptions.isEdit && this.appOptions.canLicense && !this.appOptions.isOffline) {
if (this.appOptions.isEdit && this.appOptions.canLicense && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) {
var value = Common.localStorage.getItem("de-settings-coauthmode"),
oldval = this._state.fastCoauth;
this._state.fastCoauth = (value===null || parseInt(value) == 1);
......
......@@ -2189,10 +2189,13 @@ define([
},
fillEquations: function() {
if (!this.toolbar.btnInsertEquation.rendered) return;
var me = this, equationsStore = this.getApplication().getCollection('EquationGroups');
me.equationPickers = [];
me.toolbar.btnInsertEquation.menu.removeAll();
for (var i = 0; i < equationsStore.length; ++i) {
var equationGroup = equationsStore.at(i);
......@@ -2380,8 +2383,9 @@ define([
},
fillTextArt: function() {
var me = this;
if (!this.toolbar.btnInsertText.rendered) return;
var me = this;
if (this.toolbar.mnuTextArtPicker) {
var models = this.getApplication().getCollection('Common.Collections.TextArt').models,
count = this.toolbar.mnuTextArtPicker.store.length;
......
......@@ -312,7 +312,7 @@ define([
}
/** coauthoring begin **/
$('tr.coauth', this.el)[mode.isEdit && mode.canCoAuthoring ? 'show' : 'hide']();
$('tr.coauth.changes', this.el)[mode.isEdit && mode.canLicense && !mode.isOffline ? 'show' : 'hide']();
$('tr.coauth.changes', this.el)[mode.isEdit && mode.canLicense && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide']();
/** coauthoring end **/
},
......@@ -329,7 +329,7 @@ define([
this.chLiveComment.setValue(!(value!==null && parseInt(value) == 0));
value = Common.localStorage.getItem("de-settings-coauthmode");
var fast_coauth = (value===null || parseInt(value) == 1) && !(this.mode.isDesktopApp && this.mode.isOffline);
var fast_coauth = (value===null || parseInt(value) == 1) && !(this.mode.isDesktopApp && this.mode.isOffline) && this.mode.canCoAuthoring;
item = this.cmbCoAuthMode.store.findWhere({value: parseInt(value)});
this.cmbCoAuthMode.setValue(item ? item.get('value') : 1);
......@@ -352,7 +352,7 @@ define([
this._oldUnits = this.cmbUnit.getValue();
value = Common.localStorage.getItem("de-settings-autosave");
this.chAutosave.setValue(fast_coauth || (value===null || parseInt(value) == 1));
this.chAutosave.setValue(fast_coauth || (value===null ? this.mode.canCoAuthoring : parseInt(value) == 1));
value = Common.localStorage.getItem("de-settings-spellcheck");
this.chSpell.setValue(value===null || parseInt(value) == 1);
......@@ -366,7 +366,7 @@ define([
Common.localStorage.setItem("de-settings-zoom", this.cmbZoom.getValue());
/** coauthoring begin **/
Common.localStorage.setItem("de-settings-livecomment", this.chLiveComment.isChecked() ? 1 : 0);
if (this.mode.isEdit && this.mode.canLicense && !this.mode.isOffline) {
if (this.mode.isEdit && this.mode.canLicense && !this.mode.isOffline && this.mode.canCoAuthoring) {
Common.localStorage.setItem("de-settings-coauthmode", this.cmbCoAuthMode.getValue());
Common.localStorage.setItem(this.cmbCoAuthMode.getValue() ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict", this.cmbShowChanges.getValue());
}
......
......@@ -395,6 +395,7 @@ define([
},
createDelayedElements: function() {
this.UpdateThemeColors();
this.updateMetricUnit();
},
......
......@@ -583,7 +583,7 @@ define([
data: this.options.languages
});
this.cmbLanguage.scroller.update({alwaysVisibleY: true});
if (this.cmbLanguage.scroller) this.cmbLanguage.scroller.update({alwaysVisibleY: true});
this.cmbLanguage.on('selected', _.bind(this.onLangSelect, this));
this.cmbLanguage.setValue(Common.util.LanguageInfo.getLocalLanguageName(this.options.current)[0]);
this.onLangSelect(this.cmbLanguage, this.cmbLanguage.getSelectedRecord());
......
......@@ -694,7 +694,37 @@ define([
id : 'id-toolbar-btn-colorschemas',
cls : 'btn-toolbar',
iconCls : 'btn-colorschemas',
menu : true
menu : new Common.UI.Menu({
items: [],
maxHeight : 600,
restoreHeight: 600
}).on('show:before', function(mnu) {
if ( !this.scroller ) {
this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.dropdown-menu '),
useKeyboard: this.enableKeyEvents && !this.handleSelect,
minScrollbarLength: 40,
alwaysVisibleY: true
});
}
}).on('show:after', function(btn, e) {
var mnu = $(this.el).find('.dropdown-menu '),
docH = $(document).height(),
menuH = mnu.outerHeight(),
top = parseInt(mnu.css('top'));
if (menuH > docH) {
mnu.css('max-height', (docH - parseInt(mnu.css('padding-top')) - parseInt(mnu.css('padding-bottom'))-5) + 'px');
this.scroller.update({minScrollbarLength : 40});
} else if ( mnu.height() < this.options.restoreHeight ) {
mnu.css('max-height', (Math.min(docH - parseInt(mnu.css('padding-top')) - parseInt(mnu.css('padding-bottom'))-5, this.options.restoreHeight)) + 'px');
menuH = mnu.outerHeight();
if (top+menuH > docH) {
mnu.css('top', 0);
}
this.scroller.update({minScrollbarLength : 40});
}
})
});
this.toolbarControls.push(this.btnColorSchemas);
......@@ -735,6 +765,7 @@ define([
this.mnuInsertTable = this.btnInsertTable.menu;
this.mnuInsertImage = this.btnInsertImage.menu;
this.mnuPageSize = this.btnPageSize.menu;
this.mnuColorSchema = this.btnColorSchemas.menu;
//
// DataView and pickers
......@@ -1095,6 +1126,7 @@ define([
this.btnColumns.updateHint(this.tipColumns);
this.btnPageOrient.updateHint(this.tipPageOrient);
this.btnPageSize.updateHint(this.tipPageSize);
this.btnPageMargins.updateHint(this.tipPageMargins);
this.btnClearStyle.updateHint(this.tipClearStyle);
this.btnCopyStyle.updateHint(this.tipCopyStyle + Common.Utils.String.platformKey('Ctrl+Shift+C'));
this.btnColorSchemas.updateHint(this.tipColorSchemas);
......@@ -1154,7 +1186,9 @@ define([
]
})
);
if (this.mode.isDesktopApp)
this.mnuitemHideTitleBar.hide();
this.btnMarkers.setMenu(
new Common.UI.Menu({
items: [
......@@ -1479,10 +1513,9 @@ define([
}
}
if (mode.isDesktopApp) {
if (mode.isDesktopApp)
$('.toolbar-group-native').hide();
this.mnuitemHideTitleBar.hide();
}
this.btnMailRecepients.setVisible(mode.canCoAuthoring==true && mode.canUseMailMerge);
this.listStylesAdditionalMenuItem.setVisible(mode.canEditStyles);
},
......@@ -1525,6 +1558,11 @@ define([
if (me.listStyles.menuPicker.store.length > 0 && listStylesVisible){
me.listStyles.fillComboView(me.listStyles.menuPicker.getSelectedRec(), true);
}
if (me.btnInsertText.rendered)
DE.getController('Toolbar').fillTextArt();
if (me.btnInsertEquation.rendered)
DE.getController('Toolbar').fillEquations();
}, 100);
}
......@@ -1541,40 +1579,17 @@ define([
});
}
if (!this.mnuColorSchema) {
this.btnColorSchemas.setMenu(new Common.UI.Menu({
items: [],
if (this.mnuColorSchema == null) {
this.mnuColorSchema = new Common.UI.Menu({
maxHeight : 600,
restoreHeight: 600
}));
this.mnuColorSchema = this.btnColorSchemas.menu;
this.mnuColorSchema.on('show:before', function(mnu) {
if ( !this.scroller ) {
this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.dropdown-menu '),
useKeyboard: this.enableKeyEvents && !this.handleSelect,
minScrollbarLength: 40,
alwaysVisibleY: true
});
}
}).on('show:after', function(btn, e) {
var mnu = $(this.el).find('.dropdown-menu '),
docH = Common.Utils.innerHeight(),
menuH = mnu.outerHeight(),
top = parseInt(mnu.css('top'));
if (menuH > docH) {
mnu.css('max-height', (docH - parseInt(mnu.css('padding-top')) - parseInt(mnu.css('padding-bottom'))-5) + 'px');
this.scroller.update({minScrollbarLength : 40});
} else if ( mnu.height() < this.options.restoreHeight ) {
mnu.css('max-height', (Math.min(docH - parseInt(mnu.css('padding-top')) - parseInt(mnu.css('padding-bottom'))-5, this.options.restoreHeight)) + 'px');
menuH = mnu.outerHeight();
if (top+menuH > docH) {
mnu.css('top', 0);
}
this.scroller.update({minScrollbarLength : 40});
}
})
}).on('show:before', function(mnu) {
this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.dropdown-menu '),
useKeyboard: this.enableKeyEvents && !this.handleSelect,
minScrollbarLength : 40
});
});
}
this.mnuColorSchema.items = [];
......
......@@ -218,7 +218,7 @@ define([
this.api.SetTextBoxInputMode(parseInt(value) == 1);
/** coauthoring begin **/
if (this.mode.isEdit && this.mode.canLicense && !this.mode.isOffline) {
if (this.mode.isEdit && this.mode.canLicense && !this.mode.isOffline && this.mode.canCoAuthoring) {
value = Common.localStorage.getItem("pe-settings-coauthmode");
this.api.asc_SetFastCollaborative(value===null || parseInt(value) == 1);
}
......
......@@ -591,7 +591,7 @@ define([
me.api.SetTextBoxInputMode(value!==null && parseInt(value) == 1);
/** coauthoring begin **/
if (me.appOptions.isEdit && me.appOptions.canLicense && !me.appOptions.isOffline) {
if (me.appOptions.isEdit && me.appOptions.canLicense && !me.appOptions.isOffline && me.appOptions.canCoAuthoring) {
value = Common.localStorage.getItem("pe-settings-coauthmode");
me._state.fastCoauth = (value===null || parseInt(value) == 1);
} else
......@@ -635,7 +635,7 @@ define([
if (me.appOptions.isEdit) {
value = Common.localStorage.getItem("pe-settings-autosave");
value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : 1;
value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : (me.appOptions.canCoAuthoring ? 1 : 0);
me.api.asc_setAutoSaveGap(value);
if (me.needToUpdateVersion)
......@@ -1437,7 +1437,7 @@ define([
},
applySettings: function() {
if (this.appOptions.isEdit && this.appOptions.canLicense && !this.appOptions.isOffline) {
if (this.appOptions.isEdit && this.appOptions.canLicense && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) {
var value = Common.localStorage.getItem("pe-settings-coauthmode"),
oldval = this._state.fastCoauth;
this._state.fastCoauth = (value===null || parseInt(value) == 1);
......
......@@ -258,7 +258,7 @@ define([
this.lblAutosave.text(this.textAutoRecover);
}
/** coauthoring begin **/
$('tr.coauth.changes', this.el)[mode.isEdit && mode.canLicense && !mode.isOffline ? 'show' : 'hide']();
$('tr.coauth.changes', this.el)[mode.isEdit && mode.canLicense && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide']();
/** coauthoring end **/
},
......@@ -273,7 +273,7 @@ define([
/** coauthoring begin **/
value = Common.localStorage.getItem("pe-settings-coauthmode");
var fast_coauth = (value===null || parseInt(value) == 1) && !(this.mode.isDesktopApp && this.mode.isOffline);
var fast_coauth = (value===null || parseInt(value) == 1) && !(this.mode.isDesktopApp && this.mode.isOffline) && this.mode.canCoAuthoring;
item = this.cmbCoAuthMode.store.findWhere({value: parseInt(value)});
this.cmbCoAuthMode.setValue(item ? item.get('value') : 1);
......@@ -286,7 +286,7 @@ define([
this._oldUnits = this.cmbUnit.getValue();
value = Common.localStorage.getItem("pe-settings-autosave");
this.chAutosave.setValue(fast_coauth || (value===null || parseInt(value) == 1));
this.chAutosave.setValue(fast_coauth || (value===null ? this.mode.canCoAuthoring : parseInt(value) == 1));
value = Common.localStorage.getItem("pe-settings-showsnaplines");
this.chAlignGuides.setValue(value===null || parseInt(value) == 1);
......@@ -296,7 +296,7 @@ define([
Common.localStorage.setItem("pe-settings-inputmode", this.chInputMode.isChecked() ? 1 : 0);
Common.localStorage.setItem("pe-settings-zoom", this.cmbZoom.getValue());
/** coauthoring begin **/
if (this.mode.isEdit && this.mode.canLicense && !this.mode.isOffline) {
if (this.mode.isEdit && this.mode.canLicense && !this.mode.isOffline && this.mode.canCoAuthoring) {
Common.localStorage.setItem("pe-settings-coauthmode", this.cmbCoAuthMode.getValue());
}
/** coauthoring end **/
......
......@@ -244,7 +244,7 @@ define([
(!(value!==null && parseInt(value) == 0)) ? this.api.asc_showComments() : this.api.asc_hideComments();
// this.getApplication().getController('DocumentHolder').setLiveCommenting(!(value!==null && parseInt(value) == 0));
if (this.mode.isEdit && this.mode.canLicense && !this.mode.isOffline) {
if (this.mode.isEdit && this.mode.canLicense && !this.mode.isOffline && this.mode.canCoAuthoring) {
value = Common.localStorage.getItem("sse-settings-coauthmode");
this.api.asc_SetFastCollaborative(value===null || parseInt(value) == 1);
}
......
......@@ -563,7 +563,7 @@ define([
this.isLiveCommenting = !(value!==null && parseInt(value) == 0);
this.isLiveCommenting?this.api.asc_showComments():this.api.asc_hideComments();
if (this.appOptions.isEdit && this.appOptions.canLicense && !this.appOptions.isOffline) {
if (this.appOptions.isEdit && this.appOptions.canLicense && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) {
value = Common.localStorage.getItem("sse-settings-coauthmode");
this._state.fastCoauth = (value===null || parseInt(value) == 1);
} else
......@@ -623,7 +623,7 @@ define([
if (me.appOptions.isEdit) {
if (me.appOptions.canAutosave) {
value = Common.localStorage.getItem("sse-settings-autosave");
value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : 1;
value = (!me._state.fastCoauth && value!==null) ? parseInt(value) : (me.appOptions.canCoAuthoring ? 1 : 0);
} else {
value = 0;
}
......@@ -1668,7 +1668,7 @@ define([
},
applySettings: function() {
if (this.appOptions.isEdit && this.appOptions.canLicense && !this.appOptions.isOffline) {
if (this.appOptions.isEdit && this.appOptions.canLicense && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) {
var value = Common.localStorage.getItem("sse-settings-coauthmode"),
oldval = this._state.fastCoauth;
this._state.fastCoauth = (value===null || parseInt(value) == 1);
......
......@@ -68,20 +68,6 @@ define([
'sheet:move': _.bind(this.moveWorksheet, this)
}
});
var me = this;
Common.util.Shortcuts.delegateShortcuts({shortcuts:{
'alt+pageup': function(e) {
me.moveCurrentTab(-1);
e.preventDefault();
e.stopPropagation();
},
'alt+pagedown': function(e) {
me.moveCurrentTab(1);
e.preventDefault();
e.stopPropagation();
}
}});
},
events: function() {
......
......@@ -827,15 +827,8 @@ define([
},
onNumberFormat: function(btn) {
if (this.api) {
var format = btn.options.formatId;
if (btn.options.formatId == this.toolbar.ascFormatOptions.Accounting){
var value = Common.localStorage.getItem("sse-settings-reg-settings");
value = (value!==null) ? parseInt(value) : ((this.toolbar.mode.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.toolbar.mode.lang)) : 0x0409);
format = this.api.asc_getLocaleCurrency(value);
}
this.api.asc_setCellFormat(format);
}
if (this.api)
this.api.asc_setCellStyle(btn.options.styleName);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Number Format');
......@@ -1256,6 +1249,9 @@ define([
if (me.toolbar.listStyles.menuPicker.store.length > 0 && listStylesVisible){
me.toolbar.listStyles.fillComboView(me.toolbar.listStyles.menuPicker.getSelectedRec(), true);
}
if (me.toolbar.btnInsertText.rendered)
SSE.getController('Toolbar').fillTextArt();
}, 100);
}
......@@ -2002,6 +1998,8 @@ define([
},
fillTextArt: function() {
if (!this.toolbar.btnInsertText.rendered) return;
var me = this;
if (this.toolbar.mnuTextArtPicker) {
......
......@@ -651,7 +651,7 @@ define([
this.lblAutosave.text(this.textAutoRecover);
}
$('tr.coauth', this.el)[mode.canCoAuthoring && mode.isEdit ? 'show' : 'hide']();
$('tr.coauth.changes', this.el)[mode.isEdit && mode.canLicense && !mode.isOffline ? 'show' : 'hide']();
$('tr.coauth.changes', this.el)[mode.isEdit && mode.canLicense && !mode.isOffline && mode.canCoAuthoring? 'show' : 'hide']();
},
setApi: function(api) {
......@@ -668,7 +668,7 @@ define([
this.chLiveComment.setValue(!(value!==null && parseInt(value) == 0));
value = Common.localStorage.getItem("sse-settings-coauthmode");
var fast_coauth = (value===null || parseInt(value) == 1) && !(this.mode.isDesktopApp && this.mode.isOffline);
var fast_coauth = (value===null || parseInt(value) == 1) && !(this.mode.isDesktopApp && this.mode.isOffline) && this.mode.canCoAuthoring;
item = this.cmbCoAuthMode.store.findWhere({value: parseInt(value)});
this.cmbCoAuthMode.setValue(item ? item.get('value') : 1);
......@@ -685,7 +685,7 @@ define([
this._oldUnits = this.cmbUnit.getValue();
value = Common.localStorage.getItem("sse-settings-autosave");
this.chAutosave.setValue(fast_coauth || (value===null || parseInt(value) == 1));
this.chAutosave.setValue(fast_coauth || (value===null ? this.mode.canCoAuthoring : parseInt(value) == 1));
value = Common.localStorage.getItem("sse-settings-func-locale");
if (value===null)
......@@ -726,7 +726,7 @@ define([
Common.localStorage.setItem("sse-settings-zoom", this.cmbZoom.getValue());
/** coauthoring begin **/
Common.localStorage.setItem("sse-settings-livecomment", this.chLiveComment.isChecked() ? 1 : 0);
if (this.mode.isEdit && this.mode.canLicense && !this.mode.isOffline)
if (this.mode.isEdit && this.mode.canLicense && !this.mode.isOffline && this.mode.canCoAuthoring)
Common.localStorage.setItem("sse-settings-coauthmode", this.cmbCoAuthMode.getValue());
/** coauthoring end **/
Common.localStorage.setItem("sse-settings-fontrender", this.cmbFontRender.getValue());
......
......@@ -979,7 +979,7 @@ define([
iconCls : 'btn-percent-style',
hint : me.tipDigStylePercent,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth],
formatId : me.ascFormatOptions.Percent
styleName : 'Percent'
});
me.btnCurrencyStyle = new Common.UI.Button({
......@@ -988,7 +988,7 @@ define([
iconCls : 'btn-currency-style',
hint : me.tipDigStyleAccounting,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth],
formatId : me.ascFormatOptions.Accounting,
styleName : 'Currency',
split : true,
menu : new Common.UI.Menu({
style: 'min-width: 120px;',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment