spiegel-keyman/web/docs/engine/reference/interface/insertText.md
Marc Durdin 1f82507730 docs(web): deprecate unused and obsolete API endpoints and docs cleanup
Deprecate the following obsolete functions and properties:
* `keyman.helpURL`
* `keyman.util.rgba`
* `keyman.util.toFloat`
* `keyman.util.toNumber`
* `keyman.util.toNzString`

Use correct language for code blocks in Keyman Engine for Web
documentation.

Test-bot: skip
2026-08-12 16:07:22 +02:00

38 lines
859 B
Markdown

---
title: insertText (KT)
---
## Summary
Inserts a text string and optional [`deadkey`](/developer/language/reference/deadkey) into the active output element.
## Syntax
```js
keyman.interface.insertText(text, dk);
```
or
```js
KeymanWeb.KT(text, dk); // Shorthand
```
### Parameters
`text`
: Type: `string`
: The text to insert.
`dk`
: Type: `number` *optional*
: The deadkey's id, if one is to be inserted.
### Return Value
`boolean`
: `true` if the operation is successful, otherwise `false`.
## Description
This function is designed to allow custom UI elements or custom OSK displays (as for the [EuroLatin keyboard](https://keymanweb.com/#aae,Keyboard_sil_euro_latin)) to directly insert input into a control without losing the current input state due to loss of focus for the control. It is safe for use outside of keyboard code.