1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-01 21:10:14 +02:00

add rich text checking for plain text too

This commit is contained in:
Ian Storm Taylor
2016-11-21 13:54:43 -08:00
parent 0b5ba16400
commit 59a69bbea6

View File

@@ -204,10 +204,11 @@ class Transfer {
if (this.hasNode()) return 'node' if (this.hasNode()) return 'node'
// COMPAT: Microsoft Word adds an image of the selected text to the data. // COMPAT: Microsoft Word adds an image of the selected text to the data.
// Since files are preferred over HTML, this would cause the type to be // Since files are preferred over HTML or text, this would cause the type to
// considered `files`. But it also adds rich text data so we can check for // be considered `files`. But it also adds rich text data so we can check
// that and properly set the type to `html`. (2016/11/21) // for that and properly set the type to `html` or `text`. (2016/11/21)
if (this.hasRichText() && this.hasHtml()) return 'html' if (this.hasRichText() && this.hasHtml()) return 'html'
if (this.hasRichText() && this.hasText()) return 'text'
if (this.hasFiles()) return 'files' if (this.hasFiles()) return 'files'
if (this.hasHtml()) return 'html' if (this.hasHtml()) return 'html'