Skip to content

Commit 375a166

Browse files
Fix tab in textareas
1 parent e763219 commit 375a166

File tree

7 files changed

+19
-9
lines changed

7 files changed

+19
-9
lines changed

extensions/web-base/www/app.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,8 @@
334334
<option v-for="ev in enumValues" :value="ev.const">{{ev.title}}</option>
335335
</select>
336336
<template v-else-if="schema.type === 'string'">
337-
<textarea v-if="schema.contentMediaType && schema.contentMediaType.startsWith('text/')" v-model="value" spellcheck="false" wrap="off" placeholder="Text Value" :readonly="schema.readOnly"></textarea>
337+
<textarea v-if="schema.contentMediaType && schema.contentMediaType.startsWith('text/')" v-model="value" v-on:keydown.tab.prevent="insertTab"
338+
spellcheck="false" wrap="off" placeholder="Text Value" :readonly="schema.readOnly"></textarea>
338339
<input v-else v-model="value" :readonly="schema.readOnly" :type="schema.writeOnly ? 'password' : 'text'" placeholder="String Value">
339340
</template>
340341
<input v-else-if="schema.type === 'number' || schema.type === 'integer'" v-model="value" :readonly="schema.readOnly" type="number" placeholder="Number Value">

extensions/web-base/www/app/utils.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,13 @@ function rejectIfNotOk(response) {
234234
return Promise.reject(response.statusText);
235235
}
236236

237+
function insertTab(e) {
238+
var t = e && e.target;
239+
if (t && t.setRangeText) {
240+
t.setRangeText('\t', t.selectionStart, t.selectionStart, 'end');
241+
}
242+
}
243+
237244
function findAncestor(el, selector) {
238245
if (el) {
239246
while (true) {

extensions/web-notes/web-note.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<button v-on:click="app.back()" title="Close"><i class="fa fa-window-close"></i></button>
1616
</template>
1717
<article class="content">
18-
<textarea v-model="text" v-on:keydown.ctrl.s.exact.prevent.stop="onSave()" spellcheck="false" wrap="off" class="full" style="font-size: 2rem" placeholder="Enter your note here"></textarea>
18+
<textarea v-model="text" v-on:keydown.ctrl.s.exact.prevent.stop="onSave()" v-on:keydown.tab.prevent="insertTab"
19+
spellcheck="false" wrap="off" class="full" style="font-size: 2rem" placeholder="Enter your note here"></textarea>
1920
</article>
2021
</app-page>

extensions/web-scripts/script-editor.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<button v-on:click="onSave" title="Save"><i class="far fa-save"></i></button>
1414
</template>
1515
<article class="content">
16-
<textarea v-model="text" v-on:keydown.ctrl.s.exact.prevent.stop="onSave()" spellcheck="false" wrap="off" class="full" placeholder="Enter your Lua script here"></textarea>
16+
<textarea v-model="text" v-on:keydown.ctrl.s.exact.prevent.stop="onSave()" v-on:keydown.tab.prevent="insertTab"
17+
spellcheck="false" wrap="off" class="full" placeholder="Enter your Lua script here"></textarea>
1718
</article>
1819
</app-page>

extensions/web-scripts/script-view.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
<button v-on:click="onSave" title="Save"><i class="far fa-save"></i></button>
1515
</template>
1616
<article class="content">
17-
<textarea v-model="text" v-on:keydown.ctrl.s.exact.prevent.stop="onSave()" spellcheck="false" wrap="off" class="full"></textarea>
17+
<textarea v-model="text" v-on:keydown.ctrl.s.exact.prevent.stop="onSave()" v-on:keydown.tab.prevent="insertTab" spellcheck="false" wrap="off" class="full"></textarea>
1818
</article>
1919
</app-page>

extensions/web-scripts/view-schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"icon": {
1717
"title": "Icon",
18-
"description": "The fontawesome icon to use for the view tile and menu entry, such as 'house'",
18+
"description": "The fontawesome icon to use for the view tile and menu entry, such as 'home'",
1919
"type": "string"
2020
},
2121
"properties": {

extensions/web-tools/web-tools.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
<button v-on:click="saveConfig"><i class="far fa-save"></i>&nbsp;Save Configuration</button>
2828
<button v-on:click="saveData"><i class="far fa-save"></i>&nbsp;Save Data</button>
2929
<p>Lua</p>
30-
<textarea ref="lua" v-model="lua" spellcheck="false" rows="12" wrap="off" style="width: 100%; resize: none;" placeholder="Enter your Lua code here"></textarea>
30+
<textarea ref="lua" v-model="lua" v-on:keydown.tab.prevent="insertTab" spellcheck="false" rows="12" wrap="off" style="width: 100%; resize: none;" placeholder="Enter your Lua code here"></textarea>
3131
<button v-on:click="run"><i class="fas fa-redo"></i>&nbsp;Run</button>
32-
<textarea v-model="luaOut" spellcheck="false" rows="12" wrap="off" style="width: 100%; resize: none;" placeholder="Output" readonly></textarea>
32+
<textarea v-model="luaOut" v-on:keydown.tab.prevent="insertTab" spellcheck="false" rows="12" wrap="off" style="width: 100%; resize: none;" placeholder="Output" readonly></textarea>
3333
<p>System</p>
34-
<textarea ref="cmd" v-model="cmd" spellcheck="false" rows="12" wrap="off" style="width: 100%; resize: none;" placeholder="Enter your command here"></textarea>
34+
<textarea ref="cmd" v-model="cmd" v-on:keydown.tab.prevent="insertTab" spellcheck="false" rows="12" wrap="off" style="width: 100%; resize: none;" placeholder="Enter your command here"></textarea>
3535
<button v-on:click="execute"><i class="fas fa-redo"></i>&nbsp;Execute</button>
36-
<textarea v-model="cmdOut" spellcheck="false" rows="12" wrap="off" style="width: 100%; resize: none;" placeholder="Output" readonly></textarea>
36+
<textarea v-model="cmdOut" v-on:keydown.tab.prevent="insertTab" spellcheck="false" rows="12" wrap="off" style="width: 100%; resize: none;" placeholder="Output" readonly></textarea>
3737
</page-article>
3838
</app-page>

0 commit comments

Comments
 (0)