From fdee24af213508bc131a09018b8dd929ee2e6b1d Mon Sep 17 00:00:00 2001 From: lnxcz Date: Sun, 29 May 2022 20:21:51 +0200 Subject: [PATCH] fix file preview --- package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- src/components/SideBar.tsx | 4 ++-- src/utils.ts | 5 +++++ 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 58f3ea6..c9cfd43 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "unote", - "version": "1.0.0", + "version": "1.1.0", "private": true, "dependencies": { "@radix-ui/react-dropdown-menu": "^0.1.6", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index fb2efa8..ad9e3e4 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -3154,7 +3154,7 @@ checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "unote" -version = "1.0.0" +version = "1.1.0" dependencies = [ "async-recursion", "crossbeam-channel", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index e3d5e12..df31548 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "unote" -version = "1.0.0" +version = "1.1.0" description = "Fast and easy text editor" authors = ["lynx"] license = "MIT" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 148c83f..1c05554 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "uNote", - "version": "1.0.0" + "version": "1.1.0" }, "tauri": { "allowlist": { diff --git a/src/components/SideBar.tsx b/src/components/SideBar.tsx index ed6e492..0fc729b 100644 --- a/src/components/SideBar.tsx +++ b/src/components/SideBar.tsx @@ -18,7 +18,7 @@ import { VscAdd, VscFile, VscFiles } from "react-icons/vsc"; import { keyframes, styled } from "../theme"; import { FsElement } from "types"; import { useDebouncedCallback } from "use-debounce"; -import { orderWith, basename, join, dirname } from "../utils"; +import { orderWith, basename, join, dirname, removeTags } from "../utils"; import { DraggableList } from "./DraggableList"; import { FileItem } from "./FileItem"; import { Content, Item, ItemIcon, Menu, Trigger } from "./ui/Menu"; @@ -271,7 +271,7 @@ export const SideBar: FC = () => { name={Directory?.name || File.name || ""} description={ !!File - ? File?.preview?.slice(0, 100) + ? removeTags(File?.preview?.slice(0, 100)) : `${Directory?.children_count} items` } selected={ diff --git a/src/utils.ts b/src/utils.ts index 0aadb1e..6440c5a 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -35,3 +35,8 @@ export const dirname = (path: string) => { } return path; }; + +//regex for removing tags in file preview +export const removeTags = (text: string) => { + return text.replace(/<[^>]*>/g, ""); +};