Skip to content

Commit

Permalink
pref: remove nofollow from the default editor link (#5477)
Browse files Browse the repository at this point in the history
#### What type of PR is this?

/kind improvement
/area editor
/area ui
/milestone 2.14.x

#### What this PR does / why we need it:

将默认富文本编辑器中的链接中的 rel 属性由默认的 `noopener noreferrer nofollow` 属性改为 null,优化 SEO 。
 
#### How to test it?

查看使用默认富文本编辑器创建的链接,其 rel 属性是否不再是 `noopener noreferrer nofollow`

#### Which issue(s) this PR fixes:

Fixes #5328 

#### Does this PR introduce a user-facing change?
```release-note
移除默认富文本编辑器中链接的 nofollow 等属性,优化 SEO。
```
  • Loading branch information
LIlGG committed Mar 8, 2024
1 parent a8627cb commit 92f2229
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ui/packages/editor/src/extensions/link/index.ts
Expand Up @@ -2,6 +2,17 @@ import TiptapLink from "@tiptap/extension-link";
import type { LinkOptions } from "@tiptap/extension-link";
import type { ExtensionOptions } from "@/types";

const Link = TiptapLink.extend<ExtensionOptions & LinkOptions>();
const Link = TiptapLink.extend<ExtensionOptions & LinkOptions>({
addOptions() {
return {
...this.parent?.(),
...{
HTMLAttributes: {
rel: null,
},
},
};
},
});

export default Link;

0 comments on commit 92f2229

Please sign in to comment.