Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 fix type error in keyboard plugin #2674

Merged
merged 1 commit into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/x6-plugin-keyboard/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export class Keyboard extends Disposable {
}

public init(graph: Graph) {
this.keyboard = new KeyboardImpl(this.options, graph)
this.keyboard = new KeyboardImpl({
...this.options,
graph,
})
}

isKeyboardEnabled() {
Expand Down
8 changes: 5 additions & 3 deletions packages/x6-plugin-keyboard/src/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ export class KeyboardImpl extends Disposable implements IDisablable {
private readonly container: HTMLElement
private readonly mousetrap: Mousetrap.MousetrapInstance

private get graph() {
return this.options.graph
}

constructor(
private readonly options: KeyboardImpl.Options,
private readonly graph: Graph,
private readonly options: KeyboardImpl.Options & { graph: Graph },
) {
super()

Expand Down Expand Up @@ -149,7 +152,6 @@ export namespace KeyboardImpl {
export type Handler = (e: KeyboardEvent) => void

export interface Options {
graph: Graph
enabled?: boolean

/**
Expand Down
2 changes: 2 additions & 0 deletions scripts/build-dev
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ wait

lerna run build --stream --scope @antv/x6-vue-shape \
--scope @antv/x6-react-shape \
--scope @antv/x6-plugin-keyboard \
--scope @antv/x6-plugin-scroller

wait