CKEDITOR.plugins.copyformatting
Filtering
Properties
-
breakOnElements : Array
CKEDITOR.plugins.copyformatting#breakOnElements
An array of elements on which extracting formatting should be stopped. If Copy Formatting reaches an element from the array, it ends going up the document tree and fetching the element parents' styles.
Defaults to
['ul', 'ol', 'table']
-
elementsForInlineTransform : Array
CKEDITOR.plugins.copyformatting#elementsForInlineTransform
An array of elements that will be transformed into inline styles while applying formatting to the plain text context, e.g. trying to apply styles from the
<li>
element (<li style="font-size: 24px;">
) to a regular paragraph will cause changing the<li>
element into a corresponding<span>
element (<span style="font-size: 24px;">
).Defaults to
['li']
-
excludedAttributes : Array
CKEDITOR.plugins.copyformatting#excludedAttributes
An array of attributes that should be excluded from extracted styles.
Defaults to
['id', 'style', 'href', 'data-cke-saved-href', 'dir']
-
excludedAttributesFromInlineTransform : Array
CKEDITOR.plugins.copyformatting#excludedAttributesFromInlineTransform
An array of attributes to be excluded while transforming styles from elements inside elementsForInlineTransform into
<span>
elements with styles (e.g. when applying these styles to text context).Defaults to
['value', 'type']
-
excludedElementsFromInlineTransform : Array
CKEDITOR.plugins.copyformatting#excludedElementsFromInlineTransform
An array of elements that will be excluded from the transformation while applying formatting to the plain text context.
Defaults to
['table', 'thead', 'tbody', 'ul', 'ol']
-
inlineBoundary : Array
CKEDITOR.plugins.copyformatting#inlineBoundary
An array of block boundaries that should be always transformed into inline elements with styles, e.g.
<div style="font-size: 24px;" class="important">
becomes<span style="font-size: 24px;" class="important">
.Defaults to
['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'div']
-
preservedElements : Array
CKEDITOR.plugins.copyformatting#preservedElements
An array of elements which should not be deleted when removing old styles from the current selection. Instead the styles are stripped from the elements, preserving the elements themselves, e.g.
<ul style="font-size: 24px" class="important">
becomes<ul>
.Defaults to
['ul', 'ol', 'li', 'td', 'th', 'tr', 'thead', 'tbody', 'table']
-
private
_initialKeystrokePasteCommand : String
CKEDITOR.plugins.copyformatting#_initialKeystrokePasteCommand
Stores the name of the command (if any) initially bound to the keystroke used for format applying (CKEDITOR.config.copyFormatting_keystrokePaste), to restore it after copy formatting is deactivated.
Methods
-
private
_addScreenReaderContainer() → element
CKEDITOR.plugins.copyformatting#_addScreenReaderContainer
Adds the screen reader messages wrapper. Multiple calls will create only one message container.
Returns
element
Inserted
aria-live
container.
-
Initializes applying given styles to the currently selected content in the editor.
The actual applying is performed inside event listeners for the CKEDITOR.plugins.copyformatting.state.applyFormatting event.
Parameters
editor : editor
The editor instance.
newStyles : style[]
An array of styles to be applied.
Returns
Boolean
false
if styles could not be applied,true
otherwise.
-
private
_applyStylesToListContext( editor, range, styles )
CKEDITOR.plugins.copyformatting#_applyStylesToListContext
Applies the list style inside the list context.
Parameters
editor : editor
The editor instance.
range : range
The range where the styles should be applied.
styles : style[]
The style to be applied.
-
private
_applyStylesToTableContext( editor, range, styles )
CKEDITOR.plugins.copyformatting#_applyStylesToTableContext
Applies the table style inside the table context.
Parameters
editor : editor
The editor instance.
range : range
The range where the styles should be applied.
styles : style[]
The style to be applied.
-
private
_applyStylesToTextContext( editor, range, styles )
CKEDITOR.plugins.copyformatting#_applyStylesToTextContext
Applies styles inside the plain text context.
Parameters
editor : editor
The editor instance.
range : range
The range that the context can be determined from.
styles : style[]
The styles to be applied.
-
private
_attachPasteKeystrokeHandler( editor )
CKEDITOR.plugins.copyformatting#_attachPasteKeystrokeHandler
Attaches the paste keystroke handler to the given editor instance.
Parameters
editor : editor
-
private
_convertElementToStyleDef( element ) → Object
CKEDITOR.plugins.copyformatting#_convertElementToStyleDef
Converts a given element into a style definition that could be used to create an instance of CKEDITOR.style.
Note that all definitions have a
type
property set to CKEDITOR.STYLE_INLINE.Parameters
element : element
The element to be converted.
Returns
Object
The style definition created from the element.
-
private
_detachPasteKeystrokeHandler( editor )
CKEDITOR.plugins.copyformatting#_detachPasteKeystrokeHandler
Detaches the paste keystroke handler from the given editor instance.
Parameters
editor : editor
-
Determines the context of the given selection. See CKEDITOR.config.copyFormatting_allowedContexts for a list of possible context values.
Parameters
range : range
The range that the context should be determined from.
Returns
String
-
private
_extractStylesFromElement( editor, element ) → style[]
CKEDITOR.plugins.copyformatting#_extractStylesFromElement
Extracts styles from the given element and its ancestors. This function walks up the document tree, starting from the given element, and ends on the editor's editable or when the element from breakOnElements is reached.
Parameters
editor : editor
The editor instance.
element : element
The element whose styles should be extracted.
Returns
style[]
An array containing all extracted styles.
-
private
_extractStylesFromRange( editor, range ) → style[]
CKEDITOR.plugins.copyformatting#_extractStylesFromRange
Extracts styles from the given range. This function finds all elements in the given range and then applies _extractStylesFromElement on them.
Parameters
editor : editor
The editor instance.
range : range
The range that styles should be extracted from.
Returns
style[]
An array containing all extracted styles. Styles in the array returned by this method might be duplicated; it should be cleaned later on.
-
Filters styles before applying them by using CKEDITOR.filter.
Parameters
styles : style[]
An array of styles to be filtered.
Returns
style[]
Filtered styles.
-
Returns a container element where the mouse cursor should be overridden.
Parameters
editor : editor
The editor instance.
Returns
element
For inline editor, it is the editable itself and for classic editor it is the document element of the editor iframe.
-
private
_getScreenReaderContainer() → Object
CKEDITOR.plugins.copyformatting#_getScreenReaderContainer
-
private
_getSelectedWordOffset( range ) → Object
CKEDITOR.plugins.copyformatting#_getSelectedWordOffset
Gets offsets as well as start and end containers for the selected word. It also handles cases like
lu<span style="color: #f00;">n</span>ar
.Parameters
range : range
Selected range.
Returns
Object
return An object with the following properties:
PropertiesstartNode : element
The node where the word's beginning is located.
startOffset : Number
The offset inside the
startNode
indicating the word's beginning.endNode : element
The node where the word's ending is located.
endOffset : Number
The offset inside the
endNode
indicating the word's ending.
-
private
_putScreenReaderMessage( editor, msg )
CKEDITOR.plugins.copyformatting#_putScreenReaderMessage
Puts a message solely for screen readers, meant to provide status updates for the Copy Formatting plugin.
Parameters
editor : editor
The editor instance.
msg : string
The name of the message in the language file.
-
private
_removeStylesFromElementInRange( range, element )
CKEDITOR.plugins.copyformatting#_removeStylesFromElementInRange
Removes all styles from the element in a given range without removing the element itself.
Parameters
range : range
The range where the element should be found.
element : String
The tag name of the element.