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 : StringCKEDITOR.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 nativesetDatawith a given type (see _isUnsupportedMimeTypeError).Defaults to
[] private static
_isCustomMimeTypeSupported : BooleanCKEDITOR.plugins.clipboard.fallbackDataTransfer#_isCustomMimeTypeSupportedTrue 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 equalsnullit means it was not yet initialized.This property should not be accessed directly, use isRequired method instead.
Methods
constructor( dataTransfer ) → fallbackDataTransferCKEDITOR.plugins.clipboard.fallbackDataTransfer#constructorParameters
dataTransfer : dataTransferDataTransfer object which internal cache and data transfer objects will be reused.
Returns
fallbackDataTransfer
getData( type, [ getNative ] ) → StringCKEDITOR.plugins.clipboard.fallbackDataTransfer#getDataReturns 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 ] : BooleanIndicates if the whole, original content of the dataTransfer should be returned.
Defaults to
false
Returns
String
isRequired() → BooleanCKEDITOR.plugins.clipboard.fallbackDataTransfer#isRequiredWhether fallbackDataTransfer object should be used when operating on native
dataTransfer. Iftrueis returned, it means custom MIME types are not supported in the current browser (see _isCustomMimeTypeSupported).Returns
Boolean
setData( type, value ) → StringCKEDITOR.plugins.clipboard.fallbackDataTransfer#setDataSets given data in native
dataTransferobject. 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 : Stringvalue : String
Returns
StringThe value which was set.
private
_applyDataComment( content, data ) → StringCKEDITOR.plugins.clipboard.fallbackDataTransfer#_applyDataCommentCreates
cke-datacomment containing stringified and encoded data object which is prepended to a given content.Parameters
content : Stringdata : Object
Returns
String
private
_extractDataComment( content ) → ObjectCKEDITOR.plugins.clipboard.fallbackDataTransfer#_extractDataCommentExtracts
cke-datacomment from the given content.Parameters
content : String
Returns
ObjectReturns an object containing extracted data as
dataand content (withoutcke-datacomment) ascontent.Propertiesdata : nullObject containing
MIME type : valuepairs or null ifcke-datacomment is not present.content : StringRegular content without
cke-datacomment.
private
_getData( type, [ skipCache ] ) → nullCKEDITOR.plugins.clipboard.fallbackDataTransfer#_getDataNative getData wrapper.
Parameters
type : String[ skipCache ] : BooleanDefaults to
false
Returns
null
private
_getFallbackTypeContent() → StringCKEDITOR.plugins.clipboard.fallbackDataTransfer#_getFallbackTypeContentReturns content stored in _customDataFallbackType. Content is always first retrieved from _dataTransfer cache and then from native
dataTransferobject.Returns
String
private
_getFallbackTypeData() → ObjectCKEDITOR.plugins.clipboard.fallbackDataTransfer#_getFallbackTypeDataReturns custom data stored in _customDataFallbackType. Custom data is always first retrieved from _dataTransfer cache and then from native
dataTransferobject.Returns
Object
private
_isUnsupportedMimeTypeError( error ) → BooleanCKEDITOR.plugins.clipboard.fallbackDataTransfer#_isUnsupportedMimeTypeErrorWhether provided error means that unsupported MIME type was used when calling native
dataTransfer.setDatamethod.Parameters
error : Error
Returns
Boolean