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']
-
_initialKeystrokePasteCommand : String
CKEDITOR.plugins.copyformatting#_initialKeystrokePasteCommand
private
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
-
_addScreenReaderContainer() → element
CKEDITOR.plugins.copyformatting#_addScreenReaderContainer
private
Adds the screen reader messages wrapper. Multiple calls will create only one message container.
Returns
element
Inserted
aria-live
container.
-
_applyFormat( editor, newStyles ) → Boolean
CKEDITOR.plugins.copyformatting#_applyFormat
private
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
Returns
Boolean
false
if styles could not be applied,true
otherwise.
-
_applyStylesToListContext( editor, range, styles )
CKEDITOR.plugins.copyformatting#_applyStylesToListContext
private
Applies the list style inside the list context.
-
_applyStylesToTableContext( editor, range, styles )
CKEDITOR.plugins.copyformatting#_applyStylesToTableContext
private
Applies the table style inside the table context.
-
_applyStylesToTextContext( editor, range, styles )
CKEDITOR.plugins.copyformatting#_applyStylesToTextContext
private
Applies styles inside the plain text context.
-
_attachPasteKeystrokeHandler( editor )
CKEDITOR.plugins.copyformatting#_attachPasteKeystrokeHandler
private
Attaches the paste keystroke handler to the given editor instance.
Parameters
editor : editor
-
_convertElementToStyleDef( element ) → Object
CKEDITOR.plugins.copyformatting#_convertElementToStyleDef
private
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.
-
_detachPasteKeystrokeHandler( editor )
CKEDITOR.plugins.copyformatting#_detachPasteKeystrokeHandler
private
Detaches the paste keystroke handler from the given editor instance.
Parameters
editor : editor
-
_determineContext( range ) → String
CKEDITOR.plugins.copyformatting#_determineContext
private
Determines the context of the given selection. See CKEDITOR.config.copyFormatting_allowedContexts for a list of possible context values.
-
_extractStylesFromElement( editor, element ) → style[]
CKEDITOR.plugins.copyformatting#_extractStylesFromElement
private
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.
-
_extractStylesFromRange( editor, range ) → style[]
CKEDITOR.plugins.copyformatting#_extractStylesFromRange
private
Extracts styles from the given range. This function finds all elements in the given range and then applies _extractStylesFromElement on them.
-
_filterStyles( styles ) → style[]
CKEDITOR.plugins.copyformatting#_filterStyles
private
Filters styles before applying them by using CKEDITOR.filter.
-
_getCursorContainer( editor ) → element
CKEDITOR.plugins.copyformatting#_getCursorContainer
private
Returns a container element where the mouse cursor should be overridden.
-
_getScreenReaderContainer() → Object
CKEDITOR.plugins.copyformatting#_getScreenReaderContainer
private
Returns a screen reader messages wrapper.
Returns
Object
-
_getSelectedWordOffset( range ) → Object
CKEDITOR.plugins.copyformatting#_getSelectedWordOffset
private
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:
Properties
-
_putScreenReaderMessage( editor, msg )
CKEDITOR.plugins.copyformatting#_putScreenReaderMessage
private
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.
-
_removeStylesFromElementInRange( range, element )
CKEDITOR.plugins.copyformatting#_removeStylesFromElementInRange
private
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.