|
|
@@ -7,7 +7,7 @@ import { ISentence } from "../SentEdit";
|
|
|
import SentEditMenu from "./SentEditMenu";
|
|
|
import SentCellEditable from "./SentCellEditable";
|
|
|
import MdView from "../MdView";
|
|
|
-import EditInfo from "./EditInfo";
|
|
|
+import EditInfo, { Details } from "./EditInfo";
|
|
|
import SuggestionToolbar from "./SuggestionToolbar";
|
|
|
import { useAppSelector } from "../../../hooks";
|
|
|
import { sentence } from "../../../reducers/accept-pr";
|
|
|
@@ -23,6 +23,7 @@ import { IDeleteResponse } from "../../api/Article";
|
|
|
import { delete_ } from "../../../request";
|
|
|
|
|
|
import "./style.css";
|
|
|
+import StudioName from "../../auth/StudioName";
|
|
|
|
|
|
interface IWidget {
|
|
|
initValue?: ISentence;
|
|
|
@@ -254,82 +255,93 @@ const SentCellWidget = ({
|
|
|
}}
|
|
|
>
|
|
|
{sentData ? (
|
|
|
- <div
|
|
|
- style={{
|
|
|
- display: "flex",
|
|
|
- flexDirection: compact ? "row" : "column",
|
|
|
- alignItems: "flex-start",
|
|
|
- width: "100%",
|
|
|
- }}
|
|
|
- >
|
|
|
- {isEditMode ? (
|
|
|
- sentData?.contentType === "json" ? (
|
|
|
- <SentWbwEdit
|
|
|
- data={sentData}
|
|
|
- onClose={() => {
|
|
|
- setIsEditMode(false);
|
|
|
- }}
|
|
|
- onSave={(data: ISentence) => {
|
|
|
- setSentData(data);
|
|
|
- }}
|
|
|
- />
|
|
|
- ) : (
|
|
|
- <SentCellEditable
|
|
|
- data={sentData}
|
|
|
- isPr={isPr}
|
|
|
- onClose={() => {
|
|
|
- setIsEditMode(false);
|
|
|
- }}
|
|
|
- onSave={(data: ISentence) => {
|
|
|
- setIsEditMode(false);
|
|
|
- setSentData(data);
|
|
|
- if (typeof onChange !== "undefined") {
|
|
|
- onChange(data);
|
|
|
- }
|
|
|
- }}
|
|
|
- />
|
|
|
- )
|
|
|
- ) : showDiff ? (
|
|
|
- <TextDiff
|
|
|
- showToolTip={false}
|
|
|
- content={sentData.content}
|
|
|
- oldContent={diffText}
|
|
|
- />
|
|
|
- ) : (
|
|
|
- <MdView
|
|
|
- className="sentence"
|
|
|
- style={{
|
|
|
- width: "100%",
|
|
|
- paddingLeft: compact ? 0 : "2em",
|
|
|
- marginBottom: 0,
|
|
|
- }}
|
|
|
- placeholder="请输入"
|
|
|
- html={sentData.html ? sentData.html : sentData.content}
|
|
|
- wordWidget={wordWidget}
|
|
|
+ <div style={{ display: "flex" }}>
|
|
|
+ <div style={{ marginRight: 8 }}>
|
|
|
+ <StudioName
|
|
|
+ data={sentData.studio}
|
|
|
+ showName={false}
|
|
|
+ popOver={
|
|
|
+ compact ? <Details data={sentData} isPr={isPr} /> : undefined
|
|
|
+ }
|
|
|
/>
|
|
|
- )}
|
|
|
+ </div>
|
|
|
<div
|
|
|
style={{
|
|
|
display: "flex",
|
|
|
- justifyContent: "space-between",
|
|
|
+ flexDirection: compact ? "row" : "column",
|
|
|
+ alignItems: "flex-start",
|
|
|
width: "100%",
|
|
|
- paddingRight: 20,
|
|
|
}}
|
|
|
>
|
|
|
- <EditInfo data={sentData} compact={compact} />
|
|
|
- <SuggestionToolbar
|
|
|
- style={{ marginLeft: "2em", marginBottom: 0 }}
|
|
|
- compact={compact}
|
|
|
- data={sentData}
|
|
|
- isPr={isPr}
|
|
|
- prOpen={prOpen}
|
|
|
- onPrClose={() => setPrOpen(false)}
|
|
|
- onDelete={() => {
|
|
|
- if (isPr && sentData.id) {
|
|
|
- deletePr(sentData.id);
|
|
|
- }
|
|
|
+ {isEditMode ? (
|
|
|
+ sentData?.contentType === "json" ? (
|
|
|
+ <SentWbwEdit
|
|
|
+ data={sentData}
|
|
|
+ onClose={() => {
|
|
|
+ setIsEditMode(false);
|
|
|
+ }}
|
|
|
+ onSave={(data: ISentence) => {
|
|
|
+ setSentData(data);
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ ) : (
|
|
|
+ <SentCellEditable
|
|
|
+ data={sentData}
|
|
|
+ isPr={isPr}
|
|
|
+ onClose={() => {
|
|
|
+ setIsEditMode(false);
|
|
|
+ }}
|
|
|
+ onSave={(data: ISentence) => {
|
|
|
+ setIsEditMode(false);
|
|
|
+ setSentData(data);
|
|
|
+ if (typeof onChange !== "undefined") {
|
|
|
+ onChange(data);
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ )
|
|
|
+ ) : showDiff ? (
|
|
|
+ <TextDiff
|
|
|
+ showToolTip={false}
|
|
|
+ content={sentData.content}
|
|
|
+ oldContent={diffText}
|
|
|
+ />
|
|
|
+ ) : (
|
|
|
+ <MdView
|
|
|
+ className="sentence"
|
|
|
+ style={{
|
|
|
+ width: "100%",
|
|
|
+ paddingLeft: compact ? 0 : "2em",
|
|
|
+ marginBottom: 0,
|
|
|
+ }}
|
|
|
+ placeholder="请输入"
|
|
|
+ html={sentData.html ? sentData.html : sentData.content}
|
|
|
+ wordWidget={wordWidget}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ display: "flex",
|
|
|
+ justifyContent: "space-between",
|
|
|
+ width: compact ? undefined : "100%",
|
|
|
+ paddingRight: 20,
|
|
|
}}
|
|
|
- />
|
|
|
+ >
|
|
|
+ <EditInfo data={sentData} compact={compact} />
|
|
|
+ <SuggestionToolbar
|
|
|
+ style={{ marginLeft: "2em", marginBottom: 0 }}
|
|
|
+ compact={compact}
|
|
|
+ data={sentData}
|
|
|
+ isPr={isPr}
|
|
|
+ prOpen={prOpen}
|
|
|
+ onPrClose={() => setPrOpen(false)}
|
|
|
+ onDelete={() => {
|
|
|
+ if (isPr && sentData.id) {
|
|
|
+ deletePr(sentData.id);
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
) : undefined}
|