README
textarea-code
adds code editor behavior to a
🔧 Install · 🧩 Example · 📜 API docs · 🔥 Releases · 💪🏼 Contribute · 🖐️ Help
Install
$ npm i textarea-code
Or directly from jsDelivr:
import { TextAreaCodeElement } from 'https://cdn.jsdelivr.net/gh/stagas/textarea-code/textarea-code.min.js'
Only ~2.6kb minified + brotli!
Features
- Tab/Shift + Tab Indent/unindent selection or line
- Cmd + / - Toggle single comment in selection or line
- Cmd + Shift + / - Toggle double comment in selection or position
- Cmd + Shift + d - Duplicate line or selection
- Alt + Up / Alt + Down - Move lines or selection up or down
- Shift + Del - Delete line
- Enter after
({[
indents one position
API
Table of Contents
TextAreaCodeElement
Extends HTMLTextAreaElement
Adds code editor behavior to a <textarea>
.
import { TextAreaCodeElement } from 'textarea-code'
customElements.define('textarea-code', TextAreaCodeElement, { extends: 'textarea' })
<textarea is="textarea-code"></textarea>
Contribute
All contributions are welcome!
License
MIT © 2021 stagas