修复插入图片设置最大宽度100%的bug

master
yutent 2025-03-17 16:14:32 +08:00
parent 36ced2378c
commit 705c666202
1 changed files with 1 additions and 10 deletions

View File

@ -244,10 +244,6 @@ class Editor extends Component {
outline: none; outline: none;
text-wrap: wrap; text-wrap: wrap;
word-break: break-all; word-break: break-all;
img {
max-width: 100%;
}
} }
`, `,
@ -447,13 +443,8 @@ class Editor extends Component {
send: link => { send: link => {
this.$refs.editor.focus() this.$refs.editor.focus()
this.restoreSelection() this.restoreSelection()
this.exec(ACTTION.image, link) this.exec(ACTTION.html, `<img src="${link}" style="max-width:100%" >`)
this.saveSelection() this.saveSelection()
// 修正插入的图片,宽度不得超出容器
this.$refs.editor.querySelectorAll('img').forEach(_ => {
_.style.maxWidth = '100%'
})
} }
} }
}) })