Skip to content

Commit 4616349

Browse files
fixup! feat(text-editor): add support for pasting inline images
1 parent 0e984fa commit 4616349

File tree

1 file changed

+6
-1
lines changed
  • src/components/text-editor/prosemirror-adapter/plugins/image

1 file changed

+6
-1
lines changed

src/components/text-editor/prosemirror-adapter/plugins/image/node.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,16 @@ function createImageNodeSpec(language: Languages): NodeSpec {
119119
{
120120
tag: 'img',
121121
getAttrs: (dom: HTMLElement): Attrs => {
122+
let maxWidth = dom.style.maxWidth;
123+
if (!maxWidth || maxWidth === 'none') {
124+
maxWidth = '100%';
125+
}
126+
122127
return {
123128
src: dom.getAttribute('src') || '',
124129
alt: dom.getAttribute('alt') || 'file',
125130
width: dom.style.width || '',
126-
maxWidth: dom.style.maxWidth || '100%',
131+
maxWidth: maxWidth,
127132
state: ImageState.SUCCESS,
128133
};
129134
},

0 commit comments

Comments
 (0)