mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	feat(emoji): disable auto-completion only
This commit is contained in:
		
							parent
							
								
									ba94616b87
								
							
						
					
					
						commit
						3988bb5321
					
				@ -236,8 +236,8 @@ function getLicenseKey() {
 | 
			
		||||
function getDisabledPlugins() {
 | 
			
		||||
    let disabledPlugins: string[] = [];
 | 
			
		||||
 | 
			
		||||
    if (options.get("textNoteEmojiEnabled") !== "true") {
 | 
			
		||||
        disabledPlugins.push("Emoji");
 | 
			
		||||
    if (options.get("textNoteEmojiCompletionEnabled") !== "true") {
 | 
			
		||||
        disabledPlugins.push("EmojiMention");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return disabledPlugins;
 | 
			
		||||
 | 
			
		||||
@ -6,25 +6,25 @@ const TPL = /*html*/`
 | 
			
		||||
    <h4>Features</h4>
 | 
			
		||||
 | 
			
		||||
    <label class="tn-checkbox">
 | 
			
		||||
        <input type="checkbox" name="emoji-enabled" />
 | 
			
		||||
        Enable Emoji support and auto-completion
 | 
			
		||||
        <input type="checkbox" name="emoji-completion-enabled" />
 | 
			
		||||
        Enable Emoji auto-completion
 | 
			
		||||
    </label>
 | 
			
		||||
</div>
 | 
			
		||||
`;
 | 
			
		||||
 | 
			
		||||
export default class EditorFeaturesOptions extends OptionsWidget {
 | 
			
		||||
 | 
			
		||||
    private $emojiEnabledCheckbox!: JQuery<HTMLElement>;
 | 
			
		||||
    private $emojiCompletionEnabledCheckbox!: JQuery<HTMLElement>;
 | 
			
		||||
 | 
			
		||||
    doRender() {
 | 
			
		||||
        this.$widget = $(TPL);
 | 
			
		||||
 | 
			
		||||
        this.$emojiEnabledCheckbox = this.$widget.find(`input[name="emoji-enabled"]`);
 | 
			
		||||
        this.$emojiEnabledCheckbox.on("change", () => this.updateCheckboxOption("textNoteEmojiEnabled", this.$emojiEnabledCheckbox))
 | 
			
		||||
        this.$emojiCompletionEnabledCheckbox = this.$widget.find(`input[name="emoji-completion-enabled"]`);
 | 
			
		||||
        this.$emojiCompletionEnabledCheckbox.on("change", () => this.updateCheckboxOption("textNoteEmojiCompletionEnabled", this.$emojiCompletionEnabledCheckbox))
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    optionsLoaded(options: OptionMap) {
 | 
			
		||||
        this.setCheckboxState(this.$emojiEnabledCheckbox, options.textNoteEmojiEnabled);
 | 
			
		||||
        this.setCheckboxState(this.$emojiCompletionEnabledCheckbox, options.textNoteEmojiCompletionEnabled);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -85,7 +85,7 @@ const ALLOWED_OPTIONS = new Set<OptionNames>([
 | 
			
		||||
    "languages",
 | 
			
		||||
    "textNoteEditorType",
 | 
			
		||||
    "textNoteEditorMultilineToolbar",
 | 
			
		||||
    "textNoteEmojiEnabled",
 | 
			
		||||
    "textNoteEmojiCompletionEnabled",
 | 
			
		||||
    "layoutOrientation",
 | 
			
		||||
    "backgroundEffects",
 | 
			
		||||
    "allowedHtmlTags",
 | 
			
		||||
 | 
			
		||||
@ -178,7 +178,7 @@ const defaultOptions: DefaultOption[] = [
 | 
			
		||||
    // Text note configuration
 | 
			
		||||
    { name: "textNoteEditorType", value: "ckeditor-balloon", isSynced: true },
 | 
			
		||||
    { name: "textNoteEditorMultilineToolbar", value: "false", isSynced: true },
 | 
			
		||||
    { name: "textNoteEmojiEnabled", value: "true", isSynced: true },
 | 
			
		||||
    { name: "textNoteEmojiCompletionEnabled", value: "true", isSynced: true },
 | 
			
		||||
 | 
			
		||||
    // HTML import configuration
 | 
			
		||||
    { name: "layoutOrientation", value: "vertical", isSynced: false },
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
import { Autoformat, AutoLink, BlockQuote, BlockToolbar, Bold, CKFinderUploadAdapter, Clipboard, Code, CodeBlock, Enter, FindAndReplace, Font, FontBackgroundColor, FontColor, GeneralHtmlSupport, Heading, HeadingButtonsUI, HorizontalLine, Image, ImageCaption, ImageInline, ImageResize, ImageStyle, ImageToolbar, ImageUpload, Alignment, Indent, IndentBlock, Italic, Link, List, ListProperties, Mention, PageBreak, Paragraph, ParagraphButtonUI, PasteFromOffice, PictureEditing, RemoveFormat, SelectAll, ShiftEnter, SpecialCharacters, SpecialCharactersEssentials, Strikethrough, Style, Subscript, Superscript, Table, TableCaption, TableCellProperties, TableColumnResize, TableProperties, TableSelection, TableToolbar, TextPartLanguage, TextTransformation, TodoList, Typing, Underline, Undo, Bookmark, Emoji, Notification } from "ckeditor5";
 | 
			
		||||
import { Autoformat, AutoLink, BlockQuote, BlockToolbar, Bold, CKFinderUploadAdapter, Clipboard, Code, CodeBlock, Enter, FindAndReplace, Font, FontBackgroundColor, FontColor, GeneralHtmlSupport, Heading, HeadingButtonsUI, HorizontalLine, Image, ImageCaption, ImageInline, ImageResize, ImageStyle, ImageToolbar, ImageUpload, Alignment, Indent, IndentBlock, Italic, Link, List, ListProperties, Mention, PageBreak, Paragraph, ParagraphButtonUI, PasteFromOffice, PictureEditing, RemoveFormat, SelectAll, ShiftEnter, SpecialCharacters, SpecialCharactersEssentials, Strikethrough, Style, Subscript, Superscript, Table, TableCaption, TableCellProperties, TableColumnResize, TableProperties, TableSelection, TableToolbar, TextPartLanguage, TextTransformation, TodoList, Typing, Underline, Undo, Bookmark, Emoji, Notification, EmojiMention, EmojiPicker } from "ckeditor5";
 | 
			
		||||
import { SlashCommand, Template } from "ckeditor5-premium-features";
 | 
			
		||||
import type { Plugin } from "ckeditor5";
 | 
			
		||||
import CutToNotePlugin from "./plugins/cuttonote.js";
 | 
			
		||||
@ -145,7 +145,8 @@ export const COMMON_PLUGINS: typeof Plugin[] = [
 | 
			
		||||
	TextPartLanguage,
 | 
			
		||||
    Style,
 | 
			
		||||
    Bookmark,
 | 
			
		||||
    Emoji,
 | 
			
		||||
    EmojiMention,
 | 
			
		||||
    EmojiPicker,
 | 
			
		||||
 | 
			
		||||
    ...TRILIUM_PLUGINS,
 | 
			
		||||
    ...EXTERNAL_PLUGINS
 | 
			
		||||
 | 
			
		||||
@ -118,7 +118,7 @@ export interface OptionDefinitions extends KeyboardShortcutsOptions<KeyboardActi
 | 
			
		||||
    editedNotesOpenInRibbon: boolean;
 | 
			
		||||
    codeBlockWordWrap: boolean;
 | 
			
		||||
    textNoteEditorMultilineToolbar: boolean;
 | 
			
		||||
    textNoteEmojiEnabled: boolean;
 | 
			
		||||
    textNoteEmojiCompletionEnabled: boolean;
 | 
			
		||||
    backgroundEffects: boolean;
 | 
			
		||||
 | 
			
		||||
    // Share settings
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user