I noticed that Tagify does some odd things when you try to paste formatted/rich text into it. Here is one possible solution:
http://jsfiddle.net/HBEzc/
Could something like this be implemented?
newlines (\n or \r\n) should remain intact. I have some idea I want to try.
I am aware of this problem
It would be great if pasting rich text would work 馃憤 or if there's a simple solution for adding it.
Update: Actually, i tried the snippet of the example that @thetuningspoon posted in combination with a paste event on the Tagify input and it worked 馃槉
Is there any plan to support pasting markup / rich text? This makes tagify unusable when pasting any content from google spreadsheets, for example. Any thoughts?
Well I added easily copy as text to Tagify after it's creation but something like this might be better added to the core @yairEO
var TAGIFY = new Tagify(input, {
....
})
//Add events
function handlePaste (e) {
var clipboardData, pastedData;
// Get pasted data via clipboard API
clipboardData = e.clipboardData || window.clipboardData;
pastedData = clipboardData.getData('Text');
// insert text manually
document.execCommand("insertHTML", false, pastedData);
// Stop data actually being pasted into div
e.stopPropagation();
e.preventDefault();
}
function handleCopy (e) {
const selection = document.getSelection();
var copyText = selection.toString();
event.clipboardData.setData('text/plain', copyText);
// Stop the default copy
e.stopPropagation();
e.preventDefault();
}
TAGIFY.DOM.input.addEventListener('paste', handlePaste);
TAGIFY.DOM.input.addEventListener('copy', handleCopy);
Most helpful comment
newlines (
\nor\r\n) should remain intact. I have some idea I want to try.I am aware of this problem