Skip to content
프로젝트

소개

일반 텍스트 상자에 Tab 키 동작을 추가하는 JavaScript 객체입니다.

기타 프로젝트

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
+1
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

tabIndent.js

Demo

Play with the latest stable demo

Introduction

tabIndent.js does two things to enhance the traditional text-box:

  1. Disables the default browser behaviour (moving to the next input box)
  2. Enhances the existing textbox to capture the "tab" key and replicate behaviour similar to that found in editors. (Inserting a tab character, intentation)

Installation

The repository contains four folders. Of those, only the /js folder is required.

Usage

Upon invocation, tabIndent finds all textarea elements with the tabIndent class, and applies its javascript to them.

To use, add the line of javascript to your head element:

<script src="tabIndent.js"></script>

Invoke thusly:

tabIndent.renderAll();

On the other hand, to invoke on one specific textarea:

var el = document.getELementById('#targetTextArea');
tabIndent.render(el);

Likewise, to remove an instance of tabIndent:

var el = document.getElementById('#textareaWithTabIndent');
tabIndent.remove(el);

... and to remove all instances:

tabIndent.removeAll();

For styling purposes, after a textarea is enhanced by tabIndent, it will have the class tabIndent-rendered.

The default tab sequence is '\t', but it can be set to any string you want. For example, to use four spaces instead of the tab character, just add the following line before rendering:

tabIndent.config.tab = '    ';

Caveat

tabIndent.js willingly breaks the default action of the tab button, whose normal behaviour would bring you to the next element in the tab index (likewise, shift-tab would bring you to the previous one). To bring back the regular behaviour, escape out of the textarea by hitting the esc key. The textarea enhancements will then be temporarily disabled until you return to it at a later time.

An icon will be present at the top right of the textarea, signifying when the enhancements are active.

Known Bugs

Please consult the project buglist.

Attribution / Credits

Use of the "active" icon courtesy of IconShock (retrieved from findicons.com)

관련 프로젝트 살펴보기

불러오는 중…