CKEDITOR.plugins.pastetools.filters.image
Filtering
Properties
-
recognizableImageSignatures : RecognizableImageSignature[]
since 4.16.0 private
Recognizable image file signatures with their respective types.
The recognizing of image type is done by matching the first bytes of the signature represented as hex string.
Defaults to
[{signature: 'ffd8ff', type: 'image/jpeg'}, {signature: '47494638', type: 'image/gif'}, {signature: '89504e47', type: 'image/png'}]
-
recognizableImageTypes : RecognizableImageType[]
since 4.16.0 private
Recognizable image types with their respective markers.
The recognizing of image type is done by searching for image marker inside the RTF image content.
Defaults to
[{marker: /\\pngblip/, type: 'image/png'}, {marker: /\\jpegblip/, type: 'image/jpeg'}, {marker: /\\emfblip/, type: 'image/emf'}, {marker: /\\wmetafile\d/, type: 'image/wmf'}]
-
supportedImageTypes : String[]
since 4.16.0 private
Array of all supported image formats.
Defaults to
['image/png', 'image/jpeg', 'image/gif']
Methods
-
convertBlobUrlToBase64( blobUrlSrc ) → String | null>
since 4.16.0 private
Converts blob url into base64 string. Conversion is happening asynchronously. Currently supported file types:
image/png
,image/jpeg
,image/gif
.Parameters
blobUrlSrc : String
Address of blob which is going to be converted
Returns
String | null>
Promise, which resolves to Data URL representing image. If image's type is unsupported, promise resolves to
null
.
-
createSrcWithBase64( img ) → String
since 4.16.0 private
Creates image source as Base64-encoded Data URL.
-
extractFromRtf( rtfContent ) → ImageData[]
since 4.16.0 private
Parses RTF content to find embedded images.
Parameters
rtfContent : String
RTF content to be checked for images.
Returns
ImageData[]
An array of images found in the
rtfContent
.
-
extractTagsFromHtml( html ) → String[]
since 4.16.0 private
Extracts an array of
src`` attributes in
tags from the given HTML.
` tags belonging to VML shapes are removed.
CKEDITOR.plugins.pastefromword.images.extractTagsFromHtml( html ); // Returns: [ 'http://example-picture.com/random.png', 'http://example-picture.com/another.png' ]
Parameters
html : String
A string representing HTML code.
Returns
String[]
An array of strings representing the
src
attribute of the<img>
tags found inhtml
.
-
getImageType( imageContent ) → String
since 4.16.0 private
Extract image type from its RTF content
Parameters
imageContent : String
Image content as RTF string.
Returns
String
If the image type can be extracted, it is returned in
image/*
format. Otherwise,'unknown'
is returned.
-
getImageTypeFromSignature( bytesArray ) → String | null
since 4.16.0 private
Return file type based on first 4 bytes of given file. Currently recognised file types:
image/png
,image/jpeg
,image/gif
.Parameters
bytesArray : Uint8Array
Typed array which will be analysed to obtain file type.
Returns
String | null
File type recognized from given typed array or null.