Skip to content

Commit 5a6068e

Browse files
chore: bump up refractor version to v5 (#1727)
* chore: bump up refractor version to v5 * chore: fix --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Saul-Mirone <[email protected]>
1 parent f29caba commit 5a6068e

File tree

4 files changed

+27
-37
lines changed

4 files changed

+27
-37
lines changed

Diff for: packages/plugins/plugin-prism/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
},
4747
"dependencies": {
4848
"@milkdown/utils": "workspace:*",
49-
"refractor": "^4.0.0",
49+
"@types/hast": "^3.0.4",
50+
"refractor": "^5.0.0",
5051
"tslib": "^2.8.1"
5152
},
5253
"devDependencies": {

Diff for: packages/plugins/plugin-prism/src/get-decorations.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
import { findChildren } from '@milkdown/prose'
22
import type { Node } from '@milkdown/prose/model'
33
import { Decoration, DecorationSet } from '@milkdown/prose/view'
4-
import type { RefractorElement, Text } from 'refractor/lib/common'
5-
import type { Refractor } from 'refractor/lib/core'
4+
import type { Refractor } from 'refractor/core'
5+
import type { RootContent, Text } from 'hast'
66

77
export interface FlattedNode {
88
text: string
99
className: string[]
1010
}
1111

12-
type RefractorNode = RefractorElement | Text
13-
14-
function flatNodes(nodes: RefractorNode[], className: string[] = []) {
12+
function flatNodes(nodes: RootContent[], className: string[] = []) {
1513
return nodes.flatMap((node): FlattedNode[] =>
1614
node.type === 'element'
1715
? flatNodes(node.children, [
1816
...className,
1917
...((node.properties?.className as string[]) || []),
2018
])
21-
: [{ text: node.value, className }]
19+
: [{ text: (node as Text).value, className }]
2220
)
2321
}
2422

Diff for: packages/plugins/plugin-prism/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Refractor } from 'refractor/lib/core'
1+
import type { Refractor } from 'refractor/core'
22

33
import { findChildren } from '@milkdown/prose'
44
import { Plugin, PluginKey } from '@milkdown/prose/state'

Diff for: pnpm-lock.yaml

+20-29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)