UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

25 lines (24 loc) 1.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ToolbarPlugin = void 0; const tslib_1 = require("tslib"); const React = tslib_1.__importStar(require("react")); const RenderInline_1 = require("./RenderInline"); const RenderPeritext_1 = require("./RenderPeritext"); const text_1 = require("../minimal/text"); const RenderBlock_1 = require("./RenderBlock"); const RenderCaret_1 = require("./RenderCaret"); const RenderFocus_1 = require("./RenderFocus"); const h = React.createElement; class ToolbarPlugin { constructor(opts = {}) { this.opts = opts; this.text = text_1.text; this.inline = (props, children) => h(RenderInline_1.RenderInline, props, children); this.block = (props, children) => h(RenderBlock_1.RenderBlock, props, children); this.peritext = (children, surface) => h(RenderPeritext_1.RenderPeritext, { children, surface, opts: this.opts }); this.caret = (props, children) => h(RenderCaret_1.RenderCaret, props, children); this.focus = (props, children) => h(RenderFocus_1.RenderFocus, props, children); } } exports.ToolbarPlugin = ToolbarPlugin;