Просмотр исходного кода

Merge pull request #2011 from visuddhinanda/agile

隐藏互动区和标题
visuddhinanda 2 лет назад
Родитель
Сommit
ef67f521cc

+ 6 - 0
dashboard/src/components/article/Article.tsx

@@ -56,6 +56,8 @@ interface IWidget {
   userName?: string;
   active?: boolean;
   focus?: string | null;
+  hideInteractive?: boolean;
+  hideTitle?: boolean;
   onArticleChange?: Function;
   onFinal?: Function;
   onLoad?: Function;
@@ -76,6 +78,8 @@ const ArticleWidget = ({
   mode = "read",
   active = false,
   focus,
+  hideInteractive = false,
+  hideTitle = false,
   onArticleChange,
   onFinal,
   onLoad,
@@ -96,6 +100,8 @@ const ArticleWidget = ({
           mode={mode}
           anthologyId={anthologyId}
           active={active}
+          hideInteractive={hideInteractive}
+          hideTitle={hideTitle}
           onArticleEdit={(value: IArticleDataResponse) => {
             if (typeof onArticleEdit !== "undefined") {
               onArticleEdit(value);

+ 31 - 18
dashboard/src/components/article/ArticleView.tsx

@@ -29,6 +29,7 @@ export interface IWidgetArticleData {
   articleId?: string;
   remains?: boolean;
   anthology?: IFirstAnthology;
+  hideTitle?: boolean;
   onEnd?: Function;
   onPathChange?: Function;
 }
@@ -48,6 +49,7 @@ const ArticleViewWidget = ({
   type,
   articleId,
   anthology,
+  hideTitle,
   onEnd,
   remains,
   onPathChange,
@@ -79,26 +81,37 @@ const ArticleViewWidget = ({
   return (
     <>
       <Space direction="vertical">
-        <TocPath
-          data={path}
-          channels={channels}
-          onChange={(
-            node: ITocPathNode,
-            e: React.MouseEvent<HTMLSpanElement | HTMLAnchorElement, MouseEvent>
-          ) => {
-            if (typeof onPathChange !== "undefined") {
-              onPathChange(node, e);
-            }
-          }}
-        />
-
-        <Title level={4}>
-          <div
-            dangerouslySetInnerHTML={{
-              __html: title ? title : "",
+        {hideTitle ? (
+          <></>
+        ) : (
+          <TocPath
+            data={path}
+            channels={channels}
+            onChange={(
+              node: ITocPathNode,
+              e: React.MouseEvent<
+                HTMLSpanElement | HTMLAnchorElement,
+                MouseEvent
+              >
+            ) => {
+              if (typeof onPathChange !== "undefined") {
+                onPathChange(node, e);
+              }
             }}
           />
-        </Title>
+        )}
+        {hideTitle ? (
+          <></>
+        ) : (
+          <Title level={4}>
+            <div
+              dangerouslySetInnerHTML={{
+                __html: title ? title : "",
+              }}
+            />
+          </Title>
+        )}
+
         <Text type="secondary">{subTitle}</Text>
         {currChannelList}
         <Paragraph ellipsis={{ rows: 2, expandable: true, symbol: "more" }}>

+ 6 - 0
dashboard/src/components/article/TypeArticle.tsx

@@ -13,6 +13,8 @@ interface IWidget {
   channelId?: string | null;
   anthologyId?: string | null;
   active?: boolean;
+  hideInteractive?: boolean;
+  hideTitle?: boolean;
   onArticleChange?: Function;
   onArticleEdit?: Function;
   onFinal?: Function;
@@ -26,6 +28,8 @@ const TypeArticleWidget = ({
   anthologyId,
   mode = "read",
   active = false,
+  hideInteractive = false,
+  hideTitle = false,
   onArticleChange,
   onFinal,
   onLoad,
@@ -65,6 +69,8 @@ const TypeArticleWidget = ({
           anthologyId={anthologyId}
           mode={mode}
           active={active}
+          hideInteractive={hideInteractive}
+          hideTitle={hideTitle}
           onArticleChange={(type: string, id: string, target: string) => {
             if (typeof onArticleChange !== "undefined") {
               onArticleChange(type, id, target);

+ 10 - 2
dashboard/src/components/article/TypeArticleReader.tsx

@@ -27,6 +27,8 @@ interface IWidget {
   channelId?: string | null;
   anthologyId?: string | null;
   active?: boolean;
+  hideInteractive?: boolean;
+  hideTitle?: boolean;
   onArticleChange?: Function;
   onFinal?: Function;
   onLoad?: Function;
@@ -40,6 +42,8 @@ const TypeArticleReaderWidget = ({
   anthologyId,
   mode = "read",
   active = false,
+  hideInteractive = false,
+  hideTitle = false,
   onArticleChange,
   onFinal,
   onLoad,
@@ -204,6 +208,7 @@ const TypeArticleReaderWidget = ({
             type={type}
             articleId={articleId}
             anthology={anthology}
+            hideTitle={hideTitle}
             onPathChange={(
               node: ITocPathNode,
               e: React.MouseEvent<
@@ -256,8 +261,11 @@ const TypeArticleReaderWidget = ({
               }
             }}
           />
-
-          <InteractiveArea resType={"article"} resId={articleId} />
+          {hideInteractive ? (
+            <></>
+          ) : (
+            <InteractiveArea resType={"article"} resId={articleId} />
+          )}
         </>
       )}
     </div>

+ 2 - 0
dashboard/src/components/template/Article.tsx

@@ -62,6 +62,8 @@ export const ArticleCtl = ({
       channelId={channel}
       focus={focus}
       mode="read"
+      hideInteractive={true}
+      hideTitle={true}
     />
   );
   let output = <></>;