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 a974954 commit 2dfc155
Show file tree
Hide file tree
Showing 95 changed files with 20,489 additions and 20,355 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

- 移除不必要的日志打印
- #420 ankisiyuan.bin(仅支持 Mac) 默认不提供,手动下载,减小打包体积
- 鉴于主窗口直接上传会导致内核崩溃,主窗口移除 PicGO 支持,仅支持新窗口模式使用 PicGO

## v0.7.2 Bug 修复

Expand Down
2 changes: 1 addition & 1 deletion components/picgo/PicgoIndex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
<!-- 复制图片链接 -->
<el-popover
placement="bottom"
:title="$t('setting.picgo.index.copy.link')"
:title="f.alt ? f.alt : $t('setting.picgo.index.copy.link')"
:width="picgoCommonData.popWidth"
trigger="hover"
:content="f.url"
Expand Down
9 changes: 8 additions & 1 deletion components/publish/tab/main/CommonBlogMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,11 @@ const oneclickAttr = async (hideTip) => {
const checkLimit = (lastmodKey) => {
const flag = false
// 限制开关
if (!props.limitRate) {
return false
}
const lastmodDate = getConf(lastmodKey)
// 没发布过,不限制
if (isEmptyString(lastmodDate)) {
Expand All @@ -753,7 +758,9 @@ const checkLimit = (lastmodKey) => {
ElMessage.error(
"由于【" +
props.apiType +
"】平台的限制,每6分钟之内只能发布或者更新一次文章,距离上一次发布时间为:" +
"】平台的限制,每" +
props.limitSeconds +
"秒之内只能发布或者更新一次文章,距离上一次发布时间为:" +
s +
"秒,仍需等待:" +
(props.limitSeconds - s) +
Expand Down
15 changes: 6 additions & 9 deletions composables/picgo/picgoInitPageCom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { SiYuanApi } from "~/utils/platform/siyuan/siYuanApi"
import { getPageId } from "~/utils/platform/siyuan/siyuanUtil"
import { ImageParser } from "~/utils/parser/imageParser"
import { PicgoPostApi } from "~/utils/platform/picgo/picgoPostApi"
import { ImageItem } from "~/utils/models/imageItem"
import { ParsedImage } from "~/utils/models/parsedImage"

/**
* Picgo页面初始化组件
Expand All @@ -52,17 +52,17 @@ export const usePicgoInitPage = (props, deps) => {
const pageId = await getPageId(true, props.pageId)

// 图片信息
const imageBlocks = await siyuanApi.getImageBlocksByID(pageId)
const imageBlocks: any[] = await siyuanApi.getImageBlocksByID(pageId)
logger.debug("查询文章中的图片块=>", imageBlocks)

if (!imageBlocks || imageBlocks.length === 0) {
return
}

// 解析图片地址
let retImgs = []
let retImgs: ParsedImage[] = []
imageBlocks.forEach((page) => {
const parsedImages = imageParser.parseImagesToArray(page.markdown)
const parsedImages: ParsedImage[] = imageParser.parseImagesToArray(page.markdown)

// 会有很多重复值
// retImgs = retImgs.concat(retImgs, parsedImages)
Expand All @@ -73,14 +73,11 @@ export const usePicgoInitPage = (props, deps) => {

// 将字符串数组格式的图片信息转换成图片对象数组
const attrs = await siyuanApi.getBlockAttrs(pageId)
const imageItemArray = await picgoPostApi.doConvertImagesToImagesItemArray(
attrs,
retImgs
)
const imageItemArray = await picgoPostApi.doConvertImagesToImagesItemArray(attrs, retImgs)

// 页面属性
for (let i = 0; i < imageItemArray.length; i++) {
const imageItem = imageItemArray[i] as ImageItem
const imageItem = imageItemArray[i]
picgoCommonData.fileList.files.push(imageItem)
}
}
Expand Down
4 changes: 2 additions & 2 deletions composables/publish/publishActionCom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { CONSTANTS } from "~/utils/constants/constants"
import { PicgoPostApi } from "~/utils/platform/picgo/picgoPostApi"
import { API } from "~/utils/api"
import { Post } from "~/utils/models/post"
import { LinkParser } from "~/utils/parser/LinkParser";
import { LinkParser } from "~/utils/parser/LinkParser"

/**
* 通用的发布操作组件
Expand Down Expand Up @@ -145,7 +145,7 @@ export const usePublish = (props, deps?: any) => {
if (picgoPostResult.flag) {
md = picgoPostResult.mdContent
} else {
ElMessage.warning(t("github.post.picgo.picbed.error") + "=>" + picgoPostResult.errmsg)
ElMessage.error(t("github.post.picgo.picbed.error") + "=>" + picgoPostResult.errmsg)
}
}
}
Expand Down
Loading

0 comments on commit 2dfc155

Please sign in to comment.