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

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

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/)

![Highlight keywords in a text area](/02-highlight-keywords/highlight-keywords.png)

- [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/)

![Display the line numbers in a text area](/03-line-numbers/line-numbers.png)

- [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/)

![Calculate the coordinates of the current cursor in a text area](/04-cursor-coordinates/cursor-coordinates.png)

- [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/)

![Highlight the current line in a text area](/05-highlight-current-line/highlight-current-line.png)

- [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/)

![Create your own custom cursor in a text area](/06-custom-cursor/custom-cursor.png)

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

![Add autocomplete to your text area](/07-autocomplete/autocomplete.png)

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

![Insert emojis](/08-insert-emojis/insert-emojis.png)

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

![Mention](/09-mention/mention.png)

- [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/)

![Provide a preview of the suggestion as users type in a text area](/10-preview-suggestion/preview-suggestion.png)

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

![Implement inline input suggestions](/11-inline-input-suggestions/inline-input-suggestions.png)

- [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/)

![Make a text area fit its content automatically](/12-fit-content/fit-content.png)

- [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/)

![Show a toolbar after selecting text in a text area](/13-toolbar-selected-text/toolbar-selected-text.png)

- [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/)

![Copy the content of an element to your clipboard](/14-copy-to-clipboard/copy-to-clipboard.png)

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

![Build a simple code editor](/15-code-editor/code-editor.png)

- [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/)

![Convert text links in a text area to clickable links](/16-convert-text-links/convert-text-links.png)