Skip to content

Commit

Permalink
monaco local
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomorebonato committed Jun 27, 2023
1 parent b4ce4aa commit 350d560
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions client/features/collab-editor.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { HocuspocusProvider } from '@hocuspocus/provider'
import Editor from '@monaco-editor/react'
import Editor, { loader } from '@monaco-editor/react'
import './collab-editor.css'

import * as monaco from 'monaco-editor'
import { IndexeddbPersistence } from 'y-indexeddb'
import { MonacoBinding } from 'y-monaco'
import * as Y from 'yjs'

loader.config({ monaco })

const DOC_NAME = 'collab-editor'
const getRandomColor = () => Math.floor(Math.random() * 16777215).toString(16)
const invertHex = (hex: string) => {
Expand All @@ -16,7 +19,7 @@ const createCssClass = (className: string, definition: string) => {
return
}
const style = document.createElement('style')
style.type = 'text/css'

style.innerHTML = `.${className} { ${definition} }`
style.id = className

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"fast-jwt": "^3.1.1",
"fastify": "^4.18.0",
"fastify-print-routes": "^2.1.0",
"monaco-editor": "^0.39.0",
"prettier": "^2.8.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 350d560

Please sign in to comment.