'Issue when trying to paste, using the keyboard, into a div with quill
In the web page I present the user a box with quill attached so that the user can mark up text before saving it.
The issue is that users are wanting to paste in text but when you click in the div and use the keyboard to paste (Cmd+V) it will not paste the data into the div. There are no errors in javascript console.
I would like the user to be able to use the keyboard to paste text into the div.
What I have since discovered is that if you right click and paste into the div you can indeed paste your text but a javascript error is generated
When I drill down to line 111, I get the following from quills clipboard.js:
What is now interesting is that if I try and paste using the keyboard (Cmd+V) it will work.
Have other users had this issue and if so have a solution? Below is the code I use to set up the div, in case I have been using quill incorrectly.
In the html page I have linked to quill like so:
<script src="//cdn.quilljs.com/1.3.7/quill.min.js"></script>
<link href="//cdn.quilljs.com/1.3.7/quill.snow.css" rel="stylesheet" />
I have created a div to attach quill to:
<div contenteditable="true" id="popupBodyTA" name="b" placeholder="Enter your text"></div>
When the div gets shown the following javascript gets run to set up quill:
var toolbarOptions = [
[{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown
['bold', 'italic', 'underline'], // toggled buttons
[{ 'color': ['black','gray','saddlebrown','green','royalblue','purple','red'] }, { 'background': ['gainsboro','yellow','lawngreen','aqua','hotpink','violet','sandybrown'] }], // dropdown with defaults from theme
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
[{ 'script': 'sub'}, { 'script': 'super' }], // superscript/subscript
['link'],
['clean'] // remove formatting button
];
var options = {
modules: {
toolbar: toolbarOptions
},
theme: 'snow'};
var editor = new Quill('#popupBodyTA', options);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
