@vericus/slate-kit-basic-text-formatting-renderer
Version:
TODO: fill in this description later
37 lines • 1.68 kB
JSX
import * as tslib_1 from "tslib";
import * as React from "react";
import Register from "@vericus/slate-kit-utils-register-helpers";
import SlateTypes from "slate-prop-types";
var defaultStyle = {
textDecoration: "inherit",
textDecorationColor: "inherit",
};
var renderMark = function (_a) {
var children = _a.children, attributes = _a.attributes, className = _a.className;
return (<span {...attributes} className={className}>
{children}
</span>);
};
renderMark.propTypes = SlateTypes.Mark;
export function bold(props) {
return renderMark(tslib_1.__assign({}, props, { attributes: tslib_1.__assign({}, props.attributes, { style: tslib_1.__assign({}, defaultStyle, { fontWeight: "bold" }) }) }));
}
export function italic(props) {
return renderMark(tslib_1.__assign({}, props, { attributes: tslib_1.__assign({}, props.attributes, { style: tslib_1.__assign({}, defaultStyle, { fontStyle: "italic" }) }) }));
}
export function underline(props) {
return renderMark(tslib_1.__assign({}, props, { attributes: tslib_1.__assign({}, props.attributes, { style: tslib_1.__assign({}, defaultStyle, { textDecoration: "underline" }) }) }));
}
export function strikethrough(props) {
return renderMark(tslib_1.__assign({}, props, { attributes: tslib_1.__assign({}, props.attributes, { style: tslib_1.__assign({}, defaultStyle, { textDecoration: "line-through" }) }) }));
}
export default function createRenderMark() {
var marksRenderer = {
bold: bold,
italic: italic,
underline: underline,
strikethrough: strikethrough,
};
return Register({ marksRenderer: marksRenderer });
}
//# sourceMappingURL=renderMark.jsx.map