Skip to content

Commit

Permalink
Add indentUnit prop feature. #34
Browse files Browse the repository at this point in the history
  • Loading branch information
logue committed Apr 23, 2024
1 parent 0d8eee4 commit 8633e67
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/CodeMirror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

// CodeMirror
import { indentWithTab } from '@codemirror/commands';
import { indentUnit, type LanguageSupport } from '@codemirror/language';
import {
diagnosticCount as linterDagnosticCount,
forceLinting,
Expand Down Expand Up @@ -44,7 +45,6 @@ import {
type WritableComputedRef,
} from 'vue-demi';

import type { LanguageSupport } from '@codemirror/language';
import type { StyleSpec } from 'style-mod';

import h, { slot } from '@/helpers/h-demi';
Expand Down Expand Up @@ -128,6 +128,13 @@ export default defineComponent({
type: Boolean,
default: false,
},
/**
* Tab character
*/
indentUnit: {
type: String,
default: undefined,
},
/**
* Allow Multiple Selection.
*
Expand Down Expand Up @@ -394,6 +401,8 @@ export default defineComponent({
props.wrap ? EditorView.lineWrapping : undefined,
// Indent with tab
props.tab ? keymap.of([indentWithTab]) : undefined,
// Tab character
props.indentUnit ? indentUnit.of(props.indentUnit) : undefined,
// Allow Multiple Selections
EditorState.allowMultipleSelections.of(props.allowMultipleSelections),
// Indent tab size
Expand Down

0 comments on commit 8633e67

Please sign in to comment.