[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> rich-text.js (summary)

External dependencies

File Size: 4971 lines (143 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 128 functions

  formatTypes()
  arrayOf()
  isObjectLike()
  createCache()
  isShallowEqual()
  rememo()
  getRootCache()
  getWeakMapCache()
  clear()
  callSelector()
  getFormatType()
  getFormatTypeForBareElement()
  getFormatTypeForClassName()
  addFormatTypes()
  removeFormatTypes()
  isFormatEqual()
  normaliseFormats()
  replace()
  applyFormat()
  createElement()
  createEmptyValue()
  toFormat()
  create()
  accumulateSelection()
  filterRange()
  collapseWhiteSpace()
  removeReservedCharacters()
  createFromElement()
  mergeFormats()
  createFromMultilineElement()
  getAttributes()
  mergePair()
  concat()
  getActiveFormats()
  getActiveFormat()
  getActiveObject()
  getTextContent()
  getLineIndex()
  isListRootSelected()
  isActiveListType()
  isCollapsed()
  isEmpty()
  isEmptyLine()
  join()
  registerFormatType()
  removeFormat()
  filterFormats()
  insert()
  remove()
  replace_replace()
  insertLineSeparator()
  removeLineSeparator()
  insertObject()
  slice()
  split()
  splitAtSelection()
  get_format_type_getFormatType()
  restoreOnAttributes()
  fromFormat()
  isEqualUntil()
  toTree()
  createPathToNode()
  getNodeByPath()
  append()
  appendText()
  getLastChild()
  getParent()
  isText()
  getText()
  to_dom_remove()
  toDom()
  apply()
  applyValue()
  isRangeEqual()
  applySelection()
  toHTMLString()
  createEmpty()
  to_html_string_getLastChild()
  to_html_string_append()
  to_html_string_appendText()
  to_html_string_getParent()
  to_html_string_isText()
  to_html_string_getText()
  to_html_string_remove()
  createElementHTML()
  createChildrenHTML()
  toggleFormat()
  unregisterFormatType()
  canIndentListItems()
  canOutdentListItems()
  getTargetLevelLineIndex()
  indentListItems()
  getParentLineIndex()
  getLastChildIndex()
  outdentListItems()
  changeListType()
  useAnchorRef()
  useDefaultStyle()
  useBoundaryStyle()
  useCopyHandler()
  onCopy()
  useFormatBoundaries()
  onKeyDown()
  useSelectObject()
  onClick()
  useIndentListItemOnSpace()
  onKeyDown()
  updateFormats()
  fixPlaceholderSelection()
  useInputAndSelection()
  onInput()
  handleSelectionChange()
  onCompositionStart()
  onCompositionEnd()
  onFocus()
  useDelete()
  onKeyDown()
  useSpace()
  onKeyDown()
  useRichText()
  createRecord()
  applyRecord()
  setRecordFromProps()
  handleChange()
  handleChangesUponInit()
  applyFromProps()
  __experimentalRichText()
  FormatEdit()

Functions
Functions that are not part of a class:

formatTypes()   X-Ref
Reducer managing the format types

return: {Object} Updated state.
param: {Object} state  Current state.
param: {Object} action Dispatched action.

arrayOf( value )   X-Ref
Returns the first argument as the sole entry in an array.

return: {Array} Value returned as entry in array.
param: {*} value Value to return.

isObjectLike( value )   X-Ref
Returns true if the value passed is object-like, or false otherwise. A value
is object-like if it can support property assignment, e.g. object or array.

return: {boolean} Whether value is object-like.
param: {*} value Value to test.

createCache()   X-Ref
Creates and returns a new cache object.

return: {Object} Cache object.

isShallowEqual( a, b, fromIndex )   X-Ref
Returns true if entries within the two arrays are strictly equal by
reference from a starting index.

return: {boolean} Whether arrays are shallowly equal.
param: {Array}  a         First array.
param: {Array}  b         Second array.
param: {number} fromIndex Index from which to start comparison.

rememo(selector, getDependants )   X-Ref
Returns a memoized selector function. The getDependants function argument is
called before the memoized selector and is expected to return an immutable
reference or array of references on which the selector depends for computing
its own return value. The memoize cache is preserved only as long as those
dependant references remain the same. If getDependants returns a different
reference(s), the cache is cleared and the selector value regenerated.

return: {Function} Memoized selector.
param: {Function} selector      Selector function.
param: {Function} getDependants Dependant getter returning an immutable

getRootCache()   X-Ref
Returns the root cache. If WeakMap is supported, this is assigned to the
root WeakMap cache set, otherwise it is a shared instance of the default
cache object.

return: {(WeakMap|Object)} Root cache object.

getWeakMapCache( dependants )   X-Ref
Returns the cache for a given dependants array. When possible, a WeakMap
will be used to create a unique cache for each set of dependants. This
is feasible due to the nature of WeakMap in allowing garbage collection
to occur on entries where the key object is no longer referenced. Since
WeakMap requires the key to be an object, this is only possible when the
dependant is object-like. The root cache is created as a hierarchy where
each top-level key is the first entry in a dependants set, the value a
WeakMap where each key is the next dependant, and so on. This continues
so long as the dependants are object-like. If no dependants are object-
like, then the cache is shared across all invocations.

return: {Object} Cache object.
param: {Array} dependants Selector dependants.

clear()   X-Ref
Resets root memoization cache.


callSelector( )   X-Ref
The augmented selector call, considering first whether dependants have
changed before passing it to underlying memoize function.

return: {*} Selector result.
param: {Object} source    Source object for derivation.
param: {...*}   extraArgs Additional arguments to pass to selector.

getFormatType(state, name)   X-Ref
Returns a format type by name.

return: {Object?} Format type.
param: {Object} state Data state.
param: {string} name  Format type name.

getFormatTypeForBareElement(state, bareElementTagName)   X-Ref
Gets the format type, if any, that can handle a bare element (without a
data-format-type attribute), given the tag name of this element.

return: {?Object} Format type.
param: {Object} state              Data state.
param: {string} bareElementTagName The tag name of the element to find a

getFormatTypeForClassName(state, elementClassName)   X-Ref
Gets the format type, if any, that can handle an element, given its classes.

return: {?Object} Format type.
param: {Object} state            Data state.
param: {string} elementClassName The classes of the element to find a format

addFormatTypes(formatTypes)   X-Ref
Returns an action object used in signalling that format types have been
added.

return: {Object} Action object.
param: {Array|Object} formatTypes Format types received.

removeFormatTypes(names)   X-Ref
Returns an action object used to remove a registered format type.

return: {Object} Action object.
param: {string|Array} names Format name.

isFormatEqual(format1, format2)   X-Ref
Optimised equality check for format objects.

return: {boolean} True if formats are equal, false if not.
param: {?RichTextFormat} format1 Format to compare.
param: {?RichTextFormat} format2 Format to compare.

normaliseFormats(value)   X-Ref
Normalises formats: ensures subsequent adjacent equal formats have the same
reference.

return: {RichTextValue} New value with normalised formats.
param: {RichTextValue} value Value to normalise formats of.

replace(array, index, value)   X-Ref
No description

applyFormat(value, format)   X-Ref
Apply a format object to a Rich Text value from the given `startIndex` to the
given `endIndex`. Indices are retrieved from the selection if none are
provided.

return: {RichTextValue} A new value with the format applied.
param: {RichTextValue}  value        Value to modify.
param: {RichTextFormat} format       Format to apply.
param: {number}         [startIndex] Start index.
param: {number}         [endIndex]   End index.

createElement(_ref, html)   X-Ref
Parse the given HTML into a body element.

Note: The current implementation will return a shared reference, reset on
each call to `createElement`. Therefore, you should not hold a reference to
the value to operate upon asynchronously, as it may have unexpected results.

return: {HTMLBodyElement} Body element with parsed HTML.
param: {HTMLDocument} document The HTML document to use to parse.
param: {string}       html     The HTML to parse.

createEmptyValue()   X-Ref


toFormat(_ref)   X-Ref
No description

create()   X-Ref
Create a RichText value from an `Element` tree (DOM), an HTML string or a
plain text string, with optionally a `Range` object to set the selection. If
called without any input, an empty value will be created. If
`multilineTag` is provided, any content of direct children whose type matches
`multilineTag` will be separated by two newlines. The optional functions can
be used to filter out content.

A value will have the following shape, which you are strongly encouraged not
to modify without the use of helper functions:

```js
{
text: string,
formats: Array,
replacements: Array,
?start: number,
?end: number,
}
```

As you can see, text and formatting are separated. `text` holds the text,
including any replacement characters for objects and lines. `formats`,
`objects` and `lines` are all sparse arrays of the same length as `text`. It
holds information about the formatting at the relevant text indices. Finally
`start` and `end` state which text indices are selected. They are only
provided if a `Range` was given.

return: {RichTextValue} A rich text value.
param: {Object}  [$1]                          Optional named arguments.
param: {Element} [$1.element]                  Element to create value from.
param: {string}  [$1.text]                     Text to create value from.
param: {string}  [$1.html]                     HTML to create value from.
param: {Range}   [$1.range]                    Range to create value from.
param: {string}  [$1.multilineTag]             Multiline tag if the structure is
param: {Array}   [$1.multilineWrapperTags]     Tags where lines can be found if
param: {boolean} [$1.preserveWhiteSpace]       Whether or not to collapse white
param: {boolean} [$1.__unstableIsEditableTree]

accumulateSelection(accumulator, node, range, value)   X-Ref
Helper to accumulate the value's selection start and end from the current
node and range.

param: {Object} accumulator Object to accumulate into.
param: {Node}   node        Node to create value with.
param: {Range}  range       Range to create value with.
param: {Object} value       Value that is being accumulated.

filterRange(node, range, filter)   X-Ref
Adjusts the start and end offsets from a range based on a text filter.

return: {Object|void} Object containing range properties.
param: {Node}     node   Node of which the text should be filtered.
param: {Range}    range  The range to filter.
param: {Function} filter Function to use to filter the text.

collapseWhiteSpace(string)   X-Ref
Collapse any whitespace used for HTML formatting to one space character,
because it will also be displayed as such by the browser.

param: {string} string

removeReservedCharacters(string)   X-Ref
Removes reserved characters used by rich-text (zero width non breaking spaces added by `toTree` and object replacement characters).

param: {string} string

createFromElement(_ref2)   X-Ref
Creates a Rich Text value from a DOM element and range.

return: {RichTextValue} A rich text value.
param: {Object}  $1                        Named argements.
param: {Element} [$1.element]              Element to create value from.
param: {Range}   [$1.range]                Range to create value from.
param: {string}  [$1.multilineTag]         Multiline tag if the structure is
param: {Array}   [$1.multilineWrapperTags] Tags where lines can be found if
param: {boolean} [$1.preserveWhiteSpace]   Whether or not to collapse white
param: {Array}   [$1.currentWrapperTags]
param: {boolean} [$1.isEditableTree]

mergeFormats(formats)   X-Ref
No description

createFromMultilineElement(_ref3)   X-Ref
Creates a rich text value from a DOM element and range that should be
multiline.

return: {RichTextValue} A rich text value.
param: {Object}  $1                        Named argements.
param: {Element} [$1.element]              Element to create value from.
param: {Range}   [$1.range]                Range to create value from.
param: {string}  [$1.multilineTag]         Multiline tag if the structure is
param: {Array}   [$1.multilineWrapperTags] Tags where lines can be found if
param: {Array}   [$1.currentWrapperTags]   Whether to prepend a line
param: {boolean} [$1.preserveWhiteSpace]   Whether or not to collapse white
param: {boolean} [$1.isEditableTree]

getAttributes(_ref4)   X-Ref
Gets the attributes of an element in object shape.

return: {Object|void} Attribute object or `undefined` if the element has no
param: {Object}  $1         Named argements.
param: {Element} $1.element Element to get attributes from.

mergePair(a, b)   X-Ref
Concats a pair of rich text values. Not that this mutates `a` and does NOT
normalise formats!

return: {Object} `a`, mutated.
param: {Object} a Value to mutate.
param: {Object} b Value to add read from.

concat()   X-Ref
Combine all Rich Text values into one. This is similar to
`String.prototype.concat`.

return: {RichTextValue} A new value combining all given records.
param: {...RichTextValue} values Objects to combine.

getActiveFormats(_ref)   X-Ref
Gets the all format objects at the start of the selection.

return: {RichTextFormatList} Active format objects.
param: {RichTextValue} value                Value to inspect.
param: {Array}         EMPTY_ACTIVE_FORMATS Array to return if there are no

getActiveFormat(value, formatType)   X-Ref
Gets the format object by type at the start of the selection. This can be
used to get e.g. the URL of a link format at the current selection, but also
to check if a format is active at the selection. Returns undefined if there
is no format at the selection.

return: {RichTextFormat|undefined} Active format object of the specified
param: {RichTextValue} value      Value to inspect.
param: {string}        formatType Format type to look for.

getActiveObject(_ref)   X-Ref
Gets the active object, if there is any.

return: {RichTextFormat|void} Active object, or undefined.
param: {RichTextValue} value Value to inspect.

getTextContent(_ref)   X-Ref
Get the textual content of a Rich Text value. This is similar to
`Element.textContent`.

return: {string} The text content.
param: {RichTextValue} value Value to use.

getLineIndex(_ref)   X-Ref
Gets the currently selected line index, or the first line index if the
selection spans over multiple items.

return: {number|void} The line index. Undefined if not found.
param: {RichTextValue} value      Value to get the line index from.
param: {boolean}       startIndex Optional index that should be contained by

isListRootSelected(value)   X-Ref
Whether or not the root list is selected.

return: {boolean} True if the root list or nothing is selected, false if an
param: {RichTextValue} value The value to check.

isActiveListType(value, type, rootType)   X-Ref
Whether or not the selected list has the given tag name.

return: {boolean} True if the current list type matches `type`, false if not.
param: {RichTextValue} value    The value to check.
param: {string}        type     The tag name the list should have.
param: {string}        rootType The current root tag name, to compare with in

isCollapsed(_ref)   X-Ref
Check if the selection of a Rich Text value is collapsed or not. Collapsed
means that no characters are selected, but there is a caret present. If there
is no selection, `undefined` will be returned. This is similar to
`window.getSelection().isCollapsed()`.

return: {boolean|undefined} True if the selection is collapsed, false if not,
param: {RichTextValue} value The rich text value to check.

isEmpty(_ref)   X-Ref
Check if a Rich Text value is Empty, meaning it contains no text or any
objects (such as images).

return: {boolean} True if the value is empty, false if not.
param: {RichTextValue} value Value to use.

isEmptyLine(_ref2)   X-Ref
Check if the current collapsed selection is on an empty line in case of a
multiline value.

return: {boolean} True if the line is empty, false if not.
param: {RichTextValue} value Value te check.

join(values)   X-Ref
Combine an array of Rich Text values into one, optionally separated by
`separator`, which can be a Rich Text value, HTML string, or plain text
string. This is similar to `Array.prototype.join`.

return: {RichTextValue} A new combined value.
param: {Array<RichTextValue>} values      An array of values to join.
param: {string|RichTextValue} [separator] Separator string or value.

registerFormatType(name, settings)   X-Ref
Registers a new format provided a unique name and an object defining its
behavior.

return: {WPFormat|undefined} The format, if it has been successfully
param: {string}   name     Format name.
param: {WPFormat} settings Format settings.

removeFormat(value, formatType)   X-Ref
Remove any format object from a Rich Text value by type from the given
`startIndex` to the given `endIndex`. Indices are retrieved from the
selection if none are provided.

return: {RichTextValue} A new value with the format applied.
param: {RichTextValue} value        Value to modify.
param: {string}        formatType   Format type to remove.
param: {number}        [startIndex] Start index.
param: {number}        [endIndex]   End index.

filterFormats(formats, index, formatType)   X-Ref
No description

insert(value, valueToInsert)   X-Ref
Insert a Rich Text value, an HTML string, or a plain text string, into a
Rich Text value at the given `startIndex`. Any content between `startIndex`
and `endIndex` will be removed. Indices are retrieved from the selection if
none are provided.

return: {RichTextValue} A new value with the value inserted.
param: {RichTextValue}        value         Value to modify.
param: {RichTextValue|string} valueToInsert Value to insert.
param: {number}               [startIndex]  Start index.
param: {number}               [endIndex]    End index.

remove(value, startIndex, endIndex)   X-Ref
Remove content from a Rich Text value between the given `startIndex` and
`endIndex`. Indices are retrieved from the selection if none are provided.

return: {RichTextValue} A new value with the content removed.
param: {RichTextValue} value        Value to modify.
param: {number}        [startIndex] Start index.
param: {number}        [endIndex]   End index.

replace_replace(_ref, pattern, replacement)   X-Ref
Search a Rich Text value and replace the match(es) with `replacement`. This
is similar to `String.prototype.replace`.

return: {RichTextValue} A new value with replacements applied.
param: {RichTextValue}   value       The value to modify.
param: {RegExp|string}   pattern     A RegExp object or literal. Can also be
param: {Function|string} replacement The match or matches are replaced with

insertLineSeparator(value)   X-Ref
Insert a line break character into a Rich Text value at the given
`startIndex`. Any content between `startIndex` and `endIndex` will be
removed. Indices are retrieved from the selection if none are provided.

return: {RichTextValue} A new value with the value inserted.
param: {RichTextValue} value        Value to modify.
param: {number}        [startIndex] Start index.
param: {number}        [endIndex]   End index.

removeLineSeparator(value)   X-Ref
Removes a line separator character, if existing, from a Rich Text value at
the current indices. If no line separator exists on the indices it will
return undefined.

return: {RichTextValue|undefined} A new value with the line separator
param: {RichTextValue} value    Value to modify.
param: {boolean}       backward Indicates if are removing from the start

insertObject(value, formatToInsert, startIndex, endIndex)   X-Ref
Insert a format as an object into a Rich Text value at the given
`startIndex`. Any content between `startIndex` and `endIndex` will be
removed. Indices are retrieved from the selection if none are provided.

return: {RichTextValue} A new value with the object inserted.
param: {RichTextValue}  value          Value to modify.
param: {RichTextFormat} formatToInsert Format to insert as object.
param: {number}         [startIndex]   Start index.
param: {number}         [endIndex]     End index.

slice(value)   X-Ref
Slice a Rich Text value from `startIndex` to `endIndex`. Indices are
retrieved from the selection if none are provided. This is similar to
`String.prototype.slice`.

return: {RichTextValue} A new extracted value.
param: {RichTextValue} value        Value to modify.
param: {number}        [startIndex] Start index.
param: {number}        [endIndex]   End index.

split(_ref, string)   X-Ref
Split a Rich Text value in two at the given `startIndex` and `endIndex`, or
split at the given separator. This is similar to `String.prototype.split`.
Indices are retrieved from the selection if none are provided.

return: {Array<RichTextValue>|undefined} An array of new values.
param: {RichTextValue} value
param: {number|string} [string] Start index, or string at which to split.

splitAtSelection(_ref2)   X-Ref
No description

get_format_type_getFormatType(name)   X-Ref
Returns a registered format type.

return: {RichTextFormatType|undefined} Format type.
param: {string} name Format name.

restoreOnAttributes(attributes, isEditableTree)   X-Ref
No description

fromFormat(_ref)   X-Ref
Converts a format object to information that can be used to create an element
from (type, attributes and object).

return: {Object} Information to be used for element creation.
param: {Object}  $1                        Named parameters.
param: {string}  $1.type                   The format type.
param: {Object}  $1.attributes             The format attributes.
param: {Object}  $1.unregisteredAttributes The unregistered format
param: {boolean} $1.object                 Whether or not it is an object
param: {boolean} $1.boundaryClass          Whether or not to apply a boundary
param: {boolean} $1.isEditableTree

isEqualUntil(a, b, index)   X-Ref
Checks if both arrays of formats up until a certain index are equal.

param: {Array}  a     Array of formats to compare.
param: {Array}  b     Array of formats to compare.
param: {number} index Index to check until.

toTree(_ref2)   X-Ref
No description

createPathToNode(node, rootNode, path)   X-Ref
Creates a path as an array of indices from the given root node to the given
node.

return: {Array} The path from the root node to the node.
param: {Node}        node     Node to find the path of.
param: {HTMLElement} rootNode Root node to find the path from.
param: {Array}       path     Initial path to build on.

getNodeByPath(node, path)   X-Ref
Gets a node given a path (array of indices) from the given node.

return: {Object} Object with the found node and the remaining offset (if any).
param: {HTMLElement} node Root node to find the wanted node in.
param: {Array}       path Path (indices) to the wanted node.

append(element, child)   X-Ref
No description

appendText(node, text)   X-Ref
No description

getLastChild(_ref)   X-Ref
No description

getParent(_ref2)   X-Ref
No description

isText(node)   X-Ref
No description

getText(_ref3)   X-Ref
No description

to_dom_remove(node)   X-Ref
No description

toDom(_ref4)   X-Ref
No description

apply(_ref5)   X-Ref
Create an `Element` tree from a Rich Text value and applies the difference to
the `Element` tree contained by `current`. If a `multilineTag` is provided,
text separated by two new lines will be wrapped in an `Element` of that type.

param: {Object}        $1                       Named arguments.
param: {RichTextValue} $1.value                 Value to apply.
param: {HTMLElement}   $1.current               The live root node to apply the element tree to.
param: {string}        [$1.multilineTag]        Multiline tag.
param: {Function}      [$1.prepareEditableTree] Function to filter editorable formats.
param: {boolean}       [$1.__unstableDomOnly]   Only apply elements, no selection.
param: {string}        [$1.placeholder]         Placeholder text.

applyValue(future, current)   X-Ref
No description

isRangeEqual(a, b)   X-Ref
Returns true if two ranges are equal, or false otherwise. Ranges are
considered equal if their start and end occur in the same container and
offset.

return: {boolean} Whether the two ranges are equal.
param: {Range} a First range object to test.
param: {Range} b First range object to test.

applySelection(_ref6, current)   X-Ref
No description

toHTMLString(_ref)   X-Ref
Create an HTML string from a Rich Text value. If a `multilineTag` is
provided, text separated by a line separator will be wrapped in it.

return: {string} HTML string.
param: {Object}        $1                      Named argements.
param: {RichTextValue} $1.value                Rich text value.
param: {string}        [$1.multilineTag]       Multiline tag.
param: {boolean}       [$1.preserveWhiteSpace] Whether or not to use newline

createEmpty()   X-Ref
No description

to_html_string_getLastChild(_ref2)   X-Ref
No description

to_html_string_append(parent, object)   X-Ref
No description

to_html_string_appendText(object, text)   X-Ref
No description

to_html_string_getParent(_ref3)   X-Ref
No description

to_html_string_isText(_ref4)   X-Ref
No description

to_html_string_getText(_ref5)   X-Ref
No description

to_html_string_remove(object)   X-Ref
No description

createElementHTML(_ref6)   X-Ref
No description

createChildrenHTML()   X-Ref
No description

toggleFormat(value, format)   X-Ref
Toggles a format object to a Rich Text value at the current selection.

return: {RichTextValue} A new value with the format applied or removed.
param: {RichTextValue}  value  Value to modify.
param: {RichTextFormat} format Format to apply or remove.

unregisterFormatType(name)   X-Ref
Unregisters a format.

return: {RichTextFormatType|undefined} The previous format value, if it has
param: {string} name Format name.

canIndentListItems(value)   X-Ref
Checks if the selected list item can be indented.

return: {boolean} Whether or not the selected list item can be indented.
param: {RichTextValue} value Value to check.

canOutdentListItems(value)   X-Ref
Checks if the selected list item can be outdented.

return: {boolean} Whether or not the selected list item can be outdented.
param: {RichTextValue} value Value to check.

getTargetLevelLineIndex(_ref, lineIndex)   X-Ref
Gets the line index of the first previous list item with higher indentation.

return: {number|void} The line index.
param: {RichTextValue} value     Value to search.
param: {number}        lineIndex Line index of the list item to compare

indentListItems(value, rootFormat)   X-Ref
Indents any selected list items if possible.

return: {RichTextValue} The changed value.
param: {RichTextValue}  value      Value to change.
param: {RichTextFormat} rootFormat Root format.

getParentLineIndex(_ref, lineIndex)   X-Ref
Gets the index of the first parent list. To get the parent list formats, we
go through every list item until we find one with exactly one format type
less.

return: {number|void} The parent list line index.
param: {RichTextValue} value     Value to search.
param: {number}        lineIndex Line index of a child list item.

getLastChildIndex(_ref, lineIndex)   X-Ref
Gets the line index of the last child in the list.

return: {number} The index of the last child.
param: {RichTextValue} value     Value to search.
param: {number}        lineIndex Line index of a list item in the list.

outdentListItems(value)   X-Ref
Outdents any selected list items if possible.

return: {RichTextValue} The changed value.
param: {RichTextValue} value Value to change.

changeListType(value, newFormat)   X-Ref
Changes the list type of the selected indented list, if any. Looks at the
currently selected list item and takes the parent list, then changes the list
type of this list. When multiple lines are selected, the parent lists are
takes and changed.

return: {RichTextValue} The changed value.
param: {RichTextValue}  value     Value to change.
param: {RichTextFormat} newFormat The new list format object. Choose between

useAnchorRef(_ref)   X-Ref
This hook, to be used in a format type's Edit component, returns the active
element that is formatted, or the selection range if no format is active.
The returned value is meant to be used for positioning UI, e.g. by passing it
to the `Popover` component.

return: {Element|Range} The active element or selection range.
param: {Object}                 $1          Named parameters.
param: {RefObject<HTMLElement>} $1.ref      React ref of the element
param: {RichTextValue}          $1.value    Value to check for selection.
param: {RichTextFormatType}     $1.settings The format type's settings.

useDefaultStyle()   X-Ref
A minimum width of 1px will prevent the rich text container from collapsing
to 0 width and hiding the caret. This is useful for inline containers.


useBoundaryStyle(_ref)   X-Ref
No description

useCopyHandler(props)   X-Ref
No description

onCopy(event)   X-Ref
No description

useFormatBoundaries(props)   X-Ref
No description

onKeyDown(event)   X-Ref
No description

useSelectObject()   X-Ref
WordPress dependencies


onClick(event)   X-Ref
No description

useIndentListItemOnSpace(props)   X-Ref
No description

onKeyDown(event)   X-Ref
No description

updateFormats(_ref)   X-Ref
Efficiently updates all the formats from `start` (including) until `end`
(excluding) with the active formats. Mutates `value`.

return: {RichTextValue} Mutated value.
param: {Object}        $1         Named paramentes.
param: {RichTextValue} $1.value   Value te update.
param: {number}        $1.start   Index to update from.
param: {number}        $1.end     Index to update until.
param: {Array}         $1.formats Replacement formats.

fixPlaceholderSelection(defaultView)   X-Ref
If the selection is set on the placeholder element, collapse the selection to
the start (before the placeholder).

param: {Window} defaultView

useInputAndSelection(props)   X-Ref
No description

onInput(event)   X-Ref
No description

handleSelectionChange(event)   X-Ref
Syncs the selection to local state. A callback for the `selectionchange`
native events, `keyup`, `mouseup` and `touchend` synthetic events, and
animation frames after the `focus` event.

param: {Event|DOMHighResTimeStamp} event

onCompositionStart()   X-Ref
No description

onCompositionEnd()   X-Ref
No description

onFocus()   X-Ref
No description

useDelete(props)   X-Ref
No description

onKeyDown(event)   X-Ref
No description

useSpace()   X-Ref
For some elements like BUTTON and SUMMARY, the space key doesn't insert a
space character in some browsers even though the element is editable. We have
to manually insert a space and prevent default behaviour.

DO NOT limit this behaviour to specific tag names! It would mean that this
behaviour is not widely tested. If there's ever any problems, we should find
a different solution entirely or remove it entirely.

onKeyDown(event)   X-Ref
No description

useRichText(_ref)   X-Ref
No description

createRecord()   X-Ref
No description

applyRecord(newRecord)   X-Ref
No description

setRecordFromProps()   X-Ref
No description

handleChange(newRecord)   X-Ref
Sync the value to global state. The node tree and selection will also be
updated if differences are found.

param: {Object} newRecord The record to sync and apply.

handleChangesUponInit(newRecord)   X-Ref
No description

applyFromProps()   X-Ref
No description

__experimentalRichText()   X-Ref
No description

FormatEdit(_ref)   X-Ref
Internal dependencies




Generated: Fri Apr 26 01:00:03 2024 Cross-referenced by PHPXref 0.7.1