wangeditor-team / wangEditor

wangEditor —— 开源 Web 富文本编辑器
http://www.wangeditor.com/
MIT License
17.37k stars 3.31k forks source link

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

Open sujingjun opened 3 months ago

sujingjun commented 3 months ago

bug 描述

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

wangEditor 版本

wangeditor-5.1.23

demo 能否复现该 bug ?

在线 demo

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

最小成本的复现步骤

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

cycleccc commented 3 months ago

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

sujingjun commented 3 months ago

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 commented 3 months ago

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 commented 2 months ago

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