feat: Intra-line double link interaction
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { BaseEditor } from 'slate';
|
import { BaseEditor } from 'slate';
|
||||||
import { ReactEditor } from 'slate-react';
|
import { ReactEditor } from 'slate-react';
|
||||||
|
import { DoubleLinkElement } from './text/plugins/DoubleLink';
|
||||||
import { LinkElement } from './text/plugins/link';
|
import { LinkElement } from './text/plugins/link';
|
||||||
import { RefLinkElement } from './text/plugins/reflink';
|
import { RefLinkElement } from './text/plugins/reflink';
|
||||||
|
|
||||||
@@ -8,7 +9,8 @@ export type CustomElement =
|
|||||||
| { type: string; children: CustomElement[] }
|
| { type: string; children: CustomElement[] }
|
||||||
| CustomText
|
| CustomText
|
||||||
| LinkElement
|
| LinkElement
|
||||||
| RefLinkElement;
|
| RefLinkElement
|
||||||
|
| DoubleLinkElement;
|
||||||
declare module 'slate' {
|
declare module 'slate' {
|
||||||
interface CustomTypes {
|
interface CustomTypes {
|
||||||
Editor: BaseEditor & ReactEditor;
|
Editor: BaseEditor & ReactEditor;
|
||||||
@@ -19,35 +21,32 @@ declare module 'slate' {
|
|||||||
|
|
||||||
export { BlockPreview, StyledBlockPreview } from './block-preview';
|
export { BlockPreview, StyledBlockPreview } from './block-preview';
|
||||||
export { default as Button } from './button';
|
export { default as Button } from './button';
|
||||||
export type { CommonListItem } from './list';
|
|
||||||
export { CommonList, BackLink, commonListContainer } from './list';
|
|
||||||
export * from './Logo';
|
|
||||||
export { default as Toolbar } from './toolbar';
|
|
||||||
export { CollapsibleTitle } from './collapsible-title';
|
export { CollapsibleTitle } from './collapsible-title';
|
||||||
|
export * from './comming-soon/CommingSoon';
|
||||||
export * from './text';
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
NewpageIcon,
|
AddIcon,
|
||||||
ClockIcon,
|
ClockIcon,
|
||||||
ViewSidebarIcon,
|
CloseIcon,
|
||||||
|
CodeBlockInlineIcon,
|
||||||
|
DocumentIcon,
|
||||||
|
FilterIcon,
|
||||||
|
FullScreenIcon,
|
||||||
|
HighlighterDuotoneIcon,
|
||||||
|
KanbanIcon,
|
||||||
ListIcon,
|
ListIcon,
|
||||||
SpaceIcon,
|
NewpageIcon,
|
||||||
|
PagesIcon,
|
||||||
PencilDotDuotoneIcon,
|
PencilDotDuotoneIcon,
|
||||||
PencilDuotoneIcon,
|
PencilDuotoneIcon,
|
||||||
HighlighterDuotoneIcon,
|
|
||||||
CodeBlockInlineIcon,
|
|
||||||
PagesIcon,
|
|
||||||
CloseIcon,
|
|
||||||
DocumentIcon,
|
|
||||||
TodoListIcon,
|
|
||||||
KanbanIcon,
|
|
||||||
TableIcon,
|
|
||||||
AddIcon,
|
|
||||||
FilterIcon,
|
|
||||||
SorterIcon,
|
SorterIcon,
|
||||||
FullScreenIcon,
|
SpaceIcon,
|
||||||
|
TableIcon,
|
||||||
|
TodoListIcon,
|
||||||
UnGroupIcon,
|
UnGroupIcon,
|
||||||
|
ViewSidebarIcon,
|
||||||
} from './icon';
|
} from './icon';
|
||||||
|
export { BackLink, CommonList, commonListContainer } from './list';
|
||||||
export * from './comming-soon/CommingSoon';
|
export type { CommonListItem } from './list';
|
||||||
|
export * from './Logo';
|
||||||
|
export * from './text';
|
||||||
|
export { default as Toolbar } from './toolbar';
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
import { PagesIcon } from '@toeverything/components/icons';
|
import { PagesIcon } from '@toeverything/components/icons';
|
||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import { Descendant } from 'slate';
|
||||||
|
|
||||||
|
export type DoubleLinkElement = {
|
||||||
|
type: 'link';
|
||||||
|
workspaceId: string;
|
||||||
|
blockId: string;
|
||||||
|
children: Descendant[];
|
||||||
|
id: string;
|
||||||
|
};
|
||||||
|
|
||||||
export const DoubleLinkComponent = ({ attributes, children, element }: any) => {
|
export const DoubleLinkComponent = ({ attributes, children, element }: any) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|||||||
Reference in New Issue
Block a user