A hyperscript helper for creating Slate documents with JSX-like syntax.
90
Build a document builder utility that creates richly nested document structures for testing a rich text editor.
Your utility should create nested document structures with the following capabilities:
Build a function createNestedDocument() that returns an editor containing a document with the following structure:
Each element should have a type property matching its name (e.g., type: "document").
Build a function createDocumentWithSelection() that returns an editor with a cursor positioned in the middle of the text "main content" (between "main" and "content") in the deeply nested paragraph.
The structure should be:
A "document" element containing:
The cursor is positioned at the correct offset in nested text @test
Build a function createNestedList() that returns an editor containing a nested list:
A "list" element with listType="ordered" containing:
The nested list structure is correctly formed @test
List items contain proper nesting of text and sub-lists @test
@generates
/**
* Creates a multi-level nested document structure
*/
export function createNestedDocument(): any;
/**
* Creates a nested document with cursor selection in deep content
*/
export function createDocumentWithSelection(): any;
/**
* Creates a nested ordered/unordered list structure
*/
export function createNestedList(): any;Provides utilities for creating Slate document structures with JSX syntax.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-slate-hyperscriptdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10