CKEDITOR.plugins.clipboard.fallbackDataTransfer
Fallback dataTransfer object which is used together with CKEDITOR.plugins.clipboard.dataTransfer for browsers supporting Clipboard API, but not supporting custom MIME types (Edge 16+, see ckeditor4/issues/#962).
Filtering
Properties
-
private
_customDataFallbackType : String
CKEDITOR.plugins.clipboard.fallbackDataTransfer#_customDataFallbackType
-
DataTransfer object which internal cache and data transfer objects will be modified if needed.
Static properties
-
Array containing MIME types which are not supported by native
setData
. Those types are recognized by error which is thrown when using nativesetData
with a given type (see _isUnsupportedMimeTypeError).Defaults to
[]
-
private static
_isCustomMimeTypeSupported : Boolean
CKEDITOR.plugins.clipboard.fallbackDataTransfer#_isCustomMimeTypeSupported
True if the environment supports custom MIME types in CKEDITOR.plugins.clipboard.dataTransfer.getData and CKEDITOR.plugins.clipboard.dataTransfer.setData methods.
Introduced to distinguish between browsers which support only some whitelisted types (like
text/html
,application/xml
), but do not support custom MIME types (likecke/id
). When the value of this property equalsnull
it means it was not yet initialized.This property should not be accessed directly, use isRequired method instead.
Methods
-
constructor( dataTransfer ) → fallbackDataTransfer
CKEDITOR.plugins.clipboard.fallbackDataTransfer#constructor
Parameters
dataTransfer : dataTransfer
DataTransfer object which internal cache and data transfer objects will be reused.
Returns
fallbackDataTransfer
-
getData( type, [ getNative ] ) → String
CKEDITOR.plugins.clipboard.fallbackDataTransfer#getData
Returns the data of the given MIME type if stored in a regular way or in a special comment. If given type is the same as _customDataFallbackType the whole data without special comment is returned.
Parameters
type : String
[ getNative ] : Boolean
Indicates if the whole, original content of the dataTransfer should be returned.
Defaults to
false
Returns
String
-
isRequired() → Boolean
CKEDITOR.plugins.clipboard.fallbackDataTransfer#isRequired
Whether fallbackDataTransfer object should be used when operating on native
dataTransfer
. Iftrue
is returned, it means custom MIME types are not supported in the current browser (see _isCustomMimeTypeSupported).Returns
Boolean
-
setData( type, value ) → String
CKEDITOR.plugins.clipboard.fallbackDataTransfer#setData
Sets given data in native
dataTransfer
object. If given MIME type is not supported it uses _customDataFallbackType MIME type to save data using special comment format:<!--cke-data:{ type: value }-->
It is important to keep in mind that
{ type: value }
object is stringified (usingJSON.stringify
) and encoded (usingencodeURIComponent
).Parameters
type : String
value : String
Returns
String
The value which was set.
-
private
_applyDataComment( content, data ) → String
CKEDITOR.plugins.clipboard.fallbackDataTransfer#_applyDataComment
Creates
cke-data
comment containing stringified and encoded data object which is prepended to a given content.Parameters
content : String
data : Object
Returns
String
-
private
_extractDataComment( content ) → Object
CKEDITOR.plugins.clipboard.fallbackDataTransfer#_extractDataComment
Extracts
cke-data
comment from the given content.Parameters
content : String
Returns
Object
Returns an object containing extracted data as
data
and content (withoutcke-data
comment) ascontent
.Propertiesdata : null
Object containing
MIME type : value
pairs or null ifcke-data
comment is not present.content : String
Regular content without
cke-data
comment.
-
private
_getData( type, [ skipCache ] ) → null
CKEDITOR.plugins.clipboard.fallbackDataTransfer#_getData
Native getData wrapper.
Parameters
type : String
[ skipCache ] : Boolean
-
Defaults to
false
Returns
null
-
private
_getFallbackTypeContent() → String
CKEDITOR.plugins.clipboard.fallbackDataTransfer#_getFallbackTypeContent
Returns content stored in _customDataFallbackType. Content is always first retrieved from _dataTransfer cache and then from native
dataTransfer
object.Returns
String
-
private
_getFallbackTypeData() → Object
CKEDITOR.plugins.clipboard.fallbackDataTransfer#_getFallbackTypeData
Returns custom data stored in _customDataFallbackType. Custom data is always first retrieved from _dataTransfer cache and then from native
dataTransfer
object.Returns
Object
-
private
_isUnsupportedMimeTypeError( error ) → Boolean
CKEDITOR.plugins.clipboard.fallbackDataTransfer#_isUnsupportedMimeTypeError
Whether provided error means that unsupported MIME type was used when calling native
dataTransfer.setData
method.Parameters
error : Error
Returns
Boolean