Skip to content

Commit

Permalink
Merge pull request #225 from Irfan-Ahammed/main
Browse files Browse the repository at this point in the history
Copying from notpad to somewhere else is not working
  • Loading branch information
Muhammed-Rahif authored Nov 17, 2024
2 parents de0a851 + d899402 commit 713cb28
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/lib/helpers/menubar/edit-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ export class EditOptions {
const selectedContent = quill.getContents(selection.index, selection.length);
const tempCont = document.createElement('div');
new Quill(tempCont).setContents(selectedContent);
const clipboardData = tempCont.getElementsByClassName('ql-editor')[0].innerHTML;
const clipboardHtmlData = tempCont.getElementsByClassName('ql-editor')[0].innerHTML;
const clipboardTextData = quill.getText(selection.index, selection.length);
navigator.clipboard
.write([
new ClipboardItem({
'text/html': new Blob([clipboardData], { type: 'text/html' })
'text/plain': new Blob([clipboardTextData], { type: 'text/plain' }),
'text/html': new Blob([clipboardHtmlData], { type: 'text/html' })
})
])
.catch((err) => {
Expand All @@ -47,11 +49,13 @@ export class EditOptions {
const selectedContent = quill.getContents(selection.index, selection.length);
const tempCont = document.createElement('div');
new Quill(tempCont).setContents(selectedContent);
const clipboardData = tempCont.getElementsByClassName('ql-editor')[0].innerHTML;
const clipboardHtmlData = tempCont.getElementsByClassName('ql-editor')[0].innerHTML;
const clipboardTextData = quill.getText(selection.index, selection.length);
navigator.clipboard
.write([
new ClipboardItem({
'text/html': new Blob([clipboardData], { type: 'text/html' })
'text/plain': new Blob([clipboardTextData], { type: 'text/plain' }),
'text/html': new Blob([clipboardHtmlData], { type: 'text/html' })
})
])
.catch((err) => {
Expand Down

0 comments on commit 713cb28

Please sign in to comment.