From 2d5a0bb89430b70f92b2f0b837e20ee307cfdf50 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Sun, 21 Jul 2024 17:01:24 -0700 Subject: [PATCH] closes #614 --- src/gui/src/UI/UIDesktop.js | 4 ++-- src/gui/src/UI/UIItem.js | 6 +++--- src/gui/src/css/style.css | 6 +++++- src/gui/src/helpers.js | 2 +- src/gui/src/helpers/get_html_element_from_options.js | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/gui/src/UI/UIDesktop.js b/src/gui/src/UI/UIDesktop.js index fcad9b24..c02e4559 100644 --- a/src/gui/src/UI/UIDesktop.js +++ b/src/gui/src/UI/UIDesktop.js @@ -215,7 +215,7 @@ async function UIDesktop(options){ // Update matching items // set new item name - $(`.item[data-uid='${html_encode(item.uid)}'] .item-name`).html(html_encode(truncate_filename(item.name)).replaceAll(' ', ' ')); + $(`.item[data-uid='${html_encode(item.uid)}'] .item-name`).html(html_encode(truncate_filename(item.name))); // Set new icon const new_icon = (item.is_dir ? window.icons['folder.svg'] : (await item_icon(item)).image); @@ -419,7 +419,7 @@ async function UIDesktop(options){ // Update matching items // Set new item name - $(`.item[data-uid='${html_encode(item.uid)}'] .item-name`).html(html_encode(truncate_filename(item.name)).replaceAll(' ', ' ')); + $(`.item[data-uid='${html_encode(item.uid)}'] .item-name`).html(html_encode(truncate_filename(item.name))); // Set new icon const new_icon = (item.is_dir ? window.icons['folder.svg'] : (await item_icon(item)).image); diff --git a/src/gui/src/UI/UIItem.js b/src/gui/src/UI/UIItem.js index 5ef43227..e7db916c 100644 --- a/src/gui/src/UI/UIItem.js +++ b/src/gui/src/UI/UIItem.js @@ -162,7 +162,7 @@ function UIItem(options){ h += ``; // name - h += `${options.is_trash ? i18n('trash') : html_encode(truncate_filename(options.name)).replaceAll(' ', ' ')}` + h += `
${options.is_trash ? i18n('trash') : html_encode(truncate_filename(options.name))}
` // name editor h += `` h += ``; @@ -653,7 +653,7 @@ function UIItem(options){ UIAlert(`The name ".." is not allowed, because it is a reserved name. Please choose another name.`) } - $(el_item_name).html(html_encode(truncate_filename(options.name)).replaceAll(' ', ' ')); + $(el_item_name).html(html_encode(truncate_filename(options.name))); $(el_item_name).show(); $(el_item_name_editor).val($(el_item).attr('data-name')); $(el_item_name_editor).hide(); @@ -1412,7 +1412,7 @@ function UIItem(options){ // -------------------------------------------------------- $(el_item_name_editor).on('input keypress focus', function(){ const val = $(el_item_name_editor).val(); - $('.item-name-shadow').html(html_encode(val).replaceAll(' ', ' ')); + $('.item-name-shadow').html(html_encode(val)); if(val !== ''){ const w = $('.item-name-shadow').width(); const h = $('.item-name-shadow').height(); diff --git a/src/gui/src/css/style.css b/src/gui/src/css/style.css index 1948ee6f..279c980f 100644 --- a/src/gui/src/css/style.css +++ b/src/gui/src/css/style.css @@ -77,7 +77,10 @@ font-optical-sizing: auto; font-style: normal; font-variation-settings: "slnt"0; +} +pre{ + font-family: "Inter", "Helvetica Neue", HelveticaNeue, Helvetica, Arial, sans-serif; } :root { @@ -617,8 +620,9 @@ span.header-sort-icon img { display: inline-block; font-weight: bold; border-radius: 4px; - line-break: anywhere; box-sizing: border-box; + white-space: pre-wrap; + word-break: break-word; } .item-name { diff --git a/src/gui/src/helpers.js b/src/gui/src/helpers.js index a85be51b..b258028b 100644 --- a/src/gui/src/helpers.js +++ b/src/gui/src/helpers.js @@ -2095,7 +2095,7 @@ window.rename_file = async(options, new_name, old_name, old_path, el_item, el_it } // Set new item name - $(`.item[data-uid='${$(el_item).attr('data-uid')}'] .item-name`).html(html_encode(truncate_filename(new_name)).replaceAll(' ', ' ')); + $(`.item[data-uid='${$(el_item).attr('data-uid')}'] .item-name`).html(html_encode(truncate_filename(new_name))); $(el_item_name).show(); // Hide item name editor diff --git a/src/gui/src/helpers/get_html_element_from_options.js b/src/gui/src/helpers/get_html_element_from_options.js index ee464d5f..6f197878 100644 --- a/src/gui/src/helpers/get_html_element_from_options.js +++ b/src/gui/src/helpers/get_html_element_from_options.js @@ -136,7 +136,7 @@ const get_html_element_from_options = async function(options){ h += ``; // name - h += `${html_encode(truncate_filename(options.name)).replaceAll(' ', ' ')}` + h += `${html_encode(truncate_filename(options.name))}` // name editor h += `` h += ``;