Skip to content

Commit

Permalink
feat: update menu handler arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
zzxming committed Jan 9, 2025
1 parent ca2be19 commit 998bab2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ export class QuillQuickInsert {
},
onClick: () => {
relativeLine.domNode.innerHTML = '';
item.handler.call(this.quill, item.name);
const range = this.quill.getSelection();
item.handler.call(this.quill, item, range);
this.destroyMenuList();
},
};
Expand Down
3 changes: 2 additions & 1 deletion src/utils/types.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import type Quill from 'quill';
import type { Range } from 'quill';

export interface MenuItems {
name: string;
alias: string[];
icon: string;
title: string;
descriptions?: string;
handler: (this: Quill, name: string, options?: any) => void;
handler: (this: Quill, item: MenuItems, range: Range | null, options?: any) => void;
}

export interface QuillQuickInsertOptions {
Expand Down

0 comments on commit 998bab2

Please sign in to comment.