mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	chore(code): reintroduce placeholder
This commit is contained in:
		| @@ -1,5 +1,5 @@ | ||||
| import { defaultKeymap, indentWithTab } from "@codemirror/commands"; | ||||
| import { EditorView, keymap, lineNumbers, ViewUpdate, type EditorViewConfig, type KeyBinding } from "@codemirror/view"; | ||||
| import { EditorView, keymap, lineNumbers, placeholder, ViewUpdate, type EditorViewConfig, type KeyBinding } from "@codemirror/view"; | ||||
| import { defaultHighlightStyle, StreamLanguage, syntaxHighlighting } from "@codemirror/language"; | ||||
| import { Compartment } from "@codemirror/state"; | ||||
| import byMimeType from "./syntax_highlighting.js"; | ||||
| @@ -7,6 +7,7 @@ import byMimeType from "./syntax_highlighting.js"; | ||||
| type ContentChangedListener = () => void; | ||||
|  | ||||
| export interface EditorConfig extends EditorViewConfig { | ||||
|     placeholder?: string; | ||||
|     onContentChanged?: ContentChangedListener; | ||||
| } | ||||
|  | ||||
| @@ -31,6 +32,10 @@ export default class CodeMirror extends EditorView { | ||||
|             extensions = [...extensions, ...config.extensions]; | ||||
|         } | ||||
|  | ||||
|         if (config.placeholder) { | ||||
|             extensions.push(placeholder(config.placeholder)); | ||||
|         } | ||||
|  | ||||
|         if (config.onContentChanged) { | ||||
|             extensions.push(EditorView.updateListener.of((v) => this.#onDocumentUpdated(v))); | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user