更新onlyoffice样式

This commit is contained in:
kuaifan 2022-05-19 11:27:40 +08:00
parent e0f41f9330
commit 6b6cb7473e
7 changed files with 122 additions and 63 deletions

View File

@ -3,7 +3,7 @@
*
* http://www.onlyoffice.com
*
* Version: 7.0.1 (build:37)
* Version: 7.1.0 (build:215)
*/
;(function(window) {
@ -64,6 +64,7 @@
edit: ["Group1", ""] // current user can edit comments made by users from Group1 and users without a group.
remove: ["Group1", ""] // current user can remove comments made by users from Group1 and users without a group.
},
userInfoGroups: ["Group1", ""], // show tooltips/cursors/info in header only for users in userInfoGroups groups. [""] - means users without group, [] - don't show any users, null/undefined/"" - show all users
protect: <can protect document> // default = true. show/hide protect tab or protect buttons
}
},
@ -92,7 +93,7 @@
user: {
id: 'user id',
name: 'user name',
group: 'group name' // for customization.reviewPermissions parameter
group: 'group name' // for customization.reviewPermissions or permissions.reviewGroups or permissions.commentGroups. Can be multiple groups separated by commas (,) : 'Group1' or 'Group1,Group2'
},
recent: [
{
@ -153,15 +154,57 @@
reviewDisplay: 'original', // original for viewer, markup for editor
trackChanges: undefined // true/false - open editor with track changes mode on/off,
},
layout: { // hide elements, but don't disable feature
toolbar: {
file: { // menu file
close: false / true, // close menu button
settings: false / true, // advanced settings
info: false / true // document info
save: false/true // save button
} / false / true,
home: {
mailmerge: false/true // mail merge button
},
layout: false / true, // layout tab
references: false / true, // de references tab
collaboration: false / true // collaboration tab
protect: false / true, // protect tab
plugins: false / true // plugins tab
view: {
navigation: false/true // navigation button in de
} / false / true, // view tab
save: false/true // save button on toolbar in
} / false / true, // use instead of customization.toolbar,
header: {
users: false/true // users list button
save: false/true // save button
},
leftMenu: {
navigation: false/true,
spellcheck: false/true // spellcheck button in sse
} / false / true, // use instead of customization.leftMenu
rightMenu: false/true, // use instead of customization.rightMenu
statusBar: {
textLang: false/true // text language button in de/pe
docLang: false/true // document language button in de/pe
actionStatus: false/true // status of operation
} / false / true, // use instead of customization.statusBar
},
features: { // disable feature
spellcheck: {
mode: false/true // init value in de/pe
change: false/true // hide/show feature in de/pe/sse
} / false / true // if false/true - use as init value in de/pe. use instead of customization.spellcheck parameter
},
chat: true,
comments: true,
zoom: 100,
compactToolbar: false,
leftMenu: true,
rightMenu: true,
leftMenu: true, // must be deprecated. use layout.leftMenu instead
rightMenu: true, // must be deprecated. use layout.rightMenu instead
hideRightMenu: false, // hide or show right panel on first loading
toolbar: true,
statusBar: true,
toolbar: true, // must be deprecated. use layout.toolbar instead
statusBar: true, // must be deprecated. use layout.statusBar instead
autosave: true,
forcesave: false,
commentAuthorOnly: false, // must be deprecated. use permissions.editCommentAuthorOnly and permissions.deleteCommentAuthorOnly instead
@ -171,7 +214,7 @@
toolbarNoTabs: false,
toolbarHideFileName: false,
reviewDisplay: 'original', // must be deprecated. use customization.review.reviewDisplay instead
spellcheck: true,
spellcheck: true, // must be deprecated. use customization.features.spellcheck instead
compatibleFeatures: false,
unit: 'cm' // cm, pt, inch,
mentionShare : true // customize tooltip for mention,
@ -337,36 +380,6 @@
}
};
var _callLocalStorage = function(data) {
if (data.cmd == 'get') {
if (data.keys && data.keys.length) {
var af = data.keys.split(','), re = af[0];
for (i = 0; ++i < af.length;)
re += '|' + af[i];
re = new RegExp(re); k = {};
for (i in localStorage)
if (re.test(i)) k[i] = localStorage[i];
} else {
k = localStorage;
}
_sendCommand({
command: 'internalCommand',
data: {
type: 'localstorage',
keys: k
}
});
} else
if (data.cmd == 'set') {
var k = data.keys, i;
for (i in k) {
localStorage.setItem(i, k[i]);
}
}
};
var _onMessage = function(msg) {
if ( msg ) {
if ( msg.type === "onExternalPluginMessage" ) {
@ -381,8 +394,6 @@
if (msg.event === 'onRequestEditRights' && !handler) {
_applyEditRights(false, 'handler isn\'t defined');
} else if (msg.event === 'onInternalMessage' && msg.data && msg.data.type == 'localstorage') {
_callLocalStorage(msg.data.data);
} else {
if (msg.event === 'onAppReady') {
_onAppReady();
@ -429,7 +440,7 @@
if (typeof _config.document.fileType === 'string' && _config.document.fileType != '') {
_config.document.fileType = _config.document.fileType.toLowerCase();
var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp)|(doc|docx|doct|odt|gdoc|txt|rtf|pdf|mht|htm|html|epub|djvu|xps|oxps|docm|dot|dotm|dotx|fodt|ott|fb2|xml|oform|docxf))$/
var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp)|(doc|docx|doct|odt|gdoc|txt|rtf|pdf|mht|htm|html|epub|djvu|xps|oxps|docm|dot|dotm|dotx|fodt|ott|fb2|xml|oform|docxf))$/
.exec(_config.document.fileType);
if (!type) {
window.alert("The \"document.fileType\" parameter for the config object is invalid. Please correct it.");
@ -781,7 +792,7 @@
};
DocsAPI.DocEditor.version = function() {
return '7.0.1';
return '7.1.0';
};
MessageDispatcher = function(fn, scope) {
@ -849,9 +860,24 @@
return extensionParams["url"] + "apps/";
}
function getTestPath() {
var scripts = document.getElementsByTagName('script'),
match;
for (var i = scripts.length - 1; i >= 0; i--) {
match = scripts[i].src.match(/(.*)apps\/api\/documents\/api.js/i);
if (match) {
return match[1] + "test/";
}
}
return "";
}
function getAppPath(config) {
var extensionPath = getExtensionPath(),
path = extensionPath ? extensionPath : getBasePath(),
path = extensionPath ? extensionPath : (config.type=="test" ? getTestPath() : getBasePath()),
appMap = {
'text': 'documenteditor',
'text-pdf': 'documenteditor',
@ -867,7 +893,7 @@
app = appMap[config.documentType.toLowerCase()];
} else
if (!!config.document && typeof config.document.fileType === 'string') {
var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp))$/
var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp))$/
.exec(config.document.fileType);
if (type) {
if (typeof type[1] === 'string') app = appMap['cell']; else
@ -904,7 +930,7 @@
}
function getAppParameters(config) {
var params = "?_dc=7.0.1-37";
var params = "?_dc=7.1.0-215";
if (config.editorConfig && config.editorConfig.lang)
params += "&lang=" + config.editorConfig.lang;
@ -914,14 +940,17 @@
if (config.editorConfig.customization.loaderName !== 'none') params += "&customer=" + encodeURIComponent(config.editorConfig.customization.loaderName);
} else
params += "&customer=ONLYOFFICE";
if ( (typeof(config.editorConfig.customization) == 'object') && config.editorConfig.customization.loaderLogo) {
if (config.editorConfig.customization.loaderLogo !== '') params += "&logo=" + encodeURIComponent(config.editorConfig.customization.loaderLogo);
} else if ( (typeof(config.editorConfig.customization) == 'object') && config.editorConfig.customization.logo) {
if (config.type=='embedded' && (config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageEmbedded))
params += "&headerlogo=" + encodeURIComponent(config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageEmbedded);
else if (config.type!='embedded' && (config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageDark)) {
config.editorConfig.customization.logo.image && (params += "&headerlogo=" + encodeURIComponent(config.editorConfig.customization.logo.image));
config.editorConfig.customization.logo.imageDark && (params += "&headerlogodark=" + encodeURIComponent(config.editorConfig.customization.logo.imageDark));
if (typeof(config.editorConfig.customization) == 'object') {
if ( config.editorConfig.customization.loaderLogo && config.editorConfig.customization.loaderLogo !== '') {
params += "&logo=" + encodeURIComponent(config.editorConfig.customization.loaderLogo);
}
if ( config.editorConfig.customization.logo ) {
if (config.type=='embedded' && (config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageEmbedded))
params += "&headerlogo=" + encodeURIComponent(config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageEmbedded);
else if (config.type!='embedded' && (config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageDark)) {
config.editorConfig.customization.logo.image && (params += "&headerlogo=" + encodeURIComponent(config.editorConfig.customization.logo.image));
config.editorConfig.customization.logo.imageDark && (params += "&headerlogodark=" + encodeURIComponent(config.editorConfig.customization.logo.imageDark));
}
}
}
}
@ -941,8 +970,6 @@
if (config.editorConfig && config.editorConfig.customization && (config.editorConfig.customization.toolbar===false))
params += "&toolbar=false";
else if (config.document && config.document.permissions && (config.document.permissions.edit === false && config.document.permissions.fillForms ))
params += "&toolbar=true";
if (config.parentOrigin)
params += "&parentOrigin=" + config.parentOrigin;
@ -953,6 +980,25 @@
return params;
}
function getFrameTitle(config) {
var title = 'Powerful online editor for text documents, spreadsheets, and presentations';
var appMap = {
'text': 'text documents',
'spreadsheet': 'spreadsheets',
'presentation': 'presentations',
'word': 'text documents',
'cell': 'spreadsheets',
'slide': 'presentations'
};
if (typeof config.documentType === 'string') {
var app = appMap[config.documentType.toLowerCase()];
if (app)
title = 'Powerful online editor for ' + app;
}
return title;
}
function createIframe(config) {
var iframe = document.createElement("iframe");
@ -962,6 +1008,7 @@
iframe.align = "top";
iframe.frameBorder = 0;
iframe.name = "frameEditor";
iframe.title = getFrameTitle(config);
iframe.allowFullscreen = true;
iframe.setAttribute("allowfullscreen",""); // for IE11
iframe.setAttribute("onmousewheel",""); // for Safari on Mac
@ -1000,3 +1047,4 @@
}
})(window.DocsAPI = window.DocsAPI || {}, window, document);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long