Explorar o código

add open_in_tab

visuddhinanda %!s(int64=2) %!d(string=hai) anos
pai
achega
eed9a6aa45

+ 15 - 0
dashboard/src/components/article/TypeArticleReaderToolbar.tsx

@@ -17,6 +17,7 @@ import { ArticleTplModal } from "../template/Builder/ArticleTpl";
 import AnthologiesAtArticle from "./AnthologiesAtArticle";
 import AnthologiesAtArticle from "./AnthologiesAtArticle";
 import { TRole } from "../api/Auth";
 import { TRole } from "../api/Auth";
 import { useIntl } from "react-intl";
 import { useIntl } from "react-intl";
+import { TabIcon } from "../../assets/icon";
 
 
 interface IWidget {
 interface IWidget {
   articleId?: string;
   articleId?: string;
@@ -69,6 +70,7 @@ const TypeArticleReaderToolbarWidget = ({
             <Button
             <Button
               type="link"
               type="link"
               size="small"
               size="small"
+              disabled={!editable}
               icon={<EditOutlined />}
               icon={<EditOutlined />}
               onClick={() => {
               onClick={() => {
                 if (typeof onEdit !== "undefined") {
                 if (typeof onEdit !== "undefined") {
@@ -81,6 +83,13 @@ const TypeArticleReaderToolbarWidget = ({
           <Dropdown
           <Dropdown
             menu={{
             menu={{
               items: [
               items: [
+                {
+                  label: intl.formatMessage({
+                    id: "buttons.open.in.new.tab",
+                  }),
+                  key: "open_in_tab",
+                  icon: <TabIcon />,
+                },
                 {
                 {
                   label: intl.formatMessage({
                   label: intl.formatMessage({
                     id: "buttons.add_to_anthology",
                     id: "buttons.add_to_anthology",
@@ -120,6 +129,12 @@ const TypeArticleReaderToolbarWidget = ({
               onClick: ({ key }) => {
               onClick: ({ key }) => {
                 console.log(`Click on item ${key}`);
                 console.log(`Click on item ${key}`);
                 switch (key) {
                 switch (key) {
+                  case "open_in_tab":
+                    window.open(
+                      fullUrl(`/article/article/${articleId}`),
+                      "_blank"
+                    );
+                    break;
                   case "add_to_anthology":
                   case "add_to_anthology":
                     setAddToAnthologyOpen(true);
                     setAddToAnthologyOpen(true);
                     break;
                     break;