UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

29 lines 1.38 kB
import * as React from 'react'; import { rule } from 'nano-theme'; import { useT } from 'use-t'; import { FormattingEdit } from '../views/edit/FormattingEdit'; import { ContextSep } from 'nice-ui/lib/4-card/ContextMenu'; import { Button } from 'nice-ui/lib/2-inline-block/Button'; import { useSyncStoreOpt } from '../../../../web/react/hooks'; const blockClass = rule({ maxW: '600px', }); export const FormattingEditForm = ({ formatting, onSave }) => { const [t] = useT(); useSyncStoreOpt(formatting.conf()?.api); const validation = formatting.validate(); const valid = validation === 'good' || validation === 'fine'; const handleSubmit = () => { onSave?.(); }; return (React.createElement("form", { className: blockClass, onSubmit: (e) => { e.preventDefault(); handleSubmit(); } }, React.createElement("div", { style: { padding: '16px' } }, React.createElement(FormattingEdit, { formatting: formatting, onSave: handleSubmit })), React.createElement(ContextSep, { line: true }), React.createElement("div", { style: { padding: '16px' } }, React.createElement(Button, { small: true, lite: !valid, primary: validation === 'good', block: true, disabled: !valid, submit: true, onClick: () => { } }, t('Done'))))); }; //# sourceMappingURL=FormattingEditForm.js.map