Skip to content

Commit

Permalink
fix file preview
Browse files Browse the repository at this point in the history
  • Loading branch information
dfrnoch committed May 29, 2022
1 parent 6c68da3 commit fdee24a
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "uNote",
"version": "1.0.0"
"version": "1.1.0"
},
"tauri": {
"allowlist": {
Expand Down
4 changes: 2 additions & 2 deletions src/components/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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={
Expand Down
5 changes: 5 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, "");
};

0 comments on commit fdee24a

Please # to comment.