Merge pull request '[PDF forms] Add requestRoles method in api' (#334) from fix/request-roles into hotfix/v8.3.2

This commit is contained in:
Julia Radzhabova
2025-03-13 15:06:49 +00:00
3 changed files with 32 additions and 2 deletions

View File

@ -827,6 +827,13 @@
});
};
var _requestRoles = function(data) {
_sendCommand({
command: 'requestRoles',
data: data
});
};
var _processMouse = function(evt) {
var r = iframe.getBoundingClientRect();
var data = {
@ -913,7 +920,8 @@
setRequestedSpreadsheet: _setRequestedSpreadsheet,
setReferenceSource: _setReferenceSource,
openDocument: _openDocumentFromBinary,
startFilling: _startFilling
startFilling: _startFilling,
requestRoles: _requestRoles
}
};

View File

@ -165,6 +165,10 @@ if (window.Common === undefined) {
'startFilling': function(data) {
$me.trigger('startfilling', data);
},
'requestRoles': function(data) {
$me.trigger('requestroles', data);
}
};

View File

@ -53,6 +53,7 @@ define([
sdkViewName : '#id_main',
initialize: function () {
Common.Gateway.on('requestroles', _.bind(this.onRequestRoles, this));
},
onLaunch: function () {
this._state = {
@ -61,7 +62,8 @@ define([
formCount: 0,
formAdded: undefined,
formRadioAdded: undefined,
pageCount: 1
pageCount: 1,
needToStartFilling: undefined
};
},
@ -88,6 +90,7 @@ define([
Common.NotificationCenter.on('forms:close-help', _.bind(this.closeHelpTip, this));
Common.NotificationCenter.on('forms:show-help', _.bind(this.showHelpTip, this));
Common.NotificationCenter.on('forms:request-fill', _.bind(this.requestStartFilling, this));
Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this));
return this;
},
@ -733,6 +736,21 @@ define([
value = this._state.pageCount;
this.api && this.api.goToPage(value-1);
}
},
onRequestRoles: function(tab) {
if (this._isDocReady)
this.requestStartFilling();
else
this._state.needToStartFilling = true;
},
onDocumentReady: function(tab) {
this._isDocReady = true;
if (this._state.needToStartFilling) {
this._state.needToStartFilling = false;
this.requestStartFilling();
}
}
}, DE.Controllers.FormsTab || {}));