调整article props声明
This commit is contained in:
parent
8af8487016
commit
ef648c8fab
|
|
@ -11,6 +11,6 @@ export default function Render(props: WebComponentProps<EntityDict, 'article', f
|
|||
tocFixed: boolean;
|
||||
tocClosed: boolean;
|
||||
scrollId?: string;
|
||||
tocWidth?: number | 'auto';
|
||||
tocHeight?: number;
|
||||
tocWidth?: number;
|
||||
tocHeight?: number | string;
|
||||
}, {}>): React.JSX.Element;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@ export default function Render(props: WebComponentProps<EntityDict, 'article', f
|
|||
tocFixed: boolean;
|
||||
tocClosed: boolean;
|
||||
scrollId?: string;
|
||||
tocWidth?: number | 'auto';
|
||||
tocHeight?: number;
|
||||
tocWidth?: number;
|
||||
tocHeight?: number | string;
|
||||
}, {}>): React.JSX.Element;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@ export declare function TocView(props: {
|
|||
headerTop?: number;
|
||||
scrollId?: string;
|
||||
closed?: boolean;
|
||||
tocWidth?: number | 'auto';
|
||||
tocWidth?: number;
|
||||
tocHeight?: number | string;
|
||||
}): import("react").JSX.Element;
|
||||
|
|
|
|||
|
|
@ -91,7 +91,12 @@ export function TocView(props) {
|
|||
|
||||
{(toc && toc.length > 0) ? (<ul style={{ listStyleType: 'none', paddingInlineStart: '0px', overflowX: 'hidden', overflowY: 'auto', height: '100%' }}>{generateTocList([...toc])}</ul>) : (<div style={{ display: 'flex', alignItems: 'center', color: '#B1B1B1', height: '200px' }}>
|
||||
<div>
|
||||
对文档内容应用“标题”样式,即可生成大纲
|
||||
<div>
|
||||
对文档内容应用“标题”样式
|
||||
</div>
|
||||
<div>
|
||||
即可生成大纲
|
||||
</div>
|
||||
</div>
|
||||
</div>)}
|
||||
</>) : (<div className={classNames(Style.tocButton, { [Style.tocButtonRight]: tocPosition === 'right' })}>
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ export default function Render(props: WebComponentProps<EntityDict, 'article', f
|
|||
tocPosition: 'none' | 'left' | 'right';
|
||||
highlightBgColor: string;
|
||||
scrollId?: string;
|
||||
tocWidth?: number | 'auto';
|
||||
tocHeight?: number | '100vh';
|
||||
height?: number | 'auto';
|
||||
tocWidth?: number;
|
||||
tocHeight?: number | string;
|
||||
height?: number | string;
|
||||
}, {
|
||||
setHtml: (content: string) => void;
|
||||
setEditor: (editor: any) => void;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
|
|||
show: 'edit' | 'doc' | 'preview';
|
||||
articleMenuId: string;
|
||||
articleId: string;
|
||||
width: string;
|
||||
tocPosition: 'none' | 'left' | 'right';
|
||||
highlightBgColor: string;
|
||||
origin: 'qiniu';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React, { useEffect, useState, useRef } from 'react';
|
||||
import { Button, Divider, Tooltip, Space, Drawer } from 'antd';
|
||||
import { Button, Tooltip, Space } from 'antd';
|
||||
import { EyeOutlined, CopyOutlined, MenuFoldOutlined, MenuUnfoldOutlined, PlusOutlined, EditOutlined, FileOutlined } from '@ant-design/icons';
|
||||
import copy from 'copy-to-clipboard';
|
||||
import TreeList from '../treeList';
|
||||
|
|
@ -20,11 +20,10 @@ function BreadcrumbView(props) {
|
|||
</div>);
|
||||
}
|
||||
export default function Render(props) {
|
||||
const { entity, entityId, oakFullpath, show, articleMenuId, width, articleId, tocPosition, highlightBgColor, onMenuViewById, onArticlePreview, onArticleEdit, origin, setCopyArticleUrl, scrollId } = props.data;
|
||||
const { entity, entityId, oakFullpath, show, articleMenuId, articleId, tocPosition, highlightBgColor, onMenuViewById, onArticlePreview, onArticleEdit, origin, setCopyArticleUrl, scrollId } = props.data;
|
||||
const { gotoDoc, setMessage, gotoArticleDetail } = props.methods;
|
||||
const [editArticleId, setEditArticleId] = useState('');
|
||||
const [breadcrumbItems, setBreadcrumbItems] = useState([]);
|
||||
const [open, setOpen] = useState(true);
|
||||
const [addOpen, setAddOpen] = useState(false);
|
||||
const [selectedArticleId, setSelectedArticleId] = useState('');
|
||||
const [defaultOpen, setDefaultOpen] = useState(true);
|
||||
|
|
@ -50,9 +49,6 @@ export default function Render(props) {
|
|||
const getBreadcrumbItems = (breadcrumbItems) => {
|
||||
setBreadcrumbItems(breadcrumbItems);
|
||||
};
|
||||
const changeDrawerOpen = (open) => {
|
||||
setOpen(open);
|
||||
};
|
||||
useEffect(() => {
|
||||
if (editArticleId) {
|
||||
setSelectedArticleId(editArticleId);
|
||||
|
|
@ -76,36 +72,6 @@ export default function Render(props) {
|
|||
}
|
||||
};
|
||||
if (show === 'doc') {
|
||||
if (width === 'xs') {
|
||||
return (<div className={Styles.docContainer}>
|
||||
<div className={Styles.docHeader}>
|
||||
<div className={Styles.topBar}>
|
||||
<div className={Styles.menuHeader} onClick={() => {
|
||||
setOpen(true);
|
||||
}}>
|
||||
<div>帮助文档</div>
|
||||
{open ? (<MenuFoldOutlined style={{
|
||||
fontSize: 18,
|
||||
}}/>) : (<MenuUnfoldOutlined style={{
|
||||
fontSize: 18,
|
||||
}}/>)}
|
||||
</div>
|
||||
<Divider style={{ margin: 0 }}/>
|
||||
</div>
|
||||
<div className={Styles.editor2}>
|
||||
{editArticleId ? (<React.Fragment>
|
||||
<BreadcrumbView breadcrumbItems={breadcrumbItems}/>
|
||||
<ArticleCell oakId={editArticleId} oakAutoUnmount={true} oakPath={`$articleMenu/treeManager-ArticleCell-${editArticleId}`}/>
|
||||
</React.Fragment>) : null}
|
||||
</div>
|
||||
</div>
|
||||
<Drawer className={Styles.drawerPanel} open={open} onClose={() => {
|
||||
setOpen(false);
|
||||
}} placement="left" width={260}>
|
||||
<TreeList oakPath={`$articleMenu/treeManager-TreeList`} entity={entity} entityId={entityId} onGrandChildEditArticleChange={checkEditArticle} show={show} articleMenuId={articleMenuId ? articleMenuId : undefined} getBreadcrumbItems={getBreadcrumbItems} breadcrumbItems={[]} drawerOpen={open} changeDrawerOpen={changeDrawerOpen} selectedArticleId={selectedArticleId ? selectedArticleId : undefined} defaultOpen={defaultOpen} changeDefaultOpen={changeDefaultOpen} openArray={openArray ? openArray : undefined} onMenuViewById={onMenuViewById} setCopyArticleUrl={setCopyArticleUrl}/>
|
||||
</Drawer>
|
||||
</div>);
|
||||
}
|
||||
return (<div className={Styles.docContainer}>
|
||||
<div className={Styles.menu}></div>
|
||||
<div className={Styles.menuFixed}>
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ export default function Render(
|
|||
tocFixed: boolean;
|
||||
tocClosed: boolean;
|
||||
scrollId?: string;
|
||||
tocWidth?: number | 'auto';
|
||||
tocHeight?: number ;
|
||||
tocWidth?: number;
|
||||
tocHeight?: number | string;
|
||||
},
|
||||
{}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ export default function Render(
|
|||
tocFixed: boolean;
|
||||
tocClosed: boolean;
|
||||
scrollId?: string;
|
||||
tocWidth?: number | 'auto';
|
||||
tocHeight?: number;
|
||||
tocWidth?: number;
|
||||
tocHeight?: number | string;
|
||||
},
|
||||
{}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export function TocView(
|
|||
headerTop?: number;
|
||||
scrollId?: string;
|
||||
closed?: boolean,
|
||||
tocWidth?: number | 'auto',
|
||||
tocWidth?: number,
|
||||
tocHeight?: number | string,
|
||||
}
|
||||
) {
|
||||
|
|
@ -134,7 +134,12 @@ export function TocView(
|
|||
) : (
|
||||
<div style={{ display: 'flex', alignItems: 'center', color: '#B1B1B1', height: '200px' }}>
|
||||
<div>
|
||||
对文档内容应用“标题”样式,即可生成大纲
|
||||
<div>
|
||||
对文档内容应用“标题”样式
|
||||
</div>
|
||||
<div>
|
||||
即可生成大纲
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -62,9 +62,9 @@ export default function Render(
|
|||
tocPosition: 'none' | 'left' | 'right';
|
||||
highlightBgColor: string;
|
||||
scrollId?: string;
|
||||
tocWidth?: number | 'auto';
|
||||
tocHeight?: number | '100vh';
|
||||
height?: number | 'auto';
|
||||
tocWidth?: number;
|
||||
tocHeight?: number | string;
|
||||
height?: number | string;
|
||||
},
|
||||
{
|
||||
setHtml: (content: string) => void;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ export default function Render(
|
|||
show: 'edit' | 'doc' | 'preview',
|
||||
articleMenuId: string,
|
||||
articleId: string,
|
||||
width: string,
|
||||
tocPosition: 'none' | 'left' | 'right';
|
||||
highlightBgColor: string;
|
||||
origin: 'qiniu';
|
||||
|
|
@ -58,11 +57,10 @@ export default function Render(
|
|||
}
|
||||
>
|
||||
) {
|
||||
const { entity, entityId, oakFullpath, show, articleMenuId, width, articleId, tocPosition, highlightBgColor, onMenuViewById, onArticlePreview, onArticleEdit, origin, setCopyArticleUrl, scrollId } = props.data;
|
||||
const { entity, entityId, oakFullpath, show, articleMenuId, articleId, tocPosition, highlightBgColor, onMenuViewById, onArticlePreview, onArticleEdit, origin, setCopyArticleUrl, scrollId } = props.data;
|
||||
const { gotoDoc, setMessage, gotoArticleDetail } = props.methods;
|
||||
const [editArticleId, setEditArticleId] = useState('');
|
||||
const [breadcrumbItems, setBreadcrumbItems] = useState([] as string[]);
|
||||
const [open, setOpen] = useState(true);
|
||||
const [addOpen, setAddOpen] = useState(false);
|
||||
const [selectedArticleId, setSelectedArticleId] = useState('');
|
||||
const [defaultOpen, setDefaultOpen] = useState(true);
|
||||
|
|
@ -89,9 +87,6 @@ export default function Render(
|
|||
const getBreadcrumbItems = (breadcrumbItems: string[]) => {
|
||||
setBreadcrumbItems(breadcrumbItems);
|
||||
};
|
||||
const changeDrawerOpen = (open: boolean) => {
|
||||
setOpen(open);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (editArticleId) {
|
||||
|
|
@ -118,82 +113,6 @@ export default function Render(
|
|||
};
|
||||
|
||||
if (show === 'doc') {
|
||||
if (width === 'xs') {
|
||||
return (
|
||||
<div className={Styles.docContainer}>
|
||||
<div className={Styles.docHeader}>
|
||||
<div className={Styles.topBar}>
|
||||
<div
|
||||
className={Styles.menuHeader}
|
||||
onClick={() => {
|
||||
setOpen(true);
|
||||
}}
|
||||
>
|
||||
<div>帮助文档</div>
|
||||
{
|
||||
open ? (
|
||||
<MenuFoldOutlined
|
||||
style={{
|
||||
fontSize: 18,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<MenuUnfoldOutlined
|
||||
style={{
|
||||
fontSize: 18,
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
<Divider style={{ margin: 0 }} />
|
||||
</div>
|
||||
<div className={Styles.editor2}>
|
||||
{
|
||||
editArticleId ? (
|
||||
<React.Fragment>
|
||||
<BreadcrumbView breadcrumbItems={breadcrumbItems} />
|
||||
<ArticleCell
|
||||
oakId={editArticleId}
|
||||
oakAutoUnmount={true}
|
||||
oakPath={`$articleMenu/treeManager-ArticleCell-${editArticleId}`}
|
||||
/>
|
||||
</React.Fragment>
|
||||
) : null
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<Drawer
|
||||
className={Styles.drawerPanel}
|
||||
open={open}
|
||||
onClose={() => {
|
||||
setOpen(false);
|
||||
}}
|
||||
placement="left"
|
||||
width={260}
|
||||
>
|
||||
<TreeList
|
||||
oakPath={`$articleMenu/treeManager-TreeList`}
|
||||
entity={entity}
|
||||
entityId={entityId}
|
||||
onGrandChildEditArticleChange={checkEditArticle}
|
||||
show={show}
|
||||
articleMenuId={articleMenuId ? articleMenuId : undefined}
|
||||
getBreadcrumbItems={getBreadcrumbItems}
|
||||
breadcrumbItems={[]}
|
||||
drawerOpen={open}
|
||||
changeDrawerOpen={changeDrawerOpen}
|
||||
selectedArticleId={selectedArticleId ? selectedArticleId : undefined}
|
||||
defaultOpen={defaultOpen}
|
||||
changeDefaultOpen={changeDefaultOpen}
|
||||
openArray={openArray ? openArray : undefined}
|
||||
onMenuViewById={onMenuViewById}
|
||||
setCopyArticleUrl={setCopyArticleUrl}
|
||||
/>
|
||||
</Drawer>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<div className={Styles.docContainer}>
|
||||
<div className={Styles.menu}></div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue