Merge pull request #717 from ONLYOFFICE/fix/fix-signature

Fix signature dialog
This commit is contained in:
Julia Radzhabova 2021-02-19 15:32:38 +03:00 committed by GitHub
commit 692f08d0ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 6 deletions

View file

@ -74,6 +74,8 @@ define([
bold: false,
italic: false
};
var filter = Common.localStorage.getKeysFilter();
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
this.template = [
'<div class="box" style="height: ' + ((this.signType == 'invisible') ? '132px;' : '300px;') + '">',
@ -145,6 +147,7 @@ define([
menuStyle : 'min-width: 234px;max-height: 270px;',
store : new Common.Collections.Fonts(),
recent : 0,
takeFocusOnClose: true,
hint : me.tipFontName
}).on('selected', function(combo, record) {
if (me.signObject) {
@ -160,6 +163,7 @@ define([
menuCls : 'scrollable-menu',
menuStyle: 'min-width: 55px;max-height: 270px;',
hint: this.tipFontSize,
takeFocusOnClose: true,
data: [
{ value: 8, displayValue: "8" },
{ value: 9, displayValue: "9" },
@ -186,6 +190,8 @@ define([
me.font.size = record.value;
});
this.cmbFontSize.setValue(this.font.size);
this.cmbFontSize.on('changed:before', _.bind(this.onFontSizeChanged, this, true));
this.cmbFontSize.on('changed:after', _.bind(this.onFontSizeChanged, this, false));
me.btnBold = new Common.UI.Button({
parentEl: $('#id-dlg-sign-bold'),
@ -241,6 +247,10 @@ define([
me.afterRender();
},
getFocusedComponents: function() {
return [this.inputPurpose, this.inputName, this.cmbFonts, this.cmbFontSize];
},
show: function() {
Common.UI.Window.prototype.show.apply(this, arguments);
@ -340,6 +350,39 @@ define([
this.signObject.setText(value, this.font.name, this.font.size, this.font.italic, this.font.bold);
},
onFontSizeChanged: function(before, combo, record, e) {
var value,
me = this;
if (before) {
var item = combo.store.findWhere({
displayValue: record.value
});
if (!item) {
value = /^\+?(\d*(\.|,)?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(record.value);
if (!value) {
value = combo.getValue();
combo.setRawValue(value);
e.preventDefault();
return false;
}
}
} else {
var maxvalue = (this.appPrefix=='sse-') ? 409 : 300;
value = Common.Utils.String.parseFloat(record.value);
value = value > maxvalue ? maxvalue :
value < 1 ? 1 : Math.floor((value+0.4)*2)/2;
combo.setRawValue(value);
if (this.signObject) {
this.signObject.setText(this.inputName.getValue(), this.font.name, value, this.font.italic, this.font.bold);
}
this.font.size = value;
}
},
textTitle: 'Sign Document',
textPurpose: 'Purpose for signing this document',
textCertificate: 'Certificate',

View file

@ -142,13 +142,12 @@ define([
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
},
show: function() {
Common.UI.Window.prototype.show.apply(this, arguments);
getFocusedComponents: function() {
return [this.inputName, this.inputTitle, this.inputEmail, this.textareaInstructions];
},
var me = this;
_.delay(function(){
me.inputName.cmpEl.find('input').focus();
},500);
getDefaultFocusableComponent: function () {
return this.inputName;
},
setSettings: function (props) {