@homebound/beam 2.323.0 → 2.324.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -23,7 +23,7 @@ require("trix/dist/trix.css");
|
|
|
23
23
|
* We also integrate [tributejs]{@link https://github.com/zurb/tribute} for @ mentions.
|
|
24
24
|
*/
|
|
25
25
|
function RichTextField(props) {
|
|
26
|
-
const { mergeTags, label, value = "", onChange, onBlur = utils_1.noop, onFocus = utils_1.noop, readOnly } = props;
|
|
26
|
+
const { mergeTags, label, value = "", onChange, onBlur = utils_1.noop, onFocus = utils_1.noop, readOnly, fullWidth } = props;
|
|
27
27
|
// We get a reference to the Editor instance after trix-init fires
|
|
28
28
|
const [editor, setEditor] = (0, react_2.useState)();
|
|
29
29
|
const editorElement = (0, react_2.useRef)();
|
|
@@ -98,7 +98,7 @@ function RichTextField(props) {
|
|
|
98
98
|
}, [value, readOnly, editor]);
|
|
99
99
|
const { placeholder, autoFocus } = props;
|
|
100
100
|
if (!readOnly) {
|
|
101
|
-
return ((0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.w100.maxw("550px").$, children: [label && (0, jsx_runtime_1.jsx)(Label_1.Label, { labelProps: {}, label: label }), (0, jsx_runtime_1.jsxs)("div", { css: { ...Css_1.Css.br4.bgWhite.$, ...trixCssOverrides }, children: [(0, jsx_runtime_1.jsx)("input", { type: "hidden", id: `input-${id}`, value: value }), (0, react_2.createElement)("trix-editor", {
|
|
101
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.w100.if(!fullWidth).maxw("550px").$, children: [label && (0, jsx_runtime_1.jsx)(Label_1.Label, { labelProps: {}, label: label }), (0, jsx_runtime_1.jsxs)("div", { css: { ...Css_1.Css.br4.bgWhite.$, ...trixCssOverrides }, children: [(0, jsx_runtime_1.jsx)("input", { type: "hidden", id: `input-${id}`, value: value }), (0, react_2.createElement)("trix-editor", {
|
|
102
102
|
id: id,
|
|
103
103
|
input: `input-${id}`,
|
|
104
104
|
// Autofocus attribute is case sensitive since this is standard HTML
|
|
@@ -107,7 +107,7 @@ function RichTextField(props) {
|
|
|
107
107
|
})] }), (0, jsx_runtime_1.jsx)(react_1.Global, { styles: [tributeOverrides] })] }));
|
|
108
108
|
}
|
|
109
109
|
else {
|
|
110
|
-
return ((0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.w100.maxw("550px").$, children: [label && (0, jsx_runtime_1.jsx)(Label_1.Label, { label: label }), (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.mh("120px").bgWhite.sm.gray900.bn.p1.br4.bGray300.ba.$, dangerouslySetInnerHTML: { __html: dompurify_1.default.sanitize(value) || placeholder || "" }, "data-readonly": "true" })] }));
|
|
110
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: Css_1.Css.w100.if(!fullWidth).maxw("550px").$, children: [label && (0, jsx_runtime_1.jsx)(Label_1.Label, { label: label }), (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.mh("120px").bgWhite.sm.gray900.bn.p1.br4.bGray300.ba.$, dangerouslySetInnerHTML: { __html: dompurify_1.default.sanitize(value) || placeholder || "" }, "data-readonly": "true" })] }));
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
exports.RichTextField = RichTextField;
|