@rhc-shared-components/rich-text-editor 0.5.1 → 0.5.2

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.
@@ -10,6 +10,7 @@ export interface RichTextEditorProps {
10
10
  onError?: RichTextEditorFunctionType;
11
11
  id?: string;
12
12
  name?: string;
13
+ showCodeBlock?: boolean;
13
14
  }
14
15
  declare const RichTextEditor: React.FC<RichTextEditorProps>;
15
16
  export default RichTextEditor;
@@ -9,6 +9,7 @@ export interface RichTextEditorFormComponentProps {
9
9
  helperText?: string;
10
10
  showMaxLengthText?: boolean;
11
11
  maxLength?: number;
12
+ showCodeBlock?: boolean;
12
13
  }
13
14
  declare const RichTextEditorFormComponent: React.FC<RichTextEditorFormComponentProps>;
14
15
  export default RichTextEditorFormComponent;
package/dist/index.js CHANGED
@@ -38,7 +38,8 @@ var RichTextEditor = function RichTextEditor(_ref) {
38
38
  _onBlur = _ref.onBlur,
39
39
  _onFocus = _ref.onFocus,
40
40
  id = _ref.id,
41
- name = _ref.name;
41
+ name = _ref.name,
42
+ showCodeBlock = _ref.showCodeBlock;
42
43
 
43
44
  var eventHandlerWrapper = function eventHandlerWrapper(handler, event, editor) {
44
45
  if (handler) {
@@ -60,6 +61,9 @@ var RichTextEditor = function RichTextEditor(_ref) {
60
61
  forceValue: true
61
62
  }]
62
63
  },
64
+ toolbar: {
65
+ items: ['heading', '|', 'bold', 'italic', 'underline', 'link', 'bulletedList', 'numberedList', '|'].concat(showCodeBlock ? ['codeBlock'] : [], ['blockQuote', 'insertTable', 'undo', 'redo'])
66
+ },
63
67
  isReadOnly: disabled
64
68
  },
65
69
  onReady: onReady,
@@ -161,7 +165,7 @@ var InsertCss = function InsertCss() {
161
165
  }
162
166
  };
163
167
 
164
- var _excluded = ["label", "isRequired", "ariaLabel", "placeholder", "helperText", "disabled", "showMaxLengthText", "maxLength"];
168
+ var _excluded = ["label", "isRequired", "ariaLabel", "placeholder", "helperText", "disabled", "showMaxLengthText", "maxLength", "showCodeBlock"];
165
169
 
166
170
  var RichTextEditorFormComponent = function RichTextEditorFormComponent(_ref) {
167
171
  var label = _ref.label,
@@ -170,6 +174,7 @@ var RichTextEditorFormComponent = function RichTextEditorFormComponent(_ref) {
170
174
  disabled = _ref.disabled,
171
175
  showMaxLengthText = _ref.showMaxLengthText,
172
176
  maxLength = _ref.maxLength,
177
+ showCodeBlock = _ref.showCodeBlock,
173
178
  rest = _objectWithoutPropertiesLoose$1(_ref, _excluded);
174
179
 
175
180
  var _useField = formik.useField({
@@ -212,6 +217,7 @@ var RichTextEditorFormComponent = function RichTextEditorFormComponent(_ref) {
212
217
  label: label,
213
218
  helperText: helperText
214
219
  }, React__namespace.createElement(RichTextEditor, {
220
+ showCodeBlock: showCodeBlock,
215
221
  value: value,
216
222
  id: rest.name,
217
223
  name: rest.name,
@@ -15,7 +15,8 @@ const RichTextEditor = ({
15
15
  onBlur,
16
16
  onFocus,
17
17
  id,
18
- name
18
+ name,
19
+ showCodeBlock
19
20
  }) => {
20
21
  const eventHandlerWrapper = (handler, event, editor) => {
21
22
  if (handler) {
@@ -37,6 +38,9 @@ const RichTextEditor = ({
37
38
  forceValue: true
38
39
  }]
39
40
  },
41
+ toolbar: {
42
+ items: ['heading', '|', 'bold', 'italic', 'underline', 'link', 'bulletedList', 'numberedList', '|', ...(showCodeBlock ? ['codeBlock'] : []), 'blockQuote', 'insertTable', 'undo', 'redo']
43
+ },
40
44
  isReadOnly: disabled
41
45
  },
42
46
  onReady: onReady,
@@ -140,7 +144,7 @@ const InsertCss = () => {
140
144
  }
141
145
  };
142
146
 
143
- const _excluded = ["label", "isRequired", "ariaLabel", "placeholder", "helperText", "disabled", "showMaxLengthText", "maxLength"];
147
+ const _excluded = ["label", "isRequired", "ariaLabel", "placeholder", "helperText", "disabled", "showMaxLengthText", "maxLength", "showCodeBlock"];
144
148
 
145
149
  const RichTextEditorFormComponent = _ref => {
146
150
  let {
@@ -150,7 +154,8 @@ const RichTextEditorFormComponent = _ref => {
150
154
  helperText,
151
155
  disabled,
152
156
  showMaxLengthText,
153
- maxLength
157
+ maxLength,
158
+ showCodeBlock
154
159
  } = _ref,
155
160
  rest = _objectWithoutPropertiesLoose$1(_ref, _excluded);
156
161
 
@@ -191,6 +196,7 @@ const RichTextEditorFormComponent = _ref => {
191
196
  label: label,
192
197
  helperText: helperText
193
198
  }, React.createElement(RichTextEditor, {
199
+ showCodeBlock: showCodeBlock,
194
200
  value: value,
195
201
  id: rest.name,
196
202
  name: rest.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhc-shared-components/rich-text-editor",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "WYSWYG Editor for Red Hat Certified Apps",
5
5
  "author": "gautamkrishnar",
6
6
  "license": "MIT",