Skip to content

Commit

Permalink
Use CSS to indicate the importance of whitespace rather than replacin…
Browse files Browse the repository at this point in the history
…g with nbsp's (#2780)

Closes #2779
Alternate fix for #2757
Partially reverts #2768
  • Loading branch information
anthonyryan1 authored Nov 11, 2024
1 parent a9e0342 commit fc200ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions plugins/_getdir/_getdir.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
color: windowtext;
padding: 0.15rem;
text-wrap: nowrap;

/* whitespace here is deliberate, and should be shown as we set it */
white-space: pre;
}
.rmenuitem.active {
color: highlighttext;
Expand Down
6 changes: 3 additions & 3 deletions plugins/_getdir/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,16 @@ theWebUI.rDirBrowser = class {

requestDir() {
$.ajax(
`plugins/_getdir/listdir.php?dir=${encodeURIComponent(this.edit.val().replace(/\u00a0/g, " "))}&time=${(new Date()).getTime()}${this.withFiles ? "&withfiles=1" : ""}`,
`plugins/_getdir/listdir.php?dir=${encodeURIComponent(this.edit.val())}&time=${(new Date()).getTime()}${this.withFiles ? "&withfiles=1" : ""}`,
{
success: (res) => {
this.frame.find(".filter-dir").val("").trigger("focus");
this.edit.val(res.path).data({cwd:res.path, previousValue:this.edit.val()}).change();
this.frame.find(".rmenuobj").remove();
this.frame.append(
$("<div>").addClass("rmenuobj").append(
...res.directories.map(ele => $("<div>").addClass("rmenuitem").text(ele.replace(/ /g, "\u00a0") + "/")),
...(this.withFiles ? res.files : []).map(ele => $("<div>").addClass("rmenuitem").text(ele.replace(/ /g, "\u00a0"))),
...res.directories.map(ele => $("<div>").addClass("rmenuitem").text(ele + "/")),
...(this.withFiles ? res.files : []).map(ele => $("<div>").addClass("rmenuitem").text(ele)),
),
);
this.frame.find(".rmenuitem").on(
Expand Down

0 comments on commit fc200ab

Please sign in to comment.