mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
add option to hide the "Powered by CKEditor" banner
This commit is contained in:
parent
0496412f4a
commit
8d2958738f
@ -31,6 +31,7 @@ import VacuumDatabaseOptions from "./options/advanced/vacuum_database.js";
|
|||||||
import DatabaseAnonymizationOptions from "./options/advanced/database_anonymization.js";
|
import DatabaseAnonymizationOptions from "./options/advanced/database_anonymization.js";
|
||||||
import BackendLogWidget from "./content/backend_log.js";
|
import BackendLogWidget from "./content/backend_log.js";
|
||||||
import AttachmentErasureTimeoutOptions from "./options/other/attachment_erasure_timeout.js";
|
import AttachmentErasureTimeoutOptions from "./options/other/attachment_erasure_timeout.js";
|
||||||
|
import PoweredByCKEditorOptions from "./options/appearance/powered_by_ckeditor.js";
|
||||||
|
|
||||||
const TPL = `<div class="note-detail-content-widget note-detail-printable">
|
const TPL = `<div class="note-detail-content-widget note-detail-printable">
|
||||||
<style>
|
<style>
|
||||||
@ -53,10 +54,11 @@ const TPL = `<div class="note-detail-content-widget note-detail-printable">
|
|||||||
|
|
||||||
const CONTENT_WIDGETS = {
|
const CONTENT_WIDGETS = {
|
||||||
_optionsAppearance: [
|
_optionsAppearance: [
|
||||||
ZoomFactorOptions,
|
PoweredByCKEditorOptions,
|
||||||
NativeTitleBarOptions,
|
|
||||||
ThemeOptions,
|
ThemeOptions,
|
||||||
FontsOptions,
|
FontsOptions,
|
||||||
|
ZoomFactorOptions,
|
||||||
|
NativeTitleBarOptions,
|
||||||
MaxContentWidthOptions
|
MaxContentWidthOptions
|
||||||
],
|
],
|
||||||
_optionsShortcuts: [ KeyboardShortcutsOptions ],
|
_optionsShortcuts: [ KeyboardShortcutsOptions ],
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
import OptionsWidget from "../options_widget.js";
|
||||||
|
import utils from "../../../../services/utils.js";
|
||||||
|
|
||||||
|
const TPL = `
|
||||||
|
<div class="options-section">
|
||||||
|
<h4>Powered by CKEditor banner</h4>
|
||||||
|
|
||||||
|
<p>CKEditor by default displays a small banner in the editing area. Some users may find this distracting, so it is possible to hide it.</p>
|
||||||
|
|
||||||
|
<select class="powered-by-ckeditor-select form-control">
|
||||||
|
<option value="show">shown</option>
|
||||||
|
<option value="hide">hidden</option>
|
||||||
|
</select>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
export default class PoweredByCKEditorOptions extends OptionsWidget {
|
||||||
|
doRender() {
|
||||||
|
this.$widget = $(TPL);
|
||||||
|
this.$poweredByCKEditorSelect = this.$widget.find(".powered-by-ckeditor-select");
|
||||||
|
this.$poweredByCKEditorSelect.on('change', async () => {
|
||||||
|
const hidePoweredByCKEditor = this.$poweredByCKEditorSelect.val() === 'hide' ? 'true' : 'false';
|
||||||
|
|
||||||
|
await this.updateOption('hidePoweredByCKEditor', hidePoweredByCKEditor);
|
||||||
|
|
||||||
|
utils.reloadFrontendApp("Powered by CKEditor change");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async optionsLoaded(options) {
|
||||||
|
this.$poweredByCKEditorSelect.val(options.hidePoweredByCKEditor === 'true' ? 'hide' : 'show');
|
||||||
|
}
|
||||||
|
}
|
@ -56,6 +56,7 @@ const ALLOWED_OPTIONS = new Set([
|
|||||||
'disableTray',
|
'disableTray',
|
||||||
'customSearchEngineName',
|
'customSearchEngineName',
|
||||||
'customSearchEngineUrl',
|
'customSearchEngineUrl',
|
||||||
|
'hidePoweredByCKEditor'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function getOptions() {
|
function getOptions() {
|
||||||
|
@ -29,6 +29,7 @@ function index(req, res) {
|
|||||||
mainFontSize: parseInt(options.mainFontSize),
|
mainFontSize: parseInt(options.mainFontSize),
|
||||||
treeFontSize: parseInt(options.treeFontSize),
|
treeFontSize: parseInt(options.treeFontSize),
|
||||||
detailFontSize: parseInt(options.detailFontSize),
|
detailFontSize: parseInt(options.detailFontSize),
|
||||||
|
hidePoweredByCKEditor: options.hidePoweredByCKEditor === 'true',
|
||||||
maxEntityChangeIdAtLoad: sql.getValue("SELECT COALESCE(MAX(id), 0) FROM entity_changes"),
|
maxEntityChangeIdAtLoad: sql.getValue("SELECT COALESCE(MAX(id), 0) FROM entity_changes"),
|
||||||
maxEntityChangeSyncIdAtLoad: sql.getValue("SELECT COALESCE(MAX(id), 0) FROM entity_changes WHERE isSynced = 1"),
|
maxEntityChangeSyncIdAtLoad: sql.getValue("SELECT COALESCE(MAX(id), 0) FROM entity_changes WHERE isSynced = 1"),
|
||||||
instanceName: config.General ? config.General.instanceName : null,
|
instanceName: config.General ? config.General.instanceName : null,
|
||||||
|
@ -89,6 +89,7 @@ const defaultOptions = [
|
|||||||
{ name: 'eraseUnusedAttachmentsAfterSeconds', value: '2592000', isSynced: true },
|
{ name: 'eraseUnusedAttachmentsAfterSeconds', value: '2592000', isSynced: true },
|
||||||
{ name: 'customSearchEngineName', value: 'DuckDuckGo', isSynced: true },
|
{ name: 'customSearchEngineName', value: 'DuckDuckGo', isSynced: true },
|
||||||
{ name: 'customSearchEngineUrl', value: 'https://duckduckgo.com/?q={keyword}', isSynced: true },
|
{ name: 'customSearchEngineUrl', value: 'https://duckduckgo.com/?q={keyword}', isSynced: true },
|
||||||
|
{ name: 'hidePoweredByCKEditor', value: 'false', isSynced: true },
|
||||||
];
|
];
|
||||||
|
|
||||||
function initStartupOptions() {
|
function initStartupOptions() {
|
||||||
|
@ -44,6 +44,12 @@
|
|||||||
.note-split {
|
.note-split {
|
||||||
max-width: <%= maxContentWidth %>px;
|
max-width: <%= maxContentWidth %>px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<% if (hidePoweredByCKEditor) { %>
|
||||||
|
.ck-powered-by-balloon {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
<% } %>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- Required for correct loading of scripts in Electron -->
|
<!-- Required for correct loading of scripts in Electron -->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user