MCPcopy
hub / github.com/witheve/Eve / Editor

Class Editor

src/ide.ts:685–1789  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

683 editor?:Editor
684}
685export class Editor {
686 defaults:CodeMirror.EditorConfiguration = {
687 scrollPastEnd: true,
688 scrollbarStyle: "simple",
689 tabSize: 2,
690 lineWrapping: true,
691 lineNumbers: false,
692 extraKeys: ctrlify({
693 "Cmd-Enter": () => this.ide.eval(true),
694 "Shift-Cmd-Enter": () => this.ide.eval(false),
695 "Alt-Enter": () => this.ide.tokenInfo(),
696 "Cmd-B": () => this.format({type: "strong"}),
697 "Cmd-I": () => this.format({type: "emph"}),
698 "Cmd-Y": () => this.format({type: "code"}),
699 "Cmd-K": () => this.format({type: "code_block"}),
700 "Cmd-1": () => this.format({type: "heading", level: 1}),
701 "Cmd-2": () => this.format({type: "heading", level: 2}),
702 "Cmd-3": () => this.format({type: "heading", level: 3}),
703 "Cmd-L": () => this.format({type: "item"}),
704 "Tab": (cm) => {
705 if (cm.somethingSelected()) {
706 cm.indentSelection("add");
707 } else {
708 cm.replaceSelection(cm.getOption("indentWithTabs")? "\t":
709 Array(cm.getOption("indentUnit") + 1).join(" "), "end", "+input");
710 }
711 }
712 })
713 };
714
715 cm:CMEditor;
716
717 /** Whether the editor has changed since the last update. */
718 dirty = false;
719
720 /** The current cached Markdown representation of the document. */
721 _md:string;
722
723 /** Whether the editor is being externally updated with new content. */
724 reloading = false;
725
726 /** Formatting state for the editor at the cursor. */
727 formatting:{[formatType:string]: FormatAction} = {};
728
729 /** Whether the editor is currently processing CM change events */
730 changing = false;
731 /** Cache of the spans affected by the current set of changes */
732 changingSpans?:Span[];
733 /** Cache of spans currently in a denormalized state. So long as this is non-empty, the editor may not sync with the language service. */
734 denormalizedSpans:Span[] = [];
735
736 /** Undo history state */
737 history:{position:number, transitioning:boolean, items: HistoryItem[]} = {position: 0, items: [], transitioning: false};
738
739 /** Whether to show the new block button at the cursor. */
740 protected showNewBlockBar = false;
741 protected newBlockBar:EditorBarElem;
742

Callers

nothing calls this directly

Calls 15

formatMethod · 0.95
_historyDoMethod · 0.95
findSpansAtMethod · 0.95
findSpansMethod · 0.95
addToHistoryMethod · 0.95
inCodeBlockMethod · 0.95
markSpanMethod · 0.95
trackDenormalizedMethod · 0.95
debounceFunction · 0.90
samePositionFunction · 0.90
comparePositionsFunction · 0.90

Tested by

no test coverage detected