diff --git a/.gitignore b/.gitignore index 6ee9011..29513ff 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,4 @@ node_modules # build output.css -public +snap-server/public diff --git a/README.md b/README.md index c98f505..a7e7172 100644 --- a/README.md +++ b/README.md @@ -57,9 +57,10 @@ require("codesnap").setup({...}) There is a default config: ```lua { - mac_window_bar = true, -- MacOS style title bar switch - opacity = true, -- The code snap has some opacity by default, set it to false for 100% opacity + mac_window_bar = true,-- (Optional) MacOS style title bar switch + opacity = true, -- (Optional) The code snap has some opacity by default, set it to false for 100% opacity watermark = "CodeSnap.nvim" -- (Optional) you can custom your own watermark, but if you don't like it, just set it to "" + preview_title = "CodeSnap.nvim" -- (Optional) preview page title } ``` diff --git a/lua/codesnap/static.lua b/lua/codesnap/static.lua index 9655a14..4901a45 100644 --- a/lua/codesnap/static.lua +++ b/lua/codesnap/static.lua @@ -5,6 +5,7 @@ return { mac_window_bar = true, opacity = true, watermark = "CodeSnap.nvim", + preview_title = "CodeSnap.nvim", auto_load = true, }, cwd = path_utils.back(path_utils.back(debug.getinfo(1, "S").source:sub(2):match("(.*[/\\])"))), diff --git a/snap-client/public/favicon.ico b/snap-client/public/favicon.ico deleted file mode 100644 index a11777c..0000000 Binary files a/snap-client/public/favicon.ico and /dev/null differ diff --git a/snap-client/public/logo192.png b/snap-client/public/logo192.png deleted file mode 100644 index fc44b0a..0000000 Binary files a/snap-client/public/logo192.png and /dev/null differ diff --git a/snap-client/public/logo512.png b/snap-client/public/logo512.png deleted file mode 100644 index a4e47a6..0000000 Binary files a/snap-client/public/logo512.png and /dev/null differ diff --git a/snap-client/public/manifest.json b/snap-client/public/manifest.json index 080d6c7..8c5b754 100644 --- a/snap-client/public/manifest.json +++ b/snap-client/public/manifest.json @@ -1,21 +1,11 @@ { - "short_name": "React App", - "name": "Create React App Sample", + "short_name": "CdeoSnap.nvim", + "name": "CodeSnap.nvim", "icons": [ { "src": "favicon.ico", "sizes": "64x64 32x32 24x24 16x16", "type": "image/x-icon" - }, - { - "src": "logo192.png", - "type": "image/png", - "sizes": "192x192" - }, - { - "src": "logo512.png", - "type": "image/png", - "sizes": "512x512" } ], "start_url": ".", diff --git a/snap-client/src/app.tsx b/snap-client/src/app.tsx index 61e3ac5..828ec64 100644 --- a/snap-client/src/app.tsx +++ b/snap-client/src/app.tsx @@ -8,6 +8,7 @@ import { getWebsocketHost } from "./utils"; const CODE_EMPTY_PLACEHOLDER = `print "Hello, CodeSnap.nvim!"`; const WATER_MARK_PLACEHOLDER = "CodeSnap.nvim"; +const PREVIEW_TITLE_PLACEHOLDER = "CodeSnap.nvim"; function App() { const [socketUrl] = useState(`ws://${getWebsocketHost()}/ws`); @@ -64,6 +65,10 @@ function App() { notifyCopyCommand(); }, [event, readyState, notifyCopyCommand]); + useEffect(() => { + document.title = config?.preview_title ?? PREVIEW_TITLE_PLACEHOLDER; + }, []); + return (

diff --git a/snap-client/src/hooks/use-config.ts b/snap-client/src/hooks/use-config.ts index e8d4b56..accb8c8 100644 --- a/snap-client/src/hooks/use-config.ts +++ b/snap-client/src/hooks/use-config.ts @@ -5,6 +5,7 @@ export interface Config { opacity: boolean; watermark: string; auto_load: boolean; + preview_title: string; } const CONFIG_STORAGE_KEY = "CONFIG_STORAGE_KEY"; diff --git a/snap-server/src/event_handler/config.rs b/snap-server/src/event_handler/config.rs index 42e2d0f..6e5c0fe 100644 --- a/snap-server/src/event_handler/config.rs +++ b/snap-server/src/event_handler/config.rs @@ -6,6 +6,7 @@ pub struct Config { opacity: bool, watermark: Option, auto_load: bool, + preview_title: String, } impl From<&str> for Config {