Skip to content

Commit

Permalink
[release-2.13] fix: error editing post when img component has file at…
Browse files Browse the repository at this point in the history
…tribute (#5447)

This is an automated cherry-pick of #5434

/assign ruibaby

```release-note
修复进入文章页面会偶现错误提示的问题
```
  • Loading branch information
halo-dev-bot committed Mar 6, 2024
1 parent cc5f3de commit 95c9188
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ui/src/components/editor/extensions/image/index.ts
Expand Up @@ -22,9 +22,6 @@ const Image = ExtensionImage.extend<UiImageOptions>({
addAttributes() {
return {
...this.parent?.(),
file: {
default: null,
},
width: {
default: "100%",
parseHTML: (element) => {
Expand All @@ -51,6 +48,15 @@ const Image = ExtensionImage.extend<UiImageOptions>({
};
},
},
file: {
default: null,
renderHTML() {
return {};
},
parseHTML() {
return null;
},
},
};
},

Expand Down
6 changes: 6 additions & 0 deletions ui/src/components/editor/extensions/video/index.ts
Expand Up @@ -24,6 +24,12 @@ const Video = ExtensionVideo.extend<UiVideoOptions>({
...this.parent?.(),
file: {
default: null,
renderHTML() {
return {};
},
parseHTML() {
return null;
},
},
};
},
Expand Down

0 comments on commit 95c9188

Please sign in to comment.