@rhc-shared-components/rich-text-editor 1.0.0 → 1.1.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.
package/README.md CHANGED
@@ -2,46 +2,8 @@
2
2
 
3
3
  > WYSWYG Editor for Red Hat Certified Apps
4
4
 
5
- [![NPM](https://img.shields.io/npm/v/@rhc-shared-components/rich-text-editor.svg)](https://www.npmjs.com/package/@rhc-shared-components/rich-text-editor) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
6
-
7
5
  ## Install
8
6
 
9
7
  ```bash
10
- yarn add @rhc-shared-components/rich-text-editor
8
+ npm install --save @rhc-shared-components/rich-text-editor
11
9
  ```
12
-
13
- ## Usage
14
-
15
- ```tsx
16
- import React from 'react';
17
- import { RichTextEditorFormComponent, RichTextEditor } from '@rhc-shared-components/rich-text-editor';
18
- import { Formik } from 'formik';
19
- import { Title } from "@patternfly/react-core";
20
-
21
- const App = () => {
22
- const FieldName = 'richtext';
23
- return (
24
- <div>
25
- <Title headingLevel={'h1'}>RichTextEditor</Title>
26
- <RichTextEditor value={"<h3>hello world from normal RTE</h3>"}/>
27
- <Title headingLevel={'h1'}>RichTextEditor with formik</Title>
28
- <Formik
29
- initialValues={{
30
- [FieldName]: '<h1>Hello world</h1>'
31
- }}
32
- enableReinitialize={true}
33
- onSubmit={()=>{}}>
34
- <RichTextEditorFormComponent
35
- name={FieldName}
36
- label={'Rich text form label'}
37
- helperText={'This is a test description'}
38
- isRequired={true}
39
- />
40
- </Formik>
41
- </div>);
42
- }
43
- ```
44
-
45
- ## License
46
-
47
- MIT © [gautamkrishnar](https://github.com/gautamkrishnar)
@@ -1,16 +1,18 @@
1
- import * as React from 'react';
2
- declare type RichTextEditorFunctionType = (value: string, event?: Event, editor?: any) => void;
3
- export interface RichTextEditorProps {
4
- value: string;
5
- disabled?: boolean;
6
- onReady?: (editor: any) => void;
7
- onChange?: RichTextEditorFunctionType;
8
- onBlur?: RichTextEditorFunctionType;
9
- onFocus?: RichTextEditorFunctionType;
10
- onError?: RichTextEditorFunctionType;
11
- id?: string;
12
- name?: string;
13
- showCodeBlock?: boolean;
14
- }
15
- declare const RichTextEditor: React.FC<RichTextEditorProps>;
16
- export default RichTextEditor;
1
+ import * as React from 'react';
2
+ type RichTextEditorFunctionType = (value: string, event?: any, editor?: any) => void;
3
+ export interface RichTextEditorProps {
4
+ value: string;
5
+ disabled?: boolean;
6
+ onReady?: (editor: any) => void;
7
+ onChange?: RichTextEditorFunctionType;
8
+ onBlur?: RichTextEditorFunctionType;
9
+ onFocus?: RichTextEditorFunctionType;
10
+ onError?: (error: Error, details?: any) => void;
11
+ id?: string;
12
+ name?: string;
13
+ showCodeBlock?: boolean;
14
+ ariaLabel?: string;
15
+ placeholder?: string;
16
+ }
17
+ declare const RichTextEditor: React.FC<RichTextEditorProps>;
18
+ export default RichTextEditor;
@@ -1,20 +1,20 @@
1
- import * as React from 'react';
2
- declare global {
3
- interface Window {
4
- ckeditorObj: any[];
5
- }
6
- }
7
- export interface RichTextEditorFormComponentProps {
8
- name: string;
9
- label: string;
10
- disabled?: boolean;
11
- isRequired?: boolean;
12
- placeholder?: string;
13
- ariaLabel?: string;
14
- helperText?: string;
15
- showMaxLengthText?: boolean;
16
- maxLength?: number;
17
- showCodeBlock?: boolean;
18
- }
19
- declare const RichTextEditorFormComponent: React.FC<RichTextEditorFormComponentProps>;
20
- export default RichTextEditorFormComponent;
1
+ import * as React from 'react';
2
+ declare global {
3
+ interface Window {
4
+ ckeditorObj: any[];
5
+ }
6
+ }
7
+ export interface RichTextEditorFormComponentProps {
8
+ name: string;
9
+ label: string;
10
+ disabled?: boolean;
11
+ isRequired?: boolean;
12
+ placeholder?: string;
13
+ ariaLabel?: string;
14
+ helperText?: string;
15
+ showMaxLengthText?: boolean;
16
+ maxLength?: number;
17
+ showCodeBlock?: boolean;
18
+ }
19
+ declare const RichTextEditorFormComponent: React.FC<RichTextEditorFormComponentProps>;
20
+ export default RichTextEditorFormComponent;
@@ -0,0 +1 @@
1
+ .rich-text-editor-custom{--rte-h1-internal-LineHeight: var(--pf-v5-global--LineHeight--sm, --pf-global--LineHeight--sm);--rte-h1-internal-FontSize: var(--pf-v5-global--FontSize--2xl, --pf-global--FontSize--2xl);--rte-h1-internal-FontWeight: var(--pf-v5-global--FontWeight--normal, --pf-global--FontWeight--normal);--rte-h2-internal-LineHeight: var(--pf-v5-global--LineHeight--md, -pf-global--LineHeight--mD);--rte-h2-internal-FontSize: var(--pf-v5-global--FontSize--xl, --pf-global--FontSize--xl);--rte-h2-internal-FontWeight: var(--pf-v5-global--FontWeight--normal, --pf-global--FontWeight--normal);--rte-h3-internal-LineHeight: var(--pf-v5-global--LineHeight--md, -pf-global--LineHeight--md);--rte-h3-internal-FontSize: var(--pf-v5-global--FontSize--lg, --pf-global--FontSize--lg);--rte-h3-internal-FontWeight: var(--pf-v5-global--FontWeight--normal, --pf-global--FontWeight--normal);--rte-h4-internal-LineHeight: var(--pf-v5-global--LineHeight--md, --pf-global--LineHeight--md);--rte-h4-internal-FontSize: var(--pf-v5-global--FontSize--md, --pf-global--FontSize--md);--rte-h4-internal-FontWeight: var( --pf-v5-global--FontWeight--normal, --pf-global--FontWeight--normal)}.rich-text-editor-custom .ck-editor__main{word-break:break-all}.rich-text-editor-custom .ck-code-block-dropdown .ck-splitbutton__arrow{display:none}.rich-text-editor-custom h1{font-size:var(--rte-h1-internal-FontSize);font-weight:var(--rte-h1-internal-FontWeight);line-height:var(--rte-h1-internal-LineHeight)}.rich-text-editor-custom h2{font-size:var(--rte-h2-internal-FontSize);font-weight:var(--rte-h2-internal-FontWeight);line-height:var(--rte-h2-internal-LineHeight)}.rich-text-editor-custom h3{font-size:var(--rte-h3-internal-FontSize);font-weight:var(--rte-h3-internal-FontWeight);line-height:var(--rte-h3-internal-LineHeight)}.rich-text-editor-custom h4{font-size:var(--rte-h4-internal-FontSize);font-weight:var(--rte-h4-internal-FontWeight);line-height:var(--rte-h4-internal-LineHeight)}.rich-text-editor-custom ul{display:block;list-style-type:disc;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0;margin-inline-end:0;padding-inline-start:40px}.rich-text-editor-custom ul li{display:list-item}.rich-text-editor-custom ul ul{list-style-type:circle;margin-block-start:0;margin-block-end:0}.rich-text-editor-custom ol{display:block;list-style-type:decimal;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0;margin-inline-end:0;padding-inline-start:40px}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import RichTextEditor from './RichTextEditor';
2
- import RichTextEditorFormComponent from './RichTextEditorFormComponent';
3
- export { RichTextEditor, RichTextEditorFormComponent };
1
+ import { default as RichTextEditor } from './RichTextEditor';
2
+ import { default as RichTextEditorFormComponent } from './RichTextEditorFormComponent';
3
+ export { RichTextEditor, RichTextEditorFormComponent };