-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
827 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"revision":"v1.2.3 fbea0c5","timestamp":1721591925} | ||
{"revision":"v1.2.3 2ba2321","timestamp":1722756920} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const REVISION = 'v1.2.3 fbea0c5' | ||
export const REVISION = 'v1.2.3 2ba2321' | ||
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision, prettier/prettier | ||
export const TIMESTAMP = 1721591925 | ||
export const TIMESTAMP = 1722756920 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
/** Globals */ | ||
::-webkit-scrollbar { | ||
width: 6px; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { createSignal, onCleanup, onMount } from 'solid-js' | ||
import { Editor, rootCtx } from '@milkdown/core' | ||
import { commonmark } from '@milkdown/preset-commonmark' | ||
import { history } from '@milkdown/plugin-history' | ||
import { collab, CollabService, collabServiceCtx } from '@milkdown/plugin-collab' | ||
import { nord } from '@milkdown/theme-nord' | ||
import { NdnSvsAdaptor } from '@ucla-irl/ndnts-aux/adaptors' | ||
import * as Y from 'yjs' | ||
|
||
import '@milkdown/theme-nord/style.css' | ||
|
||
export default function MarkdownDoc(props: { | ||
doc: Y.XmlFragment | ||
provider: NdnSvsAdaptor | ||
username: string | ||
subDocId: string | ||
}) { | ||
const [container, setContainer] = createSignal<HTMLDivElement>() | ||
const [editor, setEditor] = createSignal<Editor>() | ||
const [collabService, setCollabService] = createSignal<CollabService>() | ||
|
||
onMount(async () => { | ||
const editor = await Editor.make() | ||
.config((ctx) => { | ||
ctx.set(rootCtx, container()) | ||
}) | ||
.config(nord) | ||
.use(commonmark) | ||
.use(history) | ||
.use(collab) | ||
.create() | ||
|
||
setEditor(editor) | ||
props.provider.bindAwareness(props.doc.doc!, props.subDocId) | ||
|
||
editor.action((ctx) => { | ||
const collabSrv = ctx.get(collabServiceCtx) | ||
setCollabService(collabSrv) | ||
|
||
collabSrv | ||
// bind doc and awareness | ||
.bindDoc(props.doc.doc!) | ||
.setAwareness(props.provider.awareness!) | ||
// connect yjs with milkdown | ||
.connect() | ||
}) | ||
}) | ||
|
||
onCleanup(() => { | ||
collabService()?.disconnect() | ||
props.provider.cancelAwareness() | ||
editor()?.destroy() | ||
}) | ||
|
||
return <div ref={setContainer} /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import typography from "@tailwindcss/typography"; | ||
|
||
/** @type {import('tailwindcss').Config} */ | ||
export default { | ||
content: ["./src/**/*.{js,jsx,ts,tsx}"], | ||
theme: { | ||
extend: {}, | ||
}, | ||
plugins: [typography], | ||
}; |