質問

I've a droppable input.

  • 1- When i drag drop a html text, the drop works...
  • 2- When i drag drop a gedit (bloc note linux), the drop works

  • 3- But When i want to drop a selected text from LibreOffice Writer or Calc, it don't works...

I've created a fiddle if someone can help me... : http://jsfiddle.net/CnwvC/ with code

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<input id='inputid' type='text' value="snif">

<p>html blabla to test to drop </p>
役に立ちましたか?

解決

Instead of gedit, the LibreOffice text content is not plain text. This could be one of the reasons that it doesn't allow you drag and drop its content to your input box.

One interesting fact is that if you drag and drop a content from a webpage to you document on Writer you'll get the HTML content of the page (all the tags), but if you do the same in Google Chrome, you will get the rich content (like colour, formatting, and so on). This was reported by other folks.

If you try to drag LibreOffice's content to any area on Firefox, it will be same issue.

So, the problem is not in your code, but in the way that LibreOffice (Writer, Impress, and all the other apps) integrate with the browser libraries.

Hope that help you, it's not an usual issue.

Thanks

他のヒント

When you "copy" a document fragment, the program puts in the clipboard possibly more than a single version of what you copied.
Versions are tagged with their format.
Like for example if you paste the fragment in a text editor like vim it will choose a "text only" version because it doesn't deal with "text richness".
There might also be an HTML formatted version, and one in "rich text" format.

It's up to the pasting application to choose the right version.
If it doesn't specify any then the system (my experience was on Windows) chooses the most universally accepted one, that is, plain text.
It is explained in this MSDN page.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top