-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Implement configuration of which plugins are enabled at startup
- Loading branch information
Showing
6 changed files
with
182 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace CodeMirror6.Models; | ||
|
||
/// <summary> | ||
/// Stores the configuration of a CodeMirror instance (what plugins to load). | ||
/// Cannot be changed after the instance is created. | ||
/// </summary> | ||
public readonly record struct CodeMirrorSetup | ||
{ | ||
/// <summary> | ||
/// Default constructor | ||
/// </summary> | ||
public CodeMirrorSetup() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Whether to show line numbers to the left of the editor. | ||
/// </summary> | ||
[JsonPropertyName("lineNumbers")] public bool LineNumbers { get; init; } = true; | ||
|
||
/// <summary> | ||
/// Whether to highlight the line gutter when the cursor is on it. | ||
/// </summary> | ||
[JsonPropertyName("highlightActiveLineGutter")] public bool HighlightActiveLineGutter { get; init; } = true; | ||
|
||
/// <summary> | ||
/// Whether to highlight special characters (whitespace, tabs, newlines). | ||
/// </summary> | ||
[JsonPropertyName("highlightSpecialChars")] public bool HighlightSpecialChars { get; init; } = true; | ||
|
||
/// <summary> | ||
/// Whether to enable undo/redo. | ||
/// </summary> | ||
[JsonPropertyName("history")] public bool History { get; init; } = true; | ||
|
||
/// <summary> | ||
/// Whether to enable code folding. | ||
/// </summary> | ||
[JsonPropertyName("foldGutter")] public bool FoldGutter { get; init; } = true; | ||
|
||
/// <summary> | ||
/// Whether to draw the selection when the editor is focused. | ||
/// </summary> | ||
[JsonPropertyName("drawSelection")] public bool DrawSelection { get; init; } = true; | ||
|
||
/// <summary> | ||
/// Whether to show a cursor marker when the editor is focused. | ||
/// </summary> | ||
[JsonPropertyName("dropCursor")] public bool DropCursor { get; init; } = true; | ||
|
||
/// <summary> | ||
/// Whether to allow multiple selections. | ||
/// </summary> | ||
[JsonPropertyName("allowMultipleSelections")] public bool AllowMultipleSelections { get; init; } = true; | ||
|
||
/// <summary> | ||
/// Whether to indent the current line when a character is typed that might cause the line to be re-indented. | ||
/// </summary> | ||
[JsonPropertyName("indentOnInput")] public bool IndentOnInput { get; init; } = true; | ||
|
||
/// <summary> | ||
/// Whether to enable syntax highlighting. | ||
/// </summary> | ||
[JsonPropertyName("syntaxHighlighting")] public bool SyntaxHighlighting { get; init; } = true; | ||
|
||
/// <summary> | ||
/// Whether to highlight matching brackets. | ||
/// </summary> | ||
[JsonPropertyName("bracketMatching")] public bool BracketMatching { get; init; } = true; | ||
|
||
/// <summary> | ||
/// Whether to automatically close brackets. | ||
/// </summary> | ||
[JsonPropertyName("closeBrackets")] public bool CloseBrackets { get; init; } = true; | ||
|
||
/// <summary> | ||
/// Whether to enable autocompletion. | ||
/// </summary> | ||
[JsonPropertyName("autocompletion")] public bool Autocompletion { get; init; } = true; | ||
|
||
/// <summary> | ||
/// Whether to enable rectangular selection. | ||
/// </summary> | ||
[JsonPropertyName("rectangularSelection")] public bool RectangularSelection { get; init; } = true; | ||
|
||
/// <summary> | ||
/// Whether to enable crosshair selection. | ||
/// </summary> | ||
[JsonPropertyName("crossHairSelection")] public bool CrossHairSelection { get; init; } = true; | ||
|
||
/// <summary> | ||
/// Whether to highlight the active line. | ||
/// </summary> | ||
[JsonPropertyName("highlightActiveLine")] public bool HighlightActiveLine { get; init; } = true; | ||
|
||
/// <summary> | ||
/// Whether to highlight selection matches. | ||
/// </summary> | ||
[JsonPropertyName("highlightSelectionMatches")] public bool HighlightSelectionMatches { get; init; } = true; | ||
|
||
/// <summary> | ||
/// Whether to enable preview images. | ||
/// </summary> | ||
[JsonPropertyName("previewImages")] public bool PreviewImages { get; init; } = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Stores the configuration of a CodeMirror instance (what plugins to load). | ||
* Cannot be changed after the instance is created. | ||
*/ | ||
export class CmSetup | ||
{ | ||
public lineNumbers: boolean | ||
public highlightActiveLineGutter: boolean | ||
public highlightSpecialChars: boolean | ||
public history: boolean | ||
public foldGutter: boolean | ||
public drawSelection: boolean | ||
public dropCursor: boolean | ||
public allowMultipleSelections: boolean | ||
public indentOnInput: boolean | ||
public syntaxHighlighting: boolean | ||
public bracketMatching: boolean | ||
public closeBrackets: boolean | ||
public autocompletion: boolean | ||
public rectangularSelection: boolean | ||
public crosshairCursor: boolean | ||
public highlightActiveLine: boolean | ||
public highlightSelectionMatches: boolean | ||
public previewImages: boolean | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters