Skip to content

Commit 7a98119

Browse files
🔄 Sync from private repository - 2026-02-09 06:16:06
1 parent 569addc commit 7a98119

File tree

7 files changed

+1855
-36
lines changed

7 files changed

+1855
-36
lines changed

API.en.md

Lines changed: 81 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The following icons indicate API compatibility when running in background trigge
1818

1919
- [console](#console) ✅ - Console output
2020
- [device](#device) ✅ - Device information
21-
- [clipboard](#clipboard) ⚠️ - Clipboard operations
21+
- [clipboard](#clipboard) - Clipboard operations & text input field writing
2222
- [storage](#storage) ✅ - Local key-value storage
2323
- [icloud](#icloud) ✅ - iCloud file operations
2424
- [file](#file) ✅ - File system operations
@@ -181,9 +181,9 @@ Retrieve screen and display metrics
181181

182182
## clipboard
183183

184-
![Limited Support](https://img.shields.io/badge/Trigger-Limited-orange)
184+
![Full Support](https://img.shields.io/badge/Trigger-Full-brightgreen)
185185

186-
Clipboard operations
186+
Clipboard operations & text input field writing
187187

188188
### `clipboard.getText`
189189

@@ -199,8 +199,6 @@ Get text from the clipboard
199199

200200
### `clipboard.setText`
201201

202-
![Not Supported](https://img.shields.io/badge/Trigger-None-red)
203-
204202
**Signature:** `setText(text)`
205203

206204
Set text to the clipboard
@@ -217,8 +215,6 @@ Set text to the clipboard
217215

218216
### `clipboard.clear`
219217

220-
![Not Supported](https://img.shields.io/badge/Trigger-None-red)
221-
222218
**Signature:** `clear()`
223219

224220
Clear the clipboard
@@ -239,6 +235,84 @@ Check if the clipboard contains text
239235

240236
---
241237

238+
### `clipboard.insertText`
239+
240+
**Signature:** `insertText(text)`
241+
242+
Insert text at cursor position in the currently focused input field (keyboard must be active)
243+
244+
**Parameters:**
245+
246+
| Name | Type | Description | Optional |
247+
|------|------|-------------|----------|
248+
| `text` | `string` | The text to insert | No |
249+
250+
**Returns:** `boolean`
251+
252+
*Whether the insertion was successful (returns false if no input field is focused)*
253+
254+
---
255+
256+
### `clipboard.deleteBackward`
257+
258+
**Signature:** `deleteBackward(count)`
259+
260+
Delete characters before the cursor in the focused input field
261+
262+
**Parameters:**
263+
264+
| Name | Type | Description | Optional |
265+
|------|------|-------------|----------|
266+
| `count` | `number` | Number of characters to delete, defaults to 1 | No |
267+
268+
**Returns:** `boolean`
269+
270+
*Whether the deletion was successful*
271+
272+
---
273+
274+
### `clipboard.getInputText`
275+
276+
**Signature:** `getInputText()`
277+
278+
Get the full text content of the currently focused input field
279+
280+
**Returns:** `string \| null`
281+
282+
*The input field text content, or null if no input is focused*
283+
284+
---
285+
286+
### `clipboard.setInputText`
287+
288+
**Signature:** `setInputText(text)`
289+
290+
Replace all text in the currently focused input field (select all then replace)
291+
292+
**Parameters:**
293+
294+
| Name | Type | Description | Optional |
295+
|------|------|-------------|----------|
296+
| `text` | `string` | The replacement text | No |
297+
298+
**Returns:** `boolean`
299+
300+
*Whether the replacement was successful*
301+
302+
---
303+
304+
### `clipboard.hasInputFocus`
305+
306+
**Signature:** `hasInputFocus()`
307+
308+
Check if any input field is currently focused (whether the keyboard is active)
309+
310+
**Returns:** `boolean`
311+
312+
*Whether an input field is focused*
313+
314+
---
315+
242316
## storage
243317

244318
![Full Support](https://img.shields.io/badge/Trigger-Full-brightgreen)

API.md

Lines changed: 81 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The following icons indicate API compatibility when running in background trigge
1818

1919
- [console](#console) ✅ - 控制台输出
2020
- [device](#device) ✅ - 设备信息
21-
- [clipboard](#clipboard) ⚠️ - 剪贴板操作
21+
- [clipboard](#clipboard) - 剪贴板操作 & 输入框文本写入
2222
- [storage](#storage) ✅ - 本地存储
2323
- [icloud](#icloud) ✅ - iCloud 文件操作
2424
- [file](#file) ✅ - 文件操作
@@ -180,9 +180,9 @@ The following icons indicate API compatibility when running in background trigge
180180

181181
## clipboard
182182

183-
![Limited Support](https://img.shields.io/badge/Trigger-Limited-orange)
183+
![Full Support](https://img.shields.io/badge/Trigger-Full-brightgreen)
184184

185-
剪贴板操作
185+
剪贴板操作 & 输入框文本写入
186186

187187
### `clipboard.getText`
188188

@@ -198,8 +198,6 @@ The following icons indicate API compatibility when running in background trigge
198198

199199
### `clipboard.setText`
200200

201-
![Not Supported](https://img.shields.io/badge/Trigger-None-red)
202-
203201
**Signature:** `setText(text)`
204202

205203
设置剪贴板文本
@@ -216,8 +214,6 @@ The following icons indicate API compatibility when running in background trigge
216214

217215
### `clipboard.clear`
218216

219-
![Not Supported](https://img.shields.io/badge/Trigger-None-red)
220-
221217
**Signature:** `clear()`
222218

223219
清空剪贴板
@@ -238,6 +234,84 @@ The following icons indicate API compatibility when running in background trigge
238234

239235
---
240236

237+
### `clipboard.insertText`
238+
239+
**Signature:** `insertText(text)`
240+
241+
向当前聚焦的输入框光标位置插入文本(需键盘已弹出)
242+
243+
**Parameters:**
244+
245+
| Name | Type | Description | Optional |
246+
|------|------|-------------|----------|
247+
| `text` | `string` | 要插入的文本内容 | No |
248+
249+
**Returns:** `boolean`
250+
251+
*是否成功插入(无聚焦输入框时返回 false)*
252+
253+
---
254+
255+
### `clipboard.deleteBackward`
256+
257+
**Signature:** `deleteBackward(count)`
258+
259+
删除聚焦输入框中光标前的字符
260+
261+
**Parameters:**
262+
263+
| Name | Type | Description | Optional |
264+
|------|------|-------------|----------|
265+
| `count` | `number` | 要删除的字符数量,默认 1 | No |
266+
267+
**Returns:** `boolean`
268+
269+
*是否成功删除*
270+
271+
---
272+
273+
### `clipboard.getInputText`
274+
275+
**Signature:** `getInputText()`
276+
277+
获取当前聚焦输入框的全部文本内容
278+
279+
**Returns:** `string \| null`
280+
281+
*输入框文本内容,无聚焦输入框时返回 null*
282+
283+
---
284+
285+
### `clipboard.setInputText`
286+
287+
**Signature:** `setInputText(text)`
288+
289+
替换当前聚焦输入框的全部文本(全选后替换)
290+
291+
**Parameters:**
292+
293+
| Name | Type | Description | Optional |
294+
|------|------|-------------|----------|
295+
| `text` | `string` | 替换后的文本内容 | No |
296+
297+
**Returns:** `boolean`
298+
299+
*是否成功替换*
300+
301+
---
302+
303+
### `clipboard.hasInputFocus`
304+
305+
**Signature:** `hasInputFocus()`
306+
307+
检查当前是否有输入框处于聚焦状态(键盘是否已弹出)
308+
309+
**Returns:** `boolean`
310+
311+
*是否有输入框聚焦*
312+
313+
---
314+
241315
## storage
242316

243317
![Full Support](https://img.shields.io/badge/Trigger-Full-brightgreen)

TrollScript-Private

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 6395cdd06f881d29d393339dda1de82955fb941c
1+
Subproject commit 4e329a0fff7bf61eedafca1aad98891e446617c1

npm/index.d.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,39 @@ interface Clipboard {
8989
*/
9090
hasText(): boolean;
9191

92+
/**
93+
* 向当前聚焦的输入框光标位置插入文本(需键盘已弹出)
94+
* @param text 要插入的文本内容
95+
* @returns 是否成功插入(无聚焦输入框时返回 false)
96+
*/
97+
insertText(text: string): boolean;
98+
99+
/**
100+
* 删除聚焦输入框中光标前的字符
101+
* @param count 要删除的字符数量,默认 1
102+
* @returns 是否成功删除
103+
*/
104+
deleteBackward(count?: number): boolean;
105+
106+
/**
107+
* 获取当前聚焦输入框的全部文本内容
108+
* @returns 输入框文本内容,无聚焦输入框时返回 null
109+
*/
110+
getInputText(): any;
111+
112+
/**
113+
* 替换当前聚焦输入框的全部文本(全选后替换)
114+
* @param text 替换后的文本内容
115+
* @returns 是否成功替换
116+
*/
117+
setInputText(text: string): boolean;
118+
119+
/**
120+
* 检查当前是否有输入框处于聚焦状态(键盘是否已弹出)
121+
* @returns 是否有输入框聚焦
122+
*/
123+
hasInputFocus(): boolean;
124+
92125
}
93126

94127
declare const clipboard: Clipboard;

0 commit comments

Comments
 (0)