feat: localizable dialog title for enter section title (#14401)
* feat: localizable dialog title for enter section title * refactor: define `getPageBlockList` in separated file and import instead of provide/inject
This commit is contained in:
parent
6db3c50e32
commit
748a7e8f6a
|
@ -8985,6 +8985,10 @@ export interface Locale extends ILocale {
|
||||||
* ブロックを追加
|
* ブロックを追加
|
||||||
*/
|
*/
|
||||||
"chooseBlock": string;
|
"chooseBlock": string;
|
||||||
|
/**
|
||||||
|
* セクションタイトルを入力
|
||||||
|
*/
|
||||||
|
"enterSectionTitle": string;
|
||||||
/**
|
/**
|
||||||
* 種類を選択
|
* 種類を選択
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2371,6 +2371,7 @@ _pages:
|
||||||
eyeCatchingImageSet: "アイキャッチ画像を設定"
|
eyeCatchingImageSet: "アイキャッチ画像を設定"
|
||||||
eyeCatchingImageRemove: "アイキャッチ画像を削除"
|
eyeCatchingImageRemove: "アイキャッチ画像を削除"
|
||||||
chooseBlock: "ブロックを追加"
|
chooseBlock: "ブロックを追加"
|
||||||
|
enterSectionTitle: "セクションタイトルを入力"
|
||||||
selectType: "種類を選択"
|
selectType: "種類を選択"
|
||||||
contentBlocks: "コンテンツ"
|
contentBlocks: "コンテンツ"
|
||||||
inputBlocks: "入力"
|
inputBlocks: "入力"
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { i18n } from '@/i18n.js';
|
||||||
|
|
||||||
|
export function getPageBlockList() {
|
||||||
|
return [
|
||||||
|
{ value: 'section', text: i18n.ts._pages.blocks.section },
|
||||||
|
{ value: 'text', text: i18n.ts._pages.blocks.text },
|
||||||
|
{ value: 'image', text: i18n.ts._pages.blocks.image },
|
||||||
|
{ value: 'note', text: i18n.ts._pages.blocks.note },
|
||||||
|
];
|
||||||
|
}
|
|
@ -29,6 +29,7 @@ import * as os from '@/os.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import { deepClone } from '@/scripts/clone.js';
|
import { deepClone } from '@/scripts/clone.js';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
|
import { getPageBlockList } from '@/pages/page-editor/common.js';
|
||||||
|
|
||||||
const XBlocks = defineAsyncComponent(() => import('../page-editor.blocks.vue'));
|
const XBlocks = defineAsyncComponent(() => import('../page-editor.blocks.vue'));
|
||||||
|
|
||||||
|
@ -53,11 +54,9 @@ watch(children, () => {
|
||||||
deep: true,
|
deep: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const getPageBlockList = inject<(any) => any>('getPageBlockList');
|
|
||||||
|
|
||||||
async function rename() {
|
async function rename() {
|
||||||
const { canceled, result: title } = await os.inputText({
|
const { canceled, result: title } = await os.inputText({
|
||||||
title: 'Enter title',
|
title: i18n.ts._pages.enterSectionTitle,
|
||||||
default: props.modelValue.title,
|
default: props.modelValue.title,
|
||||||
});
|
});
|
||||||
if (canceled) return;
|
if (canceled) return;
|
||||||
|
|
|
@ -77,6 +77,7 @@ import { i18n } from '@/i18n.js';
|
||||||
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
||||||
import { $i } from '@/account.js';
|
import { $i } from '@/account.js';
|
||||||
import { mainRouter } from '@/router/main.js';
|
import { mainRouter } from '@/router/main.js';
|
||||||
|
import { getPageBlockList } from '@/pages/page-editor/common.js';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
initPageId?: string;
|
initPageId?: string;
|
||||||
|
@ -101,7 +102,6 @@ const alignCenter = ref(false);
|
||||||
const hideTitleWhenPinned = ref(false);
|
const hideTitleWhenPinned = ref(false);
|
||||||
|
|
||||||
provide('readonly', readonly.value);
|
provide('readonly', readonly.value);
|
||||||
provide('getPageBlockList', getPageBlockList);
|
|
||||||
|
|
||||||
watch(eyeCatchingImageId, async () => {
|
watch(eyeCatchingImageId, async () => {
|
||||||
if (eyeCatchingImageId.value == null) {
|
if (eyeCatchingImageId.value == null) {
|
||||||
|
@ -216,15 +216,6 @@ async function add() {
|
||||||
content.value.push({ id, type });
|
content.value.push({ id, type });
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPageBlockList() {
|
|
||||||
return [
|
|
||||||
{ value: 'section', text: i18n.ts._pages.blocks.section },
|
|
||||||
{ value: 'text', text: i18n.ts._pages.blocks.text },
|
|
||||||
{ value: 'image', text: i18n.ts._pages.blocks.image },
|
|
||||||
{ value: 'note', text: i18n.ts._pages.blocks.note },
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
function setEyeCatchingImage(img) {
|
function setEyeCatchingImage(img) {
|
||||||
selectFile(img.currentTarget ?? img.target, null).then(file => {
|
selectFile(img.currentTarget ?? img.target, null).then(file => {
|
||||||
eyeCatchingImageId.value = file.id;
|
eyeCatchingImageId.value = file.id;
|
||||||
|
|
Loading…
Reference in New Issue