diff --git a/packages/client/src/components/document/actions/index.tsx b/packages/client/src/components/document/actions/index.tsx index 944f889f..c7ee1a8a 100644 --- a/packages/client/src/components/document/actions/index.tsx +++ b/packages/client/src/components/document/actions/index.tsx @@ -64,9 +64,7 @@ export const DocumentActions: React.FC = ({ {text} @@ -85,9 +83,7 @@ export const DocumentActions: React.FC = ({ } > - {children || ( - + = ({ wikiId, documentId })
- + 邀请成功后,请将该链接发送给对方。 -
@@ -195,11 +179,7 @@ export const DocumentCollaboration: React.FC = ({ wikiId, documentId }) dataIndex="operate" key="operate" render={(_, document) => ( - handleDelete(document)} - > + handleDelete(document)}> @@ -166,10 +147,7 @@ export const Editor: React.FC = ({
-
+
document.querySelector('#js-template-editor-container')} /> diff --git a/packages/client/src/components/template/list/index.tsx b/packages/client/src/components/template/list/index.tsx index 3d5d9539..6882fcff 100644 --- a/packages/client/src/components/template/list/index.tsx +++ b/packages/client/src/components/template/list/index.tsx @@ -1,11 +1,7 @@ import React, { useState, useMemo } from 'react'; import { List, Pagination } from '@douyinfe/semi-ui'; import { DataRender } from 'components/data-render'; -import { - IProps as ITemplateCardProps, - TemplateCardPlaceholder, - TemplateCard, -} from 'components/template/card'; +import { IProps as ITemplateCardProps, TemplateCardPlaceholder, TemplateCard } from 'components/template/card'; import { Empty } from 'components/empty'; const grid = { diff --git a/packages/client/src/components/tiptap/components/banner/index.tsx b/packages/client/src/components/tiptap/components/banner/index.tsx index df58bbf3..ec3b5022 100644 --- a/packages/client/src/components/tiptap/components/banner/index.tsx +++ b/packages/client/src/components/tiptap/components/banner/index.tsx @@ -5,12 +5,7 @@ import styles from './index.module.scss'; export const BannerWrapper = ({ node }) => { return ( - } - closeIcon={null} - fullMode={false} - /> + } closeIcon={null} fullMode={false} /> ); }; diff --git a/packages/client/src/components/tiptap/components/documentChildren/index.tsx b/packages/client/src/components/tiptap/components/documentChildren/index.tsx index 31d7d6b5..e5258656 100644 --- a/packages/client/src/components/tiptap/components/documentChildren/index.tsx +++ b/packages/client/src/components/tiptap/components/documentChildren/index.tsx @@ -40,9 +40,7 @@ export const DocumentChildrenWrapper = ({ editor }) => { diff --git a/packages/client/src/components/tiptap/components/iframe/index.tsx b/packages/client/src/components/tiptap/components/iframe/index.tsx index 90cf2ff2..061377f1 100644 --- a/packages/client/src/components/tiptap/components/iframe/index.tsx +++ b/packages/client/src/components/tiptap/components/iframe/index.tsx @@ -14,11 +14,7 @@ export const IframeWrapper = ({ editor, node, updateAttributes }) => { {isEditable && (
- updateAttributes({ url })} - > + updateAttributes({ url })}>
)} {url && ( diff --git a/packages/client/src/components/tiptap/components/mind/index.tsx b/packages/client/src/components/tiptap/components/mind/index.tsx index 01599e27..f92769ad 100644 --- a/packages/client/src/components/tiptap/components/mind/index.tsx +++ b/packages/client/src/components/tiptap/components/mind/index.tsx @@ -97,12 +97,7 @@ export const MindWrapper = ({ editor, node, updateAttributes }) => { }, [isEditable]); const content = ( -
+
{!isEditable && (
+ diff --git a/packages/client/src/components/tiptap/menus/banner.tsx b/packages/client/src/components/tiptap/menus/banner.tsx index 2af78f6a..0a1e2acb 100644 --- a/packages/client/src/components/tiptap/menus/banner.tsx +++ b/packages/client/src/components/tiptap/menus/banner.tsx @@ -1,11 +1,5 @@ import { Space, Button } from '@douyinfe/semi-ui'; -import { - IconDelete, - IconTickCircle, - IconAlertTriangle, - IconClear, - IconInfoCircle, -} from '@douyinfe/semi-icons'; +import { IconDelete, IconTickCircle, IconAlertTriangle, IconClear, IconInfoCircle } from '@douyinfe/semi-icons'; import { Tooltip } from 'components/tooltip'; import { BubbleMenu } from './components/bubbleMenu'; import { Divider } from '../components/divider'; diff --git a/packages/client/src/components/tiptap/menus/baseBubbleMenu.tsx b/packages/client/src/components/tiptap/menus/baseBubbleMenu.tsx index c35b2af3..45a35fb8 100644 --- a/packages/client/src/components/tiptap/menus/baseBubbleMenu.tsx +++ b/packages/client/src/components/tiptap/menus/baseBubbleMenu.tsx @@ -41,8 +41,7 @@ export const BaseBubbleMenu: React.FC<{ editor: Editor }> = ({ editor }) => { className={'bubble-menu'} pluginKey="base-bubble-menu" shouldShow={() => - !editor.state.selection.empty && - OTHER_BUBBLE_MENU_TYPES.every((type) => !editor.isActive(type)) + !editor.state.selection.empty && OTHER_BUBBLE_MENU_TYPES.every((type) => !editor.isActive(type)) } > diff --git a/packages/client/src/components/tiptap/menus/baseMenu.tsx b/packages/client/src/components/tiptap/menus/baseMenu.tsx index 6351893a..082b5122 100644 --- a/packages/client/src/components/tiptap/menus/baseMenu.tsx +++ b/packages/client/src/components/tiptap/menus/baseMenu.tsx @@ -1,12 +1,6 @@ import React from 'react'; import { Button } from '@douyinfe/semi-ui'; -import { - IconBold, - IconItalic, - IconStrikeThrough, - IconUnderline, - IconCode, -} from '@douyinfe/semi-icons'; +import { IconBold, IconItalic, IconStrikeThrough, IconUnderline, IconCode } from '@douyinfe/semi-icons'; import { Tooltip } from 'components/tooltip'; import { isTitleActive } from '../services/isActive'; import { ColorMenu } from './color'; diff --git a/packages/client/src/components/tiptap/menus/components/bubbleMenu/bubbleMenuPlugin.tsx b/packages/client/src/components/tiptap/menus/components/bubbleMenu/bubbleMenuPlugin.tsx index e36ead4a..914483dd 100644 --- a/packages/client/src/components/tiptap/menus/components/bubbleMenu/bubbleMenuPlugin.tsx +++ b/packages/client/src/components/tiptap/menus/components/bubbleMenu/bubbleMenuPlugin.tsx @@ -43,12 +43,7 @@ export class BubbleMenuView { public matchRenderContainer?: BubbleMenuPluginProps['matchRenderContainer']; - public shouldShow: Exclude = ({ - view, - state, - from, - to, - }) => { + public shouldShow: Exclude = ({ view, state, from, to }) => { const { doc, selection } = state; const { empty } = selection; @@ -240,8 +235,7 @@ export class BubbleMenuView { export const BubbleMenuPlugin = (options: BubbleMenuPluginProps) => { return new Plugin({ - key: - typeof options.pluginKey === 'string' ? new PluginKey(options.pluginKey) : options.pluginKey, + key: typeof options.pluginKey === 'string' ? new PluginKey(options.pluginKey) : options.pluginKey, view: (view) => new BubbleMenuView({ view, ...options }), }); }; diff --git a/packages/client/src/components/tiptap/menus/search/index.tsx b/packages/client/src/components/tiptap/menus/search/index.tsx index 9048008b..3047053c 100644 --- a/packages/client/src/components/tiptap/menus/search/index.tsx +++ b/packages/client/src/components/tiptap/menus/search/index.tsx @@ -7,9 +7,7 @@ import { SearchNReplace } from '../../extensions/search'; const { Text } = Typography; export const Search = ({ editor }) => { - const searchExtension = editor.extensionManager.extensions.find( - (ext) => ext.name === SearchNReplace.name - ); + const searchExtension = editor.extensionManager.extensions.find((ext) => ext.name === SearchNReplace.name); const currentIndex = searchExtension ? searchExtension.options.currentIndex : -1; const results = searchExtension ? searchExtension.options.results : []; const [searchValue, setSearchValue] = useState(''); @@ -58,16 +56,10 @@ export const Search = ({ editor }) => { - - diff --git a/packages/client/src/components/tiptap/services/image.ts b/packages/client/src/components/tiptap/services/image.ts index 3f4cf74e..2ab06cfa 100644 --- a/packages/client/src/components/tiptap/services/image.ts +++ b/packages/client/src/components/tiptap/services/image.ts @@ -1,6 +1,4 @@ -export function getImageOriginSize( - src: string -): Promise<{ width: number | string; height: number | string }> { +export function getImageOriginSize(src: string): Promise<{ width: number | string; height: number | string }> { return new Promise((resolve) => { const image = document.createElement('img'); image.onload = function () { diff --git a/packages/client/src/components/tiptap/services/markUtils.ts b/packages/client/src/components/tiptap/services/markUtils.ts index 6ccfed78..27c78ec7 100644 --- a/packages/client/src/components/tiptap/services/markUtils.ts +++ b/packages/client/src/components/tiptap/services/markUtils.ts @@ -1,5 +1,4 @@ -export const markInputRegex = (tag) => - new RegExp(`(<(${tag})((?: \\w+=".+?")+)?>([^<]+))$`, 'gm'); +export const markInputRegex = (tag) => new RegExp(`(<(${tag})((?: \\w+=".+?")+)?>([^<]+))$`, 'gm'); export const extractMarkAttributesFromMatch = ([, , , attrsString]) => { const attrRegex = /(\w+)="(.+?)"/g; diff --git a/packages/client/src/components/tiptap/services/markdown/serializerHelpers.ts b/packages/client/src/components/tiptap/services/markdown/serializerHelpers.ts index 6353233d..cf847563 100644 --- a/packages/client/src/components/tiptap/services/markdown/serializerHelpers.ts +++ b/packages/client/src/components/tiptap/services/markdown/serializerHelpers.ts @@ -28,11 +28,7 @@ const tableMap = new WeakMap(); export function isPlainURL(link, parent, index, side) { if (link.attrs.title || !/^\w+:/.test(link.attrs.href)) return false; const content = parent.child(index + (side < 0 ? -1 : 0)); - if ( - !content.isText || - content.text !== link.attrs.href || - content.marks[content.marks.length - 1] !== link - ) + if (!content.isText || content.text !== link.attrs.href || content.marks[content.marks.length - 1] !== link) return false; if (index === (side < 0 ? 1 : parent.childCount - 1)) return true; const next = parent.child(index + (side < 0 ? -2 : 1)); @@ -133,8 +129,7 @@ export function openTag(tagName, attrs) { str += Object.entries(attrs || {}) .map(([key, value]) => { - if ((ignoreAttrs[tagName] || []).includes(key) || defaultAttrs[tagName]?.[key] === value) - return ''; + if ((ignoreAttrs[tagName] || []).includes(key) || defaultAttrs[tagName]?.[key] === value) return ''; return ` ${key}="${htmlEncode(value?.toString())}"`; }) @@ -162,8 +157,7 @@ function setIsInBlockTable(table, value) { rows.forEach((row) => tableMap.set(row, value)); cells.forEach((cell) => { tableMap.set(cell, value); - if (cell.childCount && cell.child(0).type.name === 'paragraph') - tableMap.set(cell.child(0), value); + if (cell.childCount && cell.child(0).type.name === 'paragraph') tableMap.set(cell.child(0), value); }); } @@ -270,12 +264,7 @@ export function renderContent(state, node, forceRenderInline) { } } -export function renderHTMLNode( - tagName, - forceRenderInline = false, - needNewLine = false, - attrs = {} -) { +export function renderHTMLNode(tagName, forceRenderInline = false, needNewLine = false, attrs = {}) { return (state, node) => { renderTagOpen(state, tagName, Object.assign({}, node.attrs || {}, attrs)); renderContent(state, node, forceRenderInline); diff --git a/packages/client/src/components/tiptap/services/table.ts b/packages/client/src/components/tiptap/services/table.ts index bb4d7508..eecbbd72 100644 --- a/packages/client/src/components/tiptap/services/table.ts +++ b/packages/client/src/components/tiptap/services/table.ts @@ -21,9 +21,7 @@ export const isRectSelected = (rect: any) => (selection: CellSelection) => { }; export const findTable = (selection: Selection) => - findParentNode((node) => node.type.spec.tableRole && node.type.spec.tableRole === 'table')( - selection - ); + findParentNode((node) => node.type.spec.tableRole && node.type.spec.tableRole === 'table')(selection); export const isCellSelection = (selection: any) => { return selection instanceof CellSelection; @@ -141,10 +139,7 @@ export const getCellsInTable = (selection: Selection) => { } }; -export const findParentNodeClosestToPos = ( - $pos: ResolvedPos, - predicate: (node: Node) => boolean -) => { +export const findParentNodeClosestToPos = ($pos: ResolvedPos, predicate: (node: Node) => boolean) => { for (let i = $pos.depth; i > 0; i--) { const node = $pos.node(i); if (predicate(node)) { @@ -159,8 +154,7 @@ export const findParentNodeClosestToPos = ( }; export const findCellClosestToPos = ($pos: ResolvedPos) => { - const predicate = (node: Node) => - node.type.spec.tableRole && /cell/i.test(node.type.spec.tableRole); + const predicate = (node: Node) => node.type.spec.tableRole && /cell/i.test(node.type.spec.tableRole); return findParentNodeClosestToPos($pos, predicate); }; diff --git a/packages/client/src/components/tiptap/services/type.ts b/packages/client/src/components/tiptap/services/type.ts index a1a6be94..896bceea 100644 --- a/packages/client/src/components/tiptap/services/type.ts +++ b/packages/client/src/components/tiptap/services/type.ts @@ -3,9 +3,7 @@ import { NodeType, Schema } from 'prosemirror-model'; export function getNodeType(nameOrType: string | NodeType, schema: Schema): NodeType { if (typeof nameOrType === 'string') { if (!schema.nodes[nameOrType]) { - throw Error( - `There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?` - ); + throw Error(`There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?`); } return schema.nodes[nameOrType]; diff --git a/packages/client/src/components/tooltip/index.tsx b/packages/client/src/components/tooltip/index.tsx index 877dc079..2187df35 100644 --- a/packages/client/src/components/tooltip/index.tsx +++ b/packages/client/src/components/tooltip/index.tsx @@ -11,22 +11,11 @@ interface IProps { position?: Position; } -export const Tooltip: React.FC = ({ - content, - hideOnClick = false, - position = 'top', - children, -}) => { +export const Tooltip: React.FC = ({ content, hideOnClick = false, position = 'top', children }) => { const [visible, toggleVisible] = useToggle(false); return ( - + { toggleVisible(true); diff --git a/packages/client/src/components/user/setting/index.tsx b/packages/client/src/components/user/setting/index.tsx index f5e344f0..257f7da1 100644 --- a/packages/client/src/components/user/setting/index.tsx +++ b/packages/client/src/components/user/setting/index.tsx @@ -65,12 +65,7 @@ export const UserSetting: React.FC = ({ visible, toggleVisible }) => { disabled placeholder="请输入账户名称" > - + ); diff --git a/packages/client/src/components/wiki-or-document-creator/index.tsx b/packages/client/src/components/wiki-or-document-creator/index.tsx index 208ee400..76d29a22 100644 --- a/packages/client/src/components/wiki-or-document-creator/index.tsx +++ b/packages/client/src/components/wiki-or-document-creator/index.tsx @@ -21,9 +21,7 @@ export const WikiOrDocumentCreator: React.FC = ({ onCreateDocument, chil render={ 知识库 - {wikiId && ( - 文档 - )} + {wikiId && 文档} } > diff --git a/packages/client/src/components/wiki/card/index.tsx b/packages/client/src/components/wiki/card/index.tsx index e37a611b..12a4c8fb 100644 --- a/packages/client/src/components/wiki/card/index.tsx +++ b/packages/client/src/components/wiki/card/index.tsx @@ -9,10 +9,7 @@ import styles from './index.module.scss'; const { Text, Paragraph } = Typography; -export const WikiCard: React.FC<{ wiki: IWiki; shareMode?: boolean }> = ({ - wiki, - shareMode = false, -}) => { +export const WikiCard: React.FC<{ wiki: IWiki; shareMode?: boolean }> = ({ wiki, shareMode = false }) => { return (
= ({ visible, toggleVisible }) => { }; return ( - -
($form.current = formApi)} - > + + ($form.current = formApi)}> = ({ wiki, update }) => {
{WIKI_AVATARS.map((cover) => { return ( -
setCover(cover)} - > +
setCover(cover)}> 系统默认图片
); diff --git a/packages/client/src/components/wiki/setting/documents/index.tsx b/packages/client/src/components/wiki/setting/documents/index.tsx index 85b889dd..6b9c6c4d 100644 --- a/packages/client/src/components/wiki/setting/documents/index.tsx +++ b/packages/client/src/components/wiki/setting/documents/index.tsx @@ -1,14 +1,5 @@ import React, { useState, useMemo, useEffect, useCallback } from 'react'; -import { - Transfer, - Button, - Banner, - Typography, - RadioGroup, - Radio, - Toast, - Checkbox, -} from '@douyinfe/semi-ui'; +import { Transfer, Button, Banner, Typography, RadioGroup, Radio, Toast, Checkbox } from '@douyinfe/semi-ui'; import { IconClose } from '@douyinfe/semi-icons'; import { WIKI_STATUS_LIST, isPublicDocument, isPublicWiki } from '@think/domains'; import { useWikiDetail, useWikiTocs } from 'data/wiki'; @@ -23,11 +14,7 @@ interface IProps { } export const WorkspaceDocs: React.FC = ({ wikiId }) => { - const { - data: workspace, - loading: workspaceLoading, - toggleStatus: toggleWorkspaceStatus, - } = useWikiDetail(wikiId); + const { data: workspace, loading: workspaceLoading, toggleStatus: toggleWorkspaceStatus } = useWikiDetail(wikiId); const { data: tocs, loading } = useWikiTocs(wikiId); const documents = flattenTree2Array(tocs).map((d) => { d.label = d.title; @@ -101,11 +88,7 @@ export const WorkspaceDocs: React.FC = ({ wikiId }) => { bordered icon={null} style={{ marginTop: 16 }} - title={ -
- 当前知识库已经公开 -
- } + title={
当前知识库已经公开
} description={ isPublic && (
@@ -130,11 +113,7 @@ export const WorkspaceDocs: React.FC = ({ wikiId }) => { 是否公开知识库? - setNextStatus(e.target.value)} - > + setNextStatus(e.target.value)}> {WIKI_STATUS_LIST.map((status) => { return {status.label}; })} diff --git a/packages/client/src/components/wiki/setting/users/add.tsx b/packages/client/src/components/wiki/setting/users/add.tsx index 28062f39..b504bf77 100644 --- a/packages/client/src/components/wiki/setting/users/add.tsx +++ b/packages/client/src/components/wiki/setting/users/add.tsx @@ -35,11 +35,7 @@ export const AddUser: React.FC = ({ visible, toggleVisible, onOk }) => { >
{userRole === WikiUserRole.admin ? ( - + ) : null} {WIKI_USER_ROLES.map((wikiStatus) => { diff --git a/packages/client/src/components/wiki/setting/users/index.tsx b/packages/client/src/components/wiki/setting/users/index.tsx index 25084b09..64f94d42 100644 --- a/packages/client/src/components/wiki/setting/users/index.tsx +++ b/packages/client/src/components/wiki/setting/users/index.tsx @@ -67,17 +67,8 @@ export const Users: React.FC = ({ wikiId }) => { align="center" render={(_, data) => ( <> -