Merge pull request #2041 from ONLYOFFICE/feature/custom-font

Feature/custom font
This commit is contained in:
Julia Radzhabova 2022-11-10 17:30:20 +03:00 committed by GitHub
commit 3d609a1576
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 57 additions and 9 deletions

View file

@ -193,6 +193,9 @@
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
},
font: {
family: "Arial",
},
chat: true,
comments: true,
zoom: 100,

View file

@ -70,7 +70,7 @@
label {
color: @text-normal-ie;
color: @text-normal;
font: 12px arial;
font-size: 12px;
line-height: normal;
border-bottom: @scaled-one-px-value-ie dotted @text-normal-ie;
border-bottom: @scaled-one-px-value dotted @text-normal;
@ -120,7 +120,7 @@
.dataview-ct {
width: 100%;
height: 100%;
font: 12px arial;
font-size: 12px;
line-height: normal;
position: relative;
overflow: hidden;

View file

@ -298,4 +298,7 @@ body {
&.pixel-ratio__1_75 {
image-rendering: crisp-edges; // FF only
}
font-family: @font-family-sans-serif;
font-family: @font-family-base;
}

View file

@ -60,7 +60,7 @@
@font-family-serif: Georgia, "Times New Roman", Times, serif;
@font-family-monospace: Menlo, Monaco, Consolas, "Courier New", monospace;
@font-family-tahoma: tahoma, arial, verdana, sans-serif;
@font-family-base: @font-family-sans-serif;
@font-family-base: var(--font-family-base-custom, @font-family-sans-serif), @font-family-sans-serif;
@font-size-base: 11px;
@font-size-large: 13px;

View file

@ -380,6 +380,19 @@ define([
Common.Utils.InternalSettings.set("guest-username", value);
Common.Utils.InternalSettings.set("save-guest-username", !!value);
}
if (this.appOptions.customization.font) {
if (this.appOptions.customization.font.family && typeof this.appOptions.customization.font.family === 'string') {
var arr = this.appOptions.customization.font.family.split(',');
for (var i=0; i<arr.length; i++) {
var item = arr[i].trim();
if (item && (/[\s0-9\.]/).test(item)) {
arr[i] = "'" + item + "'";
}
}
document.documentElement.style.setProperty("--font-family-base-custom", arr.join(','));
}
}
this.editorConfig.user =
this.appOptions.user = Common.Utils.fillUserInfo(this.editorConfig.user, this.editorConfig.lang, value ? (value + ' (' + this.appOptions.guestName + ')' ) : this.textAnonymous,
Common.localStorage.getItem("guest-id") || ('uid-' + Date.now()));
@ -1418,7 +1431,8 @@ define([
});
}
} else if (!this.appOptions.isDesktopApp && !this.appOptions.canBrandingExt &&
this.editorConfig && this.editorConfig.customization && (this.editorConfig.customization.loaderName || this.editorConfig.customization.loaderLogo)) {
this.editorConfig && this.editorConfig.customization && (this.editorConfig.customization.loaderName || this.editorConfig.customization.loaderLogo ||
this.editorConfig.customization.font && this.editorConfig.customization.font.family)) {
Common.UI.warning({
title: this.textPaidFeature,
msg : this.textCustomLoader,

View file

@ -130,7 +130,7 @@
border-radius: 0;
padding: 3px 10px;
color: #ffffff;
font: 11px arial;
.font-size-normal();
white-space: nowrap;
letter-spacing: 1px;
overflow: hidden;

View file

@ -339,6 +339,19 @@ define([
Common.Utils.InternalSettings.set("guest-username", value);
Common.Utils.InternalSettings.set("save-guest-username", !!value);
}
if (this.appOptions.customization.font) {
if (this.appOptions.customization.font.family && typeof this.appOptions.customization.font.family === 'string') {
var arr = this.appOptions.customization.font.family.split(',');
for (var i=0; i<arr.length; i++) {
var item = arr[i].trim();
if (item && (/[\s0-9\.]/).test(item)) {
arr[i] = "'" + item + "'";
}
}
document.documentElement.style.setProperty("--font-family-base-custom", arr.join(','));
}
}
this.editorConfig.user =
this.appOptions.user = Common.Utils.fillUserInfo(data.config.user, this.editorConfig.lang, value ? (value + ' (' + this.appOptions.guestName + ')' ) : this.textAnonymous,
Common.localStorage.getItem("guest-id") || ('uid-' + Date.now()));
@ -1040,7 +1053,8 @@ define([
});
}
} else if (!this.appOptions.isDesktopApp && !this.appOptions.canBrandingExt &&
this.editorConfig && this.editorConfig.customization && (this.editorConfig.customization.loaderName || this.editorConfig.customization.loaderLogo)) {
this.editorConfig && this.editorConfig.customization && (this.editorConfig.customization.loaderName || this.editorConfig.customization.loaderLogo ||
this.editorConfig.customization.font && this.editorConfig.customization.font.family)) {
Common.UI.warning({
title: this.textPaidFeature,
msg : this.textCustomLoader,

View file

@ -83,7 +83,7 @@
border-radius: 0;
padding: 3px 10px;
color: #fff;
font: 11px arial;
.font-size-normal();
white-space: nowrap;
letter-spacing: 1px;
overflow: hidden;

View file

@ -377,6 +377,19 @@ define([
Common.Utils.InternalSettings.set("guest-username", value);
Common.Utils.InternalSettings.set("save-guest-username", !!value);
}
if (this.appOptions.customization.font) {
if (this.appOptions.customization.font.family && typeof this.appOptions.customization.font.family === 'string') {
var arr = this.appOptions.customization.font.family.split(',');
for (var i=0; i<arr.length; i++) {
var item = arr[i].trim();
if (item && (/[\s0-9\.]/).test(item)) {
arr[i] = "'" + item + "'";
}
}
document.documentElement.style.setProperty("--font-family-base-custom", arr.join(','));
}
}
this.editorConfig.user =
this.appOptions.user = Common.Utils.fillUserInfo(this.editorConfig.user, this.editorConfig.lang, value ? (value + ' (' + this.appOptions.guestName + ')' ) : this.textAnonymous,
Common.localStorage.getItem("guest-id") || ('uid-' + Date.now()));
@ -1125,7 +1138,8 @@ define([
});
}
} else if (!this.appOptions.isDesktopApp && !this.appOptions.canBrandingExt && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle) &&
this.editorConfig && this.editorConfig.customization && (this.editorConfig.customization.loaderName || this.editorConfig.customization.loaderLogo)) {
this.editorConfig && this.editorConfig.customization && (this.editorConfig.customization.loaderName || this.editorConfig.customization.loaderLogo ||
this.editorConfig.customization.font && this.editorConfig.customization.font.family)) {
Common.UI.warning({
title: this.textPaidFeature,
msg : this.textCustomLoader,

View file

@ -68,7 +68,7 @@
border-radius: 0;
padding: 3px 10px;
color: #ffffff;
font: 11px arial;
.font-size-normal();
pointer-events: none;
white-space: nowrap;
letter-spacing: 1px;