Skip to content

Commit

Permalink
feat: add get_selected_text
Browse files Browse the repository at this point in the history
  • Loading branch information
yetone committed May 4, 2024
1 parent b036370 commit 5a60544
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ version = "0.0.0"
crate-type = ["cdylib"]

[dependencies]
get-selected-text = "0.1.0"
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
napi = { version = "2.12.2", default-features = false, features = ["napi4"] }
napi-derive = "2.12.2"
Expand Down
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#[macro_use]
extern crate napi_derive;

use get_selected_text::get_selected_text as _get_selected_text;

#[napi]
pub fn sum(a: i32, b: i32) -> i32 {
a + b
pub fn get_selected_text() -> String {
_get_selected_text().unwrap_or_default()
}

0 comments on commit 5a60544

Please sign in to comment.