A hyperscript helper for creating Slate documents with JSX-like syntax.
90
Create a utility that constructs Slate editor states for testing purposes. The utility should build editor instances with content and selections using a declarative approach.
Your utility should create editor states with:
@generates
/**
* Creates a Slate editor instance with the specified content and selection
*
* @param {Object} config - Configuration for the editor state
* @param {string} config.text - Text content for the editor
* @param {number} [config.cursorOffset] - Optional cursor position (collapsed selection)
* @param {Object} [config.range] - Optional range selection with {anchor: number, focus: number} offsets
* @param {Object} [config.marks] - Optional formatting marks like {bold: true, italic: true}
* @returns {Object} Slate editor instance
*/
function buildEditorState(config) {
// IMPLEMENTATION HERE
}
module.exports = { buildEditorState };Provides hyperscript helper for creating Slate documents with JSX-like 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