Skip to content

Commit

Permalink
Merge pull request #366 from thematters/fix/clipboard-use-docs-soap
Browse files Browse the repository at this point in the history
fix/clipboard: use docsSoap to prepare html from google doc
  • Loading branch information
tx0c authored Oct 11, 2021
2 parents c863021 + 95f009f commit 8567320
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"dependencies": {
"autosize": "^4.0.2",
"classnames": "^2.2.6",
"docs-soap": "^1.2.1",
"react-quill": "^1.3.3"
},
"devDependencies": {
Expand Down
5 changes: 4 additions & 1 deletion src/modules/clipboard.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Quill } from 'react-quill'

import { docsSoap } from 'docs-soap'

import createImageMatcher from '../matchers/createImage'
import { isSafari } from '../utils/browser'
import { dom } from '../utils/dom'
Expand Down Expand Up @@ -46,7 +48,8 @@ class RemadeClipboard extends Clipboard {
event.stopPropagation()

const formats = this.quill.getFormat(this.quill.selection.savedRange.index)
const html = event.clipboardData.getData('text/html')
const htmlRaw = event.clipboardData.getData('text/html')
const html = docsSoap(htmlRaw) // Needed for Google docs
const text = event.clipboardData.getData('text/plain')

let delta = new Delta().retain(range.index)
Expand Down

0 comments on commit 8567320

Please sign in to comment.