Merge branch 'develop' of codeberg.org:calckey/calckey into develop
This commit is contained in:
commit
0a3259993b
|
@ -1806,7 +1806,9 @@ _deck:
|
|||
popRight: "Pop column to the right"
|
||||
profile: "Workspace"
|
||||
newProfile: "New workspace"
|
||||
renameProfile: "Rename workspace"
|
||||
deleteProfile: "Delete workspace"
|
||||
nameAlreadyExists: "This workspace name already exists."
|
||||
introduction: "Create the perfect interface for you by arranging columns freely!"
|
||||
introduction2: "Click on the + on the right of the screen to add new colums whenever you want."
|
||||
widgetsIntroduction: "Please select \"Edit widgets\" in the column menu and add a widget."
|
||||
|
|
|
@ -1803,7 +1803,9 @@ _deck:
|
|||
popRight: "右に出す"
|
||||
profile: "ワークスペース"
|
||||
newProfile: "新規ワークスペース"
|
||||
renameProfile: "ワークスペース名を変更"
|
||||
deleteProfile: "ワークスペースを削除"
|
||||
nameAlreadyExists: "この名前のワークスペースは既に存在します。"
|
||||
introduction: "カラムを組み合わせて自分だけのインターフェイスを作りましょう!"
|
||||
introduction2: "画面の右にある + を押して、いつでもカラムを追加できます。"
|
||||
widgetsIntroduction: "カラムのメニューから、「ウィジェットの編集」を選択してウィジェットを追加してください"
|
||||
|
|
|
@ -1731,7 +1731,9 @@ _deck:
|
|||
popRight: "向右弹出"
|
||||
profile: "配置文件"
|
||||
newProfile: "新建配置文件"
|
||||
renameProfile: "重命名配置文件"
|
||||
deleteProfile: "删除配置文件"
|
||||
nameAlreadyExists: "该配置文件名已存在。"
|
||||
introduction: "将各列进行组合以创建您自己的界面!"
|
||||
introduction2: "您可以随时通过屏幕右侧的 + 来添加列"
|
||||
widgetsIntroduction: "从列菜单中,选择“小工具编辑”来添加小工具"
|
||||
|
|
|
@ -1731,7 +1731,9 @@ _deck:
|
|||
popRight: "向右彈出"
|
||||
profile: "個人檔案"
|
||||
newProfile: "新建個人檔案"
|
||||
renameProfile: "重新命名個人檔案"
|
||||
deleteProfile: "刪除個人檔案"
|
||||
nameAlreadyExists: "該個人檔案名已經存在。"
|
||||
introduction: "組合欄位來製作屬於自己的介面吧!"
|
||||
introduction2: "您可以隨時透過按畫面右方的 + 來添加欄位。"
|
||||
widgetsIntroduction: "請從欄位的選單中,選擇「編輯小工具」來添加小工具"
|
||||
|
|
|
@ -12,7 +12,6 @@ import MkGoogle from "@/components/MkGoogle.vue";
|
|||
import MkSparkle from "@/components/MkSparkle.vue";
|
||||
import MkA from "@/components/global/MkA.vue";
|
||||
import { host } from "@/config";
|
||||
import { MFM_TAGS } from "@/scripts/mfm-tags";
|
||||
import { reducedMotion } from "@/scripts/reduced-motion";
|
||||
import { defaultStore } from "@/store";
|
||||
|
||||
|
@ -461,7 +460,7 @@ export default defineComponent({
|
|||
case "search": {
|
||||
// Disable "search" keyword
|
||||
// (see the issue #9816 on Codeberg)
|
||||
if (token.props.content.endsWith("search")) {
|
||||
if (token.props.content.slice(-6).toLowerCase() === "search") {
|
||||
const sentinel = "#";
|
||||
let ast2 = (isPlain ? mfm.parseSimple : mfm.parse)(
|
||||
token.props.content.slice(0, -6) + sentinel,
|
||||
|
@ -473,19 +472,32 @@ export default defineComponent({
|
|||
ast2[ast2.length - 1].props.text = ast2[
|
||||
ast2.length - 1
|
||||
].props.text.slice(0, -1);
|
||||
} else {
|
||||
// I don't think this scope is reachable
|
||||
console.warn(
|
||||
"Something went wrong while parsing MFM. Please send a bug report, if possible.",
|
||||
);
|
||||
}
|
||||
|
||||
let prefix = "\n";
|
||||
if (
|
||||
index === 0 ||
|
||||
["blockCode", "mathBlock", "search", "quote"].includes(
|
||||
ast[index - 1].type,
|
||||
)
|
||||
[
|
||||
"blockCode",
|
||||
"center",
|
||||
"mathBlock",
|
||||
"quote",
|
||||
"search",
|
||||
].includes(ast[index - 1].type)
|
||||
) {
|
||||
prefix = "";
|
||||
}
|
||||
|
||||
return [prefix, ...genEl(ast2), "search\n"];
|
||||
return [
|
||||
prefix,
|
||||
...genEl(ast2),
|
||||
`${token.props.content.slice(-6)}\n`,
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
|
|
|
@ -70,6 +70,14 @@
|
|||
>
|
||||
<i class="ph-caret-down ph-bold ph-lg"></i>
|
||||
</button>
|
||||
<button
|
||||
v-if="deckStore.state.profile !== 'default'"
|
||||
v-tooltip.noDelay.left="i18n.ts._deck.renameProfile"
|
||||
class="_button button"
|
||||
@click="renameProfile"
|
||||
>
|
||||
<i class="ph-pencil ph-bold ph-lg"></i>
|
||||
</button>
|
||||
<button
|
||||
v-if="deckStore.state.profile !== 'default'"
|
||||
v-tooltip.noDelay.left="i18n.ts._deck.deleteProfile"
|
||||
|
@ -161,6 +169,7 @@ import {
|
|||
addColumn as addColumnToStore,
|
||||
loadDeck,
|
||||
getProfiles,
|
||||
renameProfile as renameProfile_,
|
||||
deleteProfile as deleteProfile_,
|
||||
} from "./deck/deck-store";
|
||||
import DeckColumnCore from "@/ui/deck/column-core.vue";
|
||||
|
@ -319,6 +328,23 @@ function changeProfile(ev: MouseEvent) {
|
|||
os.popupMenu(items, ev.currentTarget ?? ev.target);
|
||||
}
|
||||
|
||||
async function renameProfile() {
|
||||
const { canceled, result: newProfileName } = await os.inputText({
|
||||
title: i18n.ts._deck.renameProfile,
|
||||
allowEmpty: false,
|
||||
});
|
||||
if (canceled) return;
|
||||
|
||||
const profiles = await getProfiles();
|
||||
if (profiles.includes(newProfileName)) {
|
||||
os.alert({ type: "error", text: i18n.ts._deck.nameAlreadyExists });
|
||||
return;
|
||||
}
|
||||
|
||||
await renameProfile_(deckStore.state.profile, newProfileName);
|
||||
unisonReload();
|
||||
}
|
||||
|
||||
async function deleteProfile() {
|
||||
const { canceled } = await os.confirm({
|
||||
type: "warning",
|
||||
|
|
|
@ -115,6 +115,20 @@ export async function deleteProfile(key: string): Promise<any> {
|
|||
});
|
||||
}
|
||||
|
||||
export async function renameProfile(oldKey: string, newKey: string) {
|
||||
if (oldKey === newKey) return;
|
||||
|
||||
await api("i/registry/set", {
|
||||
scope: ["client", "deck", "profiles"],
|
||||
key: newKey,
|
||||
value: { columns: deckStore.state.columns, layout: deckStore.state.layout },
|
||||
});
|
||||
deckStore.set("profile", newKey);
|
||||
saveDeck();
|
||||
|
||||
deleteProfile(oldKey);
|
||||
}
|
||||
|
||||
export function addColumn(column: Column) {
|
||||
if (column.name === undefined) column.name = null;
|
||||
deckStore.push("columns", column);
|
||||
|
|
Loading…
Reference in New Issue