1
0
Fork 0

[Feat] add preview_title option to configure preview page title (#20)

* [Feat] add preview_title option

* [Update] add preview_title option in document
feature/custom-highlight-themes
Mist 2024-02-24 18:26:03 +08:00 committed by GitHub
parent a11ac2246d
commit 7963b3f2cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 14 additions and 15 deletions

2
.gitignore vendored
View File

@ -19,4 +19,4 @@ node_modules
# build
output.css
public
snap-server/public

View File

@ -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
}
```

View File

@ -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("(.*[/\\])"))),

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

View File

@ -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": ".",

View File

@ -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 (
<div className="w-full h-full flex flex-col items-center bg-deep-gray">
<p className="rainbow-text text-4xl font-extrabold mt-20">

View File

@ -5,6 +5,7 @@ export interface Config {
opacity: boolean;
watermark: string;
auto_load: boolean;
preview_title: string;
}
const CONFIG_STORAGE_KEY = "CONFIG_STORAGE_KEY";

View File

@ -6,6 +6,7 @@ pub struct Config {
opacity: bool,
watermark: Option<String>,
auto_load: bool,
preview_title: String,
}
impl From<&str> for Config {