Skip to content

Commit

Permalink
chore: 主窗口移除Picgo支持
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Mar 25, 2023
1 parent 1e93a30 commit a974954
Show file tree
Hide file tree
Showing 11 changed files with 293 additions and 446 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@typescript-eslint/restrict-template-expressions": 1,
"@typescript-eslint/no-var-requires": 1,
"@typescript-eslint/prefer-nullish-coalescing": 0,
"@typescript-eslint/restrict-plus-operands": 0,
"no-undef": 0,
"no-undef-init": 1,
"no-undefined": 0,
Expand Down
7 changes: 7 additions & 0 deletions assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,10 @@ code {
.dialog-action .el-form-item__content .el-button {
margin-left: 10px;
}

.pic-manage-btn{
margin-left: 10px;
}
.pic-manage-btn svg{
margin-right: 5px;
}
34 changes: 27 additions & 7 deletions components/publish/tab/main/CommonBlogMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,26 @@
<!-- 使用图床 -->
<el-form-item :label="$t('github.post.picgo.use')">
<el-switch v-model="picgoPostData.picgoEnabled" @change="picgoPostMethods.picgoOnChange" />
<el-tooltip
v-if="picgoPostData.picgoEnabled && !isInSiyuanNewWinBrowser()"
:content="$t('siyuan.browser.menu.picture.btn')"
class="box-item"
effect="light"
placement="right"
popper-class="publish-menu-tooltip"
>
<el-button
class="pic-manage-btn"
type="success"
size="small"
@click="picgoPostMethods.handlePicgoManage(siyuanData.pageId)"
>
<font-awesome-icon icon="fa-solid fa-image" />
{{ $t("setting.picgo.manage") }}
</el-button>
</el-tooltip>
<el-alert
v-if="false && picgoPostData.picgoEnabled"
v-if="picgoPostData.picgoEnabled"
:closable="false"
:title="$t('github.post.picgo.use.tip')"
type="warning"
Expand Down Expand Up @@ -249,6 +267,7 @@ import { ImageParser } from "~/utils/parser/imageParser"
import { usePicgoPost } from "~/composables/picgo/import/picgoPostCom"
import { PicgoPostApi } from "~/utils/platform/picgo/picgoPostApi"
import { LinkParser } from "~/utils/parser/LinkParser"
import { isInSiyuanNewWinBrowser } from "~/utils/otherlib/siyuanBrowserUtil"
const logger = LogFactory.getLogger("components/publish/tab/main/CommonBlogMain.vue")
const siyuanApi = new SiYuanApi()
Expand Down Expand Up @@ -823,13 +842,14 @@ const doPublish = async () => {
} else {
// 处理图床
if (picgoPostMethods.getPicgoPostData().picgoEnabled) {
ElMessage.info(t("github.post.picgo.start.upload"))
const picgoPostResult = await picgoPostApi.uploadPostImagesToBed(siyuanData.pageId, siyuanData.meta, md)
if (picgoPostResult.flag) {
md = picgoPostResult.mdContent
} else {
ElMessage.warning(t("github.post.picgo.picbed.error"))
// 有图片才上传
if (picgoPostResult.hasImages) {
if (picgoPostResult.flag) {
md = picgoPostResult.mdContent
} else {
ElMessage.error(t("github.post.picgo.picbed.error") + "=>" + picgoPostResult.errmsg)
}
}
}
}
Expand Down
Loading

0 comments on commit a974954

Please sign in to comment.