-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: ZTL-UwU <[email protected]>
- Loading branch information
Showing
18 changed files
with
147 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<template> | ||
<div class="mt-16"> | ||
<div v-if="editLink.enable" class="mb-6 flex justify-between"> | ||
<LayoutEditLink /> | ||
</div> | ||
<LayoutPrevNext /> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const { editLink } = useConfig().value.main; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<template> | ||
<div> | ||
<NuxtLink | ||
v-if="enable && page._file && url !== ''" | ||
:to="url" | ||
target="_blank" | ||
class="text-sm font-semibold text-primary" | ||
> | ||
<div class="flex items-center gap-2"> | ||
<SmartIcon :name="icon" /> | ||
<span> | ||
{{ text }} | ||
</span> | ||
</div> | ||
</NuxtLink> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const { page } = useContent(); | ||
const { enable, pattern, text, icon } = useConfig().value.main.editLink; | ||
const url = computed( | ||
() => pattern.replace(/:path/g, page.value._file ?? ''), | ||
); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: Edit Link | ||
icon: lucide:square-pen | ||
description: A link to the source file. | ||
--- | ||
|
||
An edit link allows you to display a link at the end of each page to edit the page on GitHub / GitLab. | ||
|
||
```ts [app.config.ts] | ||
export default defineAppConfig({ | ||
shadcnDocs: { | ||
main: { | ||
editLink: { | ||
enable: true, | ||
pattern: 'https://github.com/ZTL-UwU/shadcn-docs-nuxt/tree/main/content/:path', | ||
text: 'Edit this page on GitHub', | ||
icon: 'lucide:square-pen', | ||
}, | ||
} | ||
}, | ||
}); | ||
``` | ||
|
||
- The `pattern` option defines the URL structure for the link, and `:path` is going to be replaced with the page path. | ||
|
||
- The `text` option allows you to customize the link text (default is `Edit this page`) | ||
|
||
- The `icon` option allows you to customize the icon (default is `lucide:square-pen`) | ||
|
||
## Parameters | ||
|
||
::field-group | ||
::field{name="enable" type="boolean" default-value="false"} | ||
Whether to turn on the edit link. | ||
:: | ||
::field{name="pattern" type="string"} | ||
The link pattern. | ||
:: | ||
::field{name="text" type="string" default-value="Edit this page"} | ||
Text displayed on the link. | ||
:: | ||
::field{name="icon" type="string" default-value="lucide:square-pen"} | ||
The icon preceding the link. | ||
:: | ||
:: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters