Skip to content

Commit

Permalink
update editor dependencies (#230)
Browse files Browse the repository at this point in the history
* remove playground

* [editor] bake in basic setup instead

* update dependencies

* add changeset
  • Loading branch information
xiaoxinghu authored Nov 27, 2023
1 parent 5a1f944 commit 0f825de
Show file tree
Hide file tree
Showing 19 changed files with 1,213 additions and 982 deletions.
9 changes: 9 additions & 0 deletions .changeset/sharp-news-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@orgajs/cm-lang': patch
'@orgajs/example-editor': patch
'@orgajs/editor': patch
'@orgajs/lezer': patch
'website': patch
---

update editor dependencies
2 changes: 1 addition & 1 deletion examples/editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"preview": "vite preview"
},
"devDependencies": {
"@codemirror/view": "^6.17.1",
"@codemirror/view": "^6.22.0",
"typescript": "^5.2.2",
"vite": "^4.4.9"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/codemirror-lang/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"directory": "packages/cm-lang"
},
"dependencies": {
"@codemirror/language": "^6.9.0",
"@codemirror/language": "^6.9.2",
"@orgajs/lezer": "workspace:^"
},
"devDependencies": {
"@lezer/common": "^1.1.0"
"@lezer/common": "^1.1.1"
}
}
21 changes: 0 additions & 21 deletions packages/editor/lib/battery.js

This file was deleted.

8 changes: 3 additions & 5 deletions packages/editor/lib/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
* @property {boolean} [dark=false]
* @property {OnChange} [onChange=() => {}]
*/
import { EditorView } from '@codemirror/view'
import { Compartment, EditorState } from '@codemirror/state'
import { org } from '@orgajs/cm-lang'
import theme from './theme.js'
import { EditorView } from '@codemirror/view'
import { setup } from './setup.js'

/**
* @param {Config} config
Expand All @@ -31,9 +30,8 @@ export function makeEditor(config) {
const state = EditorState.create({
doc: content,
extensions: [
org(),
setup,
themeConfig.of(EditorView.theme({}, { dark })),
theme,
extensions,
],
})
Expand Down
1 change: 0 additions & 1 deletion packages/editor/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
*/

export { makeEditor } from './editor.js'
export { battery } from './battery.js'
export { tags } from '@orgajs/cm-lang'
28 changes: 28 additions & 0 deletions packages/editor/lib/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { foldGutter, toggleFold, bracketMatching } from '@codemirror/language'
import { defaultKeymap } from '@codemirror/commands'
import { EditorView, highlightActiveLine, keymap } from '@codemirror/view'
import { cleanup } from './extensions/index.js'
import { org } from '@orgajs/cm-lang'
import theme from './theme.js'

const keys = [
{
key: 'Tab',
run: toggleFold,
},
]

export const setup = (() => [
org(),
theme,
keymap.of([...defaultKeymap]),
highlightActiveLine(),
foldGutter({
openText: '▾',
closedText: '▸',
}),
EditorView.lineWrapping,
bracketMatching(),
cleanup,
keymap.of([...defaultKeymap, ...keys]),
])()
5 changes: 3 additions & 2 deletions packages/editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@
"author": "Xiaoxing Hu <[email protected]>",
"license": "MIT",
"dependencies": {
"@codemirror/language": "^6.9.0",
"@codemirror/view": "^6.17.1",
"@codemirror/commands": "^6.3.0",
"@codemirror/language": "^6.9.2",
"@codemirror/view": "^6.22.0",
"@orgajs/cm-lang": "workspace:^"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/lezer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"directory": "packages/lezer"
},
"dependencies": {
"@lezer/common": "^1.0.4",
"@lezer/highlight": "^1.1.6",
"@lezer/common": "^1.1.1",
"@lezer/highlight": "^1.2.0",
"orga": "workspace:^",
"unist-util-visit": "^5.0.0"
},
Expand Down
261 changes: 0 additions & 261 deletions packages/playground/CHANGELOG.md

This file was deleted.

Loading

0 comments on commit 0f825de

Please sign in to comment.