Skip to content
Merged

4.6.3 #636

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ package-lock.json
/steam/depot_build_*.vdf
!/steam/app_build_TEMPLATE.vdf
!/steam/depot_build_TEMPLATE.vdf
packages/origine2/src/locales/en.js
packages/origine2/src/locales/ja.js
packages/origine2/src/locales/zhCn.js
packages/origine2/src/locales/en.ts
packages/origine2/src/locales/ja.ts
packages/origine2/src/locales/zhCn.ts
packages/origine2/src/locales/*.js
packages/origine2/src/locales/*.ts
.claude
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webgal-terre",
"version": "4.6.2",
"version": "4.6.3",
"private": true,
"scripts": {
"dev": "concurrently \"yarn dev:terre\" \"yarn dev:origine\" \"yarn dev:start-dev-server\"",
Expand Down
4 changes: 2 additions & 2 deletions packages/origine2/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "webgal-origine-2",
"private": true,
"version": "4.6.2",
"version": "4.6.3",
"license": "MPL-2.0",
"scripts": {
"sync:editor-preview-protocol": "yarn workspace @webgal/editor-preview-protocol build",
Expand Down Expand Up @@ -63,7 +63,7 @@
"sass": "^1.51.0",
"swr": "^2.2.4",
"uuid": "^13.0.0",
"webgal-parser": "4.6.2",
"webgal-parser": "4.6.3",
"zustand": "^4.5.2"
},
"devDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions packages/origine2/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import useEditorStore from './store/useEditorStore';
import useLanguage from './hooks/useLanguage';
import { initMonaco } from '@/utils/initMonaco';
import { useHashRouter, RouterPage } from '@/router';
import { TrashToaster } from '@/hooks/useTrashFailedToast';

function App() {
useEffect(() => {
Expand All @@ -32,6 +33,7 @@ function App() {
return (
<div className="App" key={appKeyLang}>
<RouterPage page={page} />
<TrashToaster />
</div>
);
}
Expand Down
11 changes: 11 additions & 0 deletions packages/origine2/src/components/AppSettings/AppSettingsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import {
NavigationFilled,
NavigationRegular,
Settings20Regular,
ArchiveFilled,
ArchiveRegular,
} from '@fluentui/react-icons';
import { Platte } from '@icon-park/react';
import { ReactNode, useEffect, useState } from 'react';
Expand Down Expand Up @@ -132,6 +134,8 @@ export function SettingsShortcutGrid({ onOpenSettings }: { onOpenSettings?: () =
const isCascaderDelimitersCustomizable = useEditorStore.use.isCascaderDelimitersCustomizable();
const updateIsCascaderDelimitersCustomizable = useEditorStore.use.updateIsCascaderDelimitersCustomizable();
const updateCascaderDelimiters = useEditorStore.use.updateCascaderDelimiters();
const isTrash = useEditorStore.use.isTrash();
const updateIsTrash = useEditorStore.use.updateIsTrash();

return (
<div className={styles.grid}>
Expand Down Expand Up @@ -211,6 +215,13 @@ export function SettingsShortcutGrid({ onOpenSettings }: { onOpenSettings?: () =
if (!next) updateCascaderDelimiters(['/']);
}}
/>
<SettingTile
icon={isTrash ? <ArchiveFilled /> : <ArchiveRegular />}
title={t`回收站`}
description={isTrash ? t`已启用,删除操作会移动到回收站` : t`已禁用,删除操作会永久删除`}
active={isTrash}
onClick={() => updateIsTrash(!isTrash)}
/>
</div>
);
}
Expand Down
11 changes: 9 additions & 2 deletions packages/origine2/src/components/Assets/Assets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import { t } from '@lingui/macro';
import Upload from './Upload';
import naturalCompare from 'natural-compare-lite';
import useEditorStore from '@/store/useEditorStore';
import useTrashFailedToast from '@/hooks/useTrashFailedToast';

export interface IFile {
extName: string;
Expand Down Expand Up @@ -133,7 +134,8 @@ export default function Assets({
const updateSortBy = useEditorStore.use.updateSortBy();
const sortOrder = useEditorStore.use.sortOrder();
const updateSortOrder = useEditorStore.use.updateSortOrder();
const isTrash = false;
const isTrash = useEditorStore.use.isTrash();
const toastTrashFailed = useTrashFailedToast();

const currentPath = useValue([...basePath, ...selectedFilePath.slice(0, -1)]);
const currentFullPath = useMemo(() => [...rootPath, ...currentPath.value], [currentPath.value]);
Expand Down Expand Up @@ -309,7 +311,12 @@ export default function Assets({

const handleDeleteFile = async (source: string) => {
if (isTrash) {
await api.assetsControllerTrashFileOrDir({ source });
try {
await api.assetsControllerTrashFileOrDir({ source });
} catch {
toastTrashFailed();
return;
}
} else {
await api.assetsControllerDeleteFileOrDir({ source });
}
Expand Down
54 changes: 54 additions & 0 deletions packages/origine2/src/config/highlighting/hl.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,62 @@
}
}
},
"continuation-arguments": {
"comment": "多行语句的参数续行,ie ` -kwarg0=val0 -kwarg1`。行首空白提供了 argument-list 需要的分隔空格",
"match": "^(\\s+\\-(?:\\\\.|[^\\n;])*)($|(?<!\\\\);.*?$)",
"captures": {
"1": {
"patterns": [
{
"include": "#argument-list"
}
]
},
"2": {
"patterns": [
{
"include": "#comment-line"
}
]
}
}
},
"continuation-text": {
"comment": "多行语句的文本续行,ie ` |第二段文字 -hold`",
"match": "^\\s+(\\|)((?:\\\\.|[^\\n;])*)($|(?<!\\\\);.*?$)",
"captures": {
"1": {
"patterns": [
{
"include": "#operator"
}
]
},
"2": {
"patterns": [
{
"include": "#utterance"
}
]
},
"3": {
"patterns": [
{
"include": "#comment-line"
}
]
}
}
},
"statement": {
"patterns": [
{
"comment": "续行必须排在普通语句之前,否则会被当成对白正文",
"include": "#continuation-arguments"
},
{
"include": "#continuation-text"
},
{
"include": "#character-colon"
},
Expand Down
20 changes: 20 additions & 0 deletions packages/origine2/src/hooks/usePresetTargetOptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { useMemo } from "react";
import { t } from "@lingui/macro";

/**
* 预设的效果目标,按立绘在舞台上从左到右的顺序排列
* @param includeStage 是否包含舞台画面
*/
export const usePresetTargetOptions = (includeStage = true) => {
return useMemo(() => new Map<string, string>([
[ "fig-left", t`左侧立绘` ],
[ "fig-left14", t`左侧 1/4 立绘` ],
[ "fig-left13", t`左侧 1/3 立绘` ],
[ "fig-center", t`中间立绘` ],
[ "fig-right13", t`右侧 1/3 立绘` ],
[ "fig-right14", t`右侧 1/4 立绘` ],
[ "fig-right", t`右侧立绘` ],
[ "bg-main", t`背景图片` ],
...(includeStage ? [[ "stage-main", t`舞台画面` ] as [string, string]] : []),
]), [includeStage]);
};
21 changes: 21 additions & 0 deletions packages/origine2/src/hooks/useTrashFailedToast.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Toast, ToastBody, Toaster, ToastTitle, useToastController } from '@fluentui/react-components';
import { t } from '@lingui/macro';

const trashToasterId = 'trash-toaster';

/** 挂载在应用根部,供各处的删除操作复用 */
export const TrashToaster = () => <Toaster toasterId={trashToasterId} />;

/** 移动到回收站失败时的提示,引导用户关闭回收站功能后重试 */
export default function useTrashFailedToast() {
const { dispatchToast } = useToastController(trashToasterId);

return () =>
dispatchToast(
<Toast>
<ToastTitle>{t`移动到回收站失败`}</ToastTitle>
<ToastBody>{t`可在设置中关闭回收站功能后重试,此时删除将不可恢复`}</ToastBody>
</Toast>,
{ intent: 'error' },
);
}
Loading
Loading