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.
- Host: GitHub
- URL: https://github.com/tategakibunko/selection-edit
- Owner: tategakibunko
- Created: 2015-07-18T10:47:13.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-07-18T10:51:55.000Z (almost 10 years ago)
- Last Synced: 2025-01-12T08:33:20.457Z (4 months ago)
- Language: JavaScript
- Size: 117 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.