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

fix xss #495

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/vue-quill-editor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"dependencies": {
"object-assign": "^4.1.1",
"quill": "^1.3.7"
"quill": "^2.0.2"
},
"devDependencies": {
"autoprefixer": "^6.7.2",
Expand Down
13 changes: 10 additions & 3 deletions src/editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@

// Set editor content
if (this.value || this.content) {
this.quill.pasteHTML(this.value || this.content)
this.pasteHTML(this.value || this.content)
}

// Disabled editor
Expand Down Expand Up @@ -141,6 +141,13 @@
// Emit ready event
this.$emit('ready', this.quill)
}
},
// HTML to Quill Delta
pasteHTML(html) {
this.quill.setContents(this.quill.clipboard.convert({
html: html,
text: '\n'
}))
}
},
watch: {
Expand All @@ -149,7 +156,7 @@
if (this.quill) {
if (newVal && newVal !== this._content) {
this._content = newVal
this.quill.pasteHTML(newVal)
this.pasteHTML(newVal)
} else if(!newVal) {
this.quill.setText('')
}
Expand All @@ -160,7 +167,7 @@
if (this.quill) {
if (newVal && newVal !== this._content) {
this._content = newVal
this.quill.pasteHTML(newVal)
this.pasteHTML(newVal)
} else if(!newVal) {
this.quill.setText('')
}
Expand Down