Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:he-weilai/cherry-markdown into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
he-weilai committed Jul 14, 2024
2 parents 487fd71 + d561688 commit d6a648a
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 5 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/pr-merge.yml
Original file line number Diff line number Diff line change
@@ -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 }}
8 changes: 4 additions & 4 deletions src/core/hooks/SuggestList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) => {
Expand Down
3 changes: 2 additions & 1 deletion src/core/hooks/Suggester.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,15 @@ export default class Suggester extends SyntaxBase {

this.suggester = {};
const defaultSuggest = [];
const that = this;
// 默认的唤醒关键字
for (const suggesterKeyword of suggesterKeywords) {
defaultSuggest.push({
keyword: suggesterKeyword,
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);
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en_US.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,7 @@ 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',
editShortcutKeyConfigTip: 'double click shortcut key area to edit',
};
2 changes: 2 additions & 0 deletions src/locales/zh_CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,7 @@ export default {
large: '大',
superLarge: '特大',
detailDefaultContent: '点击展开更多\n内容\n++- 默认展开\n内容\n++ 默认收起\n内容',
inlineCode: '行内代码',
codeBlock: '代码块',
editShortcutKeyConfigTip: '双击快捷键区域编辑快捷键',
};

0 comments on commit d6a648a

Please sign in to comment.