grassator / insert-text-at-cursor Goto Github PK
View Code? Open in Web Editor NEWFast crossbrowser insertion of text at cursor position in a textarea / input
License: MIT License
Fast crossbrowser insertion of text at cursor position in a textarea / input
License: MIT License
main.js
import insertTextAtCursor from 'insert-text-at-cursor'; Vue.use(insertTextAtCursor);
Chrome Console:
index.js?585e:26 Uncaught TypeError: input.focus is not a function
Thinks
Greetings,
I've been using your package for inserting text into default textarea/input components and it works great.
Unfortunately, it doesn't work well at sites that use the draft-js editor (e.g. reddit or facebook).
Here is a workaround that works for draft-js.
Is there a chance to support this editor?
This is the minimum valuable code that inserts a text at cursor with draft-js:
function addTextToDraftJs(element, text) {
var textEvent = document.createEvent('TextEvent');
textEvent.initTextEvent ('textInput', true, true, null, text);
element.dispatchEvent(textEvent);
}
addTextToDraftJs(document.activeElement, 'it works');
Thx.
that log from netlify. i can't deploy the web site
7:20:29 AM: Failed to minify the code from this file:
7:20:29 AM: ./node_modules/insert-text-at-cursor/index.js:1
Hello,
I am using react-mde library, which has dependency to this library in the latest version.
After updating react-mde, webpack throws error during build
ERROR in assets/js/bundle.js?v=8c4ec7c34d426ef93de7 from UglifyJs
Unexpected token: name (browserSupportsTextareaTextNodes)
This is caused by webpack prioritizing module
field over main
field by default and UglifyJs can't read ES6 syntax that is in index.js
.
Would it be possible to add .npmignore
file with index.js
in it so webpack uses the correct path?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.