[DE] Load live viewer

This commit is contained in:
Julia Radzhabova 2022-02-15 10:41:16 +03:00
parent ee15a53547
commit 062d9d3d31
5 changed files with 43 additions and 6 deletions

View file

@ -218,8 +218,9 @@
uiTheme: 'theme-dark' // set interface theme: id or default-dark/default-light uiTheme: 'theme-dark' // set interface theme: id or default-dark/default-light
}, },
coEditing: { coEditing: {
mode: 'fast', // <coauthoring mode>, 'fast' or 'strict'. if 'fast' and 'customization.autosave'=false -> set 'customization.autosave'=true mode: 'fast', // <coauthoring mode>, 'fast' or 'strict'. if 'fast' and 'customization.autosave'=false -> set 'customization.autosave'=true. 'fast' - default for editor
change: true, // can change co-authoring mode // for viewer: 'strict' is default, offline viewer; 'fast' - live viewer, show changes from other users
change: true, // can change co-authoring mode. true - default for editor, false - default for viewer
}, },
plugins: { plugins: {
autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'], autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'],
@ -980,6 +981,7 @@
iframe.frameBorder = 0; iframe.frameBorder = 0;
iframe.name = "frameEditor"; iframe.name = "frameEditor";
iframe.allowFullscreen = true; iframe.allowFullscreen = true;
iframe.title = "Online editor for text documents, spreadsheets, and presentations";
iframe.setAttribute("allowfullscreen",""); // for IE11 iframe.setAttribute("allowfullscreen",""); // for IE11
iframe.setAttribute("onmousewheel",""); // for Safari on Mac iframe.setAttribute("onmousewheel",""); // for Safari on Mac
iframe.setAttribute("allow", "autoplay; camera; microphone; display-capture"); iframe.setAttribute("allow", "autoplay; camera; microphone; display-capture");

View file

@ -302,7 +302,7 @@ div {
"uiTheme": queryParams.thm==="1" ? "default-light" : (queryParams.thm==="2" ? "default-dark" : undefined) "uiTheme": queryParams.thm==="1" ? "default-light" : (queryParams.thm==="2" ? "default-dark" : undefined)
}, },
"coEditing": { "coEditing": {
"mode": "fast", "mode": userAuth.mode !== "view" ? "fast" : "strict",
"change": false "change": false
}, },
"wopi": { "wopi": {

View file

@ -457,6 +457,10 @@ define([
default: value = (fast_coauth) ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges; default: value = (fast_coauth) ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges;
} }
this.api.SetCollaborativeMarksShowType(value); this.api.SetCollaborativeMarksShowType(value);
} else if (!this.mode.isEdit && !this.mode.isRestrictedEdit && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer
fast_coauth = Common.localStorage.getBool("de-settings-view-coauthmode", false);
Common.Utils.InternalSettings.set("de-settings-coauthmode", fast_coauth);
this.api.asc_SetFastCollaborative(fast_coauth);
} }
value = Common.localStorage.getBool("de-settings-livecomment", true); value = Common.localStorage.getBool("de-settings-livecomment", true);

View file

@ -1500,7 +1500,9 @@ define([
Common.NotificationCenter.on('comments:cleardummy', _.bind(this.onClearDummyComment, this)); Common.NotificationCenter.on('comments:cleardummy', _.bind(this.onClearDummyComment, this));
Common.NotificationCenter.on('comments:showdummy', _.bind(this.onShowDummyComment, this)); Common.NotificationCenter.on('comments:showdummy', _.bind(this.onShowDummyComment, this));
this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false); // change = true by default in editor, change = false by default in viewer
this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && this.appOptions.canCoAuthoring && !(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false) ||
!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && (typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===true) ;
this.loadCoAuthSettings(); this.loadCoAuthSettings();
this.applyModeCommonElements(); this.applyModeCommonElements();
@ -1547,6 +1549,16 @@ define([
Common.Utils.InternalSettings.set((fastCoauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict", value); Common.Utils.InternalSettings.set((fastCoauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict", value);
} else if (!this.appOptions.isEdit && this.appOptions.isRestrictedEdit) { } else if (!this.appOptions.isEdit && this.appOptions.isRestrictedEdit) {
fastCoauth = true; fastCoauth = true;
} else if (!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit && !this.appOptions.isOffline) { // viewer
if (!this.appOptions.canChangeCoAuthoring) { //can't change co-auth. mode. Use coEditing.mode or 'strict' by default
value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0;
} else {
value = Common.localStorage.getItem("de-settings-view-coauthmode");
if (value===null) {
value = this.editorConfig.coEditing && this.editorConfig.coEditing.mode==='fast' ? 1 : 0;
}
}
fastCoauth = (parseInt(value) == 1);
} else { } else {
fastCoauth = false; fastCoauth = false;
autosave = 0; autosave = 0;

View file

@ -285,6 +285,10 @@ define([
'<td class="left"><label><%= scope.strShowChanges %></label></td>', '<td class="left"><label><%= scope.strShowChanges %></label></td>',
'<td class="right"><span id="fms-cmb-show-changes"></span></td>', '<td class="right"><span id="fms-cmb-show-changes"></span></td>',
'</tr>','<tr class="divider coauth changes-show"></tr>', '</tr>','<tr class="divider coauth changes-show"></tr>',
'<tr class="live-viewer">',
'<td class="left"><label><%= scope.txtLiveViewer %></label></td>',
'<td class="right"><div id="fms-chb-live-viewer"></div></td>',
'</tr>','<tr class="divider live-viewer"></tr>',
/** coauthoring end **/ /** coauthoring end **/
'<tr class="themes">', '<tr class="themes">',
'<td class="left"><label><%= scope.strTheme %></label></td>', '<td class="left"><label><%= scope.strTheme %></label></td>',
@ -480,6 +484,14 @@ define([
this.lblCoAuthMode = $markup.findById('#fms-lbl-coauth-mode'); this.lblCoAuthMode = $markup.findById('#fms-lbl-coauth-mode');
/** coauthoring end **/ /** coauthoring end **/
this.chLiveViewer = new Common.UI.CheckBox({
el: $markup.findById('#fms-chb-live-viewer'),
labelText: this.strShowOthersChanges,
dataHint: '2',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
var itemsTemplate = var itemsTemplate =
_.template([ _.template([
'<% _.each(items, function(item) { %>', '<% _.each(items, function(item) { %>',
@ -650,6 +662,8 @@ define([
$('tr.coauth', this.el)[mode.isEdit && mode.canCoAuthoring ? 'show' : 'hide'](); $('tr.coauth', this.el)[mode.isEdit && mode.canCoAuthoring ? 'show' : 'hide']();
$('tr.coauth.changes-mode', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring && mode.canChangeCoAuthoring ? 'show' : 'hide'](); $('tr.coauth.changes-mode', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring && mode.canChangeCoAuthoring ? 'show' : 'hide']();
$('tr.coauth.changes-show', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide'](); $('tr.coauth.changes-show', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide']();
$('tr.live-viewer', this.el)[!mode.isEdit && !mode.isRestrictedEdit && !mode.isOffline && mode.canChangeCoAuthoring ? 'show' : 'hide']();
$('tr.view-review', this.el)[mode.canViewReview ? 'show' : 'hide'](); $('tr.view-review', this.el)[mode.canViewReview ? 'show' : 'hide']();
$('tr.spellcheck', this.el)[mode.isEdit && Common.UI.FeaturesManager.canChange('spellcheck') ? 'show' : 'hide'](); $('tr.spellcheck', this.el)[mode.isEdit && Common.UI.FeaturesManager.canChange('spellcheck') ? 'show' : 'hide']();
$('tr.comments', this.el)[mode.canCoAuthoring ? 'show' : 'hide'](); $('tr.comments', this.el)[mode.canCoAuthoring ? 'show' : 'hide']();
@ -682,9 +696,10 @@ define([
item = this.cmbCoAuthMode.store.findWhere({value: fast_coauth ? 1 : 0}); item = this.cmbCoAuthMode.store.findWhere({value: fast_coauth ? 1 : 0});
this.cmbCoAuthMode.setValue(item ? item.get('value') : 1); this.cmbCoAuthMode.setValue(item ? item.get('value') : 1);
this.lblCoAuthMode.text(item ? item.get('descValue') : this.strCoAuthModeDescFast); this.lblCoAuthMode.text(item ? item.get('descValue') : this.strCoAuthModeDescFast);
this.fillShowChanges(fast_coauth); this.fillShowChanges(fast_coauth);
this.chLiveViewer.setValue(Common.Utils.InternalSettings.get("de-settings-coauthmode"));
value = Common.Utils.InternalSettings.get((fast_coauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict"); value = Common.Utils.InternalSettings.get((fast_coauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict");
item = this.cmbShowChanges.store.findWhere({value: value}); item = this.cmbShowChanges.store.findWhere({value: value});
this.cmbShowChanges.setValue(item ? item.get('value') : (fast_coauth) ? 'none' : 'last'); this.cmbShowChanges.setValue(item ? item.get('value') : (fast_coauth) ? 'none' : 'last');
@ -756,6 +771,8 @@ define([
if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) { if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) {
this.mode.canChangeCoAuthoring && Common.localStorage.setItem("de-settings-coauthmode", this.cmbCoAuthMode.getValue()); this.mode.canChangeCoAuthoring && Common.localStorage.setItem("de-settings-coauthmode", this.cmbCoAuthMode.getValue());
Common.localStorage.setItem(this.cmbCoAuthMode.getValue() ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict", this.cmbShowChanges.getValue()); Common.localStorage.setItem(this.cmbCoAuthMode.getValue() ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict", this.cmbShowChanges.getValue());
} else if (!this.mode.isEdit && !this.mode.isRestrictedEdit && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer
Common.localStorage.setItem("de-settings-view-coauthmode", this.chLiveViewer.isChecked() ? 1 : 0);
} }
/** coauthoring end **/ /** coauthoring end **/
Common.localStorage.setItem("de-settings-fontrender", this.cmbFontRender.getValue()); Common.localStorage.setItem("de-settings-fontrender", this.cmbFontRender.getValue());
@ -882,7 +899,9 @@ define([
strReviewHover: 'Track Changes Display', strReviewHover: 'Track Changes Display',
txtChangesTip: 'Show by hover in tooltips', txtChangesTip: 'Show by hover in tooltips',
txtChangesBalloons: 'Show by click in balloons', txtChangesBalloons: 'Show by click in balloons',
txtDarkMode: 'Turn on document dark mode' txtDarkMode: 'Turn on document dark mode',
strShowOthersChanges: 'Show changes from other users',
txtLiveViewer: 'Real-time Collaboration Changes'
}, DE.Views.FileMenuPanels.Settings || {})); }, DE.Views.FileMenuPanels.Settings || {}));
DE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({ DE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({