| 
									
										
										
										
											2024-01-13 17:40:47 +00:00
										 |  |  | import {EditorState} from "@codemirror/state" | 
					
						
							|  |  |  | import {EditorView} from '@codemirror/view'; | 
					
						
							|  |  |  | import {javascript} from "@codemirror/lang-javascript" | 
					
						
							|  |  |  | import {html} from "@codemirror/lang-html" | 
					
						
							|  |  |  | import {css} from "@codemirror/lang-css" | 
					
						
							|  |  |  | import {search} from "@codemirror/search" | 
					
						
							| 
									
										
										
										
											2024-01-15 01:56:43 +00:00
										 |  |  | import {oneDark} from "./theme-tf-dark.js" | 
					
						
							|  |  |  | import {lineNumbers, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, drawSelection, dropCursor, rectangularSelection, crosshairCursor, highlightActiveLine, keymap, highlightWhitespace} from '@codemirror/view'; | 
					
						
							| 
									
										
										
										
											2024-01-14 03:07:08 +00:00
										 |  |  | import {foldGutter, indentUnit, indentOnInput, syntaxHighlighting, defaultHighlightStyle, bracketMatching, foldKeymap} from '@codemirror/language'; | 
					
						
							|  |  |  | import {history, defaultKeymap, historyKeymap, indentWithTab} from '@codemirror/commands'; | 
					
						
							| 
									
										
										
										
											2024-01-13 17:40:47 +00:00
										 |  |  | import {highlightSelectionMatches, searchKeymap} from '@codemirror/search'; | 
					
						
							|  |  |  | import {autocompletion, closeBracketsKeymap, completionKeymap} from '@codemirror/autocomplete'; | 
					
						
							|  |  |  | import {lintKeymap} from '@codemirror/lint'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | let updateListenerExtension = EditorView.updateListener.of((update) => { | 
					
						
							|  |  |  | 	if (update.docChanged && update.view.onDocChange) { | 
					
						
							|  |  |  | 		update.view.onDocChange(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const extensions = [ | 
					
						
							|  |  |  | 	lineNumbers(), | 
					
						
							|  |  |  | 	highlightActiveLineGutter(), | 
					
						
							|  |  |  | 	highlightSpecialChars(), | 
					
						
							| 
									
										
										
										
											2024-01-14 02:58:46 +00:00
										 |  |  | 	highlightWhitespace(), | 
					
						
							| 
									
										
										
										
											2024-01-13 17:40:47 +00:00
										 |  |  | 	history(), | 
					
						
							|  |  |  | 	foldGutter(), | 
					
						
							|  |  |  | 	drawSelection(), | 
					
						
							|  |  |  | 	dropCursor(), | 
					
						
							|  |  |  | 	EditorState.allowMultipleSelections.of(true), | 
					
						
							|  |  |  | 	indentOnInput(), | 
					
						
							| 
									
										
										
										
											2024-01-14 03:07:08 +00:00
										 |  |  | 	indentUnit.of('\t'), | 
					
						
							| 
									
										
										
										
											2024-01-13 17:40:47 +00:00
										 |  |  | 	syntaxHighlighting(defaultHighlightStyle, { fallback: true }), | 
					
						
							|  |  |  | 	bracketMatching(), | 
					
						
							|  |  |  | 	autocompletion(), | 
					
						
							|  |  |  | 	rectangularSelection(), | 
					
						
							|  |  |  | 	crosshairCursor(), | 
					
						
							|  |  |  | 	highlightActiveLine(), | 
					
						
							|  |  |  | 	highlightSelectionMatches(), | 
					
						
							| 
									
										
										
										
											2024-01-15 01:56:43 +00:00
										 |  |  | 	highlightTrailingWhitespace(), | 
					
						
							| 
									
										
										
										
											2024-01-13 17:40:47 +00:00
										 |  |  | 	keymap.of([ | 
					
						
							|  |  |  | 		...defaultKeymap, | 
					
						
							|  |  |  | 		...searchKeymap, | 
					
						
							|  |  |  | 		...historyKeymap, | 
					
						
							|  |  |  | 		...foldKeymap, | 
					
						
							|  |  |  | 		...completionKeymap, | 
					
						
							| 
									
										
										
										
											2024-01-14 03:07:08 +00:00
										 |  |  | 		...lintKeymap, | 
					
						
							|  |  |  | 		indentWithTab, | 
					
						
							| 
									
										
										
										
											2024-01-13 17:40:47 +00:00
										 |  |  | 	]), | 
					
						
							|  |  |  | 	javascript(), | 
					
						
							|  |  |  | 	html(), | 
					
						
							|  |  |  | 	css(), | 
					
						
							|  |  |  | 	search(), | 
					
						
							|  |  |  | 	oneDark, | 
					
						
							|  |  |  | 	updateListenerExtension, | 
					
						
							|  |  |  | ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function TildeFriendsEditorView(parent) { | 
					
						
							|  |  |  | 	return new EditorView({ | 
					
						
							|  |  |  | 		extensions: extensions, | 
					
						
							|  |  |  | 		parent: parent, | 
					
						
							|  |  |  | 	}); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export { | 
					
						
							|  |  |  | 	TildeFriendsEditorView, | 
					
						
							|  |  |  | 	EditorState, | 
					
						
							|  |  |  | 	EditorView, | 
					
						
							|  |  |  | 	extensions, | 
					
						
							|  |  |  | }; |