@rhc-shared-components/rich-text-editor 0.5.1 → 0.6.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.6.2",
4
4
  "description": "WYSWYG Editor for Red Hat Certified Apps",
5
5
  "author": "gautamkrishnar",
6
6
  "license": "MIT",
@@ -75,5 +75,6 @@
75
75
  "formik": "^2.1.4",
76
76
  "react": "^16.13.1",
77
77
  "react-dom": "^16.13.1"
78
- }
78
+ },
79
+ "gitHead": "7d6f877710b011c16c52b143698bec2a7595afd5"
79
80
  }
package/CHANGELOG.md DELETED
@@ -1,222 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- # [0.4.0](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.2.12...@rhc-shared-components/rich-text-editor@0.4.0) (2022-06-14)
7
-
8
-
9
- ### Bug Fixes
10
-
11
- * added touched flag to validation ([e69be69](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/e69be69c901cd84f9f53c1ce2ef7047cd8ead04e))
12
- * fixed max length bug ([c63c798](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/c63c79891c16ff23919f09ba681470432a2b3301))
13
- * fixed re init bugs ([b208de0](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/b208de0ac998c4fb814cbee4e3e3a8b4c6fe4b05))
14
- * fixing validation errors ([e2d4e61](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/e2d4e610ddeefdef6dd39d9cf6000dfab84916c7))
15
- * validation bugs ([cee65e1](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/cee65e142bf2dbae06914a4add9915f11118c6af))
16
-
17
-
18
- ### Features
19
-
20
- * added maxlength feature ([564c8fa](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/564c8fa69ce2abfdc6eeb01d07330ebcfcbad4a1))
21
-
22
-
23
-
24
-
25
-
26
- ## [0.2.12](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.2.11...@rhc-shared-components/rich-text-editor@0.2.12) (2021-11-01)
27
-
28
- **Note:** Version bump only for package @rhc-shared-components/rich-text-editor
29
-
30
-
31
-
32
-
33
-
34
- ## [0.2.11](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.2.10...@rhc-shared-components/rich-text-editor@0.2.11) (2021-11-01)
35
-
36
- **Note:** Version bump only for package @rhc-shared-components/rich-text-editor
37
-
38
-
39
-
40
-
41
-
42
- ## [0.2.10](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.2.9...@rhc-shared-components/rich-text-editor@0.2.10) (2021-09-29)
43
-
44
- **Note:** Version bump only for package @rhc-shared-components/rich-text-editor
45
-
46
-
47
-
48
-
49
-
50
- ## [0.2.9](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.2.8...@rhc-shared-components/rich-text-editor@0.2.9) (2021-09-29)
51
-
52
-
53
- ### Bug Fixes
54
-
55
- * fixing minor bug in h3 ([674c21e](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/674c21e80156a70763df34887e4e34f951640b40))
56
-
57
-
58
-
59
-
60
-
61
- ## [0.2.8](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.2.7...@rhc-shared-components/rich-text-editor@0.2.8) (2021-09-28)
62
-
63
-
64
- ### Bug Fixes
65
-
66
- * fixing styles ([107d28d](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/107d28d37edefcc9172f723c6987d9a0032ee042))
67
-
68
-
69
-
70
-
71
-
72
- ## [0.2.7](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.2.6...@rhc-shared-components/rich-text-editor@0.2.7) (2021-09-28)
73
-
74
-
75
- ### Bug Fixes
76
-
77
- * converted microbundle-crl to microbundle ([0fb91bf](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/0fb91bf065c2436251097168599edbb59ce6a16c))
78
-
79
-
80
-
81
-
82
-
83
- ## [0.2.6](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.2.5...@rhc-shared-components/rich-text-editor@0.2.6) (2021-09-28)
84
-
85
-
86
- ### Bug Fixes
87
-
88
- * added missing stylesheet ([dd08fc3](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/dd08fc32298fff6a02812dedd75a2f763692f356))
89
-
90
-
91
-
92
-
93
-
94
- ## [0.2.5](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.2.4...@rhc-shared-components/rich-text-editor@0.2.5) (2021-09-28)
95
-
96
- **Note:** Version bump only for package @rhc-shared-components/rich-text-editor
97
-
98
-
99
-
100
-
101
-
102
- ## [0.2.4](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.2.3...@rhc-shared-components/rich-text-editor@0.2.4) (2021-09-28)
103
-
104
- **Note:** Version bump only for package @rhc-shared-components/rich-text-editor
105
-
106
-
107
-
108
-
109
-
110
- ## [0.2.3](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.2.2...@rhc-shared-components/rich-text-editor@0.2.3) (2021-09-28)
111
-
112
-
113
- ### Bug Fixes
114
-
115
- * remove hardcoded pf styles ([0928295](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/0928295bf89f7c14300998d56fc58cc6ec727513))
116
- * using pf no reset to avoid conflicts ([4bc0a9d](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/4bc0a9de4c702b85f9ceae7571b76f539fc24ea2))
117
-
118
-
119
-
120
-
121
-
122
- ## [0.2.2](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.2.1...@rhc-shared-components/rich-text-editor@0.2.2) (2021-09-23)
123
-
124
-
125
- ### Bug Fixes
126
-
127
- * remove broken indentation ([80d6616](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/80d66162ae3fcc8f45cf67dc4a49afca9ee72ea8))
128
-
129
-
130
-
131
-
132
-
133
- ## [0.2.1](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.2.0...@rhc-shared-components/rich-text-editor@0.2.1) (2021-09-22)
134
-
135
- **Note:** Version bump only for package @rhc-shared-components/rich-text-editor
136
-
137
-
138
-
139
-
140
-
141
- # [0.2.0](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.1.7...@rhc-shared-components/rich-text-editor@0.2.0) (2021-09-22)
142
-
143
-
144
- ### Features
145
-
146
- * use patternfly default title style for headings ([1f08ac5](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/1f08ac59a6dfc86343f7840bf405b7d820332427))
147
-
148
-
149
-
150
-
151
-
152
- ## [0.1.7](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.1.6...@rhc-shared-components/rich-text-editor@0.1.7) (2021-09-22)
153
-
154
-
155
- ### Bug Fixes
156
-
157
- * removed image and video insertion ([a89bbd4](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/a89bbd448ab9d6930c5f2b6a08b624c997e9658f))
158
-
159
-
160
-
161
-
162
-
163
- ## [0.1.6](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.1.5...@rhc-shared-components/rich-text-editor@0.1.6) (2021-09-22)
164
-
165
- **Note:** Version bump only for package @rhc-shared-components/rich-text-editor
166
-
167
-
168
-
169
-
170
-
171
- ## [0.1.5](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.1.4...@rhc-shared-components/rich-text-editor@0.1.5) (2021-09-20)
172
-
173
-
174
- ### Bug Fixes
175
-
176
- * cleaning deps ([227dc2d](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/227dc2da7dfda53172811ef287840b97cd550681))
177
-
178
-
179
-
180
-
181
-
182
- ## [0.1.4](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.1.3...@rhc-shared-components/rich-text-editor@0.1.4) (2021-09-17)
183
-
184
-
185
- ### Bug Fixes
186
-
187
- * added cleaning of dist on prepare ([68e3e76](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/commit/68e3e76f8924cabd581baeace07e9afeef20d36b))
188
-
189
-
190
-
191
-
192
-
193
- ## [0.1.3](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.1.2...@rhc-shared-components/rich-text-editor@0.1.3) (2021-09-17)
194
-
195
- **Note:** Version bump only for package @rhc-shared-components/rich-text-editor
196
-
197
-
198
-
199
-
200
-
201
- ## [0.1.2](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.1.1...@rhc-shared-components/rich-text-editor@0.1.2) (2021-09-17)
202
-
203
- **Note:** Version bump only for package @rhc-shared-components/rich-text-editor
204
-
205
-
206
-
207
-
208
-
209
- ## [0.1.1](https://gitlab.cee.redhat.com/customer-platform/rhc-shared-components/compare/@rhc-shared-components/rich-text-editor@0.1.0...@rhc-shared-components/rich-text-editor@0.1.1) (2021-09-17)
210
-
211
- **Note:** Version bump only for package @rhc-shared-components/rich-text-editor
212
-
213
-
214
-
215
-
216
-
217
- # 0.1.0 (2021-09-17)
218
-
219
-
220
- ### Features
221
-
222
- * finished rich text editor component ([52a70ce](https://gitlab.cee.redhat.com/dxp/customer-portal/rhc-shared-components/commit/52a70cef749ea5a46882122ab843a2099d5e1628))