text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_suffix|> i < children.length; i++) { parent.insertBefore(children[i]); } parent.remove(); } }); } else { // Add or merge LinkNodes if (nodes.length === 1) { const firstNode = nodes[0]; // if the first node is a LinkNode or if its // parent is a Link...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import type {ListNode, ListType} from './LexicalListNode'; import type { BaseSelection, DOMConversionMap, ...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import { addClassNamesToElement, isHTMLElement, removeClassNamesFromElement, } from '@lexical/utils'; imp...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import { $createParagraphNode, $createRangeSelection, $getRoot, LexicalEditor, LexicalNode, ParagraphNode...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import {ParagraphNode, TextNode} from 'lexical'; import {createTestContext} from 'lexical/__tests__/utils'; imp...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|> |- ListNode // |- ListItemNode // |- ListNode // |- ListItemNode // |- ListNode const root = $getRoot(); ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|> const nextSiblingsListItem = $createListItemNode(); const nextSiblingsList = $createListNode(listType); nextSiblingsListItem.append(nextSiblingsList); append(nextSiblingsList, listItemNode.getNextSiblings()); // put the sibling nested lists on either side of the grandparent l...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import type {SerializedListItemNode} from './LexicalListItemNode'; import type {ListType, SerializedListNode} f...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|> null; } /** * Takes a deeply nested ListNode or ListItemNode and traverses up the branch to delete the first * ancestral ListNode (which could be the root ListNode) or ListItemNode with siblings, essentially * bringing the deeply nested node up the branch once. Would remove sublist if it has siblings...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import { $createParagraphNode, DOMConversion, DOMConversionMap, DOMConversionOutput, ElementNode, LexicalEditor, LexicalNode, ParagraphNode, Spread } from 'lexical'; import type {EditorConfig} from "lexical/LexicalEditor"; import type {RangeSelection} from "lexical/LexicalSelec...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import { DecoratorNode, DOMConversion, DOMConversionMap, DOMConversionOutput, DOMExportOutput, LexicalEditor, LexicalNode, SerializedLexicalNode, Spread } from "lexical"; import type {EditorConfig} from "lexical/LexicalEditor"; import {EditorDecoratorAdapter} from "../../ui/fra...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>Conversion|null { return { conversion: (element: HTMLElement): DOMConversionOutput|null => { return {node: 'ignore'}; }, priority: 3, }; }, }; } exportDOM(editor...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|> type: 'diagram', version: 1, id: this.__id, drawingId: this.__drawingId, drawingUrl: this.__drawingUrl, }; } static importJSON(serializedNode: SerializedDiagramNode): DiagramNode { const node = $createDiagramNode(seriali...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import { $applyNodeReplacement, $createParagraphNode, type DOMConversionMap, DOMConversionOutput, type DOMExportOutput, type EditorConfig, isHTMLElement, type LexicalEditor, type LexicalNode, type NodeKey, type ParagraphNode, type RangeSelection, type Sp...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import { DOMConversion, DOMConversionMap, DOMConversionOutput, ElementNode, LexicalEditor, LexicalNode, SerializedElementNode, Spread, } from 'lexical'; import type {EditorConfig} from "lexical/LexicalEditor"; export type SerializedHorizontalRuleNode = Spread<{ id: string; }, ...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import { DOMConversion, DOMConversionMap, DOMConversionOutput, ElementNode, LexicalEditor, LexicalNode, Spread } from "lexical"; import type {EditorConfig} from "lexical/LexicalEditor"; import {CommonBlockAlignment, extractAlignmentFromElement} from "lexical/nodes/common"; import {$sel...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import { DOMConversion, DOMConversionMap, DOMConversionOutput, DOMExportOutput, ElementNode, LexicalEditor, LexicalNode, Spread } from 'lexical'; import type {EditorConfig} from "lexical/LexicalEditor"; import {el, setOrRemoveAttribute, sizeToPixels, styleMapToStyleString, styleSt...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|> } // Mutation insertNewAfter(_: RangeSelection, restoreSelection?: boolean): ParagraphNode { const newBlock = $createParagraphNode(); const direction = this.getDirection(); newBlock.setDirection(direction); this.insertAfter(newBlock, restoreSelection); ...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import {createTestContext} from "lexical/__tests__/utils"; import {$createDetailsNode} from "@lexical/rich-text/LexicalDetailsNode"; const editorConfig = Object.freeze({ namespace: '', theme: { }, }); describe('LexicalDetailsNode tests', () => { test('createDOM()', () => { const ...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import {createTestContext} from "lexical/__tests__/utils"; import {$createDiagramNode, DiagramNode} from "@lexical/rich-text/LexicalDiagramNode"; import {$getHtmlContent} from "@lexical/clipboard"; import {getEditorContentAsHtml} fr<|fim_suffix|>tml(editor); expect(html).toBe(`<div id="cat-123" dr...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>const root = $getRoot(); headingNode = new HeadingNode('h2'); root.append(headingNode); const textNode = $createTextNode(text); headingNode.append(textNode); }); expect(testEnv.outerHTML).toBe( `<div contenteditable="true" style="user-select: text; white...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>ediaMode.setWidth(60); expect(mediaMode.getWidth()).toBe(60); expect(mediaMode.getAttributes().style).toBe('height:40px;color:red'); mediaMode.setAttributes(defaultStyles); mediaMode.setHeight(77); expect(mediaMode.getHeight()).toBe(77); ...
fim
BookStackApp/BookStack
typescript
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import {$createRangeSelection, $getRoot, ParagraphNode} from 'lexical'; import {initializeUnitTest} from 'lexical/__tests__/u...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>null) { const node = $getNearestNodeFromDOMNode(eventRange.node); if ($isDecoratorNode(node)) { // Show browser caret as the user is dragging the media across the screen. Won't work // for DecoratorNode nor it's relevant. event.preventDefault(); ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|> const paragraph4 = $createParagraphNode(); const text3 = $createTextNode(); const text4 = $createTextNode(); paragraph1.append(text3); paragraph2.append(text4); invariant($isElementNode(column1)); column1.append(paragraph3, paragraph4); const c...
fim
BookStackApp/BookStack
typescript
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import {$createLinkNode} from '@lexical/link'; import { $getSelectionStyleValueForProperty, $patchStyleText, } from '@lex...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import { $createTextNode, $getSelection, $isNodeSelection, $isRangeSelection, $isTextNode, LexicalE...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliate<|fim_suffix|> CSS_TO_STYLES: Map<string, Record<string, string>> = new Map(); <|fim_middle|>s. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ export const<|endof...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import { $addNodeStyle, $isAtNodeEnd, $patchStyleText, $slic<|fim_suffix|>tion, $wrapNodes, }; expor...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|> } remaining -= currentNodeSize + additionalElementWhitespace; currentNode = nextNode; } else { const key = currentNode.getKey(); // See if we can just revert it to what was in the last editor state const prevTextContent: string | null = editor .getEditorState() ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|> } return predicate(parent) ? parent : null; } <|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import type { BaseSelection, ElementNode, ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>tyle) { css += `${style}: ${styles[style]};`; } } return css; } <|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import type {Lexica...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import { $createTextNode, DOMConversionMap, EditorConfig, ElementNode, LexicalEditor, LexicalNode, SerializedElementNode } from "lexical"; import {TableNode} from "@lexical/table/LexicalTableNode"; export class CaptionNode extends ElementNode { static getType(): string { ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>ggleFormat('italic'); } if (hasUnderlineTextDecoration) { lexicalNode.toggleFormat('underline'); } } paragraphNode.append(lexicalNode); return paragraphNode; } return lexicalNode; }, node: tableCellNode, }; } export ...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tr<|fim_suffix|>oad = Readonly<{ columns: string; rows: string; includeHeaders?: InsertTableCommandPayloadHeaders; }>; ...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import type {TableCellNode} from './LexicalTableCellNode'; import { DOMConversionMap, DOMConversionOutput, ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>().forEach((child) => { if (child !== paragraphNode) { child.remove(); } }); } }); $updateDOMForSelection(editor, this.table, null); $setSelection(null); editor.dispatchCommand(SELECTION_CHANGE_COMMAND, undefined); }); ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>leRowNode(); node.setStyles(new Map(Object.entries(serializedNode.styles))); return node; } constructor(key?: NodeKey) { super(key); } exportJSON(): SerializedTableRowNode { return { ...super.exportJSON(), type: 'tablerow', version: 1, styles: Object.fro...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>reatePoint('root', 0, 'element'); return new TableSelection('root', anchor, focus); } export function $getChildrenRecursively(node: LexicalNode): Array<LexicalNode> { const nodes = []; const stack = [node]; while (stack.length > 0) { const currentNode = stack.pop(); invariant( curre...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>e, true); } return true; default: return false; } }; const adjustFocusNodeInDirection = ( tableObserver: TableObserver, tableNode: TableNode, x: number, y: number, direction: Direction, ): boolean => { const isForward = direction === 'forward'; switch (direction) {...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>tColumn, startRow, }; const rowSpan = cell.__rowSpan; const colSpan = cell.__colSpan; for (let i = 0; i < rowSpan; i++) { if (tableMap[startRow + i] === undefined) { tableMap[startRow + i] = []; } for (let j = 0; j < colSpan; j++) { tableMap[startRow...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>mWidthNode.createDOM(editorConfig).outerHTML).toBe( `<td style="width: ${cellWidth}px;" class="${editorConfig.theme.tableCell}"></td>`, ); }); }); }); }); <|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>rnal source like gdoc with formatting', async () => { const {editor} = testEnv; const dataTransfer = new DataTransferMock(); dataTransfer.setData( 'text/html', '<google-sheets-html-origin><style type="text/css"><!--td {border: 1px solid #cccccc;}br {mso-data-pl...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>tializeUnitTest((testEnv) => { test('TableRowNode.constructor', async () => { const {editor} = testEnv; await editor.update(() => { const rowNode = $createTableRowNode(); expect(rowNode).not.toBe(null); }); expect(() => $createTableRowNode()).toThrow(); }...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import {$createTableSelection} from '@lexical/table'; import { $createParagraphNode, $createTextNode, $ge...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this sou<|fim_suffix|>ical-playground/src/themes/PlaygroundEditorTheme.css export const COLUMN_WIDTH = 75; <|fim_middle|>rce tree. * */...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>ableNodeWithDimensions, $deleteTableColumn, $deleteTableColumn__EXPERIMENTAL, $deleteTableRow__EXPERIMENTAL, $getNodeTriplet, $getTableCellNodeFromLexicalNode, $getTableCellNodeRect, $getTableColumnIndexFromTableCellNode, $getTableNodeFromLexicalNodeOrThrow, $getTableRowIndexFromTableCel...
fim
BookStackApp/BookStack
typescript
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import { addClassNamesToElement, removeClassNamesFromElement, } from '@lexical/utils'; describe('LexicalElementHelpers t...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>pre-wrap; word-break: break-word;" data-lexical-editor="true"><p class="editor-paragraph"><strong class="editor-text-bold" data-lexical-text="true">Bold</strong></p></div>', inputs: [pasteHTML(`<meta charset='utf-8'><b>Bold</b>`)], name: 'should produce the correct editor state from a ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>h: 3, node: block3.getLatest(), }, { depth: 2, node: block2!.getLatest(), }, ]); }); }); test('DFS of empty ParagraphNode returns only itself', async () => { const editor: LexicalEditor = testEnv.editor; ...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import {$createParagraphNode, $createTextNode, $getRoot} from 'lexical'; import {initializeUnitTest} from 'lexi...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import {objectKlassEquals} from '@lexical/utils'; import {initializeUnitTest} from 'lexical/__te<|fim_suffix|> ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>tChildAtIndex(index)!; if (!$isElementNode(nodeToSplit)) { throw new Error('Expected node to be element'); } } $splitNode(nodeToSplit, testCase.splitOffset); // Cleaning up list value attributes as it's not really needed in this test // and...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import type {LexicalEditor, LexicalNode} from 'lexical'; import {$generateHtmlFromNodes, $generateNodesFromDOM...
fim
BookStackApp/BookStack
typescript
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import {mergeRegister} from '@lexical/utils'; describe('mergeRegister', () => { it('calls all of the clean-up functions', (...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>t returns true if the current node satisfies the testing parameters. * @returns A parent node that matches the findFn parameters, or null if one wasn't found. */ export const $findMatchingParent: { <T extends LexicalNode>( startingNode: LexicalNode, findFn: (node: LexicalNode) => node is T, ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>nReposition !== undefined) { onReposition(domNodes); } }, ); } } previousAnchorNode = currentAnchorNode; previousAnchorOffset = currentAnchorOffset; previousFocusNode = currentFocusNode; previousFocusOffset = current...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and af<|fim_suffix|>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...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import type {LexicalEditor} from 'lexical'; import {createRectsFromDOMRange} from '@lexical/selection'; import...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>ult function px(value: number) { return `${value}px`; } <|fim_prefix|>/** * Copyright (c) Met<|fim_middle|>a Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ export defa<|endoftext|>
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import type {CollabDecoratorNode} from './CollabDecoratorNode'; import type {CollabElementNode} from './CollabE...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>nding, xmlElem, prevLexicalNode, nextLexicalNode, ); } syncPropertiesFromYjs( binding: Binding, keysChanged: null | Set<string>, ): void { const lexicalNode = this.getNode(); invariant( lexicalNode !== null, 'syncPropertiesFromYjs: could not find de...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import type {Binding} from '.'; import type {ElementNode, NodeKey, NodeMap} from 'lexical'; i<|fim_suffix|>ical...
fim
BookStackApp/BookStack
typescript
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import type {Binding} from '.'; import type {CollabElementNode} from './CollabElementNode'; import type {LineBreakNode, NodeK...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import type {Binding} from '.'; import type {CollabElementNode} from './CollabElementNode'; import type {NodeKe...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>er, ] { const collabNode = sharedType._collabNode; if (collabNode === undefined) { return [null, 0]; } if (collabNode instanceof CollabElementNode) { const {node, offset: collabNodeOffset} = getPositionFromElementAndOffset( collabNode, offset, true, ); if (node...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>er, events: Array<YEvent<YText>>, isFromUndoManger: boolean, ): void { const editor = binding.editor; const currentEditorState = editor._editorState; // This line precompute the delta before editor update. The reason is // delta is computed when it is accessed. Note that this can only be //...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|> = null; } if (nextSibling === null) { if (prevSibling !== null) { const writablePrevSibling = prevSibling.getWritable(); writableParent.__last = prevSibling.__key; writablePrevSibling.__next = null; } else { writableParent.__last = null; } } e...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>e(); if (localState === null) { localState = { anchorPos: null, awarenessData, color, focusPos: null, focusing: focusing, name, }; } localState.focusing = focusing; awareness.setLocalState(localState); } export {syncCursorPositions} from './SyncCursors...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>/** * Copyright (c) Meta Platforms, Inc. and a<|fim_suffix|>om './src/CollabLineBreakNode'; import {CollabTextNode} from './src/CollabTextNode'; declare module 'yjs' { interface XmlElement { _collabNode: CollabDecoratorNode; } interface XmlText { _collabNode: CollabElementNode; } // ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>leNode, DetailsNode, CodeBlockNode, DiagramNode, MediaNode, // TODO - Alignment ParagraphNode, LinkNode, ]; } export function getNodesForBasicEditor(): (KlassConstructor<typeof LexicalNode> | LexicalNodeReplacement)[] { return [ ListNode, ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>erAutoLinks(editor); let pNode!: ParagraphNode; editor.updateAndCommit(() => { pNode = new ParagraphNode(); const text = new TextNode('Some https://example.com?test=true text'); pNode.append(text); $getRoot().append(pNode); text...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import { createTestContext, destroyFromContext, dispatchKeydownEventForNode, dispatchKeydownEventForSelectedNode, expectNodeShapeToMatch, } from "lexical/__tests__/utils"; import { $createParagraphNode, $createTextNode, $getRoot, $getSelection, LexicalEditor, LexicalNode, Paragraph...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>astChild(); }); expect(lastRootChild).toBeInstanceOf(ParagraphNode); }); });<|fim_prefix|>import { createTestContext, destroyFromContext, dispatchEditorMouseClick, } from "lexical/__tests__/utils"; import { $getRoot, LexicalEditor, LexicalNode, ParagraphNode, } from "lexic...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|> let editor!: LexicalEditor; beforeEach(() => { context = createTestContext(); editor = context.editor; registerRichText(editor); registerShortcuts(context, true); }); afterEach(() => { destroyFromContext(context); }); test('Basic block for...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import { $getSelection, BaseSelection, COMMAND_PRIORITY_NORMAL, KEY_ENTER_COMMAND, KEY_SPACE_COMMAND, LexicalEditor, TextNode } from "lexical"; import {$getTextNodeFromSelection} from "../utils/selection"; import {$createLinkNode, LinkNode} from "@lexical/link"; function isLinkTe...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import {LexicalEditor} from "lexical"; import { appendHtmlToEditor, focusEditor, focusOnHeader, insertHtmlIntoEditor, prependHtmlToEditor, setEditorContentFromHtml } from "../utils/actions"; type EditorEventContent = { html: string; markdown: string; }; function getContentToI...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>block of selectionBlocks) { if (block.isEmpty()) { block.remove(); } } } } const newNodes = $htmlToNodes(editor, html); $insertNodesAtEvent(newNodes, event, editor); }); } function han...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>mmand(KEY_ARROW_DOWN_COMMAND, (event): boolean => { return insertAfterDetails(context.editor, event) || focusAdjacentOrInsertForSingleSelectNode(context.editor, event, true) }, COMMAND_PRIORITY_LOW); return () => { unregisterBackspace(); unregisterDelete(); ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>onDecorator.showSelection() } }); } function selectMention(context: EditorUiContext, event: KeyboardEvent): boolean { const selected = $getSelection()?.getNodes() || []; if (selected.length === 1 && $isMentionNode(selected[0])) { const mention = selected[0] as MentionNode; ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>$getRoot(); } function insertBelowLastNode(context: EditorUiContext, event: MouseEvent): boolean { const contextNode = $getContextNode(event); const lastNode = contextNode.getLastChild(); if (!lastNode || !isHardToEscapeNode(lastNode)) { return false; } const lastNodeDom = co...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import {EditorUiContext} from "../ui/framework/core"; import { $getSelection, COMMAND_PRIORITY_LOW, SELECTION_CHANGE_COMMAND } from "lexical"; import {$isDetailsNode} from "@lexical/rich-text/LexicalDetailsNode"; const trackedDomNodes = new Set<HTMLElement>(); /** * Set a selection indicat...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import { $getSelection, COMMAND_PRIORITY_HIGH, FORMAT_TEXT_COMMAND, KEY_ENTER_COMMAND, LexicalEditor, TextFormatType } from "lexical"; import { cycleSelectionCalloutFormats, formatCodeBlock, insertOrUpdateLink, toggleSelectionAsBlockquote, toggleSelectionAsHeading, ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>anguage = codeNode.getLanguage(); if (this.latestCode === code && this.latestLanguage === language) { return; } this.latestLanguage = language; this.latestCode = code; if (this.editor) { this.editor.setContent(code); this.editor...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>ode)); }); }); const selectionChange = (selection: BaseSelection|null): void => { element.classList.toggle('selected', $selectionContainsNode(selection, diagramNode)); }; this.context.manager.onSelectionChange(selectionChange); this.onDestro...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import {EditorDecorator} from "../framework/decorator"; import {EditorUiContext} from "../framework/core"; import {el, htmlToDom} from "../../utils/dom"; import {showLoading} from "../../../services/dom"; import {MentionNode} from "@lexical/link/LexicalMentionNode"; import {debounce} from "../../../servic...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import {$isElementNode, BaseSelection} from "lexical"; import {EditorButtonDefinition} from "../../framework/buttons"; import alignLeftIcon from "@icons/editor/align-left.svg"; import {EditorUiContext} from "../../framework/core"; import alignCenterIcon from "@icons/editor/align-center.svg"; import alignR...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import {$createCalloutNode, $isCalloutNodeOfCategory, CalloutCategory} from "@lexical/rich-text/LexicalCalloutNode"; import {EditorButtonDefinition} from "../../framework/buttons"; import {EditorUiContext} from "../../framework/core"; import {$isParagraphNode, BaseSelection, LexicalNode} from "lexical"; i...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|> return context.containerDOM.classList.contains('fullscreen'); } }; export const about: EditorButtonDefinition = { label: 'About the editor', icon: aboutIcon, async action(context: EditorUiContext, button: EditorButton) { const modal = context.manager.createModal('about'); ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>const superscript: EditorButtonDefinition = buildFormatButton('Superscript', 'superscript', superscriptIcon); export const subscript: EditorButtonDefinition = buildFormatButton('Subscript', 'subscript', subscriptIcon); export const code: EditorButtonDefinition = buildFormatButton('Inline code', 'code', co...
fim
BookStackApp/BookStack
typescript
import {$isListNode, ListNode, ListType} from "@lexical/list"; import {EditorButtonDefinition} from "../../framework/buttons"; import {EditorUiContext} from "../../framework/core"; import { BaseSelection, LexicalNode, } from "lexical"; import listBulletIcon from "@icons/editor/list-bullet.svg"; import listNumbe...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import {EditorButtonDefinition} from "../../framework/buttons"; import linkIcon from "@icons/editor/link.svg"; import {EditorUiContext} from "../../framework/core"; import { $getRoot, $getSelection, $insertNodes,<|fim_suffix|>m(selectedImage, context); return; } ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>xport const deleteColumn: EditorButtonDefinition = { label: 'Delete column', icon: deleteColumnIcon, action(context: EditorUiContext) { context.editor.update(() => { $deleteTableColumn__EXPERIMENTAL(); }); }, isActive() { return false; } }; expo...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>; }, fields: [ { build(): EditorUiElement { return new ExternalContent('/help/wysiwyg'); } } ], };<|fim_prefix|>import {EditorFormDefinition} from "../../framework/forms"; import {EditorUiContext, EditorUiElement} from "../../framework/co...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|> context.editor.update(() => { const node = $getNodeFromSelection($getSelection(), $isDetailsNode); const summary = (formData.get('summary') || '').toString().trim(); if ($isDetailsNode(node)) { node.setSummary(summary); } }); ...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|> height: styles.get('height') || '', type: cell.getTag(), h_align: cell.getAlignment(), v_align: styles.get('vertical-align') || '', border_width: styles.get('border-width') || '', border_style: styles.get('border-style') || '', border_color: styles.get('bo...
fim
BookStackApp/BookStack
typescript
<|fim_suffix|>media, }, source: { title: 'Source code', form: source, }, cell_properties: { title: 'Cell Properties', form: cellProperties, }, row_properties: { title: 'Row Properties', form: rowProperties, }, table_properties: { ti...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import {EditorButton} from "../framework/buttons"; import {EditorContainerUiElement, EditorSimpleClassContainer, EditorUiContext, EditorUiElement} from "../framework/core"; import {EditorFormatMenu} from "../framework/blocks/format-menu"; import {FormatPreviewButton} from "../framework/blocks/format-previ...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import {EditorContainerUiElement, EditorUiElement} f<|fim_suffix|>"; import {el} from "../../../utils/dom"; import {EditorButton} from "../buttons"; export class EditorActionField extends EditorContainerUiElement { protected input: EditorUiElement; protected action: EditorButton; constructo...
fim
BookStackApp/BookStack
typescript
<|fim_prefix|>import {EditorContainerUiElement, EditorUiElement} from "../core"; import {el} from "../../../utils/dom"; import {EditorButton} <|fim_suffix|>{ button: {label: 'Menu', icon: caretDownIcon}, showOnHover: false, direction: 'vertical', showAside: false, ...
fim
BookStackApp/BookStack
typescript