An open API service indexing awesome lists of open source software.

https://github.com/tategakibunko/selection-edit

Insert or wrap text to selected range in form elements.
https://github.com/tategakibunko/selection-edit

Last synced: 3 months ago
JSON representation

Insert or wrap text to selected range in form elements.

Awesome Lists containing this project

README

        

## Summary

Insert or wrap text to selected range in form elements.

## Usage

```javascript
var textarea = document.querySelector("textarea#input");

var hello_button = document.querySelector("button#insert-hello");
hello_button.onclick = function(){
textarea.value = new SelectionEdit(textarea).insertText("hello!");
};

var bold_button = document.querySelector("button#to-bold");
bold_button.onclick = function(){
textarea.value = new SelectionEdit(textarea).wrapText("", "");
};
```

## License

MIT.