[DE] Update hint in protected document

This commit is contained in:
Julia Radzhabova 2022-10-10 15:09:46 +03:00
parent 022c65cf3d
commit 0f2568e5b1
3 changed files with 25 additions and 5 deletions

View file

@ -754,7 +754,7 @@ define([
return (this.cmpEl) ? this.cmpEl.is(":visible") : $(this.el).is(":visible");
},
updateHint: function(hint) {
updateHint: function(hint, isHtml) {
this.options.hint = hint;
if (!this.rendered) return;
@ -780,10 +780,12 @@ define([
this.btnMenuEl.removeData('bs.tooltip');
this.btnEl.tooltip({
html: !!isHtml,
title : (typeof hint == 'string') ? hint : hint[0],
placement : this.options.hintAnchor||'cursor'
});
this.btnMenuEl && this.btnMenuEl.tooltip({
html: !!isHtml,
title : hint[1],
placement : this.options.hintAnchor||'cursor'
});

View file

@ -185,7 +185,7 @@ define([
isProtected = (type === Asc.c_oAscEDocProtect.ReadOnly || type === Asc.c_oAscEDocProtect.Comments ||
type === Asc.c_oAscEDocProtect.TrackedChanges || type === Asc.c_oAscEDocProtect.Forms);
me.view.btnProtectDoc.toggle(!!isProtected, true);
props && me.applyRestrictions(props[0]);
props && me.applyRestrictions(type);
});
},
@ -241,6 +241,7 @@ define([
} else
this.api.asc_setRestriction(Asc.c_oAscRestrictionType.None);
}
this.view && this.view.updateProtectionTips(type);
},
onLockDocumentProtection: function(state) {

View file

@ -72,7 +72,7 @@ define([
var _set = Common.enumLock;
this.lockedControls = [];
this._state = {disabled: false};
this._state = {disabled: false, currentProtectHint: this.hintProtectDoc };
this.btnProtectDoc = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
@ -98,7 +98,7 @@ define([
(new Promise(function (accept, reject) {
accept();
})).then(function(){
me.btnProtectDoc.updateHint(me.hintProtectDoc);
me.btnProtectDoc.updateHint(me._state.currentProtectHint, true);
setEvents.call(me);
});
},
@ -121,8 +121,25 @@ define([
this.fireEvent('show', this);
},
updateProtectionTips: function(type) {
var str = this.txtProtectDoc;
if (type === Asc.c_oAscEDocProtect.ReadOnly) {
str = this.txtDocProtectedView;
} else if (type === Asc.c_oAscEDocProtect.Comments) {
str = this.txtDocProtectedComment;
} else if (type === Asc.c_oAscEDocProtect.Forms) {
str = this.txtDocProtectedForms;
} else if (type === Asc.c_oAscEDocProtect.TrackedChanges){ // none or tracked changes
str = this.txtDocProtectedTrack;
}
this.btnProtectDoc.updateHint(str, true);
this._state.currentProtectHint = str;
},
txtProtectDoc: 'Protect Document',
txtDocUnlockTitle: 'Unprotect Document',
txtDocProtectedView: 'Document is protected.<br>You may only view this document.',
txtDocProtectedTrack: 'Document is protected.<br>You may edit this document, but all changes will be tracked.',
txtDocProtectedComment: 'Document is protected.<br>You may only insert comments to this document.',
txtDocProtectedForms: 'Document is protected.<br>You may only fill in forms in this document.',
hintProtectDoc: 'Protect document',
txtDocUnlockDescription: 'Enter a password to unprotect document'
}