mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-24 11:10:56 +08:00
[PDF] Insert stamp
This commit is contained in:
@ -251,6 +251,9 @@ define([
|
||||
toolbar.chShowComments.on('change', _.bind(this.onShowCommentsChange, this));
|
||||
toolbar.btnTextComment.on('click', _.bind(this.onBtnTextCommentClick, this));
|
||||
toolbar.btnTextComment.menu.on('item:click', _.bind(this.onMenuTextCommentClick, this));
|
||||
toolbar.btnStamp.on('click', _.bind(this.onBtnStampClick, this));
|
||||
toolbar.btnStamp.menu.on('item:click', _.bind(this.onMenuStampClick, this));
|
||||
toolbar.btnStamp.menu.on('show:after', _.bind(this.onStampShowAfter, this));
|
||||
// toolbar.btnRotate.on('click', _.bind(this.onRotateClick, this));
|
||||
Common.NotificationCenter.on('leftmenu:save', _.bind(this.tryToSave, this));
|
||||
Common.NotificationCenter.on('draw:start', _.bind(this.onDrawStart, this));
|
||||
@ -1141,6 +1144,48 @@ define([
|
||||
Common.component.Analytics.trackEvent('ToolBar', 'Add Text');
|
||||
},
|
||||
|
||||
onBtnStampClick: function(btn, e) {
|
||||
this.onInsertStamp(btn.options.stampType, btn, e);
|
||||
},
|
||||
|
||||
onMenuStampClick: function(btn, e) {
|
||||
var oldType = this.toolbar.btnStamp.options.stampType;
|
||||
var newType = e.value;
|
||||
|
||||
if(newType !== oldType){
|
||||
this.toolbar.btnStamp.options.stampType = newType;
|
||||
}
|
||||
this.onInsertStamp(newType, btn, e);
|
||||
},
|
||||
|
||||
onInsertStamp: function(type, btn, e) {
|
||||
this.api && this.api.AddStampAnnot(type);
|
||||
|
||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnStamp);
|
||||
Common.component.Analytics.trackEvent('ToolBar', 'Add Stamp');
|
||||
},
|
||||
|
||||
onStampShowAfter: function(menu) {
|
||||
var me = this;
|
||||
if (menu.getItemsLength(true)<1 && this.api) {
|
||||
var arr = this.api.asc_getPropertyEditorStamps(),
|
||||
template = _.template([
|
||||
'<a id="<%= id %>" tabindex="-1" type="menuitem">',
|
||||
'<img style="width: auto; height: auto;" src="<%= options.stampImage %>"></img>',
|
||||
'</a>'
|
||||
].join(''));
|
||||
arr.forEach(function(item){
|
||||
var menuItem = new Common.UI.MenuItem({
|
||||
value: item.Type,
|
||||
stampImage: item.Image,
|
||||
template: template
|
||||
});
|
||||
menu.addItem(menuItem, true);
|
||||
});
|
||||
this.toolbar.btnStamp.options.stampType = arr[0].Type;
|
||||
}
|
||||
},
|
||||
|
||||
onFillRequiredFields: function(isFilled) {
|
||||
this.toolbar && this.toolbar.btnSubmit && this.toolbar.lockToolbar(Common.enumLock.requiredNotFilled, !isFilled, {array: [this.toolbar.btnSubmit]});
|
||||
},
|
||||
|
||||
@ -176,6 +176,10 @@
|
||||
</div>
|
||||
<div class="separator long draw-groups"></div>
|
||||
<div class="separator long"></div>
|
||||
<div class="group">
|
||||
<span class="btn-slot text x-huge" id="slot-btn-stamp"></span>
|
||||
</div>
|
||||
<div class="separator long"></div>
|
||||
<div class="group small">
|
||||
<div class="elset">
|
||||
<span class="btn-slot text" id="slot-chk-showcomment"></span>
|
||||
|
||||
@ -137,7 +137,7 @@ define([
|
||||
if (!config.isPDFEdit) return;
|
||||
|
||||
var _set = Common.enumLock,
|
||||
arr = []
|
||||
arr = [];
|
||||
// tab Edit
|
||||
this.btnEditText = new Common.UI.Button({
|
||||
id: 'id-toolbar-btn-edittext',
|
||||
@ -882,6 +882,21 @@ define([
|
||||
});
|
||||
this.toolbarControls.push(this.chShowComments);
|
||||
|
||||
this.btnStamp = new Common.UI.Button({
|
||||
id: 'tlbtn-stamp',
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
caption: this.capBtnStamp,
|
||||
split: true,
|
||||
iconCls: 'toolbar__icon btn-stamp',
|
||||
lock: [_set.disableOnStart],
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'bottom',
|
||||
dataHintOffset: 'small',
|
||||
menu: true,
|
||||
action: 'insert-stamp'
|
||||
});
|
||||
this.toolbarControls.push(this.btnStamp);
|
||||
|
||||
this.btnStrikeout = new Common.UI.ButtonColored({
|
||||
id: 'id-toolbar-btn-strikeout',
|
||||
cls: 'btn-toolbar',
|
||||
@ -1343,6 +1358,7 @@ define([
|
||||
_injectComponent('#slot-btn-underline', this.btnUnderline);
|
||||
_injectComponent('#slot-btn-highlight', this.btnHighlight);
|
||||
_injectComponent('#slot-btn-text-comment', this.btnTextComment);
|
||||
_injectComponent('#slot-btn-stamp', this.btnStamp);
|
||||
this.btnEditMode ? _injectComponent('#slot-btn-tb-edit-mode', this.btnEditMode) : $host.findById('#slot-btn-tb-edit-mode').parents('.group').hide().next('.separator').hide();
|
||||
},
|
||||
|
||||
@ -1499,6 +1515,11 @@ define([
|
||||
]
|
||||
}));
|
||||
}
|
||||
if (me.btnStamp) {
|
||||
me.btnStamp.setMenu(new Common.UI.Menu({
|
||||
restoreHeight: 500
|
||||
}));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -1538,6 +1559,7 @@ define([
|
||||
this.btnHighlight.updateHint(this.textHighlight);
|
||||
// this.btnTextComment.updateHint([this.tipInsertTextComment, this.tipInsertText]);
|
||||
this.btnTextComment.updateHint(this.tipInsertTextComment);
|
||||
this.btnStamp.updateHint(this.tipInsertStamp);
|
||||
this.btnEditMode && this.btnEditMode.updateHint(this.tipEditMode);
|
||||
},
|
||||
|
||||
|
||||
@ -2016,6 +2016,8 @@
|
||||
"PDFE.Views.Toolbar.txtRotatePage": "Rotate page",
|
||||
"PDFE.Views.Toolbar.txtRotatePageRight": "Rotate page right",
|
||||
"PDFE.Views.Toolbar.txtRotateRight": "Rotate right",
|
||||
"PDFE.Views.Toolbar.capBtnStamp": "Stamp",
|
||||
"PDFE.Views.Toolbar.tipInsertStamp": "Insert stamp",
|
||||
"PDFE.Views.Toolbar.txtUngroup": "Ungroup",
|
||||
"PDFE.Views.ViewTab.textAlwaysShowToolbar": "Always Show Toolbar",
|
||||
"PDFE.Views.ViewTab.textDarkDocument": "Dark Document",
|
||||
|
||||
Reference in New Issue
Block a user