From d94b357b2338fbf641e6b3ceb48edb3c8a02e9eb Mon Sep 17 00:00:00 2001 From: xiayuxuan Date: Thu, 11 Jul 2024 00:41:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20#835=20=E4=BB=A3=E7=A0=81=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E8=87=AA=E5=8A=A8=E8=A1=A5=E5=85=A8=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/hooks/SuggestList.js | 8 ++++---- src/core/hooks/Suggester.js | 3 ++- src/locales/en_US.js | 2 ++ src/locales/zh_CN.js | 2 ++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/core/hooks/SuggestList.js b/src/core/hooks/SuggestList.js index 5019f5df..dc3d358a 100644 --- a/src/core/hooks/SuggestList.js +++ b/src/core/hooks/SuggestList.js @@ -261,14 +261,14 @@ const MoreSuggestList = [ }, { icon: 'FullWidth', - label: '行内代码', + label: 'inlineCode', keyword: '`', value: '``', goLeft: 1, }, { icon: 'FullWidth', - label: '代码块', + label: 'codeBlock', keyword: '`', value: '```\n\n```\n', goTop: 2, @@ -316,10 +316,10 @@ export function allSuggestList(keyword, locales) { const systemSuggestList = [].concat(SystemSuggestList); const otherSuggestList = [].concat(OtherSuggestList); systemSuggestList.forEach((item) => { - item.label = locales ? locales[item.label] : item.label; + item.label = locales[item.label] || item.label; }); otherSuggestList.forEach((item) => { - item.label = locales ? locales[item.label] : item.label; + item.label = locales[item.label] || item.label; }); if (keyword[0] === '/' || keyword[0] === '、' || addonsKeywords.includes(keyword[0])) { systemSuggestList.forEach((item) => { diff --git a/src/core/hooks/Suggester.js b/src/core/hooks/Suggester.js index 709365a6..2664b222 100644 --- a/src/core/hooks/Suggester.js +++ b/src/core/hooks/Suggester.js @@ -105,6 +105,7 @@ export default class Suggester extends SyntaxBase { this.suggester = {}; const defaultSuggest = []; + const that = this; // 默认的唤醒关键字 for (const suggesterKeyword of suggesterKeywords) { defaultSuggest.push({ @@ -112,7 +113,7 @@ export default class Suggester extends SyntaxBase { suggestList(_word, callback) { // 将word全转成小写 const word = _word.toLowerCase(); - const systemSuggestList = allSuggestList(suggesterKeyword, this.$locale); + const systemSuggestList = allSuggestList(suggesterKeyword, that.$locale); // 加个空格就直接退出联想 if (/^\s$/.test(word)) { callback(false); diff --git a/src/locales/en_US.js b/src/locales/en_US.js index 5df6407e..23a4dec1 100644 --- a/src/locales/en_US.js +++ b/src/locales/en_US.js @@ -99,4 +99,6 @@ export default { superLarge: 'Super Large', detailDefaultContent: 'Click to expand more\nContent\n++- Expand by default\nContent\n++ Collapse by default\nContent', + inlineCode: 'Inline Code', + codeBlock: 'Code Block', }; diff --git a/src/locales/zh_CN.js b/src/locales/zh_CN.js index bee5674a..00b4dc20 100644 --- a/src/locales/zh_CN.js +++ b/src/locales/zh_CN.js @@ -102,4 +102,6 @@ export default { large: '大', superLarge: '特大', detailDefaultContent: '点击展开更多\n内容\n++- 默认展开\n内容\n++ 默认收起\n内容', + inlineCode: '行内代码', + codeBlock: '代码块', }; From 0cd79ca80916cd93cdba0a8372995b9dcd727a4c Mon Sep 17 00:00:00 2001 From: xiayuxuan Date: Thu, 11 Jul 2024 00:48:11 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20#835=20=E5=A4=84=E7=90=86eslint?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/locales/en_US.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locales/en_US.js b/src/locales/en_US.js index 2cd686a7..94638cb5 100644 --- a/src/locales/en_US.js +++ b/src/locales/en_US.js @@ -98,7 +98,7 @@ export default { large: 'Large', superLarge: 'Super Large', detailDefaultContent: - 'Click to expand more\nContent\n++- Expand by default\nContent\n++ Collapse by default\nContent', + 'Click to expand more\nContent\n++- Expand by default\nContent\n++ Collapse by default\nContent', inlineCode: 'Inline Code', codeBlock: 'Code Block', editShortcutKeyConfigTip: 'double click shortcut key area to edit', From 0da9aba0bbb783c23b09343a224a18b806a2fbb0 Mon Sep 17 00:00:00 2001 From: Saraph1nes Date: Sat, 13 Jul 2024 00:27:10 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20#836=20PR=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E5=90=8E=E8=87=AA=E5=8A=A8=E6=B8=85=E9=99=A4PR=E5=9C=A8?= =?UTF-8?q?=E7=BA=BF=E9=A2=84=E8=A7=88=E7=9B=B8=E5=85=B3=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr-merge.yml | 79 ++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 .github/workflows/pr-merge.yml diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml new file mode 100644 index 00000000..f4651ed4 --- /dev/null +++ b/.github/workflows/pr-merge.yml @@ -0,0 +1,79 @@ +name: PR Closed + +on: + pull_request_target: + types: + - closed + +jobs: + remove_assets: + runs-on: ubuntu-latest + + steps: + # 检出仓库代码 + - name: Checkout repository + uses: actions/checkout@v2 + + # 打印 PR 详细信息 + - name: Print PR details + run: | + echo "The PR ID is ${{ github.event.pull_request.id }}" + echo "The PR number is ${{ github.event.pull_request.number }}" + echo "The PR title is ${{ github.event.pull_request.title }}" + echo "The PR branch is ${{ github.event.pull_request.head.ref }}" + + # 安装 cos-nodejs-sdk-v5 + - name: Install cos-nodejs-sdk-v5 + run: npm install cos-nodejs-sdk-v5 + + # 删除对应的资源 + - name: Delete Resources On COS + uses: actions/github-script@v7 + with: + script: | + const COS = require('cos-nodejs-sdk-v5'); + + const cos = new COS({ + SecretId: process.env.COS_SECRETID, + SecretKey: process.env.COS_SECRETKEY, + }); + + const bucket = 'cherrymd-1301618266'; + const region = 'ap-singapore'; + const prNumber = '${{ github.event.pull_request.number }}'; + const prefix = `pr${prNumber}/`; + + // List objects in the bucket with the specified prefix + cos.getBucket({ + Bucket: bucket, + Region: region, + Prefix: prefix, + }, (err, data) => { + if (err) { + console.error('Error listing objects:', err); + return; + } + + const objectsToDelete = data.Contents.map(item => ({ Key: item.Key })); + + if (objectsToDelete.length === 0) { + console.log('No objects to delete.'); + return; + } + + // Delete the listed objects + cos.deleteMultipleObject({ + Bucket: bucket, + Region: region, + Objects: objectsToDelete, + }, (err, data) => { + if (err) { + console.error('Error deleting objects:', err); + } else { + console.log('Successfully deleted objects:', data); + } + }); + }); + env: + COS_SECRETID: ${{ secrets.COS_SECRETID }} + COS_SECRETKEY: ${{ secrets.COS_SECRETKEY }}