Disable import on paste

Ever since I enabled spell checking in CM ( set $:/config/codemirror/inputStyle to contenteditable and $:/config/codemirror/spellcheck to true), pasting text in javascript / json tiddlers triggers the import tiddler.

I’ve narrowed it down to the fact that the dropzone widget instance that is being called by the event doesn’t have contentTypesFilter, so it accepts any paste. If the tiddler type is blank, then the dropzone widget has [prefix[/image]] which then accepts only image pastes as import.

How do I go about setting things up so that json/javascript tiddlers also have this content type filter?

Hi @Ittayd yesterday we merged a pull request that may address the issue you’ve encountered:

I don’t think so. While I don’t fully grok the issue the PR fixes, in my case it doesn’t seem to be the type of the pasted element, but the fact that the dropzone that receives the event doesn’t filter by that type. I’m basically editing text and yet the dropzone behaves as if any sort of paste should be handled as an import. This manifests itself for me since the changes I made to CM mean that the event target is no longer a textarea.

In an empty TW without these settings, if the content type of the tiddler that is being edited is empty, a dropzone with the contentTypeFilter is called, but because it doesn’t do anything, since the target is a textarea, the event gets propagated to another dropzone which again does nothing for the same condition. If the content type is for javascript, only the second dropzone is called and it does nothing.

In my TW, when the tiddler’s content type is empty, the first dropzone gets called, it enters the “!textarea” condition but in there it calls readFileCallback that does nothing due to the content filter. But since it is in the condition body, it stops propagation so the second dropzone is not called. When the content type is for javascript, only the second dropzone is called, it goes into the condition, but since it doesn’t have a filtertype, it handles the import.

I don’t know how to do it, but I think the first dropzone should remain when the tiddler that is edited has a content type of json/javascript (or other text formats). While were at the subject, it seems to me that import should trigger when the content type filter doesn’t match the pasted type (it should be a whitelist), and not the way it is now (when it acts as a blacklist).

No one can help here?

Can you set up an empty.html at tiddlyhost with all the CM-plugins and all the settings that you have, where we can test the behaviour that is wrong.

May be 1 or 2 tiddlers with some info, which makes the recreation of the problem simple.

The main problem for me is, that I don’t really understand the problem you describe in the OP. So setting up a CM environment to test is difficult too. … so I don’t even try

Thank you @pmario . Uploaded to https://paste.tiddlyhost.com/. Just edit the Json Test tiddler and paste anything with the keyboard. The import tiddler will open

OK. That’s a bug. I’ll crate an issue at GH

New issue created. … [BUG] application/json tiddler in edit mode -- copy paste to text area also creates an $:/Import tiddler · Issue #7244 · Jermolene/TiddlyWiki5 · GitHub