@dxos/react-ui-editor 0.3.10-main.8fd45da → 0.3.10-main.cb1d9e2
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/dist/lib/browser/index.mjs +111 -25
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/TextEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/TextEditor.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/extensions/comments.d.ts +10 -6
- package/dist/types/src/components/TextEditor/extensions/comments.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/extensions/demo.d.ts +10 -0
- package/dist/types/src/components/TextEditor/extensions/demo.d.ts.map +1 -0
- package/dist/types/src/components/TextEditor/extensions/index.d.ts +1 -0
- package/dist/types/src/components/TextEditor/extensions/index.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/extensions/listener.d.ts +4 -2
- package/dist/types/src/components/TextEditor/extensions/listener.d.ts.map +1 -1
- package/package.json +20 -19
- package/src/components/TextEditor/MarkdownEditor.stories.tsx +4 -2
- package/src/components/TextEditor/TextEditor.tsx +18 -4
- package/src/components/TextEditor/extensions/comments.ts +48 -31
- package/src/components/TextEditor/extensions/demo.ts +66 -0
- package/src/components/TextEditor/extensions/index.ts +1 -0
- package/src/components/TextEditor/extensions/listener.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/ui/react-ui-editor/src/components/TextEditor/extensions/autocomplete.ts":{"bytes":7096,"imports":[{"path":"@codemirror/autocomplete","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/basic.ts":{"bytes":3373,"imports":[{"path":"@codemirror/autocomplete","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/theme-one-dark","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/comments.ts":{"bytes":16512,"imports":[{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/link.ts":{"bytes":19200,"imports":[{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/listener.ts":{"bytes":2046,"imports":[{"path":"@codemirror/state","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/styles/markdown.ts":{"bytes":6320,"imports":[{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/styles/tokens.ts":{"bytes":1192,"imports":[{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/styles/index.ts":{"bytes":560,"imports":[{"path":"packages/ui/react-ui-editor/src/styles/markdown.ts","kind":"import-statement","original":"./markdown"},{"path":"packages/ui/react-ui-editor/src/styles/tokens.ts","kind":"import-statement","original":"./tokens"}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/highlight.ts":{"bytes":15930,"imports":[{"path":"@codemirror/lang-markdown","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@lezer/highlight","kind":"import-statement","external":true},{"path":"lodash.get","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/styles/index.ts","kind":"import-statement","original":"../../../../styles"}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/bundle.ts":{"bytes":10072,"imports":[{"path":"@codemirror/autocomplete","kind":"import-statement","external":true},{"path":"@codemirror/commands","kind":"import-statement","external":true},{"path":"@codemirror/lang-markdown","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/language-data","kind":"import-statement","external":true},{"path":"@codemirror/search","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/theme-one-dark","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/highlight.ts","kind":"import-statement","original":"./highlight"}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/index.ts":{"bytes":596,"imports":[{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/bundle.ts","kind":"import-statement","original":"./bundle"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/highlight.ts","kind":"import-statement","original":"./highlight"}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/tasklist.ts":{"bytes":10575,"imports":[{"path":"@codemirror/view","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/tooltip.tsx":{"bytes":5580,"imports":[{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/index.ts":{"bytes":1112,"imports":[{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/autocomplete.ts","kind":"import-statement","original":"./autocomplete"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/basic.ts","kind":"import-statement","original":"./basic"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/comments.ts","kind":"import-statement","original":"./comments"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/link.ts","kind":"import-statement","original":"./link"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/listener.ts","kind":"import-statement","original":"./listener"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/index.ts","kind":"import-statement","original":"./markdown"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/tasklist.ts","kind":"import-statement","original":"./tasklist"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/tooltip.tsx","kind":"import-statement","original":"./tooltip"}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/themes/default.ts":{"bytes":15385,"imports":[{"path":"lodash.get","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/styles/index.ts","kind":"import-statement","original":"../../../styles"}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/themes/index.ts":{"bytes":495,"imports":[{"path":"packages/ui/react-ui-editor/src/components/TextEditor/themes/default.ts","kind":"import-statement","original":"./default"}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/TextEditor.tsx":{"bytes":19485,"imports":[{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@replit/codemirror-vim","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/display-name","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/index.ts","kind":"import-statement","original":"./extensions"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/themes/index.ts","kind":"import-statement","original":"./themes"}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/index.ts":{"bytes":892,"imports":[{"path":"@lezer/highlight","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/index.ts","kind":"import-statement","original":"./extensions"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/themes/index.ts","kind":"import-statement","original":"./themes"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/TextEditor.tsx","kind":"import-statement","original":"./TextEditor"}],"format":"esm"},"packages/ui/react-ui-editor/src/components/index.ts":{"bytes":484,"imports":[{"path":"packages/ui/react-ui-editor/src/components/TextEditor/index.ts","kind":"import-statement","original":"./TextEditor"}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/automerge/amToCodemirror.ts":{"bytes":11060,"imports":[{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/hooks/automerge/plugin.ts","kind":"import-statement","original":"./plugin"}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/automerge/codeMirrorToAm.ts":{"bytes":3912,"imports":[{"path":"@dxos/automerge/automerge","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/automerge/PatchSemaphore.ts":{"bytes":8482,"imports":[{"path":"@dxos/automerge/automerge","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/hooks/automerge/amToCodemirror.ts","kind":"import-statement","original":"./amToCodemirror"},{"path":"packages/ui/react-ui-editor/src/hooks/automerge/codeMirrorToAm.ts","kind":"import-statement","original":"./codeMirrorToAm"},{"path":"packages/ui/react-ui-editor/src/hooks/automerge/plugin.ts","kind":"import-statement","original":"./plugin"}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/automerge/plugin.ts":{"bytes":13082,"imports":[{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/automerge/automerge","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/hooks/automerge/PatchSemaphore.ts","kind":"import-statement","original":"./PatchSemaphore"}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/automerge/index.ts":{"bytes":651,"imports":[{"path":"packages/ui/react-ui-editor/src/hooks/automerge/plugin.ts","kind":"import-statement","original":"./plugin"}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/yjs/cursors.ts":{"bytes":2636,"imports":[{"path":"lib0/random","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/yjs/space-provider.ts":{"bytes":15639,"imports":[{"path":"lib0/decoding","kind":"import-statement","external":true},{"path":"lib0/encoding","kind":"import-statement","external":true},{"path":"lib0/observable","kind":"import-statement","external":true},{"path":"y-protocols/awareness","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/yjs/index.ts":{"bytes":582,"imports":[{"path":"packages/ui/react-ui-editor/src/hooks/yjs/cursors.ts","kind":"import-statement","original":"./cursors"},{"path":"packages/ui/react-ui-editor/src/hooks/yjs/space-provider.ts","kind":"import-statement","original":"./space-provider"}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/useTextModel.ts":{"bytes":9937,"imports":[{"path":"lodash.get","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"y-codemirror.next","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/hooks/automerge/index.ts","kind":"import-statement","original":"./automerge"},{"path":"packages/ui/react-ui-editor/src/hooks/yjs/index.ts","kind":"import-statement","original":"./yjs"}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/index.ts":{"bytes":564,"imports":[{"path":"packages/ui/react-ui-editor/src/hooks/useTextModel.ts","kind":"import-statement","original":"./useTextModel"},{"path":"packages/ui/react-ui-editor/src/hooks/yjs/index.ts","kind":"import-statement","original":"./yjs"}],"format":"esm"},"packages/ui/react-ui-editor/src/index.ts":{"bytes":1026,"imports":[{"path":"@dxos/protocols/proto/dxos/echo/model/text","kind":"import-statement","external":true},{"path":"@dxos/text-model","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-editor/src/hooks/index.ts","kind":"import-statement","original":"./hooks"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-editor/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":98508},"packages/ui/react-ui-editor/dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/protocols/proto/dxos/echo/model/text","kind":"import-statement","external":true},{"path":"@dxos/text-model","kind":"import-statement","external":true},{"path":"@lezer/highlight","kind":"import-statement","external":true},{"path":"@codemirror/autocomplete","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@codemirror/autocomplete","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/theme-one-dark","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/autocomplete","kind":"import-statement","external":true},{"path":"@codemirror/commands","kind":"import-statement","external":true},{"path":"@codemirror/lang-markdown","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/language-data","kind":"import-statement","external":true},{"path":"@codemirror/search","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/theme-one-dark","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@codemirror/lang-markdown","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@lezer/highlight","kind":"import-statement","external":true},{"path":"lodash.get","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"lodash.get","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@replit/codemirror-vim","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/display-name","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"lodash.get","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"y-codemirror.next","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/automerge/automerge","kind":"import-statement","external":true},{"path":"@dxos/automerge/automerge","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@dxos/automerge/automerge","kind":"import-statement","external":true},{"path":"lib0/random","kind":"import-statement","external":true},{"path":"lib0/decoding","kind":"import-statement","external":true},{"path":"lib0/encoding","kind":"import-statement","external":true},{"path":"lib0/observable","kind":"import-statement","external":true},{"path":"y-protocols/awareness","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["BaseTextEditor","Doc","EditorModes","MarkdownEditor","SpaceAwarenessProvider","TextEditor","TextKind","YText","YXmlFragment","autocomplete","basicBundle","codeTheme","comments","cursorColor","defaultMarkdownSlots","defaultSlots","defaultTextSlots","defaultTheme","link","listener","markdownBundle","markdownHighlightStyle","markdownTags","markdownTagsExtension","markdownTheme","tags","tasklist","textTheme","tooltip","useTextModel"],"entryPoint":"packages/ui/react-ui-editor/src/index.ts","inputs":{"packages/ui/react-ui-editor/src/index.ts":{"bytesInOutput":132},"packages/ui/react-ui-editor/src/components/TextEditor/index.ts":{"bytesInOutput":50},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/autocomplete.ts":{"bytesInOutput":1098},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/basic.ts":{"bytesInOutput":738},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/comments.ts":{"bytesInOutput":3165},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/link.ts":{"bytesInOutput":2573},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/listener.ts":{"bytesInOutput":296},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/bundle.ts":{"bytesInOutput":2731},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/highlight.ts":{"bytesInOutput":3415},"packages/ui/react-ui-editor/src/styles/markdown.ts":{"bytesInOutput":1029},"packages/ui/react-ui-editor/src/styles/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-editor/src/styles/tokens.ts":{"bytesInOutput":94},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/tasklist.ts":{"bytesInOutput":2416},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/tooltip.tsx":{"bytesInOutput":1033},"packages/ui/react-ui-editor/src/components/TextEditor/themes/default.ts":{"bytesInOutput":4060},"packages/ui/react-ui-editor/src/components/TextEditor/themes/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-editor/src/components/TextEditor/TextEditor.tsx":{"bytesInOutput":4276},"packages/ui/react-ui-editor/src/components/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-editor/src/hooks/useTextModel.ts":{"bytesInOutput":2039},"packages/ui/react-ui-editor/src/hooks/automerge/plugin.ts":{"bytesInOutput":2340},"packages/ui/react-ui-editor/src/hooks/automerge/PatchSemaphore.ts":{"bytesInOutput":1519},"packages/ui/react-ui-editor/src/hooks/automerge/amToCodemirror.ts":{"bytesInOutput":2412},"packages/ui/react-ui-editor/src/hooks/automerge/codeMirrorToAm.ts":{"bytesInOutput":644},"packages/ui/react-ui-editor/src/hooks/automerge/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-editor/src/hooks/yjs/cursors.ts":{"bytesInOutput":565},"packages/ui/react-ui-editor/src/hooks/yjs/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-editor/src/hooks/yjs/space-provider.ts":{"bytesInOutput":3769},"packages/ui/react-ui-editor/src/hooks/index.ts":{"bytesInOutput":0}},"bytes":42844}}}
|
|
1
|
+
{"inputs":{"packages/ui/react-ui-editor/src/components/TextEditor/extensions/autocomplete.ts":{"bytes":7096,"imports":[{"path":"@codemirror/autocomplete","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/basic.ts":{"bytes":3373,"imports":[{"path":"@codemirror/autocomplete","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/theme-one-dark","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/demo.ts":{"bytes":6009,"imports":[{"path":"@codemirror/view","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/comments.ts":{"bytes":18590,"imports":[{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/link.ts":{"bytes":19200,"imports":[{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/listener.ts":{"bytes":2106,"imports":[{"path":"@codemirror/state","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/styles/markdown.ts":{"bytes":6320,"imports":[{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/styles/tokens.ts":{"bytes":1192,"imports":[{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/styles/index.ts":{"bytes":560,"imports":[{"path":"packages/ui/react-ui-editor/src/styles/markdown.ts","kind":"import-statement","original":"./markdown"},{"path":"packages/ui/react-ui-editor/src/styles/tokens.ts","kind":"import-statement","original":"./tokens"}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/highlight.ts":{"bytes":15930,"imports":[{"path":"@codemirror/lang-markdown","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@lezer/highlight","kind":"import-statement","external":true},{"path":"lodash.get","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/styles/index.ts","kind":"import-statement","original":"../../../../styles"}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/bundle.ts":{"bytes":10072,"imports":[{"path":"@codemirror/autocomplete","kind":"import-statement","external":true},{"path":"@codemirror/commands","kind":"import-statement","external":true},{"path":"@codemirror/lang-markdown","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/language-data","kind":"import-statement","external":true},{"path":"@codemirror/search","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/theme-one-dark","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/highlight.ts","kind":"import-statement","original":"./highlight"}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/index.ts":{"bytes":596,"imports":[{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/bundle.ts","kind":"import-statement","original":"./bundle"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/highlight.ts","kind":"import-statement","original":"./highlight"}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/tasklist.ts":{"bytes":10575,"imports":[{"path":"@codemirror/view","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/tooltip.tsx":{"bytes":5580,"imports":[{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/index.ts":{"bytes":1188,"imports":[{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/autocomplete.ts","kind":"import-statement","original":"./autocomplete"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/basic.ts","kind":"import-statement","original":"./basic"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/demo.ts","kind":"import-statement","original":"./demo"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/comments.ts","kind":"import-statement","original":"./comments"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/link.ts","kind":"import-statement","original":"./link"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/listener.ts","kind":"import-statement","original":"./listener"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/index.ts","kind":"import-statement","original":"./markdown"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/tasklist.ts","kind":"import-statement","original":"./tasklist"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/tooltip.tsx","kind":"import-statement","original":"./tooltip"}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/themes/default.ts":{"bytes":15385,"imports":[{"path":"lodash.get","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/styles/index.ts","kind":"import-statement","original":"../../../styles"}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/themes/index.ts":{"bytes":495,"imports":[{"path":"packages/ui/react-ui-editor/src/components/TextEditor/themes/default.ts","kind":"import-statement","original":"./default"}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/TextEditor.tsx":{"bytes":20623,"imports":[{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@replit/codemirror-vim","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/display-name","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/index.ts","kind":"import-statement","original":"./extensions"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/themes/index.ts","kind":"import-statement","original":"./themes"}],"format":"esm"},"packages/ui/react-ui-editor/src/components/TextEditor/index.ts":{"bytes":892,"imports":[{"path":"@lezer/highlight","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/extensions/index.ts","kind":"import-statement","original":"./extensions"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/themes/index.ts","kind":"import-statement","original":"./themes"},{"path":"packages/ui/react-ui-editor/src/components/TextEditor/TextEditor.tsx","kind":"import-statement","original":"./TextEditor"}],"format":"esm"},"packages/ui/react-ui-editor/src/components/index.ts":{"bytes":484,"imports":[{"path":"packages/ui/react-ui-editor/src/components/TextEditor/index.ts","kind":"import-statement","original":"./TextEditor"}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/automerge/amToCodemirror.ts":{"bytes":11060,"imports":[{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/hooks/automerge/plugin.ts","kind":"import-statement","original":"./plugin"}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/automerge/codeMirrorToAm.ts":{"bytes":3912,"imports":[{"path":"@dxos/automerge/automerge","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/automerge/PatchSemaphore.ts":{"bytes":8482,"imports":[{"path":"@dxos/automerge/automerge","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/hooks/automerge/amToCodemirror.ts","kind":"import-statement","original":"./amToCodemirror"},{"path":"packages/ui/react-ui-editor/src/hooks/automerge/codeMirrorToAm.ts","kind":"import-statement","original":"./codeMirrorToAm"},{"path":"packages/ui/react-ui-editor/src/hooks/automerge/plugin.ts","kind":"import-statement","original":"./plugin"}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/automerge/plugin.ts":{"bytes":13082,"imports":[{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/automerge/automerge","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/hooks/automerge/PatchSemaphore.ts","kind":"import-statement","original":"./PatchSemaphore"}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/automerge/index.ts":{"bytes":651,"imports":[{"path":"packages/ui/react-ui-editor/src/hooks/automerge/plugin.ts","kind":"import-statement","original":"./plugin"}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/yjs/cursors.ts":{"bytes":2636,"imports":[{"path":"lib0/random","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/yjs/space-provider.ts":{"bytes":15639,"imports":[{"path":"lib0/decoding","kind":"import-statement","external":true},{"path":"lib0/encoding","kind":"import-statement","external":true},{"path":"lib0/observable","kind":"import-statement","external":true},{"path":"y-protocols/awareness","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/yjs/index.ts":{"bytes":582,"imports":[{"path":"packages/ui/react-ui-editor/src/hooks/yjs/cursors.ts","kind":"import-statement","original":"./cursors"},{"path":"packages/ui/react-ui-editor/src/hooks/yjs/space-provider.ts","kind":"import-statement","original":"./space-provider"}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/useTextModel.ts":{"bytes":9937,"imports":[{"path":"lodash.get","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"y-codemirror.next","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/hooks/automerge/index.ts","kind":"import-statement","original":"./automerge"},{"path":"packages/ui/react-ui-editor/src/hooks/yjs/index.ts","kind":"import-statement","original":"./yjs"}],"format":"esm"},"packages/ui/react-ui-editor/src/hooks/index.ts":{"bytes":564,"imports":[{"path":"packages/ui/react-ui-editor/src/hooks/useTextModel.ts","kind":"import-statement","original":"./useTextModel"},{"path":"packages/ui/react-ui-editor/src/hooks/yjs/index.ts","kind":"import-statement","original":"./yjs"}],"format":"esm"},"packages/ui/react-ui-editor/src/index.ts":{"bytes":1026,"imports":[{"path":"@dxos/protocols/proto/dxos/echo/model/text","kind":"import-statement","external":true},{"path":"@dxos/text-model","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-editor/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-editor/src/hooks/index.ts","kind":"import-statement","original":"./hooks"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-editor/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":102925},"packages/ui/react-ui-editor/dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/protocols/proto/dxos/echo/model/text","kind":"import-statement","external":true},{"path":"@dxos/text-model","kind":"import-statement","external":true},{"path":"@lezer/highlight","kind":"import-statement","external":true},{"path":"@codemirror/autocomplete","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@codemirror/autocomplete","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/theme-one-dark","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/autocomplete","kind":"import-statement","external":true},{"path":"@codemirror/commands","kind":"import-statement","external":true},{"path":"@codemirror/lang-markdown","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/language-data","kind":"import-statement","external":true},{"path":"@codemirror/search","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/theme-one-dark","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@codemirror/lang-markdown","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@lezer/highlight","kind":"import-statement","external":true},{"path":"lodash.get","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"lodash.get","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@replit/codemirror-vim","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/display-name","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"lodash.get","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"y-codemirror.next","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/automerge/automerge","kind":"import-statement","external":true},{"path":"@dxos/automerge/automerge","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@dxos/automerge/automerge","kind":"import-statement","external":true},{"path":"lib0/random","kind":"import-statement","external":true},{"path":"lib0/decoding","kind":"import-statement","external":true},{"path":"lib0/encoding","kind":"import-statement","external":true},{"path":"lib0/observable","kind":"import-statement","external":true},{"path":"y-protocols/awareness","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["BaseTextEditor","Doc","EditorModes","MarkdownEditor","SpaceAwarenessProvider","TextEditor","TextKind","YText","YXmlFragment","autocomplete","basicBundle","codeTheme","comments","cursorColor","defaultMarkdownSlots","defaultSlots","defaultTextSlots","defaultTheme","demo","link","listener","markdownBundle","markdownHighlightStyle","markdownTags","markdownTagsExtension","markdownTheme","tags","tasklist","textTheme","tooltip","useTextModel"],"entryPoint":"packages/ui/react-ui-editor/src/index.ts","inputs":{"packages/ui/react-ui-editor/src/index.ts":{"bytesInOutput":132},"packages/ui/react-ui-editor/src/components/TextEditor/index.ts":{"bytesInOutput":50},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/autocomplete.ts":{"bytesInOutput":1098},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/basic.ts":{"bytesInOutput":738},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/demo.ts":{"bytesInOutput":1335},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/comments.ts":{"bytesInOutput":3575},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/link.ts":{"bytesInOutput":2573},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/listener.ts":{"bytesInOutput":300},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/bundle.ts":{"bytesInOutput":2731},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/highlight.ts":{"bytesInOutput":3415},"packages/ui/react-ui-editor/src/styles/markdown.ts":{"bytesInOutput":1029},"packages/ui/react-ui-editor/src/styles/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-editor/src/styles/tokens.ts":{"bytesInOutput":94},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/tasklist.ts":{"bytesInOutput":2416},"packages/ui/react-ui-editor/src/components/TextEditor/extensions/tooltip.tsx":{"bytesInOutput":1033},"packages/ui/react-ui-editor/src/components/TextEditor/themes/default.ts":{"bytesInOutput":4060},"packages/ui/react-ui-editor/src/components/TextEditor/themes/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-editor/src/components/TextEditor/TextEditor.tsx":{"bytesInOutput":4492},"packages/ui/react-ui-editor/src/components/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-editor/src/hooks/useTextModel.ts":{"bytesInOutput":2039},"packages/ui/react-ui-editor/src/hooks/automerge/plugin.ts":{"bytesInOutput":2340},"packages/ui/react-ui-editor/src/hooks/automerge/PatchSemaphore.ts":{"bytesInOutput":1519},"packages/ui/react-ui-editor/src/hooks/automerge/amToCodemirror.ts":{"bytesInOutput":2412},"packages/ui/react-ui-editor/src/hooks/automerge/codeMirrorToAm.ts":{"bytesInOutput":644},"packages/ui/react-ui-editor/src/hooks/automerge/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-editor/src/hooks/yjs/cursors.ts":{"bytesInOutput":565},"packages/ui/react-ui-editor/src/hooks/yjs/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-editor/src/hooks/yjs/space-provider.ts":{"bytesInOutput":3769},"packages/ui/react-ui-editor/src/hooks/index.ts":{"bytesInOutput":0}},"bytes":44894}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownEditor.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextEditor/MarkdownEditor.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAIpB,OAAO,KAAuC,MAAM,OAAO,CAAC;AAQ5D,OAAO,EAAkB,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;;;;;;;;;;AAoKxF,wBAKE;AAEF,eAAO,MAAM,OAAO;;CAcnB,CAAC;AAEF,eAAO,MAAM,MAAM;;CAElB,CAAC;AAEF,eAAO,MAAM,QAAQ;;CAEpB,CAAC;AAEF,eAAO,MAAM,KAAK;;CAEjB,CAAC;AAEF,eAAO,MAAM,QAAQ;;
|
|
1
|
+
{"version":3,"file":"MarkdownEditor.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextEditor/MarkdownEditor.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAIpB,OAAO,KAAuC,MAAM,OAAO,CAAC;AAQ5D,OAAO,EAAkB,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;;;;;;;;;;AAoKxF,wBAKE;AAEF,eAAO,MAAM,OAAO;;CAcnB,CAAC;AAEF,eAAO,MAAM,MAAM;;CAElB,CAAC;AAEF,eAAO,MAAM,QAAQ;;CAEpB,CAAC;AAEF,eAAO,MAAM,KAAK;;CAEjB,CAAC;AAEF,eAAO,MAAM,QAAQ;;CAcpB,CAAC;AAEF,eAAO,MAAM,YAAY;;CAYxB,CAAC;AAGF,eAAO,MAAM,QAAQ;;CAcpB,CAAC;AAEF,eAAO,MAAM,WAAW;;CAYvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextEditor/TextEditor.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAI9C,OAAO,KAAK,EAAE,EACZ,KAAK,cAAc,EAOpB,MAAM,OAAO,CAAC;AAQf,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,eAAO,MAAM,WAAW,6BAA8B,CAAC;AACvD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;IAC1C,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,WAAW,CAAC;KACrB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,WAAW,CAAC;IACnB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,uFA0F1B,CAAC;
|
|
1
|
+
{"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextEditor/TextEditor.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAI9C,OAAO,KAAK,EAAE,EACZ,KAAK,cAAc,EAOpB,MAAM,OAAO,CAAC;AAQf,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,eAAO,MAAM,WAAW,6BAA8B,CAAC;AACvD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;IAC1C,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,WAAW,CAAC;KACrB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,WAAW,CAAC;IACnB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,uFA0F1B,CAAC;AAaF,eAAO,MAAM,UAAU,uFAatB,CAAC;AAEF,eAAO,MAAM,cAAc,uFAiB1B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,eAI1B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,eAK9B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,eAKlC,CAAC"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { type Extension } from '@codemirror/state';
|
|
2
2
|
import { type Rect } from '@codemirror/view';
|
|
3
|
+
type CommentsInfo = {
|
|
4
|
+
active?: string;
|
|
5
|
+
items: {
|
|
6
|
+
id: string;
|
|
7
|
+
pos: number;
|
|
8
|
+
location: Rect | null;
|
|
9
|
+
}[];
|
|
10
|
+
};
|
|
3
11
|
export type CommentsOptions = {
|
|
4
12
|
key?: string;
|
|
5
13
|
onCreate?: () => string | void;
|
|
6
|
-
onUpdate?: (info:
|
|
7
|
-
items: string[];
|
|
8
|
-
active: string;
|
|
9
|
-
pos: number;
|
|
10
|
-
location: Rect;
|
|
11
|
-
}) => void;
|
|
14
|
+
onUpdate?: (info: CommentsInfo) => void;
|
|
12
15
|
};
|
|
13
16
|
export declare const comments: (options?: CommentsOptions) => Extension;
|
|
17
|
+
export {};
|
|
14
18
|
//# sourceMappingURL=comments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/comments.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/comments.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAGL,KAAK,IAAI,EAOV,MAAM,kBAAkB,CAAC;AAuD1B,KAAK,YAAY,GAAG;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAA;KAAE,EAAE,CAAC;CAC7D,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;CACzC,CAAC;AAKF,eAAO,MAAM,QAAQ,aAAa,eAAe,KAAQ,SAyGxD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type DemoOptions = {
|
|
2
|
+
delay?: number;
|
|
3
|
+
items?: string[];
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Demo script.
|
|
7
|
+
* Configurable plugin that let's user cycle through pre-configured input script.
|
|
8
|
+
*/
|
|
9
|
+
export declare const demo: ({ delay, items }?: DemoOptions) => import("@codemirror/state").Extension[];
|
|
10
|
+
//# sourceMappingURL=demo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"demo.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/demo.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,IAAI,sBAA0C,WAAW,4CAgDrE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { StateField } from '@codemirror/state';
|
|
2
|
-
export type
|
|
2
|
+
export type ListenerOptions = {
|
|
3
|
+
onChange: (text: string) => void;
|
|
4
|
+
};
|
|
3
5
|
/**
|
|
4
6
|
* Based on https://github.com/codemirror/dev/issues/44#issuecomment-789093799
|
|
5
7
|
*/
|
|
6
|
-
export declare const listener: (onChange:
|
|
8
|
+
export declare const listener: ({ onChange }: ListenerOptions) => StateField<null>;
|
|
7
9
|
//# sourceMappingURL=listener.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/listener.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextEditor/extensions/listener.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,MAAM,eAAe,GAAG;IAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,CAAC;AAEnE;;GAEG;AAEH,eAAO,MAAM,QAAQ,iBAAkB,eAAe,qBAUlD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-editor",
|
|
3
|
-
"version": "0.3.10-main.
|
|
3
|
+
"version": "0.3.10-main.cb1d9e2",
|
|
4
4
|
"description": "Document editing experience within a DXOS shell.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -36,18 +36,19 @@
|
|
|
36
36
|
"y-codemirror.next": "^0.3.2",
|
|
37
37
|
"y-protocols": "^1.0.5",
|
|
38
38
|
"yjs": "^13.6.10",
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/react-
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
39
|
+
"@dxos/async": "0.3.10-main.cb1d9e2",
|
|
40
|
+
"@dxos/automerge": "0.3.10-main.cb1d9e2",
|
|
41
|
+
"@dxos/display-name": "0.3.10-main.cb1d9e2",
|
|
42
|
+
"@dxos/debug": "0.3.10-main.cb1d9e2",
|
|
43
|
+
"@dxos/echo-schema": "0.3.10-main.cb1d9e2",
|
|
44
|
+
"@dxos/invariant": "0.3.10-main.cb1d9e2",
|
|
45
|
+
"@dxos/protocols": "0.3.10-main.cb1d9e2",
|
|
46
|
+
"@dxos/log": "0.3.10-main.cb1d9e2",
|
|
47
|
+
"@dxos/react-async": "0.3.10-main.cb1d9e2",
|
|
48
|
+
"@dxos/react-ui-theme": "0.3.10-main.cb1d9e2",
|
|
49
|
+
"@dxos/text-model": "0.3.10-main.cb1d9e2",
|
|
50
|
+
"@dxos/util": "0.3.10-main.cb1d9e2",
|
|
51
|
+
"@dxos/react-ui": "0.3.10-main.cb1d9e2"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@automerge/automerge-repo-network-broadcastchannel": "^1.0.19",
|
|
@@ -60,17 +61,17 @@
|
|
|
60
61
|
"@types/react-dom": "^18.0.6",
|
|
61
62
|
"react": "^18.2.0",
|
|
62
63
|
"react-dom": "^18.2.0",
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/react-
|
|
66
|
-
"@dxos/storybook-utils": "0.3.10-main.
|
|
67
|
-
"@dxos/
|
|
64
|
+
"@dxos/echo-typegen": "0.3.10-main.cb1d9e2",
|
|
65
|
+
"@dxos/react-client": "0.3.10-main.cb1d9e2",
|
|
66
|
+
"@dxos/react-ui": "0.3.10-main.cb1d9e2",
|
|
67
|
+
"@dxos/storybook-utils": "0.3.10-main.cb1d9e2",
|
|
68
|
+
"@dxos/config": "0.3.10-main.cb1d9e2"
|
|
68
69
|
},
|
|
69
70
|
"peerDependencies": {
|
|
70
71
|
"@phosphor-icons/react": "^2.0.5",
|
|
71
72
|
"react": "^18.2.0",
|
|
72
73
|
"react-dom": "^18.2.0",
|
|
73
|
-
"@dxos/react-client": "0.3.10-main.
|
|
74
|
+
"@dxos/react-client": "0.3.10-main.cb1d9e2"
|
|
74
75
|
},
|
|
75
76
|
"publishConfig": {
|
|
76
77
|
"access": "public"
|
|
@@ -21,7 +21,7 @@ import { generateName } from '@dxos/display-name';
|
|
|
21
21
|
import { useThemeContext } from '@dxos/react-ui';
|
|
22
22
|
import { getColorForValue, inputSurface, mx } from '@dxos/react-ui-theme';
|
|
23
23
|
|
|
24
|
-
import { basicBundle, markdownBundle } from './extensions';
|
|
24
|
+
import { basicBundle, demo, markdownBundle } from './extensions';
|
|
25
25
|
import { defaultTheme, markdownTheme, textTheme } from './themes';
|
|
26
26
|
import { type EditorModel } from '../../hooks';
|
|
27
27
|
import { type ThemeStyles } from '../../styles';
|
|
@@ -157,7 +157,17 @@ export const BaseTextEditor = forwardRef<TextEditorRef, TextEditorProps>(
|
|
|
157
157
|
},
|
|
158
158
|
);
|
|
159
159
|
|
|
160
|
-
// TODO(burdon):
|
|
160
|
+
// TODO(burdon): Allow plugins to set extensions (factory).
|
|
161
|
+
const maybeDebug = (): Extension => {
|
|
162
|
+
// TODO(burdon): Parse JSON script format (with key bindings?)
|
|
163
|
+
const items = localStorage.getItem('dxos.composer.demo');
|
|
164
|
+
if (items) {
|
|
165
|
+
return demo({ items: items.split(',') });
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return [];
|
|
169
|
+
};
|
|
170
|
+
|
|
161
171
|
export const TextEditor = forwardRef<TextEditorRef, TextEditorProps>(
|
|
162
172
|
({ extensions = [], slots: _slots, ...props }, forwardedRef) => {
|
|
163
173
|
const { themeMode } = useThemeContext();
|
|
@@ -165,7 +175,7 @@ export const TextEditor = forwardRef<TextEditorRef, TextEditorProps>(
|
|
|
165
175
|
return (
|
|
166
176
|
<BaseTextEditor
|
|
167
177
|
ref={forwardedRef}
|
|
168
|
-
extensions={[basicBundle({ themeMode, placeholder: slots?.editor?.placeholder }), ...extensions]}
|
|
178
|
+
extensions={[basicBundle({ themeMode, placeholder: slots?.editor?.placeholder }), maybeDebug(), ...extensions]}
|
|
169
179
|
slots={slots}
|
|
170
180
|
{...props}
|
|
171
181
|
/>
|
|
@@ -180,7 +190,11 @@ export const MarkdownEditor = forwardRef<TextEditorRef, TextEditorProps>(
|
|
|
180
190
|
return (
|
|
181
191
|
<BaseTextEditor
|
|
182
192
|
ref={forwardedRef}
|
|
183
|
-
extensions={[
|
|
193
|
+
extensions={[
|
|
194
|
+
markdownBundle({ themeMode, placeholder: slots?.editor?.placeholder }),
|
|
195
|
+
maybeDebug(),
|
|
196
|
+
...extensions,
|
|
197
|
+
]}
|
|
184
198
|
slots={slots}
|
|
185
199
|
{...props}
|
|
186
200
|
/>
|
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Extension } from '@codemirror/state';
|
|
6
6
|
import {
|
|
7
|
-
|
|
7
|
+
keymap,
|
|
8
8
|
type DecorationSet,
|
|
9
|
+
type Rect,
|
|
10
|
+
type ViewUpdate,
|
|
11
|
+
Decoration,
|
|
9
12
|
EditorView,
|
|
10
|
-
keymap,
|
|
11
13
|
MatchDecorator,
|
|
12
|
-
type Rect,
|
|
13
14
|
ViewPlugin,
|
|
14
|
-
type ViewUpdate,
|
|
15
15
|
WidgetType,
|
|
16
16
|
} from '@codemirror/view';
|
|
17
17
|
|
|
18
|
+
import { debounce } from '@dxos/async';
|
|
18
19
|
import { invariant } from '@dxos/invariant';
|
|
19
20
|
|
|
20
21
|
// 1. TODO(burdon): Make atomic (for tasklist also).
|
|
@@ -44,10 +45,10 @@ class BookmarkWidget extends WidgetType {
|
|
|
44
45
|
return this._id === other._id;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
// TODO(burdon): Click to select.
|
|
48
48
|
override toDOM() {
|
|
49
49
|
const span = document.createElement('span');
|
|
50
50
|
span.className = 'cm-bookmark';
|
|
51
|
+
// TODO(burdon): Call out to react?
|
|
51
52
|
// https://emojifinder.com/comment
|
|
52
53
|
span.textContent = '💬';
|
|
53
54
|
return span;
|
|
@@ -62,18 +63,28 @@ const styles = EditorView.baseTheme({
|
|
|
62
63
|
padding: '4px',
|
|
63
64
|
backgroundColor: 'yellow',
|
|
64
65
|
},
|
|
66
|
+
'& .cm-bookmark-selected': {
|
|
67
|
+
backgroundColor: 'orange',
|
|
68
|
+
},
|
|
65
69
|
});
|
|
66
70
|
|
|
71
|
+
type CommentsInfo = {
|
|
72
|
+
active?: string;
|
|
73
|
+
items: { id: string; pos: number; location: Rect | null }[];
|
|
74
|
+
};
|
|
75
|
+
|
|
67
76
|
export type CommentsOptions = {
|
|
68
77
|
key?: string;
|
|
69
78
|
onCreate?: () => string | void;
|
|
70
|
-
onUpdate?: (info:
|
|
79
|
+
onUpdate?: (info: CommentsInfo) => void;
|
|
71
80
|
};
|
|
72
81
|
|
|
73
82
|
// https://www.markdownguide.org/extended-syntax/#footnotes
|
|
74
83
|
// TODO(burdon): Record span in automerge model?
|
|
75
84
|
// TODO(burdon): Extended markdown: https://www.markdownguide.org/extended-syntax
|
|
76
85
|
export const comments = (options: CommentsOptions = {}): Extension => {
|
|
86
|
+
let active: string | undefined;
|
|
87
|
+
|
|
77
88
|
const bookmarkMatcher = new MatchDecorator({
|
|
78
89
|
regexp: /\[\^(\w+)\]/g,
|
|
79
90
|
decoration: (match, view, pos) => {
|
|
@@ -105,10 +116,14 @@ export const comments = (options: CommentsOptions = {}): Extension => {
|
|
|
105
116
|
},
|
|
106
117
|
);
|
|
107
118
|
|
|
119
|
+
const doUpdate = debounce((data: CommentsInfo) => {
|
|
120
|
+
options.onUpdate?.(data);
|
|
121
|
+
}, 200);
|
|
122
|
+
|
|
108
123
|
return [
|
|
109
124
|
keymap.of([
|
|
110
125
|
{
|
|
111
|
-
key: options?.key ?? '
|
|
126
|
+
key: options?.key ?? 'shift-meta-c',
|
|
112
127
|
run: (view) => {
|
|
113
128
|
// Insert footnote.
|
|
114
129
|
const id = options.onCreate?.();
|
|
@@ -132,39 +147,41 @@ export const comments = (options: CommentsOptions = {}): Extension => {
|
|
|
132
147
|
|
|
133
148
|
// Monitor cursor movement.
|
|
134
149
|
EditorView.updateListener.of((update) => {
|
|
150
|
+
active = undefined;
|
|
151
|
+
if (!options.onUpdate) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
|
|
135
155
|
const view = update.view;
|
|
136
156
|
const pos = view.state.selection.main.head;
|
|
137
157
|
|
|
138
158
|
const decorations: { from: number; to: number; value: Decoration }[] = [];
|
|
139
159
|
const rangeSet = view.plugin(bookmarks)?.bookmarks;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
160
|
+
let closest = Infinity;
|
|
161
|
+
// TODO(burdon): Always shows entire document?
|
|
162
|
+
const { from, to } = view.visibleRanges?.[0] ?? { from: 0, to: view.state.doc.length };
|
|
163
|
+
rangeSet?.between(from, to, (from, to, value) => {
|
|
164
|
+
decorations.push({ from, to, value });
|
|
165
|
+
const d = Math.min(Math.abs(pos - from), Math.abs(pos - to));
|
|
166
|
+
if (d < closest) {
|
|
167
|
+
// TODO(burdon): Update class of selected.
|
|
168
|
+
active = value.spec.id;
|
|
169
|
+
closest = d;
|
|
143
170
|
}
|
|
144
171
|
});
|
|
145
172
|
|
|
146
173
|
if (decorations.length) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
value: {
|
|
159
|
-
spec: { id },
|
|
160
|
-
},
|
|
161
|
-
}) => id,
|
|
162
|
-
),
|
|
163
|
-
active: id,
|
|
164
|
-
pos,
|
|
165
|
-
location,
|
|
166
|
-
});
|
|
167
|
-
}
|
|
174
|
+
doUpdate({
|
|
175
|
+
active,
|
|
176
|
+
items: decorations.map(
|
|
177
|
+
({
|
|
178
|
+
from,
|
|
179
|
+
value: {
|
|
180
|
+
spec: { id },
|
|
181
|
+
},
|
|
182
|
+
}) => ({ id: id as string, pos: from, location: view.coordsAtPos(from) }),
|
|
183
|
+
),
|
|
184
|
+
});
|
|
168
185
|
}
|
|
169
186
|
}),
|
|
170
187
|
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { keymap } from '@codemirror/view';
|
|
6
|
+
|
|
7
|
+
export type DemoOptions = {
|
|
8
|
+
delay?: number;
|
|
9
|
+
items?: string[];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const defaultItems = ['hello world!', 'this is a test.', 'this is [DXOS](https://dxos.org)'];
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Demo script.
|
|
16
|
+
* Configurable plugin that let's user cycle through pre-configured input script.
|
|
17
|
+
*/
|
|
18
|
+
export const demo = ({ delay = 75, items = defaultItems }: DemoOptions = {}) => {
|
|
19
|
+
let t: any;
|
|
20
|
+
let idx = 0;
|
|
21
|
+
|
|
22
|
+
return [
|
|
23
|
+
keymap.of([
|
|
24
|
+
{
|
|
25
|
+
// Reset.
|
|
26
|
+
key: "alt-meta-'",
|
|
27
|
+
run: (view) => {
|
|
28
|
+
clearTimeout(t);
|
|
29
|
+
idx = 0;
|
|
30
|
+
return true;
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
// Next prompt.
|
|
35
|
+
// TODO(burdon): Press 1-9 to select prompt?
|
|
36
|
+
key: "shift-meta-'",
|
|
37
|
+
run: (view) => {
|
|
38
|
+
clearTimeout(t);
|
|
39
|
+
// TODO(burdon): Add space if needed.
|
|
40
|
+
const text = items[idx++];
|
|
41
|
+
if (idx === items?.length) {
|
|
42
|
+
idx = 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
let i = 0;
|
|
46
|
+
const insert = (d = 0) => {
|
|
47
|
+
t = setTimeout(() => {
|
|
48
|
+
const pos = view.state.selection.main.head;
|
|
49
|
+
view.dispatch({
|
|
50
|
+
changes: { from: pos, insert: text[i++] },
|
|
51
|
+
selection: { anchor: pos + 1 },
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
if (i < text.length) {
|
|
55
|
+
insert(Math.random() * delay * (text[i] === ' ' ? 2 : 1));
|
|
56
|
+
}
|
|
57
|
+
}, d);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
insert();
|
|
61
|
+
return true;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
]),
|
|
65
|
+
];
|
|
66
|
+
};
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import { StateField } from '@codemirror/state';
|
|
6
6
|
|
|
7
|
-
export type
|
|
7
|
+
export type ListenerOptions = { onChange: (text: string) => void };
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Based on https://github.com/codemirror/dev/issues/44#issuecomment-789093799
|
|
11
11
|
*/
|
|
12
12
|
// TODO(burdon): Expose options.
|
|
13
|
-
export const listener = (onChange:
|
|
13
|
+
export const listener = ({ onChange }: ListenerOptions) =>
|
|
14
14
|
StateField.define({
|
|
15
15
|
create: () => null,
|
|
16
16
|
update: (_value, transaction) => {
|