mirror of https://github.com/halo-dev/halo
fix: error editing post when img component has file attribute (#5434)
#### What type of PR is this? /kind bug /area editor /area ui /milestone 2.14.x #### What this PR does / why we need it: 使用默认编辑器时,当图片、视频中具有 `file` 属性时,进入编辑界面时会报错。此 PR 将不再从渲染后的 HTML 中获取 file 属性,并且在渲染 HTML 时,抛弃掉 file 属性用于解决这个问题。 #### How to test it? 测试图片上传、视频上传功能不受影响即可。 #### Which issue(s) this PR fixes: Fixes #5430 #### Does this PR introduce a user-facing change? ```release-note 修复进入文章页面会偶现错误提示的问题 ```pull/5448/head
parent
eef53ea81a
commit
98523b2bd3
|
@ -22,9 +22,6 @@ const Image = ExtensionImage.extend<UiImageOptions>({
|
|||
addAttributes() {
|
||||
return {
|
||||
...this.parent?.(),
|
||||
file: {
|
||||
default: null,
|
||||
},
|
||||
width: {
|
||||
default: "100%",
|
||||
parseHTML: (element) => {
|
||||
|
@ -51,6 +48,15 @@ const Image = ExtensionImage.extend<UiImageOptions>({
|
|||
};
|
||||
},
|
||||
},
|
||||
file: {
|
||||
default: null,
|
||||
renderHTML() {
|
||||
return {};
|
||||
},
|
||||
parseHTML() {
|
||||
return null;
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
|
|
|
@ -24,6 +24,12 @@ const Video = ExtensionVideo.extend<UiVideoOptions>({
|
|||
...this.parent?.(),
|
||||
file: {
|
||||
default: null,
|
||||
renderHTML() {
|
||||
return {};
|
||||
},
|
||||
parseHTML() {
|
||||
return null;
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue