Skip to content

Commit

Permalink
Add Link (enabled as type & paste)
Browse files Browse the repository at this point in the history
  • Loading branch information
zjkmxy committed Oct 31, 2024
1 parent 9f4947c commit 223ffad
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"@tiptap/extension-collaboration-cursor": "^2.9.1",
"@tiptap/extension-color": "^2.9.1",
"@tiptap/extension-highlight": "^2.9.1",
"@tiptap/extension-link": "^2.9.1",
"@tiptap/extension-text-style": "^2.9.1",
"@tiptap/pm": "^2.9.1",
"@tiptap/starter-kit": "^2.9.1",
Expand Down
20 changes: 20 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/components/share-latex/rich-doc/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import CollaborationCursor from '@tiptap/extension-collaboration-cursor'
import Highlight from '@tiptap/extension-highlight'
import { Color } from '@tiptap/extension-color'
import TextStyle from '@tiptap/extension-text-style'
import Link from '@tiptap/extension-link'
import * as Y from 'yjs'
import { createSignal, onCleanup, onMount } from 'solid-js'
import { Card, CardContent, Divider, IconButton, Stack } from '@suid/material'
Expand All @@ -24,6 +25,7 @@ import {
FormatClear as FormatClearIcon,
Undo as UndoIcon,
Redo as RedoIcon,
Link as LinkIcon,

Check warning on line 28 in src/components/share-latex/rich-doc/index.tsx

View workflow job for this annotation

GitHub Actions / ESLint

src/components/share-latex/rich-doc/index.tsx#L28

'LinkIcon' is defined but never used (@typescript-eslint/no-unused-vars)
} from '@suid/icons-material'
import { H1Icon, H2Icon, H3Icon, H4Icon } from './icons'
import CmdIcon from './cmd-icon'
Expand Down Expand Up @@ -60,6 +62,13 @@ export default function RichDoc(props: {
Collaboration.configure({
fragment: props.doc,
}),
Link.configure({
HTMLAttributes: {
// These are default values, but we want to make sure they are set
rel: 'noopener noreferrer nofollow',
target: '_blank',
},
}),
Highlight,
TextStyle,
Color,
Expand Down

0 comments on commit 223ffad

Please sign in to comment.