Skip to content
Merged
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
23 changes: 14 additions & 9 deletions packages/origine2/src/components/Assets/Upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import {t} from '@lingui/macro';
import { List } from '@fluentui/react';
import { getFileIcon } from '@/utils/getFileIcon';

export type IUploadProps = {
export interface IUploadProps {
name?: string;
className?: string;
title?: string;
multiple?: boolean;
onChange?: ChangeEventHandler<HTMLInputElement>;
};
}

const ArrowUploadIcon = bundleIcon(ArrowUpload32Filled, ArrowUpload32Regular);
const ClosedCaptionIcon = bundleIcon(Delete20Filled, Delete20Regular);
Expand All @@ -22,16 +22,24 @@ const getFiles = (fileList?: FileList|null) => {

const files = [];
for (const file of fileList) {
files.push(file.name)
files.push(file.name);
}
return files;
}
};

// File item render component
const renderFileItem = (file?: string) => (
<div className={styles['upload-file']}>
<img src={getFileIcon(file!)} alt="icon" />
<span>{file}</span>
</div>
);

export default function Upload({ name, className, title, multiple, onChange }: IUploadProps) {
const [files, setFiles] = useState<string[]>([]);

const onChangeHandler: ChangeEventHandler<HTMLInputElement> = (ev) => {
setFiles(getFiles(ev.target.files))
setFiles(getFiles(ev.target.files));
onChange?.(ev);
};

Expand All @@ -41,9 +49,6 @@ export default function Upload({ name, className, title, multiple, onChange }: I
<div>{t`点击或拖拽文件至此上传`}</div>
<input className={styles['upload-input']} name={name} type="file" title={title} multiple={multiple} onChange={onChangeHandler} />
</div>
<List items={files} onRenderCell={(file) => <div className={styles['upload-file']}>
<img src={getFileIcon(file!)} alt="icon" />
<span>{file}</span>
</div>}/>
<List items={files} onRenderCell={renderFileItem}/>
</div>;
}
56 changes: 28 additions & 28 deletions packages/origine2/src/config/highlighting/hl.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,47 @@
"argument-list": {
"patterns": [
{
"comment": "only one argument left, ie kwarg0=val0",
"match": "(?!.*\\s\\-).+",
"comment": ">1 arguments left, ie -kwarg0=val0 -kwarg1=val1 ...",
"match": "(\\s\\-)(.*?)(\\s\\-.*)$",
"captures": {
"0": {
"1": {
"patterns": [
{
"include": "#operator"
}
]
},
"2": {
"patterns": [
{
"include": "#parameter"
}
]
},
"3": {
"patterns": [
{
"include": "#argument-list"
}
]
}
}
},
{
"comment": ">1 arguments left, ie [kwarg0=val0] -[kwarg1=val1]",
"match": "(.*?)(\\s\\-)(.*?)$",
"comment": "only one argument left, ie -kwarg0=val0",
"match": "(\\s\\-)(.*)",
"captures": {
"1": {
"patterns": [
{
"include": "#parameter"
}
]
},
"2": {
"patterns": [
{
"include": "#operator"
}
]
},
"3": {
"2": {
"patterns": [
{
"include": "#argument-list"
"include": "#parameter"
}
]
}
Expand Down Expand Up @@ -75,7 +82,7 @@
{
"comment": "value only, ie val0",
"match": "(?!.*\\=).+",
"name": "variable.other.webgal"
"name": "variable.parameter.webgal"
},
{
"comment": "name and value, ie [kwarg0]=[val0]",
Expand All @@ -92,7 +99,7 @@
]
},
"3": {
"name": "variable.other.webgal"
"name": "markup.quote"
}
}
}
Expand All @@ -111,19 +118,12 @@
},
{
"comment": "utterance and argument list",
"match": "(.*?)(\\s\\-)(.*?)$",
"match": "(.*?)(\\s\\-.*?)$",
"captures": {
"1": {
"name": "string.unquoted.utterance.webgal"
},
"2": {
"patterns": [
{
"include": "#operator"
}
]
},
"3": {
"patterns": [
{
"include": "#argument-list"
Expand All @@ -136,7 +136,7 @@
},
"character-colon": {
"comment": "[char]:[utt[ -args]][;cmt]",
"match": "^(?!(?:intro|changeBg|changeFigure|miniAvatar|playEffect|changeScene|choose|end|bgm|playVideo|setComplexAnimation|setFilter|pixiInit|pixiPerform|label|jumpLabel|setVar|callScene|showVars|unlockCg|unlockBgm|say|filmMode|callScene|setTextbox|setAnimation)\\:)(.*?)(\\:)([^\\;\\n]*?)($|\\;.*?$)",
"match": "^(?!(?:intro|changeBg|changeFigure|miniAvatar|playEffect|changeScene|choose|end|bgm|playVideo|setComplexAnimation|setFilter|pixiInit|pixiPerform|label|jumpLabel|setVar|callScene|showVars|unlockCg|unlockBgm|say|filmMode|callScene|setTextbox|setAnimation|setTransition|setTransform|say|getUserInput|applyStyle|wait)\\:)(.*?)(\\:)([^\\;\\n]*?)($|\\;.*?$)",
"captures": {
"1": {
"name": "meta.character.webgal",
Expand Down Expand Up @@ -171,7 +171,7 @@
},
"command-colon": {
"comment": "cmd:[arg0[ -args]][;cmt]",
"match": "^(intro|changeBg|changeFigure|playEffect|miniAvatar|changeScene|choose|end|bgm|playVideo|setComplexAnimation|setFilter|pixiInit|pixiPerform|label|jumpLabel|setVar|callScene|showVars|unlockCg|unlockBgm|say|filmMode|callScene|setTextbox|setAnimation)(\\:)([^\\;\\n]*?)($|\\;.*?$)",
"match": "^(intro|changeBg|changeFigure|playEffect|miniAvatar|changeScene|choose|end|bgm|playVideo|setComplexAnimation|setFilter|pixiInit|pixiPerform|label|jumpLabel|setVar|callScene|showVars|unlockCg|unlockBgm|say|filmMode|callScene|setTextbox|setAnimation|setTransition|setTransform|say|getUserInput|applyStyle|wait)(\\:)([^\\;\\n]*?)($|\\;.*?$)",
"captures": {
"1": {
"name": "meta.command.webgal",
Expand Down Expand Up @@ -206,7 +206,7 @@
},
"command-semicolon": {
"comment": "cmd;[cmt]",
"match": "^(intro|changeBg|changeFigure|playEffect|miniAvatar|changeScene|choose|end|bgm|playVideo|setComplexAnimation|setFilter|pixiInit|pixiPerform|label|jumpLabel|setVar|callScene|showVars|unlockCg|unlockBgm|say|filmMode|callScene|setTextbox|setAnimation)($|\\;.*?$)",
"match": "^(intro|changeBg|changeFigure|playEffect|miniAvatar|changeScene|choose|end|bgm|playVideo|setComplexAnimation|setFilter|pixiInit|pixiPerform|label|jumpLabel|setVar|callScene|showVars|unlockCg|unlockBgm|say|filmMode|callScene|setTextbox|setAnimation|setTransition|setTransform|say|getUserInput|applyStyle|wait)($|\\;.*?$)",
"captures": {
"1": {
"name": "meta.command.webgal",
Expand All @@ -227,7 +227,7 @@
},
"utterance-semicolon": {
"comment": "utt[ -args];[cmt]",
"match": "^(?!(?:intro|changeBg|changeFigure|playEffect|miniAvatar|changeScene|choose|end|bgm|playVideo|setComplexAnimation|setFilter|pixiInit|pixiPerform|label|jumpLabel|setVar|callScene|showVars|unlockCg|unlockBgm|say|filmMode|callScene|setTextbox|setAnimation)\\;)([^\\:\\;\\n]+?)(\\;.*?$)",
"match": "^(?!(?:intro|changeBg|changeFigure|playEffect|miniAvatar|changeScene|choose|end|bgm|playVideo|setComplexAnimation|setFilter|pixiInit|pixiPerform|label|jumpLabel|setVar|callScene|showVars|unlockCg|unlockBgm|say|filmMode|callScene|setTextbox|setAnimation|setTransition|setTransform|say|getUserInput|applyStyle|wait)\\;)([^\\:\\;\\n]+?)(\\;.*?$)",
"captures": {
"1": {
"patterns": [
Expand Down
2 changes: 1 addition & 1 deletion packages/origine2/src/config/themes/monokai-light-vs.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
}
}
],
"semanticHighlighting": true,
"semanticHighlighting": false,
"semanticTokenColors": {
"variable": "#cf7000",
"keyword": "#9966b8",
Expand Down
8 changes: 4 additions & 4 deletions packages/origine2/src/locales/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ msgstr "Delete"
msgid "删除属性"
msgstr "Delete Property"

#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:250
#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:251
#: src/pages/editor/GraphicalEditor/SentenceEditor/Choose.tsx:28
msgid "删除本句"
msgstr "Delete this sentence"
Expand Down Expand Up @@ -1004,7 +1004,7 @@ msgstr "Open effect editor"
msgid "打开文件夹"
msgstr "Open folder"

#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:258
#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:259
msgid "执行到此句"
msgstr "Execute to this sentence"

Expand Down Expand Up @@ -1336,7 +1336,7 @@ msgstr "Unrecognized"
msgid "未识别的指令"
msgstr "Unrecognized command"

#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:221
#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:222
msgid "本句前插入句子"
msgstr "Insert sentence before this"

Expand Down Expand Up @@ -1493,7 +1493,7 @@ msgstr "Add new line"
msgid "添加自定义属性"
msgstr "Add Custom Property"

#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:274
#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:275
#: src/pages/editor/GraphicalEditor/SentenceEditor/Choose.tsx:63
#: src/pages/editor/Topbar/Topbar.tsx:108
msgid "添加语句"
Expand Down
8 changes: 4 additions & 4 deletions packages/origine2/src/locales/ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ msgstr "削除"
msgid "删除属性"
msgstr "属性を削除"

#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:250
#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:251
#: src/pages/editor/GraphicalEditor/SentenceEditor/Choose.tsx:28
msgid "删除本句"
msgstr "この文を削除"
Expand Down Expand Up @@ -1004,7 +1004,7 @@ msgstr "エフェクトエディタを開く"
msgid "打开文件夹"
msgstr "フォルダーを開く"

#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:258
#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:259
msgid "执行到此句"
msgstr "この文まで実行"

Expand Down Expand Up @@ -1336,7 +1336,7 @@ msgstr "認識されないコマンド"
msgid "未识别的指令"
msgstr "認識されないコマンド"

#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:221
#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:222
msgid "本句前插入句子"
msgstr "選択した文の前に追加"

Expand Down Expand Up @@ -1493,7 +1493,7 @@ msgstr "新しい行を追加"
msgid "添加自定义属性"
msgstr "カスタム属性を追加"

#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:274
#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:275
#: src/pages/editor/GraphicalEditor/SentenceEditor/Choose.tsx:63
#: src/pages/editor/Topbar/Topbar.tsx:108
msgid "添加语句"
Expand Down
8 changes: 4 additions & 4 deletions packages/origine2/src/locales/zhCn.po
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ msgstr "删除"
msgid "删除属性"
msgstr "删除属性"

#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:250
#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:251
#: src/pages/editor/GraphicalEditor/SentenceEditor/Choose.tsx:28
msgid "删除本句"
msgstr "删除本句"
Expand Down Expand Up @@ -1024,7 +1024,7 @@ msgstr "打开效果编辑器"
msgid "打开文件夹"
msgstr "打开文件夹"

#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:258
#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:259
msgid "执行到此句"
msgstr "执行到此句"

Expand Down Expand Up @@ -1356,7 +1356,7 @@ msgstr "未识别"
msgid "未识别的指令"
msgstr "未识别的指令"

#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:221
#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:222
msgid "本句前插入句子"
msgstr "本句前插入句子"

Expand Down Expand Up @@ -1513,7 +1513,7 @@ msgstr "添加新行"
msgid "添加自定义属性"
msgstr "添加自定义属性"

#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:274
#: src/pages/editor/GraphicalEditor/GraphicalEditor.tsx:275
#: src/pages/editor/GraphicalEditor/SentenceEditor/Choose.tsx:63
#: src/pages/editor/Topbar/Topbar.tsx:108
msgid "添加语句"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default function GraphicalEditor(props: IGraphicalEditorProps) {
function submitScene(newSentences: SentenceItem[], index: number) {
const newScene = mergeToString(newSentences.map(item => item.content));
const updateIndex = index + 1;
editorLineHolder.recordSceneEdittingLine(props.targetPath, updateIndex);
editorLineHolder.recordSceneEditingLine(props.targetPath, updateIndex);

api.assetsControllerEditTextFile({
textFile: newScene,
Expand Down Expand Up @@ -138,7 +138,7 @@ export default function GraphicalEditor(props: IGraphicalEditorProps) {
if (!result.destination) {
return;
}
editorLineHolder.recordSceneEdittingLine(props.targetPath, result.destination.index);
editorLineHolder.recordSceneEditingLine(props.targetPath, result.destination.index);
reorder(
result.source.index,
result.destination.index
Expand All @@ -148,6 +148,7 @@ export default function GraphicalEditor(props: IGraphicalEditorProps) {
function syncToIndex(index: number) {
const targetValue = sentenceData.value[index]?.content || "";
WsUtil.sendSyncCommand(props.targetPath, index + 1, targetValue,true);
editorLineHolder.recordSceneEditingLine(props.targetPath, index + 1);
}

useEffect(() => {
Expand Down
Loading