Question

There was no problem some months ago but suddenly "Paste" stop working in CodeMirror in Google Chrome. Both "Ctrl+V", "Shift+Insert" and right-click -> "Paste" do nothing.

It's not a bug in my code because even at demo page at
http://codemirror.net/jstest.html
it doesn't work.

Was it helpful?

Solution 3

Update Google Chrome. Everything works in the new version - Google Chrome 8.0.552.0 dev

OTHER TIPS

This problem continues on Linux when using any webkit variant (Chrome is one). It remains unhandled in CodeMirror 2.25.

Here is the bug.

You can make a VERY PARTIAL patch to handleKeyBinding(e) in CodeMirror after var name=... This is NOT a perfect fix, but it will help you recognize Delete, Ctrl+Insert and Shift+Insert:

if( name == null && (webkit || chrome) && e.keyCode == 0 && e.charCode == 0 && e.keyLocation == 3 ) {
    // Now we know something on the keypad has been pressed and not translated properly by webkit.
    if( e.ctrlKey == false && e.shiftKey == false ) {
      // We're probably hitting the Delete key to delete a character.
      name = 'Delete';    
    }
    if( e.ctrlKey == true || e.shiftKey == true ) {
      // We're probably using Ctrl-Ins to copy, or Shift-Ins to paste.
      name = 'Insert';    
    }
  }    

Now Delete is handled. But since you can't get to the clipboard from Javascript, you are stuck with respect to Ctrl+Insert (copy) and Shift+Insert(paste) until the webkit bug is fixed.

I have the same problem - however, I found this instance of it does accept copy-paste from within chrome.

http://kml-samples.googlecode.com/svn/trunk/interactive/index.html

I've tried to use their copy of the chromemirror source code on my site - but no luck yet

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top