File tree Expand file tree Collapse file tree 4 files changed +32
-4
lines changed
src/js/components/input/link Expand file tree Collapse file tree 4 files changed +32
-4
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,13 @@ class Link extends Mark
1919 // =========================================================================
2020
2121 public function getTag ()
22- {
22+ {
23+ // Reset
24+ $ this ->attrs ['rel ' ] = null ;
25+
2326 if (isset ($ this ->attrs ['target ' ])) {
2427 if ($ this ->attrs ['target ' ] === '_blank ' ) {
25- $ this ->attrs ['rel ' ] = 'noopener noreferrer nofollow ' ;
28+ $ this ->attrs ['rel ' ] = 'noopener noreferrer ' ;
2629 }
2730 }
2831
Original file line number Diff line number Diff line change 11import { Plugin , PluginKey } from 'prosemirror-state' ;
2+ import { mergeAttributes } from '@tiptap/core' ;
23import Link from '@tiptap/extension-link' ;
34
45export default Link . extend ( {
6+ addOptions ( ) {
7+ return {
8+ ...this . parent ?. ( ) ,
9+
10+ // Reset the default attributes to not assume `target="_blank"`
11+ HTMLAttributes : {
12+ target : null ,
13+ rel : null ,
14+ class : null ,
15+ } ,
16+ } ;
17+ } ,
18+
19+ renderHTML ( { HTMLAttributes } ) {
20+ const attrs = mergeAttributes ( this . options . HTMLAttributes , HTMLAttributes ) ;
21+
22+ // Only output `rel` if setting a target
23+ if ( attrs . target === '_blank' ) {
24+ attrs . rel = 'noopener noreferrer' ;
25+ }
26+
27+ return [ 'a' , attrs , 0 ] ;
28+ } ,
29+
530 addProseMirrorPlugins ( ) {
631 return [
732 new Plugin ( {
Original file line number Diff line number Diff line change 11{
2- "/field/dist/js/main.js" : " /field/dist/js/main.js?id=fdbb173d1db25aad3a8e " ,
2+ "/field/dist/js/main.js" : " /field/dist/js/main.js?id=98f3aba287b37a296d4c " ,
33 "/field/dist/css/style.css" : " /field/dist/css/style.css?id=4d44c86feaaeeb9b55b0"
44}
You can’t perform that action at this time.
0 commit comments