Skip to content

Commit

Permalink
javascript: remove default indentation
Browse files Browse the repository at this point in the history
We had enabled indentation and tab-conversion by default. Let's discuss
that further as it seems to be controversial-ish.

See: #292

Signed-off-by: Simon de Vlieger <[email protected]>
  • Loading branch information
supakeen committed Nov 15, 2024
1 parent b383e77 commit 8ce9367
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Changelog
``pinnwand`` is Python pastebin software that tried to keep it simple but got
a little more complex.

v1.6.1 (unreleased)
*******************
* Removed the default indentation from pastes. It now only applies to configured
languages again. Opened a public discussion about this behavior.

v1.6.0 (20241101)
*******************
* Added a browser test suite by nekhvoya_.
Expand Down
8 changes: 6 additions & 2 deletions src/pinnwand/static/pinnwand.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
let indents = {
"default": " ".repeat(4),
"python": " ".repeat(4),
"python2": " ".repeat(4),
"html": " ".repeat(2),
Expand Down Expand Up @@ -124,7 +123,12 @@ function indent_textarea(event) {
let selector = event.target.parentNode.parentNode.querySelector("select[name='lexer']"),
lexer = selector.options[selector.selectedIndex].text

let indent = indents[lexer.toLowerCase()] || indents["default"];
let indent = indents[lexer.toLowerCase()];

if(!indent) {
return;
}

let keyCode = event.keyCode || event.which;

if (keyCode == 9) {
Expand Down

0 comments on commit 8ce9367

Please sign in to comment.