This file contains hidden or 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
| import { autocompletion, closeBrackets, closeBracketsKeymap, completionKeymap } from '@codemirror/autocomplete'; | |
| import { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands'; | |
| import { | |
| bracketMatching, | |
| defaultHighlightStyle, | |
| foldGutter, | |
| foldKeymap, | |
| indentOnInput, | |
| LanguageDescription, | |
| syntaxHighlighting, |
This file contains hidden or 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
| body { | |
| background-image: radial-gradient(rgba(0, 0, 0, 0.1) 1px, transparent 0); | |
| background-size: 16px 16px; | |
| } |
This file contains hidden or 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
| /** | |
| * Given two commands (commandA and commandB), returns a new command that when applied | |
| * to a ProseMirror state that uses the prosemirror-history plugin applies commandA and | |
| * then commandB so that both commands are undone with a single undo action. | |
| **/ | |
| const combineCommands = | |
| (commandA: Command, commandB: Command) => | |
| (state: EditorState, dispatch?: (tr: Transaction) => void): boolean => { | |
| return commandA(state, (transactionA: Transaction) => { | |
| const { state: stateA } = state.applyTransaction(transactionA) |
This file contains hidden or 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
| /* eslint-disable max-classes-per-file */ | |
| import { applyPatches, Patch } from "immer"; | |
| import invariant from "tiny-invariant"; | |
| class TrieNode { | |
| children: Map<string | number, TrieNode>; | |
| label: Patch["path"]; | |
| patch: Patch | undefined; |
This file contains hidden or 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
| var short = require("short-uuid") | |
| var translate = short("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") | |
| translate.toUUID("0s33UQWH9339VifYPjmRgC") |
This file contains hidden or 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
| export function debounce<T extends (...args: any[]) => void>({ | |
| callback, | |
| onStart, | |
| onEnd, | |
| delay = 100, | |
| }: { | |
| callback: T; | |
| onStart?: T; | |
| onEnd?: T; | |
| delay?: number; |
This file contains hidden or 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
| import { | |
| observable, | |
| IReactionDisposer, | |
| reaction, | |
| observe, | |
| IObservableArray, | |
| transaction, | |
| ObservableMap, | |
| Lambda, | |
| isObservableArray, |
This file contains hidden or 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
| function uniqueId(a = ''): string { | |
| return a | |
| ? /* eslint-disable no-bitwise */ | |
| ((Number(a) ^ (Math.random() * 16)) >> (Number(a) / 4)).toString(16) | |
| : `${1e7}-${1e3}-${4e3}-${8e3}-${1e11}`.replace(/[018]/g, uniqueId) | |
| } |
This file contains hidden or 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
| export function debounce<T extends (...args: any[]) => void>({ | |
| callback, | |
| onStart, | |
| onEnd, | |
| delay = 100 | |
| }: { | |
| callback: T, | |
| onStart?: T, | |
| onEnd?: T, | |
| delay?: number |
This file contains hidden or 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
| import { types as t, type IAnyModelType, getSnapshot, onPatch } from "mobx-state-tree" | |
| import invariant from "tiny-invariant"; | |
| import { validate as isUUID } from "uuid"; | |
| console.log("mobx"); | |
| const Cell = t.model("cell", { | |
| id: t.refinement(t.identifier, id => isUUID(id)), | |
| content: t.string, | |
| row: t.reference(t.late((): IAnyModelType => Row)), |