@impermeable/waterproof-editor 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +20 -0
- package/dist/api/Completions.d.ts +21 -0
- package/dist/api/Completions.d.ts.map +1 -0
- package/dist/api/DocChange.d.ts +19 -0
- package/dist/api/DocChange.d.ts.map +1 -0
- package/dist/api/FileFormat.d.ts +10 -0
- package/dist/api/FileFormat.d.ts.map +1 -0
- package/dist/api/InputAreaStatus.d.ts +14 -0
- package/dist/api/InputAreaStatus.d.ts.map +1 -0
- package/dist/api/LineNumber.d.ts +10 -0
- package/dist/api/LineNumber.d.ts.map +1 -0
- package/dist/api/ServerStatus.d.ts +18 -0
- package/dist/api/ServerStatus.d.ts.map +1 -0
- package/dist/api/Severity.d.ts +12 -0
- package/dist/api/Severity.d.ts.map +1 -0
- package/dist/api/index.d.ts +12 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/types.d.ts +105 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/autocomplete/coqTerms.d.ts +3 -0
- package/dist/autocomplete/coqTerms.d.ts.map +1 -0
- package/dist/autocomplete/emojis.d.ts +10 -0
- package/dist/autocomplete/emojis.d.ts.map +1 -0
- package/dist/autocomplete/index.d.ts +2 -0
- package/dist/autocomplete/index.d.ts.map +1 -0
- package/dist/autocomplete/renderSymbol.d.ts +7 -0
- package/dist/autocomplete/renderSymbol.d.ts.map +1 -0
- package/dist/autocomplete/symbols.d.ts +7 -0
- package/dist/autocomplete/symbols.d.ts.map +1 -0
- package/dist/codeview/code-plugin.d.ts +27 -0
- package/dist/codeview/code-plugin.d.ts.map +1 -0
- package/dist/codeview/color-scheme.d.ts +6 -0
- package/dist/codeview/color-scheme.d.ts.map +1 -0
- package/dist/codeview/debouncer.d.ts +8 -0
- package/dist/codeview/debouncer.d.ts.map +1 -0
- package/dist/codeview/index.d.ts +3 -0
- package/dist/codeview/index.d.ts.map +1 -0
- package/dist/codeview/lang-pack/index.d.ts +7 -0
- package/dist/codeview/lang-pack/index.d.ts.map +1 -0
- package/dist/codeview/lang-pack/syntax.d.ts +3 -0
- package/dist/codeview/lang-pack/syntax.d.ts.map +1 -0
- package/dist/codeview/lang-pack/syntax.terms.d.ts +2 -0
- package/dist/codeview/lang-pack/syntax.terms.d.ts.map +1 -0
- package/dist/codeview/nodeview.d.ts +65 -0
- package/dist/codeview/nodeview.d.ts.map +1 -0
- package/dist/commands/command-helpers.d.ts +48 -0
- package/dist/commands/command-helpers.d.ts.map +1 -0
- package/dist/commands/commands.d.ts +30 -0
- package/dist/commands/commands.d.ts.map +1 -0
- package/dist/commands/delete-command.d.ts +4 -0
- package/dist/commands/delete-command.d.ts.map +1 -0
- package/dist/commands/index.d.ts +4 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/insert-command.d.ts +34 -0
- package/dist/commands/insert-command.d.ts.map +1 -0
- package/dist/commands/types.d.ts +15 -0
- package/dist/commands/types.d.ts.map +1 -0
- package/dist/context-menu/index.d.ts +2 -0
- package/dist/context-menu/index.d.ts.map +1 -0
- package/dist/context-menu/menu.d.ts +8 -0
- package/dist/context-menu/menu.d.ts.map +1 -0
- package/dist/document/blocks/block.d.ts +24 -0
- package/dist/document/blocks/block.d.ts.map +1 -0
- package/dist/document/blocks/blocktypes.d.ts +78 -0
- package/dist/document/blocks/blocktypes.d.ts.map +1 -0
- package/dist/document/blocks/index.d.ts +3 -0
- package/dist/document/blocks/index.d.ts.map +1 -0
- package/dist/document/blocks/schema.d.ts +21 -0
- package/dist/document/blocks/schema.d.ts.map +1 -0
- package/dist/document/blocks/typeguards.d.ts +11 -0
- package/dist/document/blocks/typeguards.d.ts.map +1 -0
- package/dist/document/construct-document.d.ts +4 -0
- package/dist/document/construct-document.d.ts.map +1 -0
- package/dist/document/index.d.ts +5 -0
- package/dist/document/index.d.ts.map +1 -0
- package/dist/document/utils.d.ts +49 -0
- package/dist/document/utils.d.ts.map +1 -0
- package/dist/documentProgressDecorator.d.ts +9 -0
- package/dist/documentProgressDecorator.d.ts.map +1 -0
- package/dist/editor.d.ts +117 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/embedded-codemirror/embedded-codemirror-keymap.d.ts +9 -0
- package/dist/embedded-codemirror/embedded-codemirror-keymap.d.ts.map +1 -0
- package/dist/embedded-codemirror/embeddedCodemirror.d.ts +40 -0
- package/dist/embedded-codemirror/embeddedCodemirror.d.ts.map +1 -0
- package/dist/embedded-codemirror/index.d.ts +3 -0
- package/dist/embedded-codemirror/index.d.ts.map +1 -0
- package/dist/embedded-codemirror/types.d.ts +9 -0
- package/dist/embedded-codemirror/types.d.ts.map +1 -0
- package/dist/hinting/hint-plugin.d.ts +9 -0
- package/dist/hinting/hint-plugin.d.ts.map +1 -0
- package/dist/hinting/index.d.ts +2 -0
- package/dist/hinting/index.d.ts.map +1 -0
- package/dist/index.css +2 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +341 -0
- package/dist/inputArea.d.ts +14 -0
- package/dist/inputArea.d.ts.map +1 -0
- package/dist/markup-views/CoqdocPlugin.d.ts +19 -0
- package/dist/markup-views/CoqdocPlugin.d.ts.map +1 -0
- package/dist/markup-views/CoqdocView.d.ts +15 -0
- package/dist/markup-views/CoqdocView.d.ts.map +1 -0
- package/dist/markup-views/MarkdownPlugin.d.ts +21 -0
- package/dist/markup-views/MarkdownPlugin.d.ts.map +1 -0
- package/dist/markup-views/MarkdownView.d.ts +15 -0
- package/dist/markup-views/MarkdownView.d.ts.map +1 -0
- package/dist/markup-views/index.d.ts +5 -0
- package/dist/markup-views/index.d.ts.map +1 -0
- package/dist/markup-views/switchable-view/EditableView.d.ts +22 -0
- package/dist/markup-views/switchable-view/EditableView.d.ts.map +1 -0
- package/dist/markup-views/switchable-view/EditorTheme.d.ts +8 -0
- package/dist/markup-views/switchable-view/EditorTheme.d.ts.map +1 -0
- package/dist/markup-views/switchable-view/MarkdownSchema.d.ts +8 -0
- package/dist/markup-views/switchable-view/MarkdownSchema.d.ts.map +1 -0
- package/dist/markup-views/switchable-view/RenderedView.d.ts +13 -0
- package/dist/markup-views/switchable-view/RenderedView.d.ts.map +1 -0
- package/dist/markup-views/switchable-view/SwitchableView.d.ts +62 -0
- package/dist/markup-views/switchable-view/SwitchableView.d.ts.map +1 -0
- package/dist/markup-views/switchable-view/index.d.ts +2 -0
- package/dist/markup-views/switchable-view/index.d.ts.map +1 -0
- package/dist/math-integration/index.d.ts +2 -0
- package/dist/math-integration/index.d.ts.map +1 -0
- package/dist/math-integration/nodespecs.d.ts +4 -0
- package/dist/math-integration/nodespecs.d.ts.map +1 -0
- package/dist/menubar/index.d.ts +2 -0
- package/dist/menubar/index.d.ts.map +1 -0
- package/dist/menubar/menubar.d.ts +25 -0
- package/dist/menubar/menubar.d.ts.map +1 -0
- package/dist/osType.d.ts +8 -0
- package/dist/osType.d.ts.map +1 -0
- package/dist/progressBar.d.ts +13 -0
- package/dist/progressBar.d.ts.map +1 -0
- package/dist/qedStatus.d.ts +9 -0
- package/dist/qedStatus.d.ts.map +1 -0
- package/dist/schema/index.d.ts +2 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/schema-nodes.d.ts +1 -0
- package/dist/schema/schema-nodes.d.ts.map +1 -0
- package/dist/schema/schema.d.ts +23 -0
- package/dist/schema/schema.d.ts.map +1 -0
- package/dist/styles/index.d.ts +16 -0
- package/dist/styles/index.d.ts.map +1 -0
- package/dist/themeStore.d.ts +4 -0
- package/dist/themeStore.d.ts.map +1 -0
- package/dist/translation/Translator.d.ts +12 -0
- package/dist/translation/Translator.d.ts.map +1 -0
- package/dist/translation/index.d.ts +2 -0
- package/dist/translation/index.d.ts.map +1 -0
- package/dist/translation/toProsemirror/index.d.ts +2 -0
- package/dist/translation/toProsemirror/index.d.ts.map +1 -0
- package/dist/translation/toProsemirror/mvFileToProsemirror.d.ts +2 -0
- package/dist/translation/toProsemirror/mvFileToProsemirror.d.ts.map +1 -0
- package/dist/translation/toProsemirror/parseAsMv.d.ts +7 -0
- package/dist/translation/toProsemirror/parseAsMv.d.ts.map +1 -0
- package/dist/translation/toProsemirror/parser.d.ts +3 -0
- package/dist/translation/toProsemirror/parser.d.ts.map +1 -0
- package/dist/translation/types.d.ts +12 -0
- package/dist/translation/types.d.ts.map +1 -0
- package/dist/utilities/index.d.ts +2 -0
- package/dist/utilities/index.d.ts.map +1 -0
- package/dist/utilities/prosemirror.d.ts +13 -0
- package/dist/utilities/prosemirror.d.ts.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/commands/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,EAA2C,MAAM,mBAAmB,CAAC;AAErF,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAIzC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAoBpC;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,GAAG,OAAO,CAMxG;AAgBD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,GAAG,OAAO,CAO5G;AASD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,GAAG,OAAO,CAKzG;AAED,eAAO,MAAM,WAAW,EAAE,OAqBzB,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EditorState, Transaction } from "prosemirror-state";
|
|
2
|
+
import { EditorView } from "prosemirror-view";
|
|
3
|
+
export declare function deleteNodeIfEmpty(state: EditorState, dispatch?: ((tr: Transaction) => void), _view?: EditorView): boolean;
|
|
4
|
+
//# sourceMappingURL=delete-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-command.d.ts","sourceRoot":"","sources":["../../src/commands/delete-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,WAAW,KAAK,IAAI,CAAC,EAAE,KAAK,CAAC,EAAE,UAAU,GAAG,OAAO,CAmBzH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Command } from "prosemirror-state";
|
|
2
|
+
import { FileFormat } from "../api/FileFormat";
|
|
3
|
+
import { InsertionFunction, InsertionPlace } from "./types";
|
|
4
|
+
import { NodeType } from "prosemirror-model";
|
|
5
|
+
/**
|
|
6
|
+
* Return a Markdown insertion command.
|
|
7
|
+
* @param filef The file format of the file in use.
|
|
8
|
+
* @param insertionFunction The function used to insert the node into the editor.
|
|
9
|
+
* @param place Where to insert the node into the editor. Either Above or Underneath the currently selected node.
|
|
10
|
+
* @param mvNodeType The node to use in the case of a `.mv` file.
|
|
11
|
+
* @param vNodeType The node to use in the case of a `.v` file.
|
|
12
|
+
* @returns The insertion command.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getMdInsertCommand(filef: FileFormat, insertionFunction: InsertionFunction, place: InsertionPlace, mvNodeType: NodeType, vNodeType: NodeType): Command;
|
|
15
|
+
/**
|
|
16
|
+
* Returns an insertion command for insertion display latex into the editor.
|
|
17
|
+
* @param filef The file format of the file currently being edited.
|
|
18
|
+
* @param insertionFunction The insertion function to use.
|
|
19
|
+
* @param place The place to insert into, either Above or Underneath the currently selected node.
|
|
20
|
+
* @param latexNodeType The node type for a 'display latex' node.
|
|
21
|
+
* @returns The insertion command.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getLatexInsertCommand(filef: FileFormat, insertionFunction: InsertionFunction, place: InsertionPlace, latexNodeType: NodeType): Command;
|
|
24
|
+
/**
|
|
25
|
+
* Returns an insertion command for inserting a new coq code cell. Will create a new coqblock if necessary.
|
|
26
|
+
* @param filef The file format of the file that is being edited.
|
|
27
|
+
* @param insertionFunction The insertion function to use.
|
|
28
|
+
* @param place The place of insertion, either Above or Underneath the currently selected node.
|
|
29
|
+
* @param coqblockNodeType The node type of a coqblock node (contains coqdoc and coqcode).
|
|
30
|
+
* @param coqcodeNodeType The node type of a coqcode node.
|
|
31
|
+
* @returns The insertion command.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getCodeInsertCommand(filef: FileFormat, insertionFunction: InsertionFunction, place: InsertionPlace, coqblockNodeType: NodeType, coqcodeNodeType: NodeType): Command;
|
|
34
|
+
//# sourceMappingURL=insert-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert-command.d.ts","sourceRoot":"","sources":["../../src/commands/insert-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA4B,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI7C;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAC9B,KAAK,EAAE,UAAU,EACjB,iBAAiB,EAAE,iBAAiB,EACpC,KAAK,EAAE,cAAc,EACrB,UAAU,EAAE,QAAQ,EACpB,SAAS,EAAE,QAAQ,GACpB,OAAO,CA2CT;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACjC,KAAK,EAAE,UAAU,EACjB,iBAAiB,EAAE,iBAAiB,EACpC,KAAK,EAAE,cAAc,EACrB,aAAa,EAAE,QAAQ,GACxB,OAAO,CAmCT;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAChC,KAAK,EAAE,UAAU,EACjB,iBAAiB,EAAE,iBAAiB,EACpC,KAAK,EAAE,cAAc,EACrB,gBAAgB,EAAE,QAAQ,EAC1B,eAAe,EAAE,QAAQ,GAC1B,OAAO,CAkCT"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NodeType } from "prosemirror-model";
|
|
2
|
+
import { EditorState, Transaction } from "prosemirror-state";
|
|
3
|
+
/**
|
|
4
|
+
* Enum for the insertion place, can be either `Above` or `Underneath` the currently selected cell.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum InsertionPlace {
|
|
7
|
+
Above = 0,
|
|
8
|
+
Underneath = 1
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Insertion function type. This type of function is passed to the `get...Command` functions. The function will insert
|
|
12
|
+
* the correct NodeType either above or below the selected node.
|
|
13
|
+
*/
|
|
14
|
+
export type InsertionFunction = (state: EditorState, trans: Transaction, ...nodeType: NodeType[]) => Transaction;
|
|
15
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/commands/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE7D;;GAEG;AACH,oBAAY,cAAc;IACtB,KAAK,IAAA;IACL,UAAU,IAAA;CACb;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,QAAQ,EAAE,QAAQ,EAAE,KAAK,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context-menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { WaterproofEditor } from "../editor";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a context menu given the current editor.
|
|
4
|
+
* @param editor The editor in use.
|
|
5
|
+
* @returns HTMLDivElement storing the context menu element.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createContextMenuHTML(editor: WaterproofEditor): HTMLDivElement;
|
|
8
|
+
//# sourceMappingURL=menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../src/context-menu/menu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,gBAAgB,GAAG,cAAc,CAmB9E"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Node as ProseNode } from "prosemirror-model";
|
|
2
|
+
export declare enum BLOCK_NAME {
|
|
3
|
+
COQ = "coq",
|
|
4
|
+
MATH_DISPLAY = "math_display",
|
|
5
|
+
INPUT_AREA = "input_area",
|
|
6
|
+
HINT = "hint",
|
|
7
|
+
MARKDOWN = "markdown",
|
|
8
|
+
COQ_MARKDOWN = "coqdown",
|
|
9
|
+
COQ_CODE = "coq_code",
|
|
10
|
+
COQ_DOC = "coq_doc"
|
|
11
|
+
}
|
|
12
|
+
export interface BlockRange {
|
|
13
|
+
from: number;
|
|
14
|
+
to: number;
|
|
15
|
+
}
|
|
16
|
+
export interface Block {
|
|
17
|
+
type: string;
|
|
18
|
+
stringContent: string;
|
|
19
|
+
range: BlockRange;
|
|
20
|
+
innerBlocks?: Block[];
|
|
21
|
+
toProseMirror(): ProseNode;
|
|
22
|
+
debugPrint(level: number): void;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../src/document/blocks/block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGtD,oBAAY,UAAU;IAClB,GAAG,QAAQ;IACX,YAAY,iBAAiB;IAC7B,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,YAAY,YAAY;IACxB,QAAQ,aAAa;IACrB,OAAO,YAAY;CACtB;AAED,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,KAAK;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,UAAU,CAAC;IAElB,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC;IAEtB,aAAa,IAAI,SAAS,CAAC;IAC3B,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { BLOCK_NAME, Block, BlockRange } from "./block";
|
|
2
|
+
export declare class InputAreaBlock implements Block {
|
|
3
|
+
stringContent: string;
|
|
4
|
+
range: BlockRange;
|
|
5
|
+
type: BLOCK_NAME;
|
|
6
|
+
innerBlocks: Block[];
|
|
7
|
+
constructor(stringContent: string, range: BlockRange, innerBlockConstructor: (content: string) => Block[]);
|
|
8
|
+
toProseMirror(): import("prosemirror-model").Node;
|
|
9
|
+
debugPrint(level: number): void;
|
|
10
|
+
}
|
|
11
|
+
export declare class HintBlock implements Block {
|
|
12
|
+
stringContent: string;
|
|
13
|
+
title: string;
|
|
14
|
+
range: BlockRange;
|
|
15
|
+
type: BLOCK_NAME;
|
|
16
|
+
innerBlocks: Block[];
|
|
17
|
+
constructor(stringContent: string, title: string, range: BlockRange, innerBlockConstructor: (content: string) => Block[]);
|
|
18
|
+
toProseMirror(): import("prosemirror-model").Node;
|
|
19
|
+
debugPrint(level: number): void;
|
|
20
|
+
}
|
|
21
|
+
export declare class MathDisplayBlock implements Block {
|
|
22
|
+
stringContent: string;
|
|
23
|
+
range: BlockRange;
|
|
24
|
+
type: BLOCK_NAME;
|
|
25
|
+
constructor(stringContent: string, range: BlockRange);
|
|
26
|
+
toProseMirror(): import("prosemirror-model").Node;
|
|
27
|
+
debugPrint(level: number): void;
|
|
28
|
+
}
|
|
29
|
+
export declare class CoqBlock implements Block {
|
|
30
|
+
stringContent: string;
|
|
31
|
+
prePreWhite: string;
|
|
32
|
+
prePostWhite: string;
|
|
33
|
+
postPreWhite: string;
|
|
34
|
+
postPostWhite: string;
|
|
35
|
+
range: BlockRange;
|
|
36
|
+
type: BLOCK_NAME;
|
|
37
|
+
innerBlocks: Block[];
|
|
38
|
+
constructor(stringContent: string, prePreWhite: string, prePostWhite: string, postPreWhite: string, postPostWhite: string, range: BlockRange, innerBlockConstructor: (content: string) => Block[]);
|
|
39
|
+
toProseMirror(): import("prosemirror-model").Node;
|
|
40
|
+
debugPrint(level: number): void;
|
|
41
|
+
}
|
|
42
|
+
export declare class MarkdownBlock implements Block {
|
|
43
|
+
stringContent: string;
|
|
44
|
+
range: BlockRange;
|
|
45
|
+
type: BLOCK_NAME;
|
|
46
|
+
isNewLineOnly: boolean;
|
|
47
|
+
constructor(stringContent: string, range: BlockRange);
|
|
48
|
+
toProseMirror(): import("prosemirror-model").Node;
|
|
49
|
+
debugPrint(level: number): void;
|
|
50
|
+
}
|
|
51
|
+
export declare class CoqDocBlock implements Block {
|
|
52
|
+
stringContent: string;
|
|
53
|
+
preWhite: string;
|
|
54
|
+
postWhite: string;
|
|
55
|
+
range: BlockRange;
|
|
56
|
+
type: BLOCK_NAME;
|
|
57
|
+
innerBlocks: Block[];
|
|
58
|
+
constructor(stringContent: string, preWhite: string, postWhite: string, range: BlockRange, innerBlockConstructor: (content: string) => Block[]);
|
|
59
|
+
toProseMirror(): import("prosemirror-model").Node;
|
|
60
|
+
debugPrint(level?: number): void;
|
|
61
|
+
}
|
|
62
|
+
export declare class CoqMarkdownBlock implements Block {
|
|
63
|
+
stringContent: string;
|
|
64
|
+
range: BlockRange;
|
|
65
|
+
type: BLOCK_NAME;
|
|
66
|
+
constructor(stringContent: string, range: BlockRange);
|
|
67
|
+
toProseMirror(): import("prosemirror-model").Node;
|
|
68
|
+
debugPrint(level: number): void;
|
|
69
|
+
}
|
|
70
|
+
export declare class CoqCodeBlock implements Block {
|
|
71
|
+
stringContent: string;
|
|
72
|
+
range: BlockRange;
|
|
73
|
+
type: BLOCK_NAME;
|
|
74
|
+
constructor(stringContent: string, range: BlockRange);
|
|
75
|
+
toProseMirror(): import("prosemirror-model").Node;
|
|
76
|
+
debugPrint(level: number): void;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=blocktypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blocktypes.d.ts","sourceRoot":"","sources":["../../../src/document/blocks/blocktypes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAOxD,qBAAa,cAAe,YAAW,KAAK;IAIpB,aAAa,EAAE,MAAM;IAAS,KAAK,EAAE,UAAU;IAH5D,IAAI,aAAyB;IAC7B,WAAW,EAAE,KAAK,EAAE,CAAC;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AE,UAAU,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Node as ProseNode } from "prosemirror-model";
|
|
2
|
+
/** Construct basic prosemirror text node. */
|
|
3
|
+
export declare const text: (content: string) => ProseNode;
|
|
4
|
+
/** Construct coq markdown prosemirror node. */
|
|
5
|
+
export declare const coqMarkdown: (content: string) => ProseNode;
|
|
6
|
+
/** Construct math display prosemirror node. */
|
|
7
|
+
export declare const mathDisplay: (content: string) => ProseNode;
|
|
8
|
+
/** Construct markdown prosemirror node. */
|
|
9
|
+
export declare const markdown: (content: string) => ProseNode;
|
|
10
|
+
/** Construct coqcode prosemirror node. */
|
|
11
|
+
export declare const coqCode: (content: string) => ProseNode;
|
|
12
|
+
/** Construct input area prosemirror node. */
|
|
13
|
+
export declare const inputArea: (childNodes: ProseNode[]) => ProseNode;
|
|
14
|
+
/** Construct hint prosemirror node. */
|
|
15
|
+
export declare const hint: (title: string, childNodes: ProseNode[]) => ProseNode;
|
|
16
|
+
/** Construct coq prosemirror node. */
|
|
17
|
+
export declare const coqblock: (childNodes: ProseNode[], prePreWhite: string, prePostWhite: string, postPreWhite: string, postPostWhite: string) => ProseNode;
|
|
18
|
+
/** Construct coqdoc prosemirror node. */
|
|
19
|
+
export declare const coqDoc: (childNodes: ProseNode[], preWhite: string, postWhite: string) => ProseNode;
|
|
20
|
+
export declare const root: (childNodes: ProseNode[]) => ProseNode;
|
|
21
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/document/blocks/schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAItD,6CAA6C;AAC7C,eAAO,MAAM,IAAI,GAAI,SAAS,MAAM,KAAG,SAEtC,CAAA;AAED,+CAA+C;AAC/C,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,KAAG,SAE7C,CAAA;AAED,+CAA+C;AAC/C,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,KAAG,SAE7C,CAAA;AAED,2CAA2C;AAC3C,eAAO,MAAM,QAAQ,GAAI,SAAS,MAAM,KAAG,SAE1C,CAAA;AAED,0CAA0C;AAC1C,eAAO,MAAM,OAAO,GAAI,SAAS,MAAM,KAAG,SAEzC,CAAA;AAID,6CAA6C;AAC7C,eAAO,MAAM,SAAS,GAAI,YAAY,SAAS,EAAE,KAAG,SAEnD,CAAA;AAED,uCAAuC;AACvC,eAAO,MAAM,IAAI,GAAI,OAAO,MAAM,EAAE,YAAY,SAAS,EAAE,KAAG,SAE7D,CAAA;AAED,sCAAsC;AACtC,eAAO,MAAM,QAAQ,GAAI,YAAY,SAAS,EAAE,EAAE,aAAa,MAAM,EAAE,cAAc,MAAM,EAAE,cAAc,MAAM,EAAE,eAAe,MAAM,KAAG,SAE1I,CAAA;AAED,yCAAyC;AACzC,eAAO,MAAM,MAAM,GAAI,YAAY,SAAS,EAAE,EAAE,UAAU,MAAM,EAAE,WAAW,MAAM,KAAG,SAErF,CAAA;AAGD,eAAO,MAAM,IAAI,GAAI,YAAY,SAAS,EAAE,KAAG,SAE9C,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Block } from "./block";
|
|
2
|
+
import { CoqBlock, CoqCodeBlock, CoqDocBlock, CoqMarkdownBlock, HintBlock, InputAreaBlock, MarkdownBlock, MathDisplayBlock } from "./blocktypes";
|
|
3
|
+
export declare const isInputAreaBlock: (block: Block) => block is InputAreaBlock;
|
|
4
|
+
export declare const isHintBlock: (block: Block) => block is HintBlock;
|
|
5
|
+
export declare const isMathDisplayBlock: (block: Block) => block is MathDisplayBlock;
|
|
6
|
+
export declare const isCoqBlock: (block: Block) => block is CoqBlock;
|
|
7
|
+
export declare const isMarkdownBlock: (block: Block) => block is MarkdownBlock;
|
|
8
|
+
export declare const isCoqMarkdownBlock: (block: Block) => block is CoqMarkdownBlock;
|
|
9
|
+
export declare const isCoqDocBlock: (block: Block) => block is CoqDocBlock;
|
|
10
|
+
export declare const isCoqCodeBlock: (block: Block) => block is CoqCodeBlock;
|
|
11
|
+
//# sourceMappingURL=typeguards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeguards.d.ts","sourceRoot":"","sources":["../../../src/document/blocks/typeguards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEjJ,eAAO,MAAM,gBAAgB,GAAI,OAAO,KAAK,KAAG,KAAK,IAAI,cAAsD,CAAC;AAChH,eAAO,MAAM,WAAW,GAAI,OAAO,KAAK,KAAG,KAAK,IAAI,SAA2C,CAAC;AAChG,eAAO,MAAM,kBAAkB,GAAI,OAAO,KAAK,KAAG,KAAK,IAAI,gBAA0D,CAAC;AACtH,eAAO,MAAM,UAAU,GAAI,OAAO,KAAK,KAAG,KAAK,IAAI,QAAyC,CAAC;AAC7F,eAAO,MAAM,eAAe,GAAI,OAAO,KAAK,KAAG,KAAK,IAAI,aAAmD,CAAC;AAC5G,eAAO,MAAM,kBAAkB,GAAI,OAAO,KAAK,KAAG,KAAK,IAAI,gBAA0D,CAAC;AACtH,eAAO,MAAM,aAAa,GAAI,OAAO,KAAK,KAAG,KAAK,IAAI,WAAgD,CAAC;AACvG,eAAO,MAAM,cAAc,GAAI,OAAO,KAAK,KAAG,KAAK,IAAI,YAAkD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"construct-document.d.ts","sourceRoot":"","sources":["../../src/document/construct-document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGtD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,SAAS,CAG5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/document/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,cAAc,UAAU,CAAC;AACzB,OAAO,KAAK,YAAY,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Block, BlockRange } from "./blocks";
|
|
2
|
+
/**
|
|
3
|
+
* Convert a list of blocks to a prosemirror compatible node list.
|
|
4
|
+
* @param blocks Input array of blocks.
|
|
5
|
+
* @returns ProseMirror nodes.
|
|
6
|
+
*/
|
|
7
|
+
export declare function blocksToProseMirrorNodes(blocks: Block[]): import("prosemirror-model").Node[];
|
|
8
|
+
/**
|
|
9
|
+
* Helper function to sort block type objects. Will sort based on the range object of the block.
|
|
10
|
+
* Sorts in ascending (`range.from`) order.
|
|
11
|
+
* @param blocks Blocks to sort.
|
|
12
|
+
* @returns Sorted array of blocks.
|
|
13
|
+
*/
|
|
14
|
+
export declare function sortBlocks(blocks: Block[]): Block[];
|
|
15
|
+
/**
|
|
16
|
+
* Map `f` over every consecutive pair from the `input` array.
|
|
17
|
+
* @param input Input array.
|
|
18
|
+
* @param f Function to map over the pairs.
|
|
19
|
+
* @returns The result of mapping `f` over every consecutive pair. Will return an empty array if the input array has length < 2.
|
|
20
|
+
*/
|
|
21
|
+
export declare function iteratePairs<ArrayType, FunctionReturnType>(input: Array<ArrayType>, f: (a: ArrayType, b: ArrayType) => FunctionReturnType): FunctionReturnType[];
|
|
22
|
+
/**
|
|
23
|
+
* Utility function to extract the ranges between blocks (ie. the ranges that are not covered by the blocks).
|
|
24
|
+
* @param blocks The input array of block.
|
|
25
|
+
* @param inputDocument The document the blocks are part of.
|
|
26
|
+
* @returns The ranges between the blocks.
|
|
27
|
+
*/
|
|
28
|
+
export declare function extractInterBlockRanges(blocks: Array<Block>, inputDocument: string): BlockRange[];
|
|
29
|
+
/**
|
|
30
|
+
* Utility function to mask regions of a document covered by blocks.
|
|
31
|
+
* @param inputDocument The input document on which to apply the masking.
|
|
32
|
+
* @param blocks The blocks that will mask content from the input document.
|
|
33
|
+
* @param mask The mask to use (defaults to `" "`).
|
|
34
|
+
* @returns The document (`string`) with the ranges covered by the blocks in `blocks` masked using `mask`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function maskInputAndHints(inputDocument: string, blocks: Block[], mask?: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Create blocks based on ranges.
|
|
39
|
+
*
|
|
40
|
+
* Extracts the text content of the ranges and creates blocks from them.
|
|
41
|
+
*/
|
|
42
|
+
export declare function extractBlocksUsingRanges<BlockType extends Block>(inputDocument: string, ranges: {
|
|
43
|
+
from: number;
|
|
44
|
+
to: number;
|
|
45
|
+
}[], BlockConstructor: new (content: string, range: {
|
|
46
|
+
from: number;
|
|
47
|
+
to: number;
|
|
48
|
+
}) => BlockType): BlockType[];
|
|
49
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/document/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,KAAK,EAAE,sCAEvD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,WAEzC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,kBAAkB,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,KAAK,kBAAkB,wBAEzI;AAGD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,MAAM,GAAG,UAAU,EAAE,CAcjG;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,GAAE,MAAY,GAAG,MAAM,CAMpG;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,SAAS,KAAK,EAC5D,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAC,EAAE,EACpC,gBAAgB,EAAE,KAAK,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,KAAK,SAAS,GAAI,SAAS,EAAE,CAS3G"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
2
|
+
export interface IDocumentProgressDecoratorState {
|
|
3
|
+
total: number;
|
|
4
|
+
progressHeightLow: number;
|
|
5
|
+
progressHeightHigh: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const DOCUMENT_PROGRESS_DECORATOR_KEY: PluginKey<IDocumentProgressDecoratorState>;
|
|
8
|
+
export declare const documentProgressDecoratorPlugin: Plugin<IDocumentProgressDecoratorState>;
|
|
9
|
+
//# sourceMappingURL=documentProgressDecorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentProgressDecorator.d.ts","sourceRoot":"","sources":["../src/documentProgressDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAc,MAAM,mBAAmB,CAAC;AAGlE,MAAM,WAAW,+BAA+B;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAGD,eAAO,MAAM,+BAA+B,4CAA4F,CAAC;AA+DzI,eAAO,MAAM,+BAA+B,yCAAkD,CAAC"}
|
package/dist/editor.d.ts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { ResolvedPos, Node as ProseNode } from "prosemirror-model";
|
|
2
|
+
import { EditorState, Plugin, Selection } from "prosemirror-state";
|
|
3
|
+
import { LineNumber, InputAreaStatus, SimpleProgressParams, HistoryChange, Severity } from "./api";
|
|
4
|
+
import "katex/dist/katex.min.css";
|
|
5
|
+
import "prosemirror-view/style/prosemirror.css";
|
|
6
|
+
import "./styles";
|
|
7
|
+
import { WaterproofEditorConfig, DiagnosticMessage, ThemeStyle } from "./api";
|
|
8
|
+
import { Completion } from "@codemirror/autocomplete";
|
|
9
|
+
import { ServerStatus } from "./api";
|
|
10
|
+
/** Type that contains a coq diagnostics object fit for use in the ProseMirror editor context. */
|
|
11
|
+
type DiagnosticObjectProse = {
|
|
12
|
+
message: string;
|
|
13
|
+
start: number;
|
|
14
|
+
end: number;
|
|
15
|
+
$start: ResolvedPos;
|
|
16
|
+
$end: ResolvedPos;
|
|
17
|
+
severity: Severity;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* WaterproofEditor class. Configured via the WaterproofEditorConfig object.
|
|
21
|
+
*/
|
|
22
|
+
export declare class WaterproofEditor {
|
|
23
|
+
private _editorConfig;
|
|
24
|
+
private _schema;
|
|
25
|
+
private _editorElem;
|
|
26
|
+
private _view;
|
|
27
|
+
private _translator;
|
|
28
|
+
private _mapping;
|
|
29
|
+
private readonly _userOS;
|
|
30
|
+
private currentProseDiagnostics;
|
|
31
|
+
private _lineNumbersShown;
|
|
32
|
+
/**
|
|
33
|
+
* Create a new WaterproofEditor instance.
|
|
34
|
+
* @param editorElement The HTML element where the editor will be inserted in the document
|
|
35
|
+
* @param config The configuration of the editor to use.
|
|
36
|
+
*/
|
|
37
|
+
constructor(editorElement: HTMLElement, config: WaterproofEditorConfig);
|
|
38
|
+
init(content: string, version?: number): void;
|
|
39
|
+
get state(): EditorState | undefined;
|
|
40
|
+
createProseMirrorEditor(proseDoc: ProseNode): void;
|
|
41
|
+
/** Create initial prosemirror state */
|
|
42
|
+
createState(proseDoc: ProseNode): EditorState;
|
|
43
|
+
/** Create the array of plugins used by the prosemirror editor */
|
|
44
|
+
createPluginsArray(): Plugin[];
|
|
45
|
+
updateNodeViewThemes(theme: ThemeStyle): void;
|
|
46
|
+
/**
|
|
47
|
+
* Handle a snippet that should be inserted into the editor.
|
|
48
|
+
* @param template The template string of the snippet that should be inserted.
|
|
49
|
+
*/
|
|
50
|
+
handleSnippet(template: string): void;
|
|
51
|
+
/** Called on every selection update. */
|
|
52
|
+
updateCursor(pos: Selection): void;
|
|
53
|
+
/** Called on every transaction update in which the textdocument was modified */
|
|
54
|
+
sendLineNumbers(): void;
|
|
55
|
+
private updateDocumentProgress;
|
|
56
|
+
/**
|
|
57
|
+
* Updates the dynamic autocomplete suggestions shown in the editor.
|
|
58
|
+
* @param completions Array of completions.
|
|
59
|
+
*/
|
|
60
|
+
handleCompletions(completions: Array<Completion>): void;
|
|
61
|
+
/** Called whenever a line number message is received from vscode to update line numbers of codemirror cells */
|
|
62
|
+
setLineNumbers(msg: LineNumber): void;
|
|
63
|
+
/**
|
|
64
|
+
* Execute a history change (undo/redo) in the editor.
|
|
65
|
+
* @param type Type of the change
|
|
66
|
+
*/
|
|
67
|
+
handleHistoryChange(type: HistoryChange): void;
|
|
68
|
+
handleScroll(innerHeight: number): void;
|
|
69
|
+
/**
|
|
70
|
+
* Insert a symbol at the cursor position (replaces the current selection if there is one).
|
|
71
|
+
*
|
|
72
|
+
* @param symbolUnicode The unicode character to insert.
|
|
73
|
+
* @returns Whether the operation was a success.
|
|
74
|
+
*/
|
|
75
|
+
insertSymbol(symbolUnicode: string): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Toggles line numbers for all codeblocks.
|
|
78
|
+
* @param show The editor will show line numbers in the code cells when set to `true`.
|
|
79
|
+
*/
|
|
80
|
+
setShowLineNumbers(show: boolean): void;
|
|
81
|
+
/**
|
|
82
|
+
* Toggles showing menu items in the editor for students.
|
|
83
|
+
* @param show The editor will show menu items to students when set to `true`.
|
|
84
|
+
*/
|
|
85
|
+
setShowMenuItems(show: boolean): void;
|
|
86
|
+
private createAndDispatchInsertionTransaction;
|
|
87
|
+
/**
|
|
88
|
+
* Called whenever a message describing the configuration of user is sent
|
|
89
|
+
*
|
|
90
|
+
* @param isTeacher Whether teacher mode is enabled
|
|
91
|
+
*/
|
|
92
|
+
updateLockingState(isTeacher: boolean): void;
|
|
93
|
+
/**
|
|
94
|
+
* Updates the state of the progress bar in the editor.
|
|
95
|
+
*
|
|
96
|
+
* @param progressParams The type used to store information on the status of the checking of the current file
|
|
97
|
+
*/
|
|
98
|
+
updateProgressBar(progressParams: SimpleProgressParams): void;
|
|
99
|
+
updateServerStatus(status: ServerStatus): void;
|
|
100
|
+
/**
|
|
101
|
+
* Updates the status of the input areas in the editor.
|
|
102
|
+
*
|
|
103
|
+
* @param status Array containing the status of the input areas within the current document, where `status[i]` corresponds to the i-th input area (starting at zero for the first input area).
|
|
104
|
+
*/
|
|
105
|
+
updateQedStatus(status: InputAreaStatus[]): void;
|
|
106
|
+
/**
|
|
107
|
+
* Updates the current set of diagnostics in the document. This function takes in the set of all diagnostics in the current document and assigns them to the correct code cell in the document.
|
|
108
|
+
*
|
|
109
|
+
* @param msg The set of diagnostics for the current document.
|
|
110
|
+
*/
|
|
111
|
+
parseCoqDiagnostics(msg: DiagnosticMessage): void;
|
|
112
|
+
getDiagnosticsInRange(low: number, high: number, truncationLevel?: number): Array<DiagnosticObjectProse>;
|
|
113
|
+
executeCommand(command: string): void;
|
|
114
|
+
executeHelp(): void;
|
|
115
|
+
}
|
|
116
|
+
export {};
|
|
117
|
+
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAU,IAAI,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAgB,WAAW,EAAiB,MAAM,EAAE,SAAS,EAA8B,MAAM,mBAAmB,CAAC;AAM5H,OAAO,EAAa,UAAU,EAAE,eAAe,EAAE,oBAAoB,EAAqB,aAAa,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAcjI,OAAO,0BAA0B,CAAC;AAClC,OAAO,wCAAwC,CAAC;AAChD,OAAO,UAAU,CAAC;AAKlB,OAAO,EAAiC,sBAAsB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC7G,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,iGAAiG;AACjG,KAAK,qBAAqB,GAAG;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAC,CAAC;AAEvI;;GAEG;AACH,qBAAa,gBAAgB;IAE5B,OAAO,CAAC,aAAa,CAAyB;IAG9C,OAAO,CAAC,OAAO,CAAS;IAGxB,OAAO,CAAC,WAAW,CAAc;IAGjC,OAAO,CAAC,KAAK,CAAyB;IAGt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AiB,CAAC,cAAc,EAAE,oBAAoB,GAAG,IAAI;IAS7D,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAI,IAAI;IAQtD;;;;OAIG;IACI,eAAe,CAAC,MAAM,EAAE,eAAe,EAAE,GAAI,IAAI;IAQxD;;;;OAIG;IACI,mBAAmB,CAAC,GAAG,EAAE,iBAAiB;IA8D1C,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,GAAE,MAAU,GAAG,KAAK,CAAC,qBAAqB,CAAC;IAO3G,cAAc,CAAC,OAAO,EAAE,MAAM;IAI9B,WAAW;CAGlB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { KeyBinding } from "@codemirror/view";
|
|
2
|
+
import { StateCommand } from "@codemirror/state";
|
|
3
|
+
/**
|
|
4
|
+
* Filtered set of keybindings taken from
|
|
5
|
+
* https://github.com/codemirror/commands/blob/e27916c9b09d2cedd7e0c9770bff04eeb3696e69/src/commands.ts#L878
|
|
6
|
+
*/
|
|
7
|
+
export declare const keybindings: KeyBinding[];
|
|
8
|
+
export declare const indentMoreCustom: StateCommand;
|
|
9
|
+
//# sourceMappingURL=embedded-codemirror-keymap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedded-codemirror-keymap.d.ts","sourceRoot":"","sources":["../../src/embedded-codemirror/embedded-codemirror-keymap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAc,YAAY,EAAoD,MAAM,mBAAmB,CAAA;AAE9G;;;GAGG;AAEH,eAAO,MAAM,WAAW,EAAE,UAAU,EA+BnC,CAAA;AAcD,eAAO,MAAM,gBAAgB,EAAE,YAM5B,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { EditorView as CodeMirror, Command, KeyBinding, ViewUpdate } from "@codemirror/view";
|
|
2
|
+
import { Node as PNode, Schema } from "prosemirror-model";
|
|
3
|
+
import { Decoration, DecorationSource, EditorView, NodeView } from "prosemirror-view";
|
|
4
|
+
import { MovementDirection, MovementUnit } from "./types";
|
|
5
|
+
/**
|
|
6
|
+
* A class implementing everything required to create an embedded codemirror editor for prosemirror.
|
|
7
|
+
* Implements the `NodeView` prosemirror class. Can be extended to create custom codemirror editors like
|
|
8
|
+
* the one used to edit markdown or coq.
|
|
9
|
+
*/
|
|
10
|
+
export declare class EmbeddedCodeMirrorEditor implements NodeView {
|
|
11
|
+
_getPos: (() => number | undefined);
|
|
12
|
+
protected updating: boolean;
|
|
13
|
+
protected _codemirror: CodeMirror | undefined;
|
|
14
|
+
protected _outerView: EditorView;
|
|
15
|
+
protected _schema: Schema;
|
|
16
|
+
protected _node: PNode;
|
|
17
|
+
constructor(node: PNode, view: EditorView, getPos: (() => number | undefined), schema: Schema);
|
|
18
|
+
dom: Node;
|
|
19
|
+
contentDOM?: HTMLElement | null | undefined;
|
|
20
|
+
update(node: PNode, _decorations: readonly Decoration[], _innerDecorations: DecorationSource): boolean;
|
|
21
|
+
selectNode?: (() => void) | undefined;
|
|
22
|
+
deselectNode?: (() => void) | undefined;
|
|
23
|
+
setSelection(anchor: number, head: number, _root: Document | ShadowRoot): void;
|
|
24
|
+
stopEvent?: ((event: Event) => boolean) | undefined;
|
|
25
|
+
ignoreMutation?: ((mutation: MutationRecord) => boolean) | undefined;
|
|
26
|
+
destroy?(): void;
|
|
27
|
+
forwardUpdate(update: ViewUpdate): void;
|
|
28
|
+
/**
|
|
29
|
+
* Do a movement, but first check if we escape the current view.
|
|
30
|
+
*
|
|
31
|
+
* The command returns false when we **will not** escape the current view.
|
|
32
|
+
*
|
|
33
|
+
* @param unit The movement unit (could be a line (up and down) or a character (left to right))
|
|
34
|
+
* @param dir The direction either forward or backward.
|
|
35
|
+
* @returns A command handling the escaping.
|
|
36
|
+
*/
|
|
37
|
+
maybeEscape(unit: MovementUnit, dir: MovementDirection): Command;
|
|
38
|
+
embeddedCodeMirrorKeymap(): KeyBinding[];
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=embeddedCodemirror.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embeddedCodemirror.d.ts","sourceRoot":"","sources":["../../src/embedded-codemirror/embeddedCodemirror.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI1D;;;;GAIG;AACH,qBAAa,wBAAyB,YAAW,QAAQ;IAC9C,OAAO,EAAE,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC;IAG9C,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC;IAEzB,SAAS,CAAC,WAAW,EAAE,UAAU,GAAG,SAAS,CAAC;IAE9C,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;IAEjC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAE1B,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;gBAGnB,IAAI,EAAE,KAAK,EACjB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC,EAClC,MAAM,EAAE,MAAM;IAYZ,GAAG,EAAG,IAAI,CAAC;IACX,UAAU,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IAE5C,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,UAAU,EAAE,EAAE,iBAAiB,EAAE,gBAAgB;IAqD5F,UAAU,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACtC,YAAY,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAExC,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,UAAU;IAYvE,SAAS,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;IACpD,cAAc,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,cAAc,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;IACrE,OAAO,CAAC,IAAI,IAAI;IAEnB,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAmCpC;;;;;;;;OAQA;IACH,WAAW,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO;IAkEhE,wBAAwB,IAAI,UAAU,EAAE;CAmBxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/embedded-codemirror/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/embedded-codemirror/types.ts"],"names":[],"mappings":"AAEA,oBAAY,YAAY;IACvB,IAAI,SAAS;IACb,SAAS,cAAc;CACvB;AAGD,oBAAY,iBAAiB;IAC5B,OAAO,IAAK;IACZ,QAAQ,KAAK;CACb"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Schema } from "prosemirror-model";
|
|
2
|
+
import { Plugin } from "prosemirror-state";
|
|
3
|
+
/**
|
|
4
|
+
* Function that returns the hint plugin.
|
|
5
|
+
* @param schema The schema in use for the editor.
|
|
6
|
+
* @returns A `Plugin` that enables the hint functionality.
|
|
7
|
+
*/
|
|
8
|
+
export declare const createHintPlugin: (schema: Schema) => Plugin;
|
|
9
|
+
//# sourceMappingURL=hint-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hint-plugin.d.ts","sourceRoot":"","sources":["../../src/hinting/hint-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAkC,MAAM,EAAe,MAAM,mBAAmB,CAAC;AAIxF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,MA6BjD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hinting/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|