Merge pull request #2792 from ONLYOFFICE/fix/bugfix

Fix/bugfix
This commit is contained in:
Julia Radzhabova
2024-01-18 12:47:16 +03:00
committed by GitHub
2 changed files with 45 additions and 48 deletions

View File

@ -76,7 +76,8 @@ define([
this.addListeners({
'Toolbar': {
'change:compact' : this.onClickChangeCompact,
'home:open' : this.onHomeOpen
'home:open' : this.onHomeOpen,
'tab:active' : this.onActiveTab
},
'FileMenu': {
'menu:hide': this.onFileMenu.bind(this, 'hide'),
@ -215,34 +216,6 @@ define([
toolbar.btnNextForm.on('click', _.bind(this.onGoToForm, this, 'next'));
toolbar.btnSubmit && toolbar.btnSubmit.on('click', _.bind(this.onSubmitClick, this));
toolbar.btnSaveForm && toolbar.btnSaveForm.on('click', _.bind(this.onSaveFormClick, this));
if (toolbar.btnSubmit && !this.api.asc_IsAllRequiredFormsFilled()) {
toolbar.lockToolbar(Common.enumLock.requiredNotFilled, true, {array: [toolbar.btnSubmit]});
if (!Common.localStorage.getItem("pdfe-embed-hide-submittip")) {
var requiredTooltip = new Common.UI.SynchronizeTip({
extCls: 'colored',
placement: 'bottom-right',
target: toolbar.btnSubmit.$el,
text: this.textRequired,
showLink: false,
closable: false,
showButton: true,
textButton: this.textGotIt
});
var onclose = function () {
requiredTooltip.hide();
me.api && me.api.asc_MoveToFillingForm(true, true, true);
toolbar.btnSubmit.updateHint(me.textRequired);
};
requiredTooltip.on('buttonclick', function () {
onclose();
Common.localStorage.setItem("pdfe-embed-hide-submittip", 1);
});
requiredTooltip.on('closeclick', onclose);
requiredTooltip.show();
} else {
toolbar.btnSubmit.updateHint(me.textRequired);
}
}
}
},
@ -941,6 +914,34 @@ define([
})).then(function () {
(config.isEdit || config.isRestrictedEdit) && me.toolbar && me.toolbar.btnHandTool.toggle(true, true);
me.api && me.api.asc_setViewerTargetType('hand');
if (config.isRestrictedEdit && me.toolbar && me.toolbar.btnSubmit && me.api && !me.api.asc_IsAllRequiredFormsFilled()) {
me.toolbar.lockToolbar(Common.enumLock.requiredNotFilled, true, {array: [me.toolbar.btnSubmit]});
if (!Common.localStorage.getItem("pdfe-embed-hide-submittip")) {
me.requiredTooltip = new Common.UI.SynchronizeTip({
extCls: 'colored',
placement: 'bottom-right',
target: me.toolbar.btnSubmit.$el,
text: me.textRequired,
showLink: false,
closable: false,
showButton: true,
textButton: me.textGotIt
});
var onclose = function () {
me.requiredTooltip.hide();
me.api.asc_MoveToFillingForm(true, true, true);
me.toolbar.btnSubmit.updateHint(me.textRequired);
};
me.requiredTooltip.on('buttonclick', function () {
onclose();
Common.localStorage.setItem("pdfe-embed-hide-submittip", 1);
});
me.requiredTooltip.on('closeclick', onclose);
me.requiredTooltip.show();
} else {
me.toolbar.btnSubmit.updateHint(me.textRequired);
}
}
});
},
@ -958,6 +959,13 @@ define([
}
},
onActiveTab: function(tab) {
if (tab !== 'file' && tab !== 'home' && this.requiredTooltip) {
this.requiredTooltip.close();
this.requiredTooltip = undefined;
}
},
applySettings: function() {
this.toolbar && this.toolbar.chShowComments && this.toolbar.chShowComments.setValue(Common.Utils.InternalSettings.get("pdfe-settings-livecomment"), true);
},

View File

@ -305,16 +305,6 @@ define([
},
getSettings: function () {
if (this.isStepChanged) {
var value = this.inputStep.getValue();
(typeof value === 'string') && (value = value.replace(',','.'));
this._changedProps.asc_setStepValue(value!=='' ? parseFloat(value) : null);
}
if (this.isStopChanged) {
var value = this.inputStop.getValue();
(typeof value === 'string') && (value = value.replace(',','.'));
this._changedProps.asc_setStopValue(value!=='' ? parseFloat(value) : null);
}
return this._changedProps;
},
@ -338,26 +328,25 @@ define([
},
isValid: function() {
var regstr = new RegExp('^\s*[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)\s*$');
if (this.isStepChanged) {
var value = this.inputStep.getValue();
(typeof value === 'string') && (value = value.replace(',','.'));
if (value!=='' && (!regstr.test(value.trim()) || isNaN(parseFloat(value)))) {
var res = this._changedProps.asc_isValidStepValue(this.inputStep.getValue());
if (res[0]!==Asc.c_oAscError.ID.No) {
this.inputStep.showError([this.txtErrorNumber]);
this.inputStep.focus();
this.isInputStepFirstChange = true;
return false;
}
} else
this._changedProps.asc_setStepValue(res[1]);
}
if (this.isStopChanged) {
var value = this.inputStop.getValue();
(typeof value === 'string') && (value = value.replace(',','.'));
if (value!=='' && (!regstr.test(value.trim()) || isNaN(parseFloat(value)))) {
var res = this._changedProps.asc_isValidStopValue(this.inputStop.getValue());
if (res[0]!==Asc.c_oAscError.ID.No) {
this.inputStop.showError([this.txtErrorNumber]);
this.inputStop.focus();
this.isInputStopFirstChange = true;
return false;
}
} else
this._changedProps.asc_setStopValue(res[1]);
}
return true;
},