Skip to content
This repository has been archived by the owner on Nov 28, 2024. It is now read-only.

Commit

Permalink
feat(tab): add tab code
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamadreza1388 committed Sep 8, 2024
1 parent 9c0bac1 commit 8931093
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions salam-online.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
};

function captureOutput(arguments) {
if(iframe.style.right === "50%"){
if (iframe.style.right === "50%") {
iframe.style.right = "150%"
}else if(iframe.style.right === "150%"){
} else if (iframe.style.right === "150%") {
iframe.style.right = "50%"
}else {
} else {
iframe.style.right = "50%"
}
if (outputPre) {
Expand Down Expand Up @@ -102,15 +102,14 @@
runSalam();
});

codeTextArea.addEventListener('keydown', (e) => {
if (e.key === 'Tab') {
e.preventDefault();
const start = codeTextArea.selectionStart;
const end = codeTextArea.selectionEnd;

codeTextArea.value = codeTextArea.value.substring(0, start) + ' ' + codeTextArea.value.substring(end);

codeTextArea.selectionStart = codeTextArea.selectionEnd = start + 4;
codeTextArea.addEventListener('keydown', function (event) {
if (event.key === 'Tab') {
event.preventDefault();
const textarea = this;
const start = textarea.selectionStart;
const end = textarea.selectionEnd;
textarea.value = textarea.value.substring(0, start) + '\t' + textarea.value.substring(end);
textarea.selectionStart = textarea.selectionEnd = start + 1;
}
});

Expand Down

0 comments on commit 8931093

Please sign in to comment.