File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,13 @@ ol {
149149 padding : 0px ;
150150}
151151
152+ .tabbed_text {
153+ text-indent : 10px ;
154+ padding-left : 10px ;
155+ list-style-type : circle;
156+ list-style-position : inside;
157+ }
158+
152159input ::placeholder {
153160 font-family : "Andale" , monospace;
154161}
Original file line number Diff line number Diff line change 8787 this . addListItem ( ) ;
8888 } ) ;
8989
90+ function addIndent ( input ) {
91+ const li = input . parentElement ;
92+ if ( ! li . classList . contains ( "tabbed_text" ) ) {
93+ li . classList . add ( "tabbed_text" ) ;
94+ }
95+ }
96+
97+ function removeIndent ( input ) {
98+ const li = input . parentElement ;
99+ if ( li . classList . contains ( "tabbed_text" ) ) {
100+ li . classList . remove ( "tabbed_text" ) ;
101+ }
102+ }
103+
104+ this . element . addEventListener ( "keydown" , ( event ) => {
105+ if ( event . key === "Tab" ) {
106+ event . preventDefault ( ) ;
107+ const currentInput = document . activeElement ;
108+ if ( currentInput && currentInput . tagName === "INPUT" ) {
109+ if ( event . shiftKey ) {
110+ // Handle Shift+Tab to remove indent
111+ removeIndent ( currentInput ) ;
112+ } else {
113+ // Handle Tab to add indent
114+ addIndent ( currentInput ) ;
115+ }
116+ }
117+ }
118+ } ) ;
119+
90120 /*
91121 Following function uses external code
92122 Title: How To Build Sortable Drag & Drop With Vanilla Javascript
You can’t perform that action at this time.
0 commit comments