Skip to content

Commit

Permalink
fix: wrong type of paste event
Browse files Browse the repository at this point in the history
  • Loading branch information
mkslanc committed Jan 27, 2025
1 parent 5acea6d commit bd77ac7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ace-internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ export namespace Ace {
/**
* Emitted when text is pasted.
**/
"paste": (text: string, event: any) => void;
"paste": (e: { text: string }) => void;
/**
* Emitted when the selection style changes, via [[Editor.setSelectionStyle]].
* @param data Contains one property, `data`, which indicates the new selection style
Expand Down
4 changes: 3 additions & 1 deletion ace.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,9 @@ declare module "ace-code" {
/**
* Emitted when text is pasted.
**/
"paste": (text: string, event: any) => void;
"paste": (e: {
text: string;
}) => void;
/**
* Emitted when the selection style changes, via [[Editor.setSelectionStyle]].
* @param data Contains one property, `data`, which indicates the new selection style
Expand Down
6 changes: 5 additions & 1 deletion demo/test_package/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,8 @@ const filter = new FilteredList([]);
filter.setFilter("test");

editor.session.startOperation();
editor.session.endOperation();
editor.session.endOperation();

editor.on("paste", (e) => {
e.text;
})
2 changes: 1 addition & 1 deletion src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ class Editor {

/**
*
* @param e
* @param {string | {text: string}} e
* @returns {boolean}
*/
$handlePaste(e) {
Expand Down
2 changes: 1 addition & 1 deletion types/ace-modules.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ declare module "ace-code/src/virtual_renderer" {
* @param {EditSession} session The session to associate with
**/
setSession(session: EditSession): void;
session: import("ace-code/src/edit_session").EditSession;
session: import("ace-code").Ace.EditSession;
/**
* Triggers a partial update of the text, from the range given by the two parameters.
* @param {Number} firstRow The first row to update
Expand Down

0 comments on commit bd77ac7

Please sign in to comment.