@apolitical/component-library 5.4.0-beta.3 → 5.4.0-beta.5

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.
@@ -2,9 +2,17 @@ import { BaseElement, BaseText, Descendant, Point, Range } from 'slate';
2
2
  import type { IListMemberData, IMentions, IDiscussionFormFns } from '../../../discussion';
3
3
  import type { MemberDetailsProps } from '../../../user';
4
4
  import type { IEnrichedUrlData } from '../../../navigation';
5
+ interface IRTEData {
6
+ /** Optional mentions */
7
+ mentions?: IMentions;
8
+ /** Optional data about the first link, to be displayed in the EnrichedUrl component */
9
+ link?: IEnrichedUrlData | false | undefined;
10
+ }
5
11
  interface IRTEFunctions extends IDiscussionFormFns {
6
12
  /** An optional event handler, called when the rich text editor is changed */
7
13
  onChange?: (value: string, data?: false | IEnrichedUrlData) => void;
14
+ /** An optional event handler, called when the data in the rich text editor is changed. This is used to keep data state up-to-date, when the onChange isn't likely to have been called, e.g. when a link preview resolves */
15
+ onChangeData?: (data: IRTEData) => void;
8
16
  /** An optional function to call when a mention is inserted */
9
17
  onMention?: (value?: IListMemberData) => void;
10
18
  /** An optional event handler, called when the rich text editor reports an error */
@@ -33,12 +41,7 @@ export interface IRTEProps {
33
41
  /** Optional aria error message */
34
42
  'aria-errormessage'?: string;
35
43
  /** Optional data for the editor */
36
- data?: {
37
- /** Optional mentions */
38
- mentions?: IMentions;
39
- /** Optional data about the first link, to be displayed in the EnrichedUrl component */
40
- link?: IEnrichedUrlData;
41
- };
44
+ data?: IRTEData;
42
45
  }
43
46
  export interface IRTEInitialState {
44
47
  editorKey: string | null;