expaste

0.1.1 • Public • Published

expaste

Parser for pasted data that is copied from spreadsheet on Excel and Google Drive

Build Status

demo

ex.) Markdown output

Demo Page

demo

usage

Vanilla

document.getElementById('input').addEventListener('paste', function (e) {
 
    var ep = expaste.getDataByEvent(e);
 
    // output style
    var json = ep.toJSONStringify();
    var csv = ep.toCSV();
    var tsv = ep.toTSV();
    var md = ep.toMarkdown();
 
    // overwritten paste
    this.value = md;
 
    e.preventDefault();
 
}, false);

jQuery

$('#input').on('paste', function (e) {
 
    var ep = expaste.getDataByEvent(e.originalEvent);
 
    // output style
    var json = ep.toJSONStringify();
    var csv = ep.toCSV();
    var tsv = ep.toTSV();
    var md = ep.toMarkdown();
 
    // overwritten paste
    $(this).val(md);
 
    return false;
 
});

Support

  • Chrome
  • Safari
  • Firefox

unsupport

  • Internet Explorer

Partial support in IE refers using a non-standard method of interacting with the clipboard. Can I use

Package Sidebar

Install

npm i expaste

Weekly Downloads

28

Version

0.1.1

License

MIT

Last publish

Collaborators

  • yusukehirao