Skip to content

Commit

Permalink
Copying from notpad to somewhere else
Browse files Browse the repository at this point in the history
  • Loading branch information
Irfan-Ahammed authored and Muhammed-Rahif committed Nov 17, 2024
1 parent de0a851 commit d899402
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 d899402

Please sign in to comment.