mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 19:12:27 +08:00
okay, we can start npm server now, but new db redirects to share
This commit is contained in:
parent
7af4e52766
commit
bc66e98533
@ -35,7 +35,7 @@ import RibbonOptions from "./options/appearance/ribbon.js";
|
||||
import LocalizationOptions from "./options/appearance/i18n.js";
|
||||
import CodeBlockOptions from "./options/appearance/code_block.js";
|
||||
import EditorOptions from "./options/text_notes/editor.js";
|
||||
import ShareSettingsOptions from "./options/other/share_settings.js"; // added import statement
|
||||
import ShareSettingsOptions from "./options/other/share_settings.js";
|
||||
import type FNote from "../../entities/fnote.js";
|
||||
import type NoteContextAwareWidget from "../note_context_aware_widget.js";
|
||||
|
||||
|
@ -0,0 +1,47 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import options from "../../../../services/options.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="card-body">
|
||||
<h4>${t('Share Settings')}</h4>
|
||||
|
||||
<div class="form-check">
|
||||
<label class="form-check-label">
|
||||
<input class="form-check-input" type="checkbox" name="redirectBareDomain" value="true">
|
||||
${t('Redirect bare domain to Share page')}
|
||||
</label>
|
||||
<p class="form-text">${t('When enabled, accessing the root URL will redirect to the Share page instead of Login')}</p>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<label class="form-check-label">
|
||||
<input class="form-check-input" type="checkbox" name="showLoginInShareTheme" value="true">
|
||||
${t('Show Login link in Share theme')}
|
||||
</label>
|
||||
<p class="form-text">${t('Add a login link to the Share page footer')}</p>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
export default class ShareSettingsOptions extends OptionsWidget {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.contentSized();
|
||||
}
|
||||
|
||||
async optionsLoaded(options: Record<string, any>) {
|
||||
this.$widget.find('input[name="redirectBareDomain"]').prop('checked',
|
||||
options.redirectBareDomain === 'true');
|
||||
|
||||
this.$widget.find('input[name="showLoginInShareTheme"]').prop('checked',
|
||||
options.showLoginInShareTheme === 'true');
|
||||
}
|
||||
|
||||
async save() {
|
||||
const redirectBareDomain = this.$widget.find('input[name="redirectBareDomain"]').prop('checked');
|
||||
await this.updateOption('redirectBareDomain', redirectBareDomain.toString());
|
||||
|
||||
const showLoginInShareTheme = this.$widget.find('input[name="showLoginInShareTheme"]').prop('checked');
|
||||
await this.updateOption('showLoginInShareTheme', showLoginInShareTheme.toString());
|
||||
}
|
||||
}
|
@ -29,6 +29,9 @@ export interface OptionDefinitions extends KeyboardShortcutsOptions<KeyboardActi
|
||||
detailFontFamily: FontFamily;
|
||||
monospaceFontFamily: FontFamily;
|
||||
spellCheckLanguageCode: string;
|
||||
// Share settings
|
||||
redirectBareDomain: string;
|
||||
showLoginInShareTheme: string;
|
||||
codeNotesMimeTypes: string;
|
||||
headingStyle: string;
|
||||
highlightsList: string;
|
||||
|
@ -16,7 +16,7 @@ import type SNote from "./shaca/entities/snote.js";
|
||||
import type SBranch from "./shaca/entities/sbranch.js";
|
||||
import type SAttachment from "./shaca/entities/sattachment.js";
|
||||
import utils from "../services/utils.js";
|
||||
import optionService from '../services/option_service.js';
|
||||
import options from '../services/options.js';
|
||||
|
||||
function getSharedSubTreeRoot(note: SNote): { note?: SNote; branch?: SBranch } {
|
||||
if (note.noteId === shareRoot.SHARE_ROOT_NOTE_ID) {
|
||||
@ -152,7 +152,7 @@ function register(router: Router) {
|
||||
|
||||
const { header, content, isEmpty } = contentRenderer.getContent(note);
|
||||
const subRoot = getSharedSubTreeRoot(note);
|
||||
const showLoginInShareTheme = optionService.getOption('showLoginInShareTheme');
|
||||
const showLoginInShareTheme = options.getOption('showLoginInShareTheme');
|
||||
const opts = { note, header, content, isEmpty, subRoot, assetPath, appPath, showLoginInShareTheme };
|
||||
let useDefaultView = true;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user