mirror of
https://github.com/facebook/lexical.git
synced 2025-08-14 09:42:23 +08:00
[Breaking Change] Chore: Improve spelling consistency across codebase (#7437)
This commit is contained in:
@ -38,7 +38,7 @@ const initialConfig = {
|
||||
const editor = createEditor(initialConfig);
|
||||
editor.setRootElement(editorRef);
|
||||
|
||||
// Registring Plugins
|
||||
// Registering Plugins
|
||||
mergeRegister(
|
||||
registerRichText(editor),
|
||||
registerDragonSupport(editor),
|
||||
|
@ -45,7 +45,7 @@ const initialConfig = {
|
||||
const editor = createEditor(initialConfig);
|
||||
editor.setRootElement(editorRef);
|
||||
|
||||
// Registring Plugins
|
||||
// Registering Plugins
|
||||
mergeRegister(
|
||||
registerRichText(editor),
|
||||
registerDragonSupport(editor),
|
||||
|
@ -369,7 +369,7 @@ export function $generateJSONFromSelectedNodes<
|
||||
}
|
||||
|
||||
/**
|
||||
* This method takes an array of objects conforming to the BaseSeralizedNode interface and returns
|
||||
* This method takes an array of objects conforming to the BaseSerializedNode interface and returns
|
||||
* an Array containing instances of the corresponding LexicalNode classes registered on the editor.
|
||||
* Normally, you'd get an Array of BaseSerialized nodes from {@link $generateJSONFromSelectedNodes}
|
||||
*
|
||||
|
@ -269,7 +269,7 @@ function codeNodeTransform(
|
||||
}
|
||||
|
||||
// Using nested update call to pass `skipTransforms` since we don't want
|
||||
// each individual codehighlight node to be transformed again as it's already
|
||||
// each individual CodeHighlightNode to be transformed again as it's already
|
||||
// in its final state
|
||||
editor.update(
|
||||
() => {
|
||||
@ -456,7 +456,7 @@ function getDiffRange(
|
||||
}
|
||||
|
||||
function isEqual(nodeA: LexicalNode, nodeB: LexicalNode): boolean {
|
||||
// Only checking for code higlight nodes, tabs and linebreaks. If it's regular text node
|
||||
// Only checking for code highlight nodes, tabs and linebreaks. If it's regular text node
|
||||
// returning false so that it's transformed into code highlight node
|
||||
return (
|
||||
($isCodeHighlightNode(nodeA) &&
|
||||
@ -650,7 +650,7 @@ function $handleShiftLines(
|
||||
}
|
||||
if (!event.altKey) {
|
||||
// Handle moving selection out of the code block, given there are no
|
||||
// sibling thats can natively take the selection.
|
||||
// siblings that can natively take the selection.
|
||||
if (selection.isCollapsed()) {
|
||||
const codeNode = anchorNode.getParentOrThrow();
|
||||
if (
|
||||
|
@ -109,7 +109,7 @@ describe('LexicalCodeNode tests', () => {
|
||||
// If you broke this test, you changed the public interface of a
|
||||
// serialized Lexical Core Node. Please ensure the correct adapter
|
||||
// logic is in place in the corresponding importJSON method
|
||||
// to accomodate these changes.import { moveSelectionPointToSibling } from '../../../../lexical/src/LexicalSelection';
|
||||
// to accommodate these changes.import { moveSelectionPointToSibling } from '../../../../lexical/src/LexicalSelection';
|
||||
|
||||
expect(node.exportJSON()).toStrictEqual({
|
||||
children: [],
|
||||
|
@ -18,7 +18,7 @@ describe('LexicalHashtagNode tests', () => {
|
||||
// If you broke this test, you changed the public interface of a
|
||||
// serialized Lexical Core Node. Please ensure the correct adapter
|
||||
// logic is in place in the corresponding importJSON method
|
||||
// to accomodate these changes.
|
||||
// to accommodate these changes.
|
||||
expect(node.exportJSON()).toStrictEqual({
|
||||
detail: 0,
|
||||
format: 0,
|
||||
|
@ -59,7 +59,7 @@ export function $generateNodesFromDOM(
|
||||
}
|
||||
}
|
||||
}
|
||||
$unwrapArtificalNodes(allArtificialNodes);
|
||||
$unwrapArtificialNodes(allArtificialNodes);
|
||||
|
||||
return lexicalNodes;
|
||||
}
|
||||
@ -355,7 +355,7 @@ function wrapContinuousInlines(
|
||||
return out;
|
||||
}
|
||||
|
||||
function $unwrapArtificalNodes(
|
||||
function $unwrapArtificialNodes(
|
||||
allArtificialNodes: Array<ArtificialNode__DO_NOT_USE>,
|
||||
) {
|
||||
for (const node of allArtificialNodes) {
|
||||
|
@ -488,7 +488,7 @@ export function $handleOutdent(listItemNode: ListItemNode): void {
|
||||
* (which should be the parent node) and insert the ParagraphNode as a sibling to the ListNode. If the ListNode is
|
||||
* nested in a ListItemNode instead, it will add the ParagraphNode after the grandparent ListItemNode.
|
||||
* Throws an invariant if the selection is not a child of a ListNode.
|
||||
* @returns true if a ParagraphNode was inserted succesfully, false if there is no selection
|
||||
* @returns true if a ParagraphNode was inserted successfully, false if there is no selection
|
||||
* or the selection does not contain a ListItemNode or the node already holds text.
|
||||
*/
|
||||
export function $handleListInsertParagraph(): boolean {
|
||||
|
@ -78,7 +78,7 @@ export function $wrapSelectionInMarkNode(
|
||||
} else if ($isMarkNode(node)) {
|
||||
// Case 2: the node is a mark node and we can ignore it as a target,
|
||||
// moving on to its children. Note that when we make a mark inside
|
||||
// another mark, it may utlimately be unnested by a call to
|
||||
// another mark, it may ultimately be unnested by a call to
|
||||
// `registerNestedElementResolver<MarkNode>` somewhere else in the
|
||||
// codebase.
|
||||
continue;
|
||||
|
@ -236,7 +236,7 @@ function exportTextFormat(
|
||||
// Multiple tags might be used for the same format (*, _)
|
||||
applied.add(format);
|
||||
|
||||
// append the tag to openningTags, if it's not applied to the previous nodes,
|
||||
// append the tag to openingTags, if it's not applied to the previous nodes,
|
||||
// or the nodes before that (which would result in an unclosed tag)
|
||||
if (
|
||||
!hasFormat(prevNode, format) ||
|
||||
|
@ -585,12 +585,12 @@ describe('Markdown', () => {
|
||||
md: 'This is an asterisk: \\*',
|
||||
},
|
||||
{
|
||||
html: '<p><span style="white-space: pre-wrap;">Backtick and asteriks: `**`</span></p>',
|
||||
md: 'Backtick and asteriks: \\`\\*\\*\\`',
|
||||
html: '<p><span style="white-space: pre-wrap;">Backtick and asterisk: `**`</span></p>',
|
||||
md: 'Backtick and asterisk: \\`\\*\\*\\`',
|
||||
},
|
||||
{
|
||||
html: '<p><b><strong style="white-space: pre-wrap;">Backtick and asteriks: `**`</strong></b></p>',
|
||||
md: '**Backtick and asteriks: \\`\\*\\*\\`**',
|
||||
html: '<p><b><strong style="white-space: pre-wrap;">Backtick and asterisk: `**`</strong></b></p>',
|
||||
md: '**Backtick and asterisk: \\`\\*\\*\\`**',
|
||||
},
|
||||
{
|
||||
html: '<p><b><strong style="white-space: pre-wrap;">*test*</strong></b></p>',
|
||||
|
@ -39,7 +39,7 @@ test.describe('HTML CopyAndPaste', () => {
|
||||
await expect(paragraphs).toHaveCount(4);
|
||||
|
||||
// Explicitly checking inner text, since regular assertHTML will prettify it and strip all
|
||||
// extra newlines, which makes this test less acurate
|
||||
// extra newlines, which makes this test less accurate
|
||||
await expect(paragraphs.nth(0)).toHaveText('Hello', {useInnerText: true});
|
||||
await expect(paragraphs.nth(1)).toHaveText('World', {useInnerText: true});
|
||||
await expect(paragraphs.nth(2)).toHaveText('Hello World !', {
|
||||
|
@ -249,7 +249,7 @@ test.describe.parallel('Nested List', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test(`Can indent/outdent mutliple list nodes in a list with multiple levels of indentation`, async ({
|
||||
test(`Can indent/outdent multiple list nodes in a list with multiple levels of indentation`, async ({
|
||||
page,
|
||||
}) => {
|
||||
await focusEditor(page);
|
||||
@ -1009,7 +1009,7 @@ test.describe.parallel('Nested List', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test(`Can create mutliple bullet lists and then toggle off the list.`, async ({
|
||||
test(`Can create multiple bullet lists and then toggle off the list.`, async ({
|
||||
page,
|
||||
}) => {
|
||||
await focusEditor(page);
|
||||
|
@ -905,7 +905,7 @@ test.describe.parallel('Selection', () => {
|
||||
},
|
||||
);
|
||||
|
||||
test('Can adjust tripple click selection', async ({
|
||||
test('Can adjust triple click selection', async ({
|
||||
page,
|
||||
isPlainText,
|
||||
isCollab,
|
||||
@ -940,7 +940,7 @@ test.describe.parallel('Selection', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('Can adjust tripple click selection with', async ({
|
||||
test('Can adjust triple click selection with', async ({
|
||||
page,
|
||||
isPlainText,
|
||||
isCollab,
|
||||
|
@ -53,7 +53,7 @@ test.describe('Grapheme deleteCharacter', () => {
|
||||
// Unclear why Firefox behaves differently here
|
||||
firefoxCaretDistance: 2,
|
||||
|
||||
// Devangari 'kshi' tailored grapheme cluster.
|
||||
// Devanagari 'kshi' tailored grapheme cluster.
|
||||
// http://unicode.org/reports/tr29/#Table_Sample_Grapheme_Clusters
|
||||
grapheme: '\u0915\u094D\u0937\u093F',
|
||||
},
|
||||
|
@ -29,7 +29,7 @@ import {INSERT_TWEET_COMMAND} from '../TwitterPlugin';
|
||||
import {INSERT_YOUTUBE_COMMAND} from '../YouTubePlugin';
|
||||
|
||||
interface PlaygroundEmbedConfig extends EmbedConfig {
|
||||
// Human readable name of the embeded content e.g. Tweet or Google Map.
|
||||
// Human readable name of the embedded content e.g. Tweet or Google Map.
|
||||
contentName: string;
|
||||
|
||||
// Icon for display.
|
||||
|
@ -53,14 +53,14 @@ export function CheckListPlugin(): null {
|
||||
editor.registerCommand<KeyboardEvent>(
|
||||
KEY_ARROW_DOWN_COMMAND,
|
||||
(event) => {
|
||||
return handleArrownUpOrDown(event, editor, false);
|
||||
return handleArrowUpOrDown(event, editor, false);
|
||||
},
|
||||
COMMAND_PRIORITY_LOW,
|
||||
),
|
||||
editor.registerCommand<KeyboardEvent>(
|
||||
KEY_ARROW_UP_COMMAND,
|
||||
(event) => {
|
||||
return handleArrownUpOrDown(event, editor, true);
|
||||
return handleArrowUpOrDown(event, editor, true);
|
||||
},
|
||||
COMMAND_PRIORITY_LOW,
|
||||
),
|
||||
@ -271,7 +271,7 @@ function findCheckListItemSibling(
|
||||
return null;
|
||||
}
|
||||
|
||||
function handleArrownUpOrDown(
|
||||
function handleArrowUpOrDown(
|
||||
event: KeyboardEvent,
|
||||
editor: LexicalEditor,
|
||||
backward: boolean,
|
||||
|
@ -82,7 +82,7 @@ export function ClickableLinkPlugin({
|
||||
return;
|
||||
}
|
||||
|
||||
// Allow user to select link text without follwing url
|
||||
// Allow user to select link text without following url
|
||||
const selection = editor.getEditorState().read($getSelection);
|
||||
if ($isRangeSelection(selection) && !selection.isCollapsed()) {
|
||||
event.preventDefault();
|
||||
|
@ -72,7 +72,7 @@ export function CollaborationPlugin({
|
||||
collabContext.isCollabActive = true;
|
||||
|
||||
return () => {
|
||||
// Reseting flag only when unmount top level editor collab plugin. Nested
|
||||
// Resetting flag only when unmount top level editor collab plugin. Nested
|
||||
// editors (e.g. image caption) should unmount without affecting it
|
||||
if (editor._parentEditor == null) {
|
||||
collabContext.isCollabActive = false;
|
||||
|
@ -112,7 +112,7 @@ export function registerTabIndentation(
|
||||
|
||||
/**
|
||||
* This plugin adds the ability to indent content using the tab key. Generally, we don't
|
||||
* recommend using this plugin as it could negatively affect acessibility for keyboard
|
||||
* recommend using this plugin as it could negatively affect accessibility for keyboard
|
||||
* users, causing focus to become trapped within the editor.
|
||||
*/
|
||||
export function TabIndentationPlugin({maxIndent}: {maxIndent?: number}): null {
|
||||
|
@ -133,7 +133,7 @@ export function useYjsCollaboration(
|
||||
provider.on('status', onStatus);
|
||||
provider.on('sync', onSync);
|
||||
awareness.on('update', onAwarenessUpdate);
|
||||
// This updates the local editor state when we recieve updates from other clients
|
||||
// This updates the local editor state when we receive updates from other clients
|
||||
root.getSharedType().observeDeep(onYjsTreeChanges);
|
||||
const removeListener = editor.registerUpdateListener(
|
||||
({
|
||||
|
@ -324,7 +324,7 @@ export class TableObserver {
|
||||
// set one then the reconciler will undo it.
|
||||
// TODO - it would make sense to have one so that native
|
||||
// copy/paste worked. Right now we have to emulate with
|
||||
// keyboard events but it won't fire if trigged from the menu
|
||||
// keyboard events but it won't fire if triggered from the menu
|
||||
if (domSelection && domSelection.rangeCount > 0) {
|
||||
domSelection.removeAllRanges();
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ export function $isTableSelection(x: unknown): x is TableSelection {
|
||||
export function $createTableSelection(): TableSelection {
|
||||
// TODO this is a suboptimal design, it doesn't make sense to have
|
||||
// a table selection that isn't associated with a table. This
|
||||
// constructor should have required argumnets and in __DEV__ we
|
||||
// constructor should have required arguments and in __DEV__ we
|
||||
// should check that they point to a table and are element points to
|
||||
// cell nodes of that table.
|
||||
const anchor = $createPoint('root', 0, 'element');
|
||||
|
@ -195,7 +195,7 @@ export function applyTableHandlers(
|
||||
const tableElement = getTableElement(tableNode, element);
|
||||
attachTableObserverToTableElement(tableElement, tableObserver);
|
||||
tableObserver.listenersToRemove.add(() =>
|
||||
detatchTableObserverFromTableElement(tableElement, tableObserver),
|
||||
detachTableObserverFromTableElement(tableElement, tableObserver),
|
||||
);
|
||||
|
||||
const createPointerHandlers = () => {
|
||||
@ -1238,7 +1238,7 @@ export type HTMLTableElementWithWithTableSelectionState = HTMLTableElement & {
|
||||
[LEXICAL_ELEMENT_KEY]?: TableObserver | undefined;
|
||||
};
|
||||
|
||||
export function detatchTableObserverFromTableElement(
|
||||
export function detachTableObserverFromTableElement(
|
||||
tableElement: HTMLTableElementWithWithTableSelectionState,
|
||||
tableObserver: TableObserver,
|
||||
) {
|
||||
|
@ -646,7 +646,7 @@ export type ObjectKlass<T> = new (...args: any[]) => T;
|
||||
/**
|
||||
* @param object = The instance of the type
|
||||
* @param objectClass = The class of the type
|
||||
* @returns Whether the object is has the same Klass of the objectClass, ignoring the difference across window (e.g. different iframs)
|
||||
* @returns Whether the object is has the same Klass of the objectClass, ignoring the difference across window (e.g. different iframes)
|
||||
*/
|
||||
export function objectKlassEquals<T>(
|
||||
object: unknown,
|
||||
|
@ -25,7 +25,7 @@ type Func = () => void;
|
||||
* In this case, useEffect is returning the function returned by mergeRegister as a cleanup
|
||||
* function to be executed after either the useEffect runs again (due to one of its dependencies
|
||||
* updating) or the component it resides in unmounts.
|
||||
* Note the functions don't neccesarily need to be in an array as all arguments
|
||||
* Note the functions don't necessarily need to be in an array as all arguments
|
||||
* are considered to be the func argument and spread from there.
|
||||
* The order of cleanup is the reverse of the argument order. Generally it is
|
||||
* expected that the first "acquire" will be "released" last (LIFO order),
|
||||
|
@ -69,7 +69,7 @@ function HeadingText({filteredPlugins}: {filteredPlugins: Array<Example>}) {
|
||||
<Heading as="h2">Filters</Heading>
|
||||
<span>
|
||||
{filteredPlugins.length === 1
|
||||
? '1 exampe'
|
||||
? '1 example'
|
||||
: `${filteredPlugins.length} examples`}
|
||||
</span>
|
||||
</div>
|
||||
|
@ -234,7 +234,7 @@ function updateCursor(
|
||||
|
||||
// In the case of a collapsed selection on a linebreak, we need
|
||||
// to improvise as the browser will return nothing here as <br>
|
||||
// apparantly take up no visual space :/
|
||||
// apparently take up no visual space :/
|
||||
// This won't work in all cases, but it's better than just showing
|
||||
// nothing all the time.
|
||||
if (anchorNode === focusNode && $isLineBreakNode(anchorNode)) {
|
||||
|
@ -1327,7 +1327,7 @@ export class LexicalEditor {
|
||||
});
|
||||
});
|
||||
// In the case where onUpdate doesn't fire (due to the focus update not
|
||||
// occuring).
|
||||
// occurring).
|
||||
if (this._pendingEditorState === null) {
|
||||
rootElement.removeAttribute('autocapitalize');
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ export class LexicalNode {
|
||||
/**
|
||||
* Returns true if there is a path between this node and the RootNode, false otherwise.
|
||||
* This is a way of determining if the node is "attached" EditorState. Unattached nodes
|
||||
* won't be reconciled and will ultimatelt be cleaned up by the Lexical GC.
|
||||
* won't be reconciled and will ultimately be cleaned up by the Lexical GC.
|
||||
*/
|
||||
isAttached(): boolean {
|
||||
let nodeKey: string | null = this.__key;
|
||||
@ -822,7 +822,7 @@ export class LexicalNode {
|
||||
*
|
||||
* This method must return exactly one HTMLElement. Nested elements are not supported.
|
||||
*
|
||||
* Do not attempt to update the Lexical EditorState during this phase of the update lifecyle.
|
||||
* Do not attempt to update the Lexical EditorState during this phase of the update lifecycle.
|
||||
*
|
||||
* @param _config - allows access to things like the EditorTheme (to apply classes) during reconciliation.
|
||||
* @param _editor - allows access to the editor for context during reconciliation.
|
||||
|
@ -143,8 +143,8 @@ export interface StateValueConfig<V> {
|
||||
* that it is not required to copy or clone the given value, you can
|
||||
* pass it directly through if it matches the expected type.
|
||||
*
|
||||
* When you encounder an invalid value, it's up to you to decide
|
||||
* as to whether to ignore it and return the defaut value,
|
||||
* When you encounter an invalid value, it's up to you to decide
|
||||
* as to whether to ignore it and return the default value,
|
||||
* return some non-default error value, or throw an error.
|
||||
*
|
||||
* It is possible for V to include undefined, but if it does, then
|
||||
@ -493,7 +493,7 @@ export class NodeState<T extends LexicalNode> {
|
||||
* its parent or siblings change).
|
||||
*
|
||||
* @param node The node to associate with the state
|
||||
* @returns The next writaable state
|
||||
* @returns The next writable state
|
||||
*/
|
||||
getWritable(node: T): NodeState<T> {
|
||||
if (this.node === node) {
|
||||
|
@ -488,7 +488,7 @@ export class RangeSelection implements BaseSelection {
|
||||
|
||||
/**
|
||||
* Used to check if the provided selections is equal to this one by value,
|
||||
* inluding anchor, focus, format, and style properties.
|
||||
* including anchor, focus, format, and style properties.
|
||||
* @param selection - the Selection to compare this one to.
|
||||
* @returns true if the Selections are equal, false otherwise.
|
||||
*/
|
||||
|
@ -1965,7 +1965,7 @@ export function $cloneWithProperties<T extends LexicalNode>(latestNode: T): T {
|
||||
mutableNode.__parent === latestNode.__parent &&
|
||||
mutableNode.__next === latestNode.__next &&
|
||||
mutableNode.__prev === latestNode.__prev,
|
||||
"$cloneWithProperties: %s.clone(node) (with type '%s') overrided afterCloneFrom but did not call super.afterCloneFrom(prevNode)",
|
||||
"$cloneWithProperties: %s.clone(node) (with type '%s') overrode afterCloneFrom but did not call super.afterCloneFrom(prevNode)",
|
||||
constructor.name,
|
||||
constructor.getType(),
|
||||
);
|
||||
|
@ -3077,7 +3077,7 @@ describe('LexicalEditor tests', () => {
|
||||
});
|
||||
|
||||
// Cause reconciler error in update dom, so that it attempts to fallback by
|
||||
// reseting editor and rerendering whole content
|
||||
// resetting editor and rerendering whole content
|
||||
jest.spyOn(ParagraphNode.prototype, 'updateDOM').mockImplementation(() => {
|
||||
throw updateError;
|
||||
});
|
||||
|
@ -112,7 +112,7 @@ export interface CaretRange<D extends CaretDirection = CaretDirection>
|
||||
/**
|
||||
* There are between zero and two non-null TextSliceCarets for a CaretRange.
|
||||
* Note that when anchor and focus share an origin node the second element
|
||||
* will be null becaues the slice is entirely represented by the first element.
|
||||
* will be null because the slice is entirely represented by the first element.
|
||||
*
|
||||
* `[slice, slice]`: anchor and focus are TextPointCaret with distinct origin nodes
|
||||
* `[slice, null]`: anchor is a TextPointCaret
|
||||
@ -190,8 +190,8 @@ export interface SiblingCaret<
|
||||
*/
|
||||
getParentCaret: (mode?: RootMode) => null | SiblingCaret<ElementNode, D>;
|
||||
/**
|
||||
* Retun true if other is a SiblingCaret or TextPointCaret with the same
|
||||
* origin (by node key comparion) and direction.
|
||||
* Return true if other is a SiblingCaret or TextPointCaret with the same
|
||||
* origin (by node key comparison) and direction.
|
||||
*/
|
||||
isSameNodeCaret: (
|
||||
other: null | undefined | PointCaret,
|
||||
@ -199,8 +199,8 @@ export interface SiblingCaret<
|
||||
? TextPointCaret<T & TextNode, D>
|
||||
: never;
|
||||
/**
|
||||
* Retun true if other is a SiblingCaret with the same
|
||||
* origin (by node key comparion) and direction.
|
||||
* Return true if other is a SiblingCaret with the same
|
||||
* origin (by node key comparison) and direction.
|
||||
*/
|
||||
isSamePointCaret: (
|
||||
other: null | undefined | PointCaret,
|
||||
@ -235,15 +235,15 @@ export interface ChildCaret<
|
||||
/** Return this, the ChildCaret is already a child caret of its origin */
|
||||
getChildCaret: () => this;
|
||||
/**
|
||||
* Retun true if other is a ChildCaret with the same
|
||||
* origin (by node key comparion) and direction.
|
||||
* Return true if other is a ChildCaret with the same
|
||||
* origin (by node key comparison) and direction.
|
||||
*/
|
||||
isSameNodeCaret: (
|
||||
other: null | undefined | PointCaret,
|
||||
) => other is ChildCaret<T, D>;
|
||||
/**
|
||||
* Retun true if other is a ChildCaret with the same
|
||||
* origin (by node key comparion) and direction.
|
||||
* Return true if other is a ChildCaret with the same
|
||||
* origin (by node key comparison) and direction.
|
||||
*/
|
||||
isSamePointCaret: (
|
||||
other: null | undefined | PointCaret,
|
||||
@ -297,15 +297,15 @@ export interface TextPointCaret<
|
||||
*/
|
||||
getParentCaret: (mode?: RootMode) => null | SiblingCaret<ElementNode, D>;
|
||||
/**
|
||||
* Retun true if other is a TextPointCaret or SiblingCaret with the same
|
||||
* origin (by node key comparion) and direction.
|
||||
* Return true if other is a TextPointCaret or SiblingCaret with the same
|
||||
* origin (by node key comparison) and direction.
|
||||
*/
|
||||
isSameNodeCaret: (
|
||||
other: null | undefined | PointCaret,
|
||||
) => other is TextPointCaret<T, D> | SiblingCaret<T, D>;
|
||||
/**
|
||||
* Retun true if other is a ChildCaret with the same
|
||||
* origin (by node key comparion) and direction.
|
||||
* Return true if other is a ChildCaret with the same
|
||||
* origin (by node key comparison) and direction.
|
||||
*/
|
||||
isSamePointCaret: (
|
||||
other: null | undefined | PointCaret,
|
||||
|
@ -926,7 +926,7 @@ export class ElementNode extends LexicalNode {
|
||||
return false;
|
||||
}
|
||||
// A shadow root is a Node that behaves like RootNode. The shadow root (and RootNode) mark the
|
||||
// end of the hiercharchy, most implementations should treat it as there's nothing (upwards)
|
||||
// end of the hierarchy, most implementations should treat it as there's nothing (upwards)
|
||||
// beyond this point. For example, node.getTopLevelElement(), when performed inside a TableCellNode
|
||||
// will return the immediate first child underneath TableCellNode instead of RootNode.
|
||||
isShadowRoot(): boolean {
|
||||
|
@ -113,7 +113,7 @@ function isOnlyChildInBlockNode(node: Node): boolean {
|
||||
function isLastChildInBlockNode(node: Node): boolean {
|
||||
const parentElement = node.parentElement;
|
||||
if (parentElement !== null && isBlockDomNode(parentElement)) {
|
||||
// check if node is first child, because only childs dont count
|
||||
// check if node is first child, because only child dont count
|
||||
const firstChild = parentElement.firstChild!;
|
||||
if (
|
||||
firstChild === node ||
|
||||
|
@ -373,7 +373,7 @@ export class TextNode extends LexicalNode {
|
||||
|
||||
/**
|
||||
* Returns whether or not the node is in "token" mode. TextNodes in token mode can be navigated through character-by-character
|
||||
* with a RangeSelection, but are deleted as a single entity (not invdividually by character).
|
||||
* with a RangeSelection, but are deleted as a single entity (not individually by character).
|
||||
*
|
||||
* @returns true if the node is in token mode, false otherwise.
|
||||
*/
|
||||
@ -392,7 +392,7 @@ export class TextNode extends LexicalNode {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not the node is in "segemented" mode. TextNodes in segemented mode can be navigated through character-by-character
|
||||
* Returns whether or not the node is in "segmented" mode. TextNodes in segmented mode can be navigated through character-by-character
|
||||
* with a RangeSelection, but are deleted in space-delimited "segments".
|
||||
*
|
||||
* @returns true if the node is in segmented mode, false otherwise.
|
||||
@ -909,7 +909,7 @@ export class TextNode extends LexicalNode {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is meant to be overriden by TextNode subclasses to control the behavior of those nodes
|
||||
* This method is meant to be overridden by TextNode subclasses to control the behavior of those nodes
|
||||
* when a user event would cause text to be inserted before them in the editor. If true, Lexical will attempt
|
||||
* to insert text into this node. If false, it will insert the text in a new sibling node.
|
||||
*
|
||||
@ -920,7 +920,7 @@ export class TextNode extends LexicalNode {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is meant to be overriden by TextNode subclasses to control the behavior of those nodes
|
||||
* This method is meant to be overridden by TextNode subclasses to control the behavior of those nodes
|
||||
* when a user event would cause text to be inserted after them in the editor. If true, Lexical will attempt
|
||||
* to insert text into this node. If false, it will insert the text in a new sibling node.
|
||||
*
|
||||
@ -1151,7 +1151,7 @@ export class TextNode extends LexicalNode {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is meant to be overriden by TextNode subclasses to control the behavior of those nodes
|
||||
* This method is meant to be overridden by TextNode subclasses to control the behavior of those nodes
|
||||
* when used with the registerLexicalTextEntity function. If you're using registerLexicalTextEntity, the
|
||||
* node class that you create and replace matched text with should return true from this method.
|
||||
*
|
||||
@ -1251,7 +1251,7 @@ function $convertTextDOMNode(domNode: Node): DOMConversionOutput {
|
||||
return {node: null};
|
||||
}
|
||||
if (textContent[0] === ' ') {
|
||||
// Traverse backward while in the same line. If content contains new line or tab -> pontential
|
||||
// Traverse backward while in the same line. If content contains new line or tab -> potential
|
||||
// delete, other elements can borrow from this one. Deletion depends on whether it's also the
|
||||
// last space (see next condition: textContent[textContent.length - 1] === ' '))
|
||||
let previousText: null | Text = domNode_;
|
||||
|
@ -101,7 +101,7 @@ describe('LexicalElementNode tests', () => {
|
||||
// If you broke this test, you changed the public interface of a
|
||||
// serialized Lexical Core Node. Please ensure the correct adapter
|
||||
// logic is in place in the corresponding importJSON method
|
||||
// to accomodate these changes.
|
||||
// to accommodate these changes.
|
||||
|
||||
expect(node.exportJSON()).toStrictEqual({
|
||||
children: [],
|
||||
|
@ -32,7 +32,7 @@ describe('LexicalLineBreakNode tests', () => {
|
||||
// If you broke this test, you changed the public interface of a
|
||||
// serialized Lexical Core Node. Please ensure the correct adapter
|
||||
// logic is in place in the corresponding importJSON method
|
||||
// to accomodate these changes.
|
||||
// to accommodate these changes.
|
||||
expect(node.exportJSON()).toStrictEqual({
|
||||
type: 'linebreak',
|
||||
version: 1,
|
||||
|
@ -46,7 +46,7 @@ describe('LexicalParagraphNode tests', () => {
|
||||
// If you broke this test, you changed the public interface of a
|
||||
// serialized Lexical Core Node. Please ensure the correct adapter
|
||||
// logic is in place in the corresponding importJSON method
|
||||
// to accomodate these changes.
|
||||
// to accommodate these changes.
|
||||
expect(node.exportJSON()).toStrictEqual({
|
||||
children: [],
|
||||
direction: null,
|
||||
|
@ -73,7 +73,7 @@ describe('LexicalRootNode tests', () => {
|
||||
// If you broke this test, you changed the public interface of a
|
||||
// serialized Lexical Core Node. Please ensure the correct adapter
|
||||
// logic is in place in the corresponding importJSON method
|
||||
// to accomodate these changes.
|
||||
// to accommodate these changes.
|
||||
expect(node.exportJSON()).toStrictEqual({
|
||||
children: [],
|
||||
direction: null,
|
||||
|
@ -132,7 +132,7 @@ describe('LexicalTextNode tests', () => {
|
||||
// If you broke this test, you changed the public interface of a
|
||||
// serialized Lexical Core Node. Please ensure the correct adapter
|
||||
// logic is in place in the corresponding importJSON method
|
||||
// to accomodate these changes.
|
||||
// to accommodate these changes.
|
||||
|
||||
expect(node.exportJSON()).toStrictEqual({
|
||||
detail: 0,
|
||||
|
@ -45,7 +45,7 @@
|
||||
"43": "$mergeGridNodesStrategy: Expected selection to be inside of a Grid.",
|
||||
"44": "$getListItemValue: list node is not parent of list item node",
|
||||
"45": "Expected node %s to have a first child.",
|
||||
"46": "append: attemtping to append self",
|
||||
"46": "append: attempting to append self",
|
||||
"47": "decorate: base method not extended",
|
||||
"48": "updateDOM: prevInnerDOM is null or undefined",
|
||||
"49": "updateDOM: innerDOM is null or undefined",
|
||||
@ -196,7 +196,7 @@
|
||||
"194": "Children of root nodes must be elements or decorators",
|
||||
"195": "Unable to find an active editor state. State helpers or node methods can only be used synchronously during the callback of editor.update(), editor.read(), or editorState.read().%s",
|
||||
"196": "Unable to find an active editor. This method can only be used synchronously during the callback of editor.update() or editor.read().%s",
|
||||
"197": "$cloneWithProperties: %s.clone(node) (with type '%s') overrided afterCloneFrom but did not call super.afterCloneFrom(prevNode)",
|
||||
"197": "$cloneWithProperties: %s.clone(node) (with type '%s') overrode afterCloneFrom but did not call super.afterCloneFrom(prevNode)",
|
||||
"198": "Attempted to remove event handlers from a node that does not belong to this build of Lexical",
|
||||
"199": "Indent value must be non-negative.",
|
||||
"200": "$applyNodeReplacement node %s with type %s must be registered to the editor. You can do this by passing the node class via the \"nodes\" array in the editor config.",
|
||||
|
@ -172,7 +172,7 @@ function sortDependencies(packageJson, key, deps) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Update depdenencies and peerDependencies in pkg in-place.
|
||||
* Update dependencies and peerDependencies in pkg in-place.
|
||||
* All entries for monorepo packages will be updated to version.
|
||||
* All peerDependencies for monorepo packages will be moved to dependencies.
|
||||
*
|
||||
|
Reference in New Issue
Block a user