Skip to content

Commit

Permalink
Merge pull request 'v1.4.0 Releases' (PR#35) from dev into main
Browse files Browse the repository at this point in the history
  • Loading branch information
justice2001 committed Dec 30, 2023
2 parents 240513d + b6b9017 commit 31435e5
Show file tree
Hide file tree
Showing 21 changed files with 446 additions and 29 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repositories {
}

dependencies {
implementation platform('run.halo.tools.platform:plugin:2.8.0-SNAPSHOT')
implementation platform('run.halo.tools.platform:plugin:2.11.0-SNAPSHOT')
compileOnly 'run.halo.app:api'

testImplementation 'run.halo.app:api'
Expand Down
7 changes: 4 additions & 3 deletions console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
},
"dependencies": {
"@halo-dev/components": "^1.7.0",
"@halo-dev/console-shared": "^2.8.0",
"@halo-dev/api-client": "^2.11.0",
"@halo-dev/components": "^1.10.0",
"@halo-dev/console-shared": "^2.11.0",
"canvas-confetti": "^1.6.0",
"@zhengyi/vditor": "^3.9.8",
"@zhengyi/vditor": "3.9.9",
"vue": "^3.3.4"
},
"devDependencies": {
Expand Down
20 changes: 14 additions & 6 deletions console/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions console/src/i18n/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@ import type { I18nLang } from "@/type/i18n";

const lang: I18nLang = {
insert_image: "Insert Image",
confirm: "Confirm",
close: "Close",
default: "Default",
warning: "Warning",
danger: "Danger",
success: "Success",
info: "Info",
insert_tips: "Insert Tips",
type: "Type",
content: "Content",
platform: "Platform",
owner: "Owner",
repo: "Repo",
insert_git: "Insert Git Repo",
insert_custom: "Insert Custom",
insert_drive: "Insert Resources Link",
baidu_net_disk: "Baidu Net Disk",
ali_drive: "Ali Drive",
title: "Title",
link: "Link",
password: "Password",
};

export default lang;
30 changes: 25 additions & 5 deletions console/src/i18n/zh-CN.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
import type {I18nLang} from "@/type/i18n";
import type { I18nLang } from "@/type/i18n";

const lang: I18nLang = {
"insert_image": "插入图片"
}
insert_image: "插入图片",
confirm: "确定",
close: "关闭",
default: "默认",
warning: "警告",
danger: "危险",
success: "成功",
info: "信息",
insert_tips: "插入Tips",
type: "类型",
content: "内容",
platform: "平台",
owner: "所有者",
repo: "仓库",
insert_git: "插入Git仓库",
insert_custom: "插入自定义块",
insert_drive: "插入资源链接",
baidu_net_disk: "百度网盘",
ali_drive: "阿里云盘",
title: "标题",
link: "链接",
password: "密码",
};


export default lang
export default lang;
29 changes: 25 additions & 4 deletions console/src/i18n/zh-TW.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
import type {I18nLang} from "@/type/i18n";
import type { I18nLang } from "@/type/i18n";

const lang: I18nLang = {
"insert_image": "插入圖片"
}
insert_image: "插入圖片",
confirm: "確定",
close: "關閉",
default: "默認",
warning: "警告",
danger: "危險",
success: "成功",
info: "訊息",
insert_tips: "插入Tips",
type: "類型",
content: "內容",
platform: "平臺",
owner: "所有者",
repo: "儲存庫",
insert_git: "插入Git存儲庫",
insert_custom: "插入自定義塊",
insert_drive: "插入資源鏈接",
baidu_net_disk: "百度網盤",
ali_drive: "阿里雲盤",
title: "標題",
link: "鏈接",
password: "密碼",
};

export default lang
export default lang;
75 changes: 75 additions & 0 deletions console/src/model/DriveModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<script setup lang="ts">
import { VModal, VButton, VSpace } from "@halo-dev/components";
import { t } from "@/utils/i18n-utils";
import { ref } from "vue";
const props = defineProps<{
open: boolean;
}>();
const emit = defineEmits<{
(event: "done", value: string): void;
(event: "close"): void;
}>();
const platform = ref("baidu");
const name = ref("");
const link = ref("");
const password = ref("");
const generateCode = () => {
let code = "\n\n```halo\n";
code += `drive:${platform.value}\n`;
code += `name: ${name.value}\n`;
code += `link: ${link.value}\n`;
if (password.value) {
code += `password: ${password.value}\n`;
}
emit("done", code + "```\n\n");
};
</script>

<template>
<VModal
:visible="props.open"
:layer-closable="false"
:title="t('insert_drive')"
@close="emit('close')"
>
<v-space align="start" direction="column" spacing="xs" style="width: 100%">
<label for="type" class="vditor-mde-label">
<span>{{ t("platform") }}</span>
<select id="platform" v-model="platform" class="vditor-mde-select">
<option value="baidu">{{ t("baidu_net_disk") }}</option>
<option value="ali">{{ t("ali_drive") }}</option>
</select>
</label>
<label for="name" class="vditor-mde-label">
<span>{{ t("title") }}</span>
<input id="name" v-model="name" type="text" class="vditor-mde-input" />
</label>
<label for="link" class="vditor-mde-label">
<span>{{ t("link") }}</span>
<input id="link" v-model="link" type="text" class="vditor-mde-input" />
</label>
<label for="password" class="vditor-mde-label">
<span>{{ t("password") }}</span>
<input
id="password"
v-model="password"
type="text"
class="vditor-mde-input"
/>
</label>
</v-space>
<template #footer>
<v-space align="center" direction="row" spacing="xs">
<v-button type="primary" @click="generateCode">
{{ t("confirm") }}
</v-button>
<v-button type="default" @click="emit('close')">
{{ t("close") }}
</v-button>
</v-space>
</template>
</VModal>
</template>
72 changes: 72 additions & 0 deletions console/src/model/GitModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<script setup lang="ts">
import { VModal, VButton, VSpace } from "@halo-dev/components";
import { t } from "@/utils/i18n-utils";
import { ref } from "vue";
const URL_NOT_SHOW = ["github", "gitee"];
const props = defineProps<{
open: boolean;
}>();
const emit = defineEmits<{
(event: "done", value: string): void;
(event: "close"): void;
}>();
const url = ref("");
const platform = ref("github");
const owner = ref("");
const repo = ref("");
const generateCode = () => {
emit(
"done",
"\n\n```halo\n" +
`git:[${url.value}@${platform.value}/${owner.value}/${repo.value}]` +
"\n```\n\n"
);
};
</script>

<template>
<VModal
:visible="props.open"
:layer-closable="false"
:title="t('insert_git')"
@close="emit('close')"
>
<v-space align="start" direction="column" spacing="xs" style="width: 100%">
<label v-if="URL_NOT_SHOW.indexOf(platform) === -1" for="url">
<span>URL</span>
<input id="url" v-model="url" type="text" class="vditor-mde-input" />
</label>
<label for="type" class="vditor-mde-label">
<span>{{ t("platform") }}</span>
<select id="platform" v-model="platform" class="vditor-mde-select">
<option value="github">GitHub</option>
<option value="gitee">Gitee</option>
</select>
</label>
<label for="owner" class="vditor-mde-label">
<span>{{ t("owner") }}</span>
<input id="owner" v-model="owner" type="text" class="vditor-mde-input" />
</label>
<label for="repo" class="vditor-mde-label">
<span>{{ t("repo") }}</span>
<input id="repo" v-model="repo" type="text" class="vditor-mde-input" />
</label>
</v-space>
<template #footer>
<v-space align="center" direction="row" spacing="xs">
<v-button type="primary" @click="generateCode">
{{ t("confirm") }}
</v-button>
<v-button type="default" @click="emit('close')">
{{ t("close") }}
</v-button>
</v-space>
</template>
</VModal>
</template>

<style scoped></style>
59 changes: 59 additions & 0 deletions console/src/model/TipsModel.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<script setup lang="ts">
import { VModal, VButton, VSpace } from "@halo-dev/components";
import { ref } from "vue";
import { t } from "@/utils/i18n-utils";
const props = defineProps<{
open: boolean;
}>();
const emit = defineEmits<{
(event: "done", value: string): void;
(event: "close"): void;
}>();
const type = ref("default");
const content = ref("");
const generateCode = () => {
emit(
"done",
"\n\n```halo\n" + `tips:${type.value}\n${content.value}\n` + "```\n\n"
);
};
</script>

<template>
<VModal
:visible="props.open"
:layer-closable="false"
:title="t('insert_tips')"
@close="emit('close')"
>
<v-space align="start" direction="column" spacing="xs" style="width: 100%">
<label for="type" class="vditor-mde-label">
<span>{{ t("type") }}</span>
<select id="type" v-model="type" class="vditor-mde-select">
<option value="default">{{ t("default") }}</option>
<option value="danger">{{ t("danger") }}</option>
<option value="warn">{{ t("warning") }}</option>
<option value="info">{{ t("info") }}</option>
<option value="success">{{ t("success") }}</option>
</select>
</label>
<label for="content" class="vditor-mde-label">
<span>{{ t("content") }}</span>
<textarea id="content" v-model="content" class="vditor-mde-textarea" />
</label>
</v-space>
<template #footer>
<v-space align="center" direction="row" spacing="xs">
<v-button type="primary" @click="generateCode">
{{ t("confirm") }}
</v-button>
<v-button type="default" @click="emit('close')">
{{ t("close") }}
</v-button>
</v-space>
</template>
</VModal>
</template>
2 changes: 2 additions & 0 deletions console/src/type/editor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ export declare type Options = {
showAttachment: () => void;
language: string;
codeBlockPreview: boolean;
uploadImage?: (files: File[]) => string | null | Promise;
openModal: (name: string) => void;
};
7 changes: 6 additions & 1 deletion console/src/utils/i18n-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import zhCN from "@/i18n/zh-CN";
import type { I18nLang } from "@/type/i18n";
import zhTW from "@/i18n/zh-TW";
import enUS from "@/i18n/en-US";
import {getLanguage} from "@/utils/vditor-utils";

const langDict: { [key: string]: I18nLang } = {
zh_CN: zhCN,
Expand All @@ -14,6 +15,10 @@ const langDict: { [key: string]: I18nLang } = {
* @param key key
* @param lang 目标语言
*/
export function t(key: string, lang: keyof II18n): string {
export function t(
key: string,
lang: keyof II18n | undefined = undefined
): string {
if (!lang) lang = getLanguage(localStorage.getItem("locale") || "zh-CN");
return langDict[lang][key];
}
1 change: 1 addition & 0 deletions console/src/utils/icon.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const mdiImage = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="m8.5 13.5l2.5 3l3.5-4.5l4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2"/></svg>`;
export const mdiGrid = `<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M120-520v-320h320v320H120Zm0 400v-320h320v320H120Zm400-400v-320h320v320H520Zm0 400v-320h320v320H520ZM200-600h160v-160H200v160Zm400 0h160v-160H600v160Zm0 400h160v-160H600v160Zm-400 0h160v-160H200v160Zm400-400Zm0 240Zm-240 0Zm0-240Z"/></svg>`;
Loading

0 comments on commit 31435e5

Please sign in to comment.