[PDF] Show hand/select buttons for pdf-forms

This commit is contained in:
Julia Radzhabova
2023-12-14 13:04:58 +03:00
parent 9e6d1517e9
commit d99ada575f
3 changed files with 49 additions and 52 deletions

View File

@ -173,6 +173,8 @@ define([
toolbar.btnCopy.on('click', _.bind(this.onCopyPaste, this, 'copy'));
toolbar.btnPaste.on('click', _.bind(this.onCopyPaste, this, 'paste'));
toolbar.btnCut.on('click', _.bind(this.onCopyPaste, this, 'cut'));
toolbar.btnSelectTool.on('toggle', _.bind(this.onSelectTool, this, 'select'));
toolbar.btnHandTool.on('toggle', _.bind(this.onSelectTool, this, 'hand'));
toolbar.fieldPages.on('changed:after', _.bind(this.onPagesChanged, this));
toolbar.fieldPages.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me.toolbar);});
toolbar.fieldPages.cmpEl && toolbar.fieldPages.cmpEl.on('focus', 'input.form-control', function() {
@ -189,8 +191,6 @@ define([
if (this.mode && this.mode.isEdit) {
toolbar.btnSave.on('click', _.bind(this.tryToSave, this));
toolbar.btnSelectAll.on('click', _.bind(this.onSelectAll, this));
toolbar.btnSelectTool.on('toggle', _.bind(this.onSelectTool, this, 'select'));
toolbar.btnHandTool.on('toggle', _.bind(this.onSelectTool, this, 'hand'));
toolbar.btnAddComment.on('click', function (btn, e) {
Common.NotificationCenter.trigger('app:comment:add', 'toolbar');
});
@ -562,7 +562,7 @@ define([
},
turnOnSelectTool: function() {
if (this.mode.isEdit && this.toolbar && this.toolbar.btnSelectTool && !this.toolbar.btnSelectTool.isActive()) {
if ((this.mode.isEdit && this.mode.isRestrictedEdit) && this.toolbar && this.toolbar.btnSelectTool && !this.toolbar.btnSelectTool.isActive()) {
this.api.asc_setViewerTargetType('select');
this.toolbar.btnSelectTool.toggle(true, true);
this.toolbar.btnHandTool.toggle(false, true);
@ -933,7 +933,7 @@ define([
(new Promise(function(accept) {
accept();
})).then(function () {
config.isEdit && me.toolbar && me.toolbar.btnHandTool.toggle(true, true);
(config.isEdit || config.isRestrictedEdit) && me.toolbar && me.toolbar.btnHandTool.toggle(true, true);
me.api && me.api.asc_setViewerTargetType('hand');
});
},

View File

@ -34,29 +34,14 @@
</div>
</div>
<div class="separator long"></div>
<% if ( typeof config !== "undefined" && config.isEdit) { %>
<div class="group" data-layout-name="toolbar-view-navigation">
<span class="btn-slot text x-huge" id="slot-btn-hand-tool"></span>
<span class="btn-slot text x-huge" id="slot-btn-select-tool"></span>
</div>
<div class="separator long"></div>
<% } %>
</section>
<section class="box-panels">
<section class="panel" data-tab="home">
<% if ( typeof config !== "undefined" && config.isRestrictedEdit) { %>
<div class="group" style="">
<span class="btn-slot text x-huge" id="slot-btn-form-prev"></span>
<span class="btn-slot text x-huge" id="slot-btn-form-next"></span>
<span class="btn-slot text x-huge" id="slot-btn-form-clear"></span>
</div>
<div class="separator long"></div>
<div class="group" style="">
<span class="btn-slot text x-huge" id="slot-btn-form-submit"></span>
<span class="btn-slot text x-huge" id="slot-btn-form-save"></span>
</div>
<div class="separator long"></div>
<% } %>
<div class="group small">
<div class="elset">
<span class="btn-slot" id="slot-btn-pages" style="width: 95px"></span>
@ -89,6 +74,19 @@
<span class="btn-slot text slot-btn-ftw" style="text-align: center;"></span>
</div>
</div>
<% if ( typeof config !== "undefined" && config.isRestrictedEdit) { %>
<div class="separator long"></div>
<div class="group" style="">
<span class="btn-slot text x-huge" id="slot-btn-form-prev"></span>
<span class="btn-slot text x-huge" id="slot-btn-form-next"></span>
<span class="btn-slot text x-huge" id="slot-btn-form-clear"></span>
</div>
<div class="separator long"></div>
<div class="group" style="">
<span class="btn-slot text x-huge" id="slot-btn-form-submit"></span>
<span class="btn-slot text x-huge" id="slot-btn-form-save"></span>
</div>
<% } %>
</section>
<section class="panel" data-tab="comment">
<div class="group">

View File

@ -148,36 +148,6 @@ define([
this.toolbarControls.push(this.btnSave);
this.btnCollabChanges = this.btnSave;
this.btnSelectTool = new Common.UI.Button({
id: 'tlbtn-selecttool',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-select',
lock: [_set.disableOnStart],
caption: me.capBtnSelect,
toggleGroup: 'select-tools-tb',
enableToggle: true,
allowDepress: false,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.toolbarControls.push(this.btnSelectTool);
this.btnHandTool = new Common.UI.Button({
id: 'tlbtn-handtool',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-big-hand-tool',
lock: [_set.disableOnStart],
caption: me.capBtnHand,
toggleGroup: 'select-tools-tb',
enableToggle: true,
allowDepress: false,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.toolbarControls.push(this.btnHandTool);
// this.btnRotate = new Common.UI.Button({
// id: 'tlbtn-rotate',
// cls: 'btn-toolbar x-huge icon-top',
@ -423,6 +393,36 @@ define([
});
this.toolbarControls.push(this.btnSelectAll);
this.btnSelectTool = new Common.UI.Button({
id: 'tlbtn-selecttool',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-select',
lock: [_set.disableOnStart],
caption: me.capBtnSelect,
toggleGroup: 'select-tools-tb',
enableToggle: true,
allowDepress: false,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.toolbarControls.push(this.btnSelectTool);
this.btnHandTool = new Common.UI.Button({
id: 'tlbtn-handtool',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-big-hand-tool',
lock: [_set.disableOnStart],
caption: me.capBtnHand,
toggleGroup: 'select-tools-tb',
enableToggle: true,
allowDepress: false,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.toolbarControls.push(this.btnHandTool);
this.fieldPages = new Common.UI.InputFieldFixed({
id: 'id-toolbar-txt-pages',
style : 'width: 100%;',
@ -703,14 +703,11 @@ define([
// set hints
if (this.mode.isEdit) {
this.btnSave.updateHint(this.btnSaveTip);
this.btnSelectTool.updateHint(this.tipSelectTool);
this.btnHandTool.updateHint(this.tipHandTool);
this.btnAddComment.updateHint(this.tipAddComment);
this.btnStrikeout.updateHint(this.textStrikeout);
this.btnUnderline.updateHint(this.textUnderline);
this.btnHighlight.updateHint(this.textHighlight);
// this.btnRotate.updateHint(this.tipRotate);
} else if (this.mode.isRestrictedEdit) {
this.btnClear.updateHint(this.textClearFields);
this.btnPrevForm.updateHint(this.tipPrevForm);
@ -725,6 +722,8 @@ define([
this.btnPaste.updateHint(this.tipPaste + Common.Utils.String.platformKey('Ctrl+V'));
this.btnCut.updateHint(this.tipCut + Common.Utils.String.platformKey('Ctrl+X'));
this.btnSelectAll.updateHint(this.tipSelectAll + Common.Utils.String.platformKey('Ctrl+A'));
this.btnSelectTool.updateHint(this.tipSelectTool);
this.btnHandTool.updateHint(this.tipHandTool);
this.btnFirstPage.updateHint(this.tipFirstPage);
this.btnLastPage.updateHint(this.tipLastPage);
this.btnPrevPage.updateHint(this.tipPrevPage);