mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-25 14:36:49 +08:00
[PDF] Fix changing view/edit mode
This commit is contained in:
@ -595,7 +595,7 @@ define([
|
||||
items: arr
|
||||
}));
|
||||
me.btnPDFMode.menu.on('item:click', function (menu, item) {
|
||||
Common.NotificationCenter.trigger('pdf:mode', item.value, _.bind(changePDFMode, me));
|
||||
Common.NotificationCenter.trigger('pdf:mode-apply', item.value);
|
||||
});
|
||||
} else if (me.btnDocMode) {
|
||||
var arr = [];
|
||||
@ -897,6 +897,7 @@ define([
|
||||
});
|
||||
me.btnPDFMode.render($html.find('#slot-btn-edit-mode'));
|
||||
changePDFMode.call(me, config);
|
||||
Common.NotificationCenter.on('pdf:mode-changed', _.bind(changePDFMode, me));
|
||||
} else if (isDocEditor && config.isEdit && config.canSwitchMode) {
|
||||
me.btnDocMode = new Common.UI.Button({
|
||||
cls: 'btn-header btn-header-pdf-mode ',
|
||||
|
||||
@ -192,7 +192,7 @@ define([
|
||||
Common.NotificationCenter.on('showmessage', _.bind(this.onExternalMessage, this));
|
||||
Common.NotificationCenter.on('showerror', _.bind(this.onError, this));
|
||||
Common.NotificationCenter.on('editing:disable', _.bind(this.onEditingDisable, this));
|
||||
Common.NotificationCenter.on('pdf:mode', _.bind(this.onPdfModeChange, this));
|
||||
Common.NotificationCenter.on('pdf:mode-apply', _.bind(this.onPdfModeApply, this));
|
||||
|
||||
this.isShowOpenDialog = false;
|
||||
|
||||
@ -1011,7 +1011,7 @@ define([
|
||||
Common.Utils.InternalSettings.set("pdfe-settings-show-alt-hints", value);
|
||||
|
||||
/** coauthoring begin **/
|
||||
me.onPdfModeApply();
|
||||
me.onPdfModeCoAuthApply();
|
||||
/** coauthoring end **/
|
||||
|
||||
var application = me.getApplication();
|
||||
@ -1333,7 +1333,8 @@ define([
|
||||
|
||||
this.api.asc_setViewMode(!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit);
|
||||
this.api.asc_setCanSendChanges(this.appOptions.canSaveToFile);
|
||||
this.appOptions.isRestrictedEdit && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms);
|
||||
this.api.asc_setRestriction(this.appOptions.isRestrictedEdit ? Asc.c_oAscRestrictionType.OnlyForms : this.appOptions.isPDFEdit ? Asc.c_oAscRestrictionType.None : Asc.c_oAscRestrictionType.View);
|
||||
|
||||
this.api.asc_LoadDocument();
|
||||
},
|
||||
|
||||
@ -1376,7 +1377,7 @@ define([
|
||||
Common.Utils.InternalSettings.set("pdfe-settings-autosave", autosave);
|
||||
},
|
||||
|
||||
onPdfModeChange: function(mode, callback) {
|
||||
onPdfModeApply: function(mode) {
|
||||
if (!this.appOptions.canSwitchMode) return;
|
||||
|
||||
if ((mode==='comment' || mode==='edit') && false) { // TODO: fix when use co-edit
|
||||
@ -1428,8 +1429,9 @@ define([
|
||||
} else if (mode==='view') {
|
||||
this.appOptions.isPDFEdit = this.appOptions.isPDFAnnotate = false;
|
||||
}
|
||||
callback && callback();
|
||||
this.onPdfModeApply();
|
||||
this.onPdfModeCoAuthApply();
|
||||
this.api.asc_setRestriction(this.appOptions.isRestrictedEdit ? Asc.c_oAscRestrictionType.OnlyForms : this.appOptions.isPDFEdit ? Asc.c_oAscRestrictionType.None : Asc.c_oAscRestrictionType.View);
|
||||
Common.NotificationCenter.trigger('pdf:mode-changed', this.appOptions);
|
||||
var app = this.getApplication(),
|
||||
toolbar = app.getController('Toolbar');
|
||||
toolbar.applyMode();
|
||||
@ -1441,7 +1443,7 @@ define([
|
||||
toolbar.toolbar.processPanelVisible(null, true);
|
||||
},
|
||||
|
||||
onPdfModeApply: function() {
|
||||
onPdfModeCoAuthApply: function() {
|
||||
if (!this.api) return;
|
||||
|
||||
this._state.fastCoauth = (this.appOptions.isPDFAnnotate || this.appOptions.isPDFEdit) && this.appOptions.canSaveToFile ? Common.Utils.InternalSettings.get("pdfe-settings-coauthmode") : this.appOptions.isForm;
|
||||
|
||||
Reference in New Issue
Block a user