mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
37 lines
722 B
JavaScript
37 lines
722 B
JavaScript
import { Link as TipTapLink } from 'tiptap-extensions'
|
|
|
|
export default class Link extends TipTapLink {
|
|
pasteRules({ type }) {
|
|
return []
|
|
}
|
|
|
|
get schema() {
|
|
return {
|
|
attrs: {
|
|
href: {
|
|
default: null,
|
|
},
|
|
},
|
|
inclusive: false,
|
|
parseDOM: [
|
|
{
|
|
// if this is an embed link or a hashtag, ignore
|
|
tag: 'a[href]:not(.embed):not([data-hashtag-id])',
|
|
getAttrs: dom => ({
|
|
href: dom.getAttribute('href'),
|
|
}),
|
|
},
|
|
],
|
|
toDOM: node => [
|
|
'a',
|
|
{
|
|
...node.attrs,
|
|
rel: 'noopener noreferrer nofollow',
|
|
target: '_blank',
|
|
},
|
|
0,
|
|
],
|
|
}
|
|
}
|
|
}
|