@rhc-shared-components/rich-text-editor 2.0.5 → 3.0.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
@@ -1,9 +1,19 @@
1
1
  # @rhc-shared-components/rich-text-editor
2
2
 
3
- > WYSWYG Editor for Red Hat Certified Apps
3
+ > WYSIWYG Editor for Red Hat Certified Apps
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```bash
8
8
  npm install --save @rhc-shared-components/rich-text-editor
9
9
  ```
10
+
11
+ ## Development
12
+
13
+ ```bash
14
+ yarn dev # start dev server
15
+ yarn build # production build
16
+ yarn lint # check with Biome
17
+ yarn lint-fix # auto-fix with Biome
18
+ yarn format # format with Biome
19
+ ```
@@ -1,18 +1,21 @@
1
- import { FC } from 'react';
2
- type RichTextEditorFunctionType = (value: string, event?: any, editor?: any) => void;
1
+ import { FC } from '../node_modules/@types/react';
2
+ type RichTextEditorFunctionType = (value: string, event?: Event, editor?: CKEditorInstance) => void;
3
3
  export interface RichTextEditorProps {
4
4
  value: string;
5
- disabled?: boolean;
6
- onReady?: (editor: any) => void;
7
- onChange?: RichTextEditorFunctionType;
8
- onBlur?: RichTextEditorFunctionType;
9
- onFocus?: RichTextEditorFunctionType;
10
- onError?: (error: any, details?: any) => void;
11
- id?: string;
12
- name?: string;
13
- showCodeBlock?: boolean;
14
- ariaLabel?: string;
15
- placeholder?: string;
5
+ disabled?: boolean | undefined;
6
+ onReady?: ((editor: CKEditorInstance) => void) | undefined;
7
+ onChange?: RichTextEditorFunctionType | undefined;
8
+ onBlur?: RichTextEditorFunctionType | undefined;
9
+ onFocus?: RichTextEditorFunctionType | undefined;
10
+ onError?: ((error: Error, details?: {
11
+ phase: string;
12
+ willEditorRestart: boolean;
13
+ }) => void) | undefined;
14
+ id?: string | undefined;
15
+ name?: string | undefined;
16
+ showCodeBlock?: boolean | undefined;
17
+ ariaLabel?: string | undefined;
18
+ placeholder?: string | undefined;
16
19
  }
17
20
  declare const RichTextEditor: FC<RichTextEditorProps>;
18
21
  export default RichTextEditor;
@@ -1,21 +1,21 @@
1
- import { FC, ReactNode } from 'react';
1
+ import { FC, ReactNode } from '../node_modules/@types/react';
2
2
  declare global {
3
3
  interface Window {
4
- ckeditorObj: any[];
4
+ ckeditorObj: Record<string, CKEditorInstance>;
5
5
  }
6
6
  }
7
7
  export interface RichTextEditorFormComponentProps {
8
8
  name: string;
9
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
- labelIcon?: ReactNode;
10
+ disabled?: boolean | undefined;
11
+ isRequired?: boolean | undefined;
12
+ placeholder?: string | undefined;
13
+ ariaLabel?: string | undefined;
14
+ helperText?: string | undefined;
15
+ showMaxLengthText?: boolean | undefined;
16
+ maxLength?: number | undefined;
17
+ showCodeBlock?: boolean | undefined;
18
+ labelHelp?: ReactNode | undefined;
19
19
  }
20
20
  declare const RichTextEditorFormComponent: FC<RichTextEditorFormComponentProps>;
21
21
  export default RichTextEditorFormComponent;
@@ -1 +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--disabled{opacity:.6;pointer-events:none}.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}
1
+ .rich-text-editor-custom{--rte-h1-internal-LineHeight: var(--pf-v6-global--LineHeight--sm);--rte-h1-internal-FontSize: var(--pf-v6-global--FontSize--2xl);--rte-h1-internal-FontWeight: var(--pf-v6-global--FontWeight--normal);--rte-h2-internal-LineHeight: var(--pf-v6-global--LineHeight--md);--rte-h2-internal-FontSize: var(--pf-v6-global--FontSize--xl);--rte-h2-internal-FontWeight: var(--pf-v6-global--FontWeight--normal);--rte-h3-internal-LineHeight: var(--pf-v6-global--LineHeight--md);--rte-h3-internal-FontSize: var(--pf-v6-global--FontSize--lg);--rte-h3-internal-FontWeight: var(--pf-v6-global--FontWeight--normal);--rte-h4-internal-LineHeight: var(--pf-v6-global--LineHeight--md);--rte-h4-internal-FontSize: var(--pf-v6-global--FontSize--md);--rte-h4-internal-FontWeight: var(--pf-v6-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--disabled{opacity:.6;pointer-events:none}.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,5 @@
1
1
  import { default as RichTextEditor } from './RichTextEditor';
2
2
  import { default as RichTextEditorFormComponent } from './RichTextEditorFormComponent';
3
+ export type { RichTextEditorProps } from './RichTextEditor';
4
+ export type { RichTextEditorFormComponentProps } from './RichTextEditorFormComponent';
3
5
  export { RichTextEditor, RichTextEditorFormComponent };