Skip to content

Commit

Permalink
feat: upgrade milkdown to v7
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Mar 27, 2023
1 parent 74536ea commit 1806140
Show file tree
Hide file tree
Showing 11 changed files with 288 additions and 1,024 deletions.
34 changes: 16 additions & 18 deletions packages/better-write-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,22 @@
},
"dependencies": {
"@headlessui/vue": "1.7.12",
"@milkdown/core": "6.4.1",
"@milkdown/design-system": "6.4.1",
"@milkdown/plugin-block": "6.4.1",
"@milkdown/plugin-clipboard": "6.4.1",
"@milkdown/plugin-cursor": "6.4.1",
"@milkdown/plugin-emoji": "6.4.1",
"@milkdown/plugin-history": "6.4.1",
"@milkdown/plugin-indent": "6.4.1",
"@milkdown/plugin-listener": "6.4.1",
"@milkdown/plugin-math": "6.4.1",
"@milkdown/plugin-menu": "6.4.1",
"@milkdown/plugin-slash": "6.4.1",
"@milkdown/plugin-tooltip": "6.4.1",
"@milkdown/plugin-trailing": "6.4.1",
"@milkdown/plugin-upload": "6.4.1",
"@milkdown/preset-commonmark": "6.4.1",
"@milkdown/prose": "6.4.1",
"@milkdown/theme-pack-helper": "6.4.1",
"@milkdown/core": "7.1.1",
"@milkdown/ctx": "7.1.1",
"@milkdown/transformer": "7.1.1",
"@milkdown/plugin-block": "7.1.1",
"@milkdown/plugin-clipboard": "7.1.1",
"@milkdown/plugin-cursor": "7.1.1",
"@milkdown/plugin-emoji": "7.1.1",
"@milkdown/plugin-history": "7.1.1",
"@milkdown/plugin-indent": "7.1.1",
"@milkdown/plugin-listener": "7.1.1",
"@milkdown/plugin-math": "7.1.1",
"@milkdown/plugin-tooltip": "7.1.1",
"@milkdown/plugin-trailing": "7.1.1",
"@milkdown/plugin-upload": "7.1.1",
"@milkdown/preset-commonmark": "7.1.1",
"@milkdown/prose": "7.1.1",
"@sentry/tracing": "7.45.0",
"@sentry/vue": "7.45.0",
"@supabase/supabase-js": "2.10.0",
Expand Down
4 changes: 3 additions & 1 deletion packages/better-write-app/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ import i18n from './lang'
import App from './App.vue'

import 'virtual:windi.css'
import 'better-write-plugin-theme/css/inject.css'
import '@milkdown/prose/view/style/prosemirror.css'
import '@milkdown/prose/tables/style/tables.css'
import 'floating-vue/dist/style.css'
import 'vue-toastification/dist/index.css'
import 'better-write-plugin-theme/css/inject.css'

const env = useEnv()

Expand Down

This file was deleted.

177 changes: 0 additions & 177 deletions packages/better-write-plugin-annotations/src/plugin/slash.ts

This file was deleted.

33 changes: 14 additions & 19 deletions packages/better-write-plugin-annotations/src/set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ import {
ProjectStateAnnotationFolder,
} from 'better-write-types'
import { On } from 'better-write-plugin-core'
import { rootCtx, defaultValueCtx, Editor } from '@milkdown/core'
import {
rootCtx,
defaultValueCtx,
Editor,
editorViewOptionsCtx,
} from '@milkdown/core'
import { listener, listenerCtx } from '@milkdown/plugin-listener'
import { math } from '@milkdown/plugin-math'
import { tooltip } from '@milkdown/plugin-tooltip'
import { clipboard } from '@milkdown/plugin-clipboard'
import { block } from '@milkdown/plugin-block'
import { history } from '@milkdown/plugin-history'
import { cursor } from '@milkdown/plugin-cursor'
import { indent, indentPlugin } from '@milkdown/plugin-indent'
import { trailing } from '@milkdown/plugin-trailing'
import { upload } from '@milkdown/plugin-upload'
import { emoji } from '@milkdown/plugin-emoji'
import { bw } from './theme'
import { cmk } from './plugin/commonmark'
import { sls } from './plugin/slash'
import { commonmark } from '@milkdown/preset-commonmark'
import { ID } from 'better-write-types'
import { nextTick } from 'vue-demi'

Expand Down Expand Up @@ -136,29 +136,24 @@ export const PluginAnnotationsSet = (
)
}

ctx.get(listenerCtx).updated((ctx, doc, prevDoc) => {
ctx.get(listenerCtx).updated((_, doc) => {
setFile(file.id, doc.toJSON())
})

ctx.update(editorViewOptionsCtx, (prev) => ({
...prev,
attributes: { class: 'milkdown-betterwrite', spellcheck: 'true' },
}))
})
.use(listener)
.use(cmk)
.use(commonmark)
.use(math)
.use(sls(hooks))
.use(tooltip)
.use(clipboard)
.use(block)
.use(history)
.use(cursor)
.use(trailing)
.use(upload)
.use(emoji)
.use(
indent.configure(indentPlugin, {
type: 'space',
size: 2,
})
)
.use(bw)
.create()
}

Expand Down
Loading

0 comments on commit 1806140

Please sign in to comment.