@rhc-shared-components/rich-text-editor 0.2.2 → 0.2.8

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.
package/dist/index.js CHANGED
@@ -1,11 +1,34 @@
1
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
2
-
3
1
  var React = require('react');
4
2
  var ckeditor5React = require('@ckeditor/ckeditor5-react');
5
- var ClassicEditor = _interopDefault(require('@ckeditor/ckeditor5-build-classic'));
3
+ var ClassicEditor = require('@ckeditor/ckeditor5-build-classic');
6
4
  var reactCore = require('@patternfly/react-core');
7
5
  var formik = require('formik');
8
6
 
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n["default"] = e;
24
+ return n;
25
+ }
26
+
27
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
+ var ClassicEditor__default = /*#__PURE__*/_interopDefaultLegacy(ClassicEditor);
29
+
30
+ var css_248z = ".rich-text-editor-custom {\n --pf-c-title--m-2xl--LineHeight: var(--pf-global--LineHeight--sm);\n --pf-c-title--m-2xl--FontSize: var(--pf-global--FontSize--2xl);\n --pf-c-title--m-2xl--FontWeight: var(--pf-global--FontWeight--normal);\n --pf-c-title--m-xl--LineHeight: var(--pf-global--LineHeight--md);\n --pf-c-title--m-xl--FontSize: var(--pf-global--FontSize--xl);\n --pf-c-title--m-xl--FontWeight: var(--pf-global--FontWeight--normal);\n --pf-c-title--m-lg--LineHeight: var(--pf-global--LineHeight--md);\n --pf-c-title--m-lg--FontSize: var(--pf-global--FontSize--lg);\n --pf-c-title--m-lg--FontWeight: var(--pf-global--FontWeight--normal);\n --pf-c-title--m-md--LineHeight: var(--pf-global--LineHeight--md);\n --pf-c-title--m-md--FontSize: var(--pf-global--FontSize--md);\n --pf-c-title--m-md--FontWeight: var(--pf-global--FontWeight--normal); }\n .rich-text-editor-custom h1 {\n font-size: var(--pf-c-title--m-2xl--FontSize);\n font-weight: var(--pf-c-title--m-2xl--FontWeight);\n line-height: var(--pf-c-title--m-2xl--LineHeight); }\n .rich-text-editor-custom h2 {\n font-size: var(--pf-c-title--m-xl--FontSize);\n font-weight: var(--pf-c-title--m-xl--FontWeight);\n line-height: var(--pf-c-title--m-xl--LineHeight); }\n .rich-text-editor-custom h3 {\n font-size: var(--pf-c-title--m-lg--FontSize);\n font-weight: var(--pf-c-title--m-lg--FontWeight);\n line-height: var(--pf-c-title--m-lg--LineHeight); }\n .rich-text-editor-custom h4 {\n font-size: var(--pf-c-title--m-md--FontSize);\n font-weight: var(--pf-c-title--m-md--FontWeight);\n line-height: var(--pf-c-title--m-md--LineHeight); }\n .rich-text-editor-custom ul {\n display: block;\n list-style-type: disc;\n -webkit-margin-before: 1em;\n margin-block-start: 1em;\n -webkit-margin-after: 1em;\n margin-block-end: 1em;\n -webkit-margin-start: 0px;\n margin-inline-start: 0px;\n -webkit-margin-end: 0px;\n margin-inline-end: 0px;\n -webkit-padding-start: 40px;\n padding-inline-start: 40px; }\n .rich-text-editor-custom ul li {\n display: list-item; }\n .rich-text-editor-custom ul ul {\n list-style-type: circle;\n -webkit-margin-before: 0px;\n margin-block-start: 0px;\n -webkit-margin-after: 0px;\n margin-block-end: 0px; }\n .rich-text-editor-custom ol {\n display: block;\n list-style-type: decimal;\n -webkit-margin-before: 1em;\n margin-block-start: 1em;\n -webkit-margin-after: 1em;\n margin-block-end: 1em;\n -webkit-margin-start: 0px;\n margin-inline-start: 0px;\n -webkit-margin-end: 0px;\n margin-inline-end: 0px;\n -webkit-padding-start: 40px;\n padding-inline-start: 40px; }\n";
31
+
9
32
  var RichTextEditor = function RichTextEditor(_ref) {
10
33
  var value = _ref.value,
11
34
  disabled = _ref.disabled,
@@ -23,9 +46,12 @@ var RichTextEditor = function RichTextEditor(_ref) {
23
46
  }
24
47
  };
25
48
 
26
- return React.createElement("div", null, React.createElement(ckeditor5React.CKEditor, Object.assign({
49
+ InsertCss();
50
+ return React__namespace.createElement("div", {
51
+ className: 'rich-text-editor-custom'
52
+ }, React__namespace.createElement(ckeditor5React.CKEditor, Object.assign({
27
53
  disabled: disabled,
28
- editor: ClassicEditor,
54
+ editor: ClassicEditor__default["default"],
29
55
  data: value,
30
56
  config: {
31
57
  heading: {
@@ -35,35 +61,27 @@ var RichTextEditor = function RichTextEditor(_ref) {
35
61
  }, {
36
62
  model: 'heading1',
37
63
  view: {
38
- name: 'h1',
39
- classes: 'pf-c-title pf-m-2xl'
64
+ name: 'h1'
40
65
  },
41
- title: 'Heading 1',
42
- "class": 'ck-heading_heading1'
66
+ title: 'Heading 1'
43
67
  }, {
44
68
  model: 'heading2',
45
69
  view: {
46
- name: 'h2',
47
- classes: 'pf-c-title pf-m-xl'
70
+ name: 'h2'
48
71
  },
49
- title: 'Heading 2',
50
- "class": 'ck-heading_heading2'
72
+ title: 'Heading 2'
51
73
  }, {
52
74
  model: 'heading3',
53
75
  view: {
54
- name: 'h4',
55
- classes: 'pf-c-title pf-m-lg'
76
+ name: 'h4'
56
77
  },
57
- title: 'Heading 3',
58
- "class": 'ck-heading_heading3'
78
+ title: 'Heading 3'
59
79
  }, {
60
80
  model: 'heading4',
61
81
  view: {
62
- name: 'h4',
63
- classes: 'pf-c-title pf-m-md'
82
+ name: 'h4'
64
83
  },
65
- title: 'Heading 4',
66
- "class": 'ck-heading_heading4'
84
+ title: 'Heading 4'
67
85
  }]
68
86
  },
69
87
  toolbar: {
@@ -93,7 +111,19 @@ var RichTextEditor = function RichTextEditor(_ref) {
93
111
  })));
94
112
  };
95
113
 
96
- function _objectWithoutPropertiesLoose(source, excluded) {
114
+ var InsertCss = function InsertCss() {
115
+ var styleId = 'rich-test-editor-styles';
116
+
117
+ if (!document.getElementById(styleId)) {
118
+ var styleTag = document.createElement('style');
119
+ styleTag.id = styleId;
120
+ styleTag.type = 'text/css';
121
+ styleTag.innerHTML = css_248z;
122
+ document.body.appendChild(styleTag);
123
+ }
124
+ };
125
+
126
+ function _objectWithoutPropertiesLoose$1(source, excluded) {
97
127
  if (source == null) return {};
98
128
  var target = {};
99
129
  var sourceKeys = Object.keys(source);
@@ -108,7 +138,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
108
138
  return target;
109
139
  }
110
140
 
111
- function _objectWithoutPropertiesLoose$1(source, excluded) {
141
+ function _objectWithoutPropertiesLoose(source, excluded) {
112
142
  if (source == null) return {};
113
143
  var target = {};
114
144
  var sourceKeys = Object.keys(source);
@@ -123,7 +153,7 @@ function _objectWithoutPropertiesLoose$1(source, excluded) {
123
153
  return target;
124
154
  }
125
155
 
126
- var _excluded = ["children", "helperTextInvalid", "isValid", "helperText", "labelIcon", "onClick"];
156
+ var _excluded$1 = ["children", "helperTextInvalid", "isValid", "helperText", "labelIcon", "onClick"];
127
157
 
128
158
  var FormGroupContainer = function FormGroupContainer(_ref) {
129
159
  var children = _ref.children,
@@ -132,7 +162,7 @@ var FormGroupContainer = function FormGroupContainer(_ref) {
132
162
  helperText = _ref.helperText,
133
163
  labelIcon = _ref.labelIcon,
134
164
  onClick = _ref.onClick,
135
- rest = _objectWithoutPropertiesLoose$1(_ref, _excluded);
165
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
136
166
 
137
167
  return React.createElement(reactCore.FormGroup, Object.assign({
138
168
  className: 'form-group',
@@ -146,14 +176,14 @@ var FormGroupContainer = function FormGroupContainer(_ref) {
146
176
  }, rest), children);
147
177
  };
148
178
 
149
- var _excluded$1 = ["label", "isRequired", "ariaLabel", "placeholder", "helperText", "maxItems", "maxHeight", "disabled"];
179
+ var _excluded = ["label", "isRequired", "ariaLabel", "placeholder", "helperText", "maxItems", "maxHeight", "disabled"];
150
180
 
151
181
  var RichTextEditorFormComponent = function RichTextEditorFormComponent(_ref) {
152
182
  var label = _ref.label,
153
183
  isRequired = _ref.isRequired,
154
184
  helperText = _ref.helperText,
155
185
  disabled = _ref.disabled,
156
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
186
+ rest = _objectWithoutPropertiesLoose$1(_ref, _excluded);
157
187
 
158
188
  var _useField = formik.useField({
159
189
  name: rest.name
@@ -161,17 +191,18 @@ var RichTextEditorFormComponent = function RichTextEditorFormComponent(_ref) {
161
191
  meta = _useField[1];
162
192
 
163
193
  var value = meta.value;
164
- var editorRef = React.useRef(null);
194
+ var editorRef = React__namespace.useRef(null);
165
195
 
166
196
  var _useFormikContext = formik.useFormikContext(),
167
197
  isSubmitting = _useFormikContext.isSubmitting,
168
198
  setFieldValue = _useFormikContext.setFieldValue,
169
199
  validateField = _useFormikContext.validateField;
170
200
 
171
- return React.createElement(FormGroupContainer, {
201
+ return React__namespace.createElement(FormGroupContainer, {
172
202
  validated: meta.error ? reactCore.ValidatedOptions.error : reactCore.ValidatedOptions["default"],
173
203
  onClick: function onClick() {
174
204
  if (editorRef) {
205
+ // @ts-ignore
175
206
  editorRef.current.editing.view.focus();
176
207
  }
177
208
  },
@@ -180,7 +211,7 @@ var RichTextEditorFormComponent = function RichTextEditorFormComponent(_ref) {
180
211
  isRequired: isRequired,
181
212
  label: label,
182
213
  helperText: helperText
183
- }, React.createElement(RichTextEditor, {
214
+ }, React__namespace.createElement(RichTextEditor, {
184
215
  value: value,
185
216
  id: rest.name,
186
217
  name: rest.name,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/RichTextEditor.tsx","../../form-group-container/dist/index.modern.js","../src/RichTextEditorFormComponent.tsx"],"sourcesContent":["import * as React from 'react';\nimport { CKEditor } from '@ckeditor/ckeditor5-react';\nimport ClassicEditor from '@ckeditor/ckeditor5-build-classic';\n\ntype RichTextEditorFunctionType = (\n value: string,\n event?: Event,\n editor?: ClassicEditor\n) => void;\n\nexport interface RichTextEditorProps {\n value: string;\n disabled?: boolean;\n onReady?: (editor: ClassicEditor) => void;\n onChange?: RichTextEditorFunctionType;\n onBlur?: RichTextEditorFunctionType;\n onFocus?: RichTextEditorFunctionType;\n onError?: RichTextEditorFunctionType;\n id?: string;\n name?: string;\n}\n\nconst RichTextEditor: React.FC<RichTextEditorProps> = ({\n value,\n disabled,\n onReady,\n onChange,\n onError,\n onBlur,\n onFocus,\n id,\n name\n}) => {\n const eventHandlerWrapper = (\n handler: RichTextEditorFunctionType | undefined,\n event: Event | undefined,\n editor: ClassicEditor | undefined\n ) => {\n if (handler) {\n handler(editor.getData(), event, editor);\n }\n };\n return (\n <div>\n <CKEditor\n disabled={disabled}\n editor={ClassicEditor}\n data={value}\n config={{\n heading: {\n options: [\n {\n model: 'paragraph',\n title: 'Paragraph'\n },\n {\n model: 'heading1',\n view: {\n name: 'h1',\n classes: 'pf-c-title pf-m-2xl'\n },\n title: 'Heading 1',\n class: 'ck-heading_heading1'\n },\n {\n model: 'heading2',\n view: {\n name: 'h2',\n classes: 'pf-c-title pf-m-xl'\n },\n title: 'Heading 2',\n class: 'ck-heading_heading2'\n },\n {\n model: 'heading3',\n view: {\n name: 'h4',\n classes: 'pf-c-title pf-m-lg'\n },\n title: 'Heading 3',\n class: 'ck-heading_heading3'\n },\n {\n model: 'heading4',\n view: {\n name: 'h4',\n classes: 'pf-c-title pf-m-md'\n },\n title: 'Heading 4',\n class: 'ck-heading_heading4'\n }\n ]\n },\n toolbar: {\n items: [\n 'heading',\n '|',\n 'bold',\n 'italic',\n 'link',\n 'bulletedList',\n 'numberedList',\n '|',\n 'blockQuote',\n 'insertTable',\n 'undo',\n 'redo'\n ]\n },\n table: {\n contentToolbar: ['tableColumn', 'tableRow', 'mergeTableCells']\n }\n }}\n onReady={onReady}\n onChange={(event?: Event, editor?: ClassicEditor) => {\n eventHandlerWrapper(onChange, event, editor);\n }}\n onBlur={(event?: Event, editor?: ClassicEditor) => {\n eventHandlerWrapper(onBlur, event, editor);\n }}\n onFocus={(event?: Event, editor?: ClassicEditor) => {\n eventHandlerWrapper(onFocus, event, editor);\n }}\n onError={(event?: Event, editor?: ClassicEditor) => {\n eventHandlerWrapper(onError, event, editor);\n }}\n {...(id && { id })}\n {...(name && { name })}\n />\n </div>\n );\n};\n\nexport default RichTextEditor;\n","import { createElement } from 'react';\nimport { FormGroup, ValidatedOptions } from '@patternfly/react-core';\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nvar _excluded = [\"children\", \"helperTextInvalid\", \"isValid\", \"helperText\", \"labelIcon\", \"onClick\"];\n\nvar FormGroupContainer = function FormGroupContainer(_ref) {\n var children = _ref.children,\n helperTextInvalid = _ref.helperTextInvalid,\n isValid = _ref.isValid,\n helperText = _ref.helperText,\n labelIcon = _ref.labelIcon,\n onClick = _ref.onClick,\n rest = _objectWithoutPropertiesLoose(_ref, _excluded);\n\n return createElement(FormGroup, Object.assign({\n className: 'form-group',\n helperTextInvalid: helperTextInvalid,\n helperText: helperText,\n validated: isValid ? ValidatedOptions[\"default\"] : ValidatedOptions.error\n }, labelIcon && {\n labelIcon: labelIcon\n }, onClick && {\n onClick: onClick\n }, rest), children);\n};\n\nexport { FormGroupContainer };\n","import * as React from 'react';\nimport { FormGroupContainer } from '@rhc-shared-components/form-group-container';\nimport { useField, useFormikContext } from 'formik';\nimport { ValidatedOptions } from '@patternfly/react-core';\nimport RichTextEditor from './RichTextEditor';\n\nexport interface RichTextEditorFormComponentProps {\n name: string;\n label: string;\n disabled?: boolean;\n isRequired?: boolean;\n placeholder?: string;\n ariaLabel?: string;\n helperText?: string;\n maxItems?: number;\n maxHeight?: string | number;\n}\n\nconst RichTextEditorFormComponent: React.FC<RichTextEditorFormComponentProps> =\n ({\n label,\n isRequired,\n ariaLabel = 'Enter text',\n placeholder,\n helperText,\n maxItems,\n maxHeight,\n disabled,\n ...rest\n }) => {\n const [, meta] = useField({ name: rest.name });\n const { value } = meta;\n const editorRef = React.useRef(null);\n const { isSubmitting, setFieldValue, validateField } = useFormikContext();\n return (\n <FormGroupContainer\n validated={\n meta.error ? ValidatedOptions.error : ValidatedOptions.default\n }\n onClick={() => {\n if (editorRef) {\n // @ts-ignore\n editorRef.current.editing.view.focus();\n }\n }}\n fieldId={rest.name}\n helperTextInvalid={meta.error}\n isRequired={isRequired}\n label={label}\n helperText={helperText}\n >\n <RichTextEditor\n value={value}\n id={rest.name}\n name={rest.name}\n onReady={(editor) => {\n editorRef.current = editor;\n }}\n disabled={disabled || isSubmitting}\n onChange={(data) => {\n setFieldValue(rest.name, data);\n validateField(rest.name);\n }}\n onBlur={(data) => {\n setFieldValue(rest.name, data);\n validateField(rest.name);\n }}\n />\n </FormGroupContainer>\n );\n };\n\nexport default RichTextEditorFormComponent;\n"],"names":["RichTextEditor","value","disabled","onReady","onChange","onError","onBlur","onFocus","id","name","eventHandlerWrapper","handler","event","editor","getData","React","CKEditor","ClassicEditor","data","config","heading","options","model","title","view","classes","toolbar","items","table","contentToolbar","_objectWithoutPropertiesLoose","source","excluded","target","sourceKeys","Object","keys","key","i","length","indexOf","_excluded","FormGroupContainer","_ref","children","helperTextInvalid","isValid","helperText","labelIcon","onClick","rest","createElement","FormGroup","assign","className","validated","ValidatedOptions","error","RichTextEditorFormComponent","label","isRequired","maxItems","useField","meta","editorRef","useFormikContext","isSubmitting","setFieldValue","validateField","current","editing","focus","fieldId"],"mappings":";;;;;;;;AAsBA,IAAMA,cAAc,GAAkC,SAAhDA,cAAgD;MACpDC,aAAAA;MACAC,gBAAAA;MACAC,eAAAA;MACAC,iBAAAA;MACAC,gBAA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C,IAAI,CAACzC;AACXN,IAAAA,OAAO,EAAE,iBAACU,MAAD;AACPmD,MAAAA,SAAS,CAACK,OAAV,GAAoBxD,MAApB;AACD;AACDX,IAAAA,QAAQ,EAAEA,QAAQ,IAAIgE;AACtB9D,IAAAA,QAAQ,EAAE,kBAACc,IAAD;AACRiD,MAAAA,aAAa,CAACjB,IAAI,CAACzC,IAAN,EAAYS,IAAZ,CAAb;AACAkD,MAAAA,aAAa,CAAClB,IAAI,CAACzC,IAAN,CAAb;AACD;AACDH,IAAAA,MAAM,EAAE,gBAACY,IAAD;AACNiD,MAAAA,aAAa,CAACjB,IAAI,CAACzC,IAAN,EAAYS,IAAZ,CAAb;AACAkD,MAAAA,aAAa,CAAClB,IAAI,CAACzC,IAAN,CAAb;AACD;GAfH,CAhBF,CADF;AAoCD,CApDH;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/RichTextEditor.tsx","../../form-group-container/dist/index.modern.js","../src/RichTextEditorFormComponent.tsx"],"sourcesContent":["import * as React from 'react';\nimport { CKEditor } from '@ckeditor/ckeditor5-react';\nimport ClassicEditor from '@ckeditor/ckeditor5-build-classic';\nimport styles from './RichTextEditor.scss';\n\ntype RichTextEditorFunctionType = (\n value: string,\n event?: Event,\n editor?: ClassicEditor\n) => void;\n\nexport interface RichTextEditorProps {\n value: string;\n disabled?: boolean;\n onReady?: (editor: ClassicEditor) => void;\n onChange?: RichTextEditorFunctionType;\n onBlur?: RichTextEditorFunctionType;\n onFocus?: RichTextEditorFunctionType;\n onError?: RichTextEditorFunctionType;\n id?: string;\n name?: string;\n}\n\nconst RichTextEditor: React.FC<RichTextEditorProps> = ({\n value,\n disabled,\n onReady,\n onChange,\n onError,\n onBlur,\n onFocus,\n id,\n name\n}) => {\n const eventHandlerWrapper = (\n handler: RichTextEditorFunctionType | undefined,\n event: Event | undefined,\n editor: ClassicEditor | undefined\n ) => {\n if (handler) {\n handler(editor.getData(), event, editor);\n }\n };\n InsertCss();\n return (\n <div className='rich-text-editor-custom'>\n <CKEditor\n disabled={disabled}\n editor={ClassicEditor}\n data={value}\n config={{\n heading: {\n options: [\n {\n model: 'paragraph',\n title: 'Paragraph'\n },\n {\n model: 'heading1',\n view: {\n name: 'h1'\n },\n title: 'Heading 1'\n },\n {\n model: 'heading2',\n view: {\n name: 'h2'\n },\n title: 'Heading 2'\n },\n {\n model: 'heading3',\n view: {\n name: 'h4'\n },\n title: 'Heading 3'\n },\n {\n model: 'heading4',\n view: {\n name: 'h4'\n },\n title: 'Heading 4'\n }\n ]\n },\n toolbar: {\n items: [\n 'heading',\n '|',\n 'bold',\n 'italic',\n 'link',\n 'bulletedList',\n 'numberedList',\n '|',\n 'blockQuote',\n 'insertTable',\n 'undo',\n 'redo'\n ]\n },\n table: {\n contentToolbar: ['tableColumn', 'tableRow', 'mergeTableCells']\n }\n }}\n onReady={onReady}\n onChange={(event?: Event, editor?: ClassicEditor) => {\n eventHandlerWrapper(onChange, event, editor);\n }}\n onBlur={(event?: Event, editor?: ClassicEditor) => {\n eventHandlerWrapper(onBlur, event, editor);\n }}\n onFocus={(event?: Event, editor?: ClassicEditor) => {\n eventHandlerWrapper(onFocus, event, editor);\n }}\n onError={(event?: Event, editor?: ClassicEditor) => {\n eventHandlerWrapper(onError, event, editor);\n }}\n {...(id && { id })}\n {...(name && { name })}\n />\n </div>\n );\n};\n\nconst InsertCss = () => {\n const styleId = 'rich-test-editor-styles';\n if (!document.getElementById(styleId)) {\n const styleTag = document.createElement('style');\n styleTag.id = styleId;\n styleTag.type = 'text/css';\n styleTag.innerHTML = styles;\n document.body.appendChild(styleTag);\n }\n};\n\nexport default RichTextEditor;\n","import { createElement } from 'react';\nimport { FormGroup, ValidatedOptions } from '@patternfly/react-core';\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nvar _excluded = [\"children\", \"helperTextInvalid\", \"isValid\", \"helperText\", \"labelIcon\", \"onClick\"];\n\nvar FormGroupContainer = function FormGroupContainer(_ref) {\n var children = _ref.children,\n helperTextInvalid = _ref.helperTextInvalid,\n isValid = _ref.isValid,\n helperText = _ref.helperText,\n labelIcon = _ref.labelIcon,\n onClick = _ref.onClick,\n rest = _objectWithoutPropertiesLoose(_ref, _excluded);\n\n return createElement(FormGroup, Object.assign({\n className: 'form-group',\n helperTextInvalid: helperTextInvalid,\n helperText: helperText,\n validated: isValid ? ValidatedOptions[\"default\"] : ValidatedOptions.error\n }, labelIcon && {\n labelIcon: labelIcon\n }, onClick && {\n onClick: onClick\n }, rest), children);\n};\n\nexport { FormGroupContainer };\n","import * as React from 'react';\nimport { FormGroupContainer } from '@rhc-shared-components/form-group-container';\nimport { useField, useFormikContext } from 'formik';\nimport { ValidatedOptions } from '@patternfly/react-core';\nimport RichTextEditor from './RichTextEditor';\n\nexport interface RichTextEditorFormComponentProps {\n name: string;\n label: string;\n disabled?: boolean;\n isRequired?: boolean;\n placeholder?: string;\n ariaLabel?: string;\n helperText?: string;\n maxItems?: number;\n maxHeight?: string | number;\n}\n\nconst RichTextEditorFormComponent: React.FC<RichTextEditorFormComponentProps> =\n ({\n label,\n isRequired,\n ariaLabel = 'Enter text',\n placeholder,\n helperText,\n maxItems,\n maxHeight,\n disabled,\n ...rest\n }) => {\n const [, meta] = useField({ name: rest.name });\n const { value } = meta;\n const editorRef = React.useRef(null);\n const { isSubmitting, setFieldValue, validateField } = useFormikContext();\n return (\n <FormGroupContainer\n validated={\n meta.error ? ValidatedOptions.error : ValidatedOptions.default\n }\n onClick={() => {\n if (editorRef) {\n // @ts-ignore\n editorRef.current.editing.view.focus();\n }\n }}\n fieldId={rest.name}\n helperTextInvalid={meta.error}\n isRequired={isRequired}\n label={label}\n helperText={helperText}\n >\n <RichTextEditor\n value={value}\n id={rest.name}\n name={rest.name}\n onReady={(editor) => {\n editorRef.current = editor;\n }}\n disabled={disabled || isSubmitting}\n onChange={(data) => {\n setFieldValue(rest.name, data);\n validateField(rest.name);\n }}\n onBlur={(data) => {\n setFieldValue(rest.name, data);\n validateField(rest.name);\n }}\n />\n </FormGroupContainer>\n );\n };\n\nexport default RichTextEditorFormComponent;\n"],"names":["RichTextEditor","value","disabled","onReady","onChange","onError","onBlur","onFocus","id","name","eventHandlerWrapper","handler","event","editor","getData","InsertCss","React","className","CKEditor","ClassicEditor","data","config","heading","options","model","title","view","toolbar","items","table","contentToolbar","styleId","document","getElementById","styleTag","createElement","type","innerHTML","styles","body","appendChild","_objectWithoutPropertiesLoose","source","excluded","target","sourceKeys","Object","keys","key","i","length","indexOf","_excluded","FormGroupContainer","_ref","children","helperTextInvalid","isValid","helperText","labelIcon","onClick","rest","FormGroup","assign","validated","ValidatedOptions","error","RichTextEditorFormComponent","label","isRequired","useField","meta","editorRef","useRef","useFormikContext","isSubmitting","setFieldValue","validateField","current","editing","focus","fieldId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAuBMA,cAAc,GAAkC,SAAhDA,cAAgD;MACpDC,aAAAA;MACAC,gBAAAA;MACAC,eAAAA;MACAC,iBAAAA;MACAC,gBAAAA;MACAC,eAAAA;MACAC,gBAAAA;MACAC,UAAAA;MACAC,YAAAA;;AAEA,MAAMC,mBAAmB,GAAG,SAAtBA,mBAAsB,CAC1BC,OAD0B,EAE1BC,KAF0B,EAG1BC,MAH0B;AAK1B,QAAIF,OAAJ,EAAa;AACXA,MAAAA,OAAO,CAACE,MAAM,CAACC,OAAP,EAAD,EAAmBF,KAAnB,EAA0BC,MAA1B,CAAP;AACD;AACF,GARD;;AASAE,EAAAA,SAAS;AACT,SACEC,8BAAA,MAAA;AAAKC,IAAAA,SAAS,EAAC;GAAf,EACED,8BAAA,CAACE,uBAAD;AACEhB,IAAAA,QAAQ,EAAEA;AACVW,IAAAA,MAAM,EAAEM;AACRC,IAAAA,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B,IAAD;AACRwD,MAAAA,aAAa,CAACf,IAAI,CAACpD,IAAN,EAAYW,IAAZ,CAAb;AACAyD,MAAAA,aAAa,CAAChB,IAAI,CAACpD,IAAN,CAAb;AACD;AACDH,IAAAA,MAAM,EAAE,gBAACc,IAAD;AACNwD,MAAAA,aAAa,CAACf,IAAI,CAACpD,IAAN,EAAYW,IAAZ,CAAb;AACAyD,MAAAA,aAAa,CAAChB,IAAI,CAACpD,IAAN,CAAb;AACD;GAfH,CAhBF,CADF;AAoCD;;;;;"}
@@ -1,27 +1,33 @@
1
- import { createElement, useRef } from 'react';
1
+ import * as React from 'react';
2
+ import { createElement } from 'react';
2
3
  import { CKEditor } from '@ckeditor/ckeditor5-react';
3
4
  import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
4
5
  import { FormGroup, ValidatedOptions } from '@patternfly/react-core';
5
6
  import { useField, useFormikContext } from 'formik';
6
7
 
7
- var RichTextEditor = function RichTextEditor(_ref) {
8
- var value = _ref.value,
9
- disabled = _ref.disabled,
10
- onReady = _ref.onReady,
11
- _onChange = _ref.onChange,
12
- _onError = _ref.onError,
13
- _onBlur = _ref.onBlur,
14
- _onFocus = _ref.onFocus,
15
- id = _ref.id,
16
- name = _ref.name;
17
-
18
- var eventHandlerWrapper = function eventHandlerWrapper(handler, event, editor) {
8
+ var css_248z = ".rich-text-editor-custom {\n --pf-c-title--m-2xl--LineHeight: var(--pf-global--LineHeight--sm);\n --pf-c-title--m-2xl--FontSize: var(--pf-global--FontSize--2xl);\n --pf-c-title--m-2xl--FontWeight: var(--pf-global--FontWeight--normal);\n --pf-c-title--m-xl--LineHeight: var(--pf-global--LineHeight--md);\n --pf-c-title--m-xl--FontSize: var(--pf-global--FontSize--xl);\n --pf-c-title--m-xl--FontWeight: var(--pf-global--FontWeight--normal);\n --pf-c-title--m-lg--LineHeight: var(--pf-global--LineHeight--md);\n --pf-c-title--m-lg--FontSize: var(--pf-global--FontSize--lg);\n --pf-c-title--m-lg--FontWeight: var(--pf-global--FontWeight--normal);\n --pf-c-title--m-md--LineHeight: var(--pf-global--LineHeight--md);\n --pf-c-title--m-md--FontSize: var(--pf-global--FontSize--md);\n --pf-c-title--m-md--FontWeight: var(--pf-global--FontWeight--normal); }\n .rich-text-editor-custom h1 {\n font-size: var(--pf-c-title--m-2xl--FontSize);\n font-weight: var(--pf-c-title--m-2xl--FontWeight);\n line-height: var(--pf-c-title--m-2xl--LineHeight); }\n .rich-text-editor-custom h2 {\n font-size: var(--pf-c-title--m-xl--FontSize);\n font-weight: var(--pf-c-title--m-xl--FontWeight);\n line-height: var(--pf-c-title--m-xl--LineHeight); }\n .rich-text-editor-custom h3 {\n font-size: var(--pf-c-title--m-lg--FontSize);\n font-weight: var(--pf-c-title--m-lg--FontWeight);\n line-height: var(--pf-c-title--m-lg--LineHeight); }\n .rich-text-editor-custom h4 {\n font-size: var(--pf-c-title--m-md--FontSize);\n font-weight: var(--pf-c-title--m-md--FontWeight);\n line-height: var(--pf-c-title--m-md--LineHeight); }\n .rich-text-editor-custom ul {\n display: block;\n list-style-type: disc;\n -webkit-margin-before: 1em;\n margin-block-start: 1em;\n -webkit-margin-after: 1em;\n margin-block-end: 1em;\n -webkit-margin-start: 0px;\n margin-inline-start: 0px;\n -webkit-margin-end: 0px;\n margin-inline-end: 0px;\n -webkit-padding-start: 40px;\n padding-inline-start: 40px; }\n .rich-text-editor-custom ul li {\n display: list-item; }\n .rich-text-editor-custom ul ul {\n list-style-type: circle;\n -webkit-margin-before: 0px;\n margin-block-start: 0px;\n -webkit-margin-after: 0px;\n margin-block-end: 0px; }\n .rich-text-editor-custom ol {\n display: block;\n list-style-type: decimal;\n -webkit-margin-before: 1em;\n margin-block-start: 1em;\n -webkit-margin-after: 1em;\n margin-block-end: 1em;\n -webkit-margin-start: 0px;\n margin-inline-start: 0px;\n -webkit-margin-end: 0px;\n margin-inline-end: 0px;\n -webkit-padding-start: 40px;\n padding-inline-start: 40px; }\n";
9
+
10
+ const RichTextEditor = ({
11
+ value,
12
+ disabled,
13
+ onReady,
14
+ onChange,
15
+ onError,
16
+ onBlur,
17
+ onFocus,
18
+ id,
19
+ name
20
+ }) => {
21
+ const eventHandlerWrapper = (handler, event, editor) => {
19
22
  if (handler) {
20
23
  handler(editor.getData(), event, editor);
21
24
  }
22
25
  };
23
26
 
24
- return createElement("div", null, createElement(CKEditor, Object.assign({
27
+ InsertCss();
28
+ return React.createElement("div", {
29
+ className: 'rich-text-editor-custom'
30
+ }, React.createElement(CKEditor, Object.assign({
25
31
  disabled: disabled,
26
32
  editor: ClassicEditor,
27
33
  data: value,
@@ -33,35 +39,27 @@ var RichTextEditor = function RichTextEditor(_ref) {
33
39
  }, {
34
40
  model: 'heading1',
35
41
  view: {
36
- name: 'h1',
37
- classes: 'pf-c-title pf-m-2xl'
42
+ name: 'h1'
38
43
  },
39
- title: 'Heading 1',
40
- "class": 'ck-heading_heading1'
44
+ title: 'Heading 1'
41
45
  }, {
42
46
  model: 'heading2',
43
47
  view: {
44
- name: 'h2',
45
- classes: 'pf-c-title pf-m-xl'
48
+ name: 'h2'
46
49
  },
47
- title: 'Heading 2',
48
- "class": 'ck-heading_heading2'
50
+ title: 'Heading 2'
49
51
  }, {
50
52
  model: 'heading3',
51
53
  view: {
52
- name: 'h4',
53
- classes: 'pf-c-title pf-m-lg'
54
+ name: 'h4'
54
55
  },
55
- title: 'Heading 3',
56
- "class": 'ck-heading_heading3'
56
+ title: 'Heading 3'
57
57
  }, {
58
58
  model: 'heading4',
59
59
  view: {
60
- name: 'h4',
61
- classes: 'pf-c-title pf-m-md'
60
+ name: 'h4'
62
61
  },
63
- title: 'Heading 4',
64
- "class": 'ck-heading_heading4'
62
+ title: 'Heading 4'
65
63
  }]
66
64
  },
67
65
  toolbar: {
@@ -72,26 +70,38 @@ var RichTextEditor = function RichTextEditor(_ref) {
72
70
  }
73
71
  },
74
72
  onReady: onReady,
75
- onChange: function onChange(event, editor) {
76
- eventHandlerWrapper(_onChange, event, editor);
73
+ onChange: (event, editor) => {
74
+ eventHandlerWrapper(onChange, event, editor);
77
75
  },
78
- onBlur: function onBlur(event, editor) {
79
- eventHandlerWrapper(_onBlur, event, editor);
76
+ onBlur: (event, editor) => {
77
+ eventHandlerWrapper(onBlur, event, editor);
80
78
  },
81
- onFocus: function onFocus(event, editor) {
82
- eventHandlerWrapper(_onFocus, event, editor);
79
+ onFocus: (event, editor) => {
80
+ eventHandlerWrapper(onFocus, event, editor);
83
81
  },
84
- onError: function onError(event, editor) {
85
- eventHandlerWrapper(_onError, event, editor);
82
+ onError: (event, editor) => {
83
+ eventHandlerWrapper(onError, event, editor);
86
84
  }
87
85
  }, id && {
88
- id: id
86
+ id
89
87
  }, name && {
90
- name: name
88
+ name
91
89
  })));
92
90
  };
93
91
 
94
- function _objectWithoutPropertiesLoose(source, excluded) {
92
+ const InsertCss = () => {
93
+ const styleId = 'rich-test-editor-styles';
94
+
95
+ if (!document.getElementById(styleId)) {
96
+ const styleTag = document.createElement('style');
97
+ styleTag.id = styleId;
98
+ styleTag.type = 'text/css';
99
+ styleTag.innerHTML = css_248z;
100
+ document.body.appendChild(styleTag);
101
+ }
102
+ };
103
+
104
+ function _objectWithoutPropertiesLoose$1(source, excluded) {
95
105
  if (source == null) return {};
96
106
  var target = {};
97
107
  var sourceKeys = Object.keys(source);
@@ -106,7 +116,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
106
116
  return target;
107
117
  }
108
118
 
109
- function _objectWithoutPropertiesLoose$1(source, excluded) {
119
+ function _objectWithoutPropertiesLoose(source, excluded) {
110
120
  if (source == null) return {};
111
121
  var target = {};
112
122
  var sourceKeys = Object.keys(source);
@@ -121,7 +131,7 @@ function _objectWithoutPropertiesLoose$1(source, excluded) {
121
131
  return target;
122
132
  }
123
133
 
124
- var _excluded = ["children", "helperTextInvalid", "isValid", "helperText", "labelIcon", "onClick"];
134
+ var _excluded$1 = ["children", "helperTextInvalid", "isValid", "helperText", "labelIcon", "onClick"];
125
135
 
126
136
  var FormGroupContainer = function FormGroupContainer(_ref) {
127
137
  var children = _ref.children,
@@ -130,7 +140,7 @@ var FormGroupContainer = function FormGroupContainer(_ref) {
130
140
  helperText = _ref.helperText,
131
141
  labelIcon = _ref.labelIcon,
132
142
  onClick = _ref.onClick,
133
- rest = _objectWithoutPropertiesLoose$1(_ref, _excluded);
143
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
134
144
 
135
145
  return createElement(FormGroup, Object.assign({
136
146
  className: 'form-group',
@@ -144,32 +154,35 @@ var FormGroupContainer = function FormGroupContainer(_ref) {
144
154
  }, rest), children);
145
155
  };
146
156
 
147
- var _excluded$1 = ["label", "isRequired", "ariaLabel", "placeholder", "helperText", "maxItems", "maxHeight", "disabled"];
157
+ const _excluded = ["label", "isRequired", "ariaLabel", "placeholder", "helperText", "maxItems", "maxHeight", "disabled"];
148
158
 
149
- var RichTextEditorFormComponent = function RichTextEditorFormComponent(_ref) {
150
- var label = _ref.label,
151
- isRequired = _ref.isRequired,
152
- helperText = _ref.helperText,
153
- disabled = _ref.disabled,
154
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
159
+ const RichTextEditorFormComponent = _ref => {
160
+ let {
161
+ label,
162
+ isRequired,
163
+ ariaLabel = 'Enter text',
164
+ helperText,
165
+ disabled
166
+ } = _ref,
167
+ rest = _objectWithoutPropertiesLoose$1(_ref, _excluded);
155
168
 
156
- var _useField = useField({
169
+ const [, meta] = useField({
157
170
  name: rest.name
158
- }),
159
- meta = _useField[1];
160
-
161
- var value = meta.value;
162
- var editorRef = useRef(null);
163
-
164
- var _useFormikContext = useFormikContext(),
165
- isSubmitting = _useFormikContext.isSubmitting,
166
- setFieldValue = _useFormikContext.setFieldValue,
167
- validateField = _useFormikContext.validateField;
168
-
169
- return createElement(FormGroupContainer, {
170
- validated: meta.error ? ValidatedOptions.error : ValidatedOptions["default"],
171
- onClick: function onClick() {
171
+ });
172
+ const {
173
+ value
174
+ } = meta;
175
+ const editorRef = React.useRef(null);
176
+ const {
177
+ isSubmitting,
178
+ setFieldValue,
179
+ validateField
180
+ } = useFormikContext();
181
+ return React.createElement(FormGroupContainer, {
182
+ validated: meta.error ? ValidatedOptions.error : ValidatedOptions.default,
183
+ onClick: () => {
172
184
  if (editorRef) {
185
+ // @ts-ignore
173
186
  editorRef.current.editing.view.focus();
174
187
  }
175
188
  },
@@ -178,19 +191,19 @@ var RichTextEditorFormComponent = function RichTextEditorFormComponent(_ref) {
178
191
  isRequired: isRequired,
179
192
  label: label,
180
193
  helperText: helperText
181
- }, createElement(RichTextEditor, {
194
+ }, React.createElement(RichTextEditor, {
182
195
  value: value,
183
196
  id: rest.name,
184
197
  name: rest.name,
185
- onReady: function onReady(editor) {
198
+ onReady: editor => {
186
199
  editorRef.current = editor;
187
200
  },
188
201
  disabled: disabled || isSubmitting,
189
- onChange: function onChange(data) {
202
+ onChange: data => {
190
203
  setFieldValue(rest.name, data);
191
204
  validateField(rest.name);
192
205
  },
193
- onBlur: function onBlur(data) {
206
+ onBlur: data => {
194
207
  setFieldValue(rest.name, data);
195
208
  validateField(rest.name);
196
209
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.modern.js","sources":["../src/RichTextEditor.tsx","../../form-group-container/dist/index.modern.js","../src/RichTextEditorFormComponent.tsx"],"sourcesContent":["import * as React from 'react';\nimport { CKEditor } from '@ckeditor/ckeditor5-react';\nimport ClassicEditor from '@ckeditor/ckeditor5-build-classic';\n\ntype RichTextEditorFunctionType = (\n value: string,\n event?: Event,\n editor?: ClassicEditor\n) => void;\n\nexport interface RichTextEditorProps {\n value: string;\n disabled?: boolean;\n onReady?: (editor: ClassicEditor) => void;\n onChange?: RichTextEditorFunctionType;\n onBlur?: RichTextEditorFunctionType;\n onFocus?: RichTextEditorFunctionType;\n onError?: RichTextEditorFunctionType;\n id?: string;\n name?: string;\n}\n\nconst RichTextEditor: React.FC<RichTextEditorProps> = ({\n value,\n disabled,\n onReady,\n onChange,\n onError,\n onBlur,\n onFocus,\n id,\n name\n}) => {\n const eventHandlerWrapper = (\n handler: RichTextEditorFunctionType | undefined,\n event: Event | undefined,\n editor: ClassicEditor | undefined\n ) => {\n if (handler) {\n handler(editor.getData(), event, editor);\n }\n };\n return (\n <div>\n <CKEditor\n disabled={disabled}\n editor={ClassicEditor}\n data={value}\n config={{\n heading: {\n options: [\n {\n model: 'paragraph',\n title: 'Paragraph'\n },\n {\n model: 'heading1',\n view: {\n name: 'h1',\n classes: 'pf-c-title pf-m-2xl'\n },\n title: 'Heading 1',\n class: 'ck-heading_heading1'\n },\n {\n model: 'heading2',\n view: {\n name: 'h2',\n classes: 'pf-c-title pf-m-xl'\n },\n title: 'Heading 2',\n class: 'ck-heading_heading2'\n },\n {\n model: 'heading3',\n view: {\n name: 'h4',\n classes: 'pf-c-title pf-m-lg'\n },\n title: 'Heading 3',\n class: 'ck-heading_heading3'\n },\n {\n model: 'heading4',\n view: {\n name: 'h4',\n classes: 'pf-c-title pf-m-md'\n },\n title: 'Heading 4',\n class: 'ck-heading_heading4'\n }\n ]\n },\n toolbar: {\n items: [\n 'heading',\n '|',\n 'bold',\n 'italic',\n 'link',\n 'bulletedList',\n 'numberedList',\n '|',\n 'blockQuote',\n 'insertTable',\n 'undo',\n 'redo'\n ]\n },\n table: {\n contentToolbar: ['tableColumn', 'tableRow', 'mergeTableCells']\n }\n }}\n onReady={onReady}\n onChange={(event?: Event, editor?: ClassicEditor) => {\n eventHandlerWrapper(onChange, event, editor);\n }}\n onBlur={(event?: Event, editor?: ClassicEditor) => {\n eventHandlerWrapper(onBlur, event, editor);\n }}\n onFocus={(event?: Event, editor?: ClassicEditor) => {\n eventHandlerWrapper(onFocus, event, editor);\n }}\n onError={(event?: Event, editor?: ClassicEditor) => {\n eventHandlerWrapper(onError, event, editor);\n }}\n {...(id && { id })}\n {...(name && { name })}\n />\n </div>\n );\n};\n\nexport default RichTextEditor;\n","import { createElement } from 'react';\nimport { FormGroup, ValidatedOptions } from '@patternfly/react-core';\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nvar _excluded = [\"children\", \"helperTextInvalid\", \"isValid\", \"helperText\", \"labelIcon\", \"onClick\"];\n\nvar FormGroupContainer = function FormGroupContainer(_ref) {\n var children = _ref.children,\n helperTextInvalid = _ref.helperTextInvalid,\n isValid = _ref.isValid,\n helperText = _ref.helperText,\n labelIcon = _ref.labelIcon,\n onClick = _ref.onClick,\n rest = _objectWithoutPropertiesLoose(_ref, _excluded);\n\n return createElement(FormGroup, Object.assign({\n className: 'form-group',\n helperTextInvalid: helperTextInvalid,\n helperText: helperText,\n validated: isValid ? ValidatedOptions[\"default\"] : ValidatedOptions.error\n }, labelIcon && {\n labelIcon: labelIcon\n }, onClick && {\n onClick: onClick\n }, rest), children);\n};\n\nexport { FormGroupContainer };\n","import * as React from 'react';\nimport { FormGroupContainer } from '@rhc-shared-components/form-group-container';\nimport { useField, useFormikContext } from 'formik';\nimport { ValidatedOptions } from '@patternfly/react-core';\nimport RichTextEditor from './RichTextEditor';\n\nexport interface RichTextEditorFormComponentProps {\n name: string;\n label: string;\n disabled?: boolean;\n isRequired?: boolean;\n placeholder?: string;\n ariaLabel?: string;\n helperText?: string;\n maxItems?: number;\n maxHeight?: string | number;\n}\n\nconst RichTextEditorFormComponent: React.FC<RichTextEditorFormComponentProps> =\n ({\n label,\n isRequired,\n ariaLabel = 'Enter text',\n placeholder,\n helperText,\n maxItems,\n maxHeight,\n disabled,\n ...rest\n }) => {\n const [, meta] = useField({ name: rest.name });\n const { value } = meta;\n const editorRef = React.useRef(null);\n const { isSubmitting, setFieldValue, validateField } = useFormikContext();\n return (\n <FormGroupContainer\n validated={\n meta.error ? ValidatedOptions.error : ValidatedOptions.default\n }\n onClick={() => {\n if (editorRef) {\n // @ts-ignore\n editorRef.current.editing.view.focus();\n }\n }}\n fieldId={rest.name}\n helperTextInvalid={meta.error}\n isRequired={isRequired}\n label={label}\n helperText={helperText}\n >\n <RichTextEditor\n value={value}\n id={rest.name}\n name={rest.name}\n onReady={(editor) => {\n editorRef.current = editor;\n }}\n disabled={disabled || isSubmitting}\n onChange={(data) => {\n setFieldValue(rest.name, data);\n validateField(rest.name);\n }}\n onBlur={(data) => {\n setFieldValue(rest.name, data);\n validateField(rest.name);\n }}\n />\n </FormGroupContainer>\n );\n };\n\nexport default RichTextEditorFormComponent;\n"],"names":["RichTextEditor","value","disabled","onReady","onChange","onError","onBlur","onFocus","id","name","eventHandlerWrapper","handler","event","editor","getData","React","CKEditor","ClassicEditor","data","config","heading","options","model","title","view","classes","class","toolbar","items","table","contentToolbar","_objectWithoutPropertiesLoose","source","excluded","target","sourceKeys","Object","keys","key","i","length","indexOf","_excluded","FormGroupContainer","_ref","children","helperTextInvalid","isValid","helperText","labelIcon","onClick","rest","createElement","FormGroup","assign","className","validated","ValidatedOptions","error","RichTextEditorFormComponent","label","isRequired","ariaLabel","placeholder","maxItems","maxHeight","meta","useField","editorRef","isSubmitting","setFieldValue","validateField","useFormikContext","default","current","editing","focus","fieldId"],"mappings":";;;;;;AAsBA,MAAMA,cAAc,GAAkC,CAAC;AACrDC,EAAAA,KADqD;AAErDC,EAAAA,QAFqD;AAGrDC,EAAAA,OAHqD;AAIrDC,EAAAA,QAJqD;AAKrDC,EAAAA,OALqD;AAMrDC,EAAAA,MANqD;AAOrDC,EAAAA,OAPqD;AAQrDC,EAAAA,EARqD;AASrDC,EAAAA;AATqD,CAAD;AAWpD,QAAMC,mBAAmB,GAAG,CAC1BC,OAD0B,EAE1BC,KAF0B,EAG1BC,MAH0B;AAK1B,QAAIF,OAAJ,EAAa;AACXA,MAAAA,OAAO,CAACE,MAAM,CAACC,OAAP,EAAD,EAAmBF,KAAnB,EAA0BC,MAA1B,CAAP;AACD;AACF,GARD;;AASA,SACEE,aAAA,MAAA,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IAAN,EAAYS,IAAZ,CAAb;AACAqD,MAAAA,aAAa,CAACpB,IAAI,CAAC1C,IAAN,CAAb;AACD;AACDH,IAAAA,MAAM,EAAGY,IAAD;AACNoD,MAAAA,aAAa,CAACnB,IAAI,CAAC1C,IAAN,EAAYS,IAAZ,CAAb;AACAqD,MAAAA,aAAa,CAACpB,IAAI,CAAC1C,IAAN,CAAb;AACD;GAfH,CAhBF,CADF;AAoCD,CApDH;;;;"}
1
+ {"version":3,"file":"index.modern.js","sources":["../src/RichTextEditor.tsx","../../form-group-container/dist/index.modern.js","../src/RichTextEditorFormComponent.tsx"],"sourcesContent":["import * as React from 'react';\nimport { CKEditor } from '@ckeditor/ckeditor5-react';\nimport ClassicEditor from '@ckeditor/ckeditor5-build-classic';\nimport styles from './RichTextEditor.scss';\n\ntype RichTextEditorFunctionType = (\n value: string,\n event?: Event,\n editor?: ClassicEditor\n) => void;\n\nexport interface RichTextEditorProps {\n value: string;\n disabled?: boolean;\n onReady?: (editor: ClassicEditor) => void;\n onChange?: RichTextEditorFunctionType;\n onBlur?: RichTextEditorFunctionType;\n onFocus?: RichTextEditorFunctionType;\n onError?: RichTextEditorFunctionType;\n id?: string;\n name?: string;\n}\n\nconst RichTextEditor: React.FC<RichTextEditorProps> = ({\n value,\n disabled,\n onReady,\n onChange,\n onError,\n onBlur,\n onFocus,\n id,\n name\n}) => {\n const eventHandlerWrapper = (\n handler: RichTextEditorFunctionType | undefined,\n event: Event | undefined,\n editor: ClassicEditor | undefined\n ) => {\n if (handler) {\n handler(editor.getData(), event, editor);\n }\n };\n InsertCss();\n return (\n <div className='rich-text-editor-custom'>\n <CKEditor\n disabled={disabled}\n editor={ClassicEditor}\n data={value}\n config={{\n heading: {\n options: [\n {\n model: 'paragraph',\n title: 'Paragraph'\n },\n {\n model: 'heading1',\n view: {\n name: 'h1'\n },\n title: 'Heading 1'\n },\n {\n model: 'heading2',\n view: {\n name: 'h2'\n },\n title: 'Heading 2'\n },\n {\n model: 'heading3',\n view: {\n name: 'h4'\n },\n title: 'Heading 3'\n },\n {\n model: 'heading4',\n view: {\n name: 'h4'\n },\n title: 'Heading 4'\n }\n ]\n },\n toolbar: {\n items: [\n 'heading',\n '|',\n 'bold',\n 'italic',\n 'link',\n 'bulletedList',\n 'numberedList',\n '|',\n 'blockQuote',\n 'insertTable',\n 'undo',\n 'redo'\n ]\n },\n table: {\n contentToolbar: ['tableColumn', 'tableRow', 'mergeTableCells']\n }\n }}\n onReady={onReady}\n onChange={(event?: Event, editor?: ClassicEditor) => {\n eventHandlerWrapper(onChange, event, editor);\n }}\n onBlur={(event?: Event, editor?: ClassicEditor) => {\n eventHandlerWrapper(onBlur, event, editor);\n }}\n onFocus={(event?: Event, editor?: ClassicEditor) => {\n eventHandlerWrapper(onFocus, event, editor);\n }}\n onError={(event?: Event, editor?: ClassicEditor) => {\n eventHandlerWrapper(onError, event, editor);\n }}\n {...(id && { id })}\n {...(name && { name })}\n />\n </div>\n );\n};\n\nconst InsertCss = () => {\n const styleId = 'rich-test-editor-styles';\n if (!document.getElementById(styleId)) {\n const styleTag = document.createElement('style');\n styleTag.id = styleId;\n styleTag.type = 'text/css';\n styleTag.innerHTML = styles;\n document.body.appendChild(styleTag);\n }\n};\n\nexport default RichTextEditor;\n","import { createElement } from 'react';\nimport { FormGroup, ValidatedOptions } from '@patternfly/react-core';\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nvar _excluded = [\"children\", \"helperTextInvalid\", \"isValid\", \"helperText\", \"labelIcon\", \"onClick\"];\n\nvar FormGroupContainer = function FormGroupContainer(_ref) {\n var children = _ref.children,\n helperTextInvalid = _ref.helperTextInvalid,\n isValid = _ref.isValid,\n helperText = _ref.helperText,\n labelIcon = _ref.labelIcon,\n onClick = _ref.onClick,\n rest = _objectWithoutPropertiesLoose(_ref, _excluded);\n\n return createElement(FormGroup, Object.assign({\n className: 'form-group',\n helperTextInvalid: helperTextInvalid,\n helperText: helperText,\n validated: isValid ? ValidatedOptions[\"default\"] : ValidatedOptions.error\n }, labelIcon && {\n labelIcon: labelIcon\n }, onClick && {\n onClick: onClick\n }, rest), children);\n};\n\nexport { FormGroupContainer };\n","import * as React from 'react';\nimport { FormGroupContainer } from '@rhc-shared-components/form-group-container';\nimport { useField, useFormikContext } from 'formik';\nimport { ValidatedOptions } from '@patternfly/react-core';\nimport RichTextEditor from './RichTextEditor';\n\nexport interface RichTextEditorFormComponentProps {\n name: string;\n label: string;\n disabled?: boolean;\n isRequired?: boolean;\n placeholder?: string;\n ariaLabel?: string;\n helperText?: string;\n maxItems?: number;\n maxHeight?: string | number;\n}\n\nconst RichTextEditorFormComponent: React.FC<RichTextEditorFormComponentProps> =\n ({\n label,\n isRequired,\n ariaLabel = 'Enter text',\n placeholder,\n helperText,\n maxItems,\n maxHeight,\n disabled,\n ...rest\n }) => {\n const [, meta] = useField({ name: rest.name });\n const { value } = meta;\n const editorRef = React.useRef(null);\n const { isSubmitting, setFieldValue, validateField } = useFormikContext();\n return (\n <FormGroupContainer\n validated={\n meta.error ? ValidatedOptions.error : ValidatedOptions.default\n }\n onClick={() => {\n if (editorRef) {\n // @ts-ignore\n editorRef.current.editing.view.focus();\n }\n }}\n fieldId={rest.name}\n helperTextInvalid={meta.error}\n isRequired={isRequired}\n label={label}\n helperText={helperText}\n >\n <RichTextEditor\n value={value}\n id={rest.name}\n name={rest.name}\n onReady={(editor) => {\n editorRef.current = editor;\n }}\n disabled={disabled || isSubmitting}\n onChange={(data) => {\n setFieldValue(rest.name, data);\n validateField(rest.name);\n }}\n onBlur={(data) => {\n setFieldValue(rest.name, data);\n validateField(rest.name);\n }}\n />\n </FormGroupContainer>\n );\n };\n\nexport default RichTextEditorFormComponent;\n"],"names":["RichTextEditor","value","disabled","onReady","onChange","onError","onBlur","onFocus","id","name","eventHandlerWrapper","handler","event","editor","getData","InsertCss","React","className","CKEditor","ClassicEditor","data","config","heading","options","model","title","view","toolbar","items","table","contentToolbar","styleId","document","getElementById","styleTag","createElement","type","innerHTML","styles","body","appendChild","_objectWithoutPropertiesLoose","source","excluded","target","sourceKeys","Object","keys","key","i","length","indexOf","_excluded","FormGroupContainer","_ref","children","helperTextInvalid","isValid","helperText","labelIcon","onClick","rest","FormGroup","assign","validated","ValidatedOptions","error","RichTextEditorFormComponent","label","isRequired","ariaLabel","meta","useField","editorRef","useRef","isSubmitting","setFieldValue","validateField","useFormikContext","default","current","editing","focus","fieldId"],"mappings":";;;;;;;;;MAuBMA,cAAc,GAAkC,CAAC;AACrDC,EAAAA,KADqD;AAErDC,EAAAA,QAFqD;AAGrDC,EAAAA,OAHqD;AAIrDC,EAAAA,QAJqD;AAKrDC,EAAAA,OALqD;AAMrDC,EAAAA,MANqD;AAOrDC,EAAAA,OAPqD;AAQrDC,EAAAA,EARqD;AASrDC,EAAAA;AATqD,CAAD;AAWpD,QAAMC,mBAAmB,GAAG,CAC1BC,OAD0B,EAE1BC,KAF0B,EAG1BC,MAH0B;AAK1B,QAAIF,OAAJ,EAAa;AACXA,MAAAA,OAAO,CAACE,MAAM,CAACC,OAAP,EAAD,EAAmBF,KAAnB,EAA0BC,MAA1B,CAAP;AACD;AACF,GARD;;AASAE,EAAAA,SAAS;AACT,SACEC,mBAAA,MAAA;AAAKC,IAAAA,SAAS,EAAC;GAAf,EACED,mBAAA,CAACE,QAAD;AACEhB,IAAAA,QAAQ,EAAEA;AACVW,IAAAA,MAAM,EAAEM;AACRC,IAAAA,IAAI,EAAEnB;AACNoB,IAAAA,MAAM,EAAE;AACNC,MAAAA,OAAO,EAAE;AACPC,QAAAA,OAAO,EAAE,CACP;AACEC,UAAAA,KAAK,EAAE,WADT;AAEEC,UAAAA,KAAK,EAAE;AAFT,SADO,EAKP;AACED,UAAAA,KAAK,EAAE,UADT;A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IAAI,CAACpD,IAAN,CAAb;AACD;GAfH,CAhBF,CADF;AAoCD;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhc-shared-components/rich-text-editor",
3
- "version": "0.2.2",
3
+ "version": "0.2.8",
4
4
  "description": "WYSWYG Editor for Red Hat Certified Apps",
5
5
  "author": "gautamkrishnar",
6
6
  "license": "MIT",
@@ -8,14 +8,15 @@
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.modern.js",
10
10
  "source": "src/index.tsx",
11
+ "types": "dist/index.d.ts",
11
12
  "engines": {
12
13
  "node": ">=10"
13
14
  },
14
15
  "scripts": {
15
- "build": "microbundle-crl --no-sourcemap --no-compress --format modern,cjs",
16
+ "build": "microbundle --css inline --no-sourcemap --no-compress --format modern,cjs --jsx React.createElement",
16
17
  "clean": "rimraf dist",
17
18
  "prepare": "run-s clean build",
18
- "start": "microbundle-crl watch --no-compress --format modern,cjs",
19
+ "start": "microbundle watch --css inline --no-compress --format modern,cjs --jsx React.createElement",
19
20
  "test": "run-s test:unit test:lint test:build",
20
21
  "test:build": "run-s build",
21
22
  "test:lint": "eslint src --ext .js,.jsx,.ts,.tsx --fix",
@@ -53,7 +54,7 @@
53
54
  "eslint-plugin-react": "^7.17.0",
54
55
  "eslint-plugin-standard": "^4.0.1",
55
56
  "gh-pages": "^2.2.0",
56
- "microbundle-crl": "^0.13.10",
57
+ "microbundle": "^0.13.3",
57
58
  "node-sass": "^4.0.0",
58
59
  "npm-run-all": "^4.1.5",
59
60
  "prettier": "^2.0.4",
@@ -75,5 +76,5 @@
75
76
  "react": "^16.13.1",
76
77
  "react-dom": "^16.13.1"
77
78
  },
78
- "gitHead": "87e4e6060b931fc97e5a5dca250a24244f199af8"
79
+ "gitHead": "ab1bcb8239c03b865f7b9e06bb1c13dd841d5002"
79
80
  }