-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from terwer/dev
feat:#85 Google插件扩展-文章详情页支持新窗口单独预览
- Loading branch information
Showing
23 changed files
with
355 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
{ | ||
"resources": [ | ||
"blog/index.html", | ||
"detail/index.html", | ||
"index.html" | ||
], | ||
"matches": [ | ||
|
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,15 @@ | ||
<template> | ||
<BlogDetail :page-id="undefined"/> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import BlogDetail from "./blog/BlogDetail.vue"; | ||
export default { | ||
name: "Detail", | ||
components: {BlogDetail} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
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,66 @@ | ||
<template> | ||
<div class="post-detail-content-box"> | ||
<div class="btn-publish"> | ||
<el-button size="small" type="primary" @click="handlePublish">发布到其他平台</el-button> | ||
</div> | ||
|
||
<!-- 文章详情 --> | ||
<DefaultPostDetailService :page-id="pid"/> | ||
|
||
<locale-changer/> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import {goToPage} from "../../lib/chrome/ChromeUtil"; | ||
import {getPageId} from "../../lib/platform/siyuan/siyuanUtil"; | ||
import {onMounted, ref} from "vue"; | ||
import LocaleChanger from "../tab/ChangeLocale.vue"; | ||
const props = defineProps({ | ||
pageId: { | ||
type: String, | ||
default: undefined | ||
} | ||
}) | ||
const pid = ref("") | ||
const handlePublish = (e: any) => { | ||
e.preventDefault() | ||
goToPage("/index.html?id=" + pid.value, "/") | ||
} | ||
const initPage = async () => { | ||
const pageId = await getPageId(true, props.pageId); | ||
if (!pageId || pageId === "") { | ||
return | ||
} | ||
pid.value = pageId | ||
} | ||
onMounted(async () => { | ||
await initPage() | ||
}) | ||
</script> | ||
|
||
<script lang="ts"> | ||
import DefaultPostDetailService from "./themes/default/DefaultPostDetailService.vue"; | ||
export default { | ||
name: "BlogDetail", | ||
components: {DefaultPostDetailService} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.post-detail-content-box { | ||
padding: 10px; | ||
} | ||
.post-detail-content-box .btn-publish { | ||
/*margin-left: 10px;*/ | ||
cursor: pointer; | ||
padding: 10px 10px 0 0; | ||
} | ||
</style> |
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
63 changes: 63 additions & 0 deletions
63
src/components/blog/themes/default/DefaultPostDetailService.vue
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,63 @@ | ||
<template> | ||
<div id="post-detail-content" | ||
v-highlight | ||
v-html="post.description" | ||
></div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import {Post} from "../../../../lib/common/post"; | ||
import {onMounted, ref, watch} from "vue"; | ||
import {API} from "../../../../lib/api"; | ||
import {API_TYPE_CONSTANTS} from "../../../../lib/constants/apiTypeConstants"; | ||
import logUtil from "../../../../lib/logUtil"; | ||
const props = defineProps({ | ||
pageId: { | ||
type: String, | ||
default: undefined | ||
} | ||
}) | ||
/*监听props*/ | ||
watch(() => props.pageId, /**/(oldValue, newValue) => { | ||
// Here you can add you functionality | ||
// as described in the name you will get old and new value of watched property | ||
// 默认选中vuepress | ||
// setBooleanConf(SWITCH_CONSTANTS.SWITCH_VUEPRESS_KEY, true) | ||
initPage(); | ||
logUtil.logInfo("文章详情查看初始化") | ||
}) | ||
const defaultPost = new Post() | ||
const post = ref(defaultPost) | ||
const initPage = async () => { | ||
const api = new API(API_TYPE_CONSTANTS.API_TYPE_SIYUAN) | ||
const siyuanPost = await api.getPost(props.pageId || "") | ||
post.value = siyuanPost | ||
} | ||
onMounted(async () => { | ||
await initPage() | ||
}) | ||
</script> | ||
|
||
<script lang="ts"> | ||
export default { | ||
name: "DefaultPostDetailService" | ||
} | ||
</script> | ||
|
||
<style> | ||
/* 预览样式 */ | ||
#post-detail-content { | ||
} | ||
#post-detail-content img { | ||
max-width: 99%; | ||
} | ||
</style> | ||
<style scoped> | ||
</style> |
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
Oops, something went wrong.
a991048
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
src-sy-post-publisher – ./
src-sy-post-publisher-git-main-terwergreen.vercel.app
publish.terwer.space
src-sy-post-publisher-terwergreen.vercel.app
src-sy-post-publisher.vercel.app