https://github.com/phuocng/mirror-a-text-area
Enhancing user experience through text area mirroring
https://github.com/phuocng/mirror-a-text-area
dom-manipulation javascript
Last synced: 12 months ago
JSON representation
Enhancing user experience through text area mirroring
- Host: GitHub
- URL: https://github.com/phuocng/mirror-a-text-area
- Owner: phuocng
- License: mit
- Created: 2023-09-26T12:40:14.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-28T06:31:01.000Z (over 2 years ago)
- Last Synced: 2025-03-16T22:36:19.330Z (over 1 year ago)
- Topics: dom-manipulation, javascript
- Language: HTML
- Homepage: https://phuoc.ng/collection/mirror-a-text-area/
- Size: 8.64 MB
- Stars: 79
- Watchers: 3
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mirror a text area
We have been using text areas in many web applications. However, there are many limitations when working with text area. For example, it only accept raw text value. This can be a hindrance when trying to implement advanced features such as highlighting a keyword, displaying the line numbers.
This series introduces a technique to mirror a text area element. Instead of working with the text area element directly, we create a copied element that look identical with the original text area. It's also placed at the same position as the text area. By doing this, we can enhance the user experience by allowing users to interact with the mirrored element in ways that were not possible with the original text area.
- [01: Mirror a text area for improving user experience](https://phuoc.ng/collection/mirror-a-text-area/mirror-a-text-area-for-improving-user-experience/)
- [02: Highlight keywords in a text area](https://phuoc.ng/collection/mirror-a-text-area/highlight-keywords-in-a-text-area/)

- [03: Display the line numbers in a text area](https://phuoc.ng/collection/mirror-a-text-area/display-the-line-numbers-in-a-text-area/)

- [04: Calculate the coordinates of the current cursor in a text area](https://phuoc.ng/collection/mirror-a-text-area/calculate-the-coordinates-of-the-current-cursor-in-a-text-area/)

- [05: Highlight the current line in a text area](https://phuoc.ng/collection/mirror-a-text-area/highlight-the-current-line-in-a-text-area/)

- [06: Create your own custom cursor in a text area](https://phuoc.ng/collection/mirror-a-text-area/create-your-own-custom-cursor-in-a-text-area/)

- [07: Add autocomplete to your text area](https://phuoc.ng/collection/mirror-a-text-area/add-autocomplete-to-your-text-area/)

- [08: Insert emojis](https://phuoc.ng/collection/mirror-a-text-area/insert-emojis/)

- [09: Mention](https://phuoc.ng/collection/mirror-a-text-area/mention/)

- [10: Provide a preview of the suggestion as users type in a text area](https://phuoc.ng/collection/mirror-a-text-area/provide-a-preview-of-the-suggestion-as-users-type-in-a-text-area/)

- [11: Implement inline input suggestions](https://phuoc.ng/collection/mirror-a-text-area/implement-inline-input-suggestions/)

- [12: Make a text area fit its content automatically](https://phuoc.ng/collection/mirror-a-text-area/make-a-text-area-fit-its-content-automatically/)

- [13: Show a toolbar after selecting text in a text area](https://phuoc.ng/collection/mirror-a-text-area/show-a-toolbar-after-selecting-text-in-a-text-area/)

- [14: Copy the content of an element to your clipboard](https://phuoc.ng/collection/mirror-a-text-area/copy-the-content-of-an-element-to-your-clipboard/)

- [15: Build a simple code editor](https://phuoc.ng/collection/mirror-a-text-area/build-a-simple-code-editor/)

- [16: Convert text links in a text area to clickable links](https://phuoc.ng/collection/mirror-a-text-area/convert-text-links-in-a-text-area-to-clickable-links/)
