Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

复制html,img标签的width,height属性被过滤了 #5878

Open
sujingjun opened this issue Jun 4, 2024 · 4 comments
Open

复制html,img标签的width,height属性被过滤了 #5878

sujingjun opened this issue Jun 4, 2024 · 4 comments

Comments

@sujingjun
Copy link

bug 描述

复制一段携带img标签的html文本,会将img标签上的width,height属性过滤掉。这个属性时期望能保留的。 所以能不能在复制的场景保留img标签尺寸相关的属性?

wangEditor 版本

wangeditor-5.1.23

demo 能否复现该 bug ?

在线 demo

请尽量提供在线 demo (推荐以下网站),帮助我们最低成本复现 bug

最小成本的复现步骤

(请告诉我们,如何最快的复现该 bug)

  • 步骤一
    复制一段带有图片标签且有width和height属性的富文本,到demo地址
  • 步骤二
    查看富文本生成的html,img标签的width,height属性被过滤了
@cycleccc
Copy link

cycleccc commented Jun 4, 2024

复制image标签,width和height是会保留的呀,是不是复制的时候有嵌套?如,这种就识别不到。

@sujingjun
Copy link
Author

wangeditor插件width和height是定在在style属性里面的,在构建虚拟dom过程img组件并没有定义width和height属性:
export declare type ImageStyle = { width?: string; height?: string; }; export declare type ImageElement = { type: 'image'; src: string; alt?: string; href?: string; style?: ImageStyle; children: EmptyText[]; };

@cycleccc
Copy link

cycleccc commented Jun 5, 2024

wangeditor插件width和height是定在在style属性里面的,在构建虚拟dom过程img组件并没有定义width和height属性: export declare type ImageStyle = { width?: string; height?: string; }; export declare type ImageElement = { type: 'image'; src: string; alt?: string; href?: string; style?: ImageStyle; children: EmptyText[]; };

懂了,抱歉,我搞错了,确实,wangeditor现在是获取的style,过滤掉了自带的width和height。

@cycleccc
Copy link

@sujingjun 不好意思,隔了有点久才回复,我现在在wangEditor-next 添加了 图片 width 和 height 属性的支持,你可以查看wangeditor-next的readme 来安装替换,如果有兴趣的话欢迎一起来维护这个项目。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants