@zeedhi/zd-richtext-common 1.3.2 → 1.4.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.
@@ -11,6 +11,12 @@ class RichText extends ComponentRender {
11
11
  * The content output format.
12
12
  */
13
13
  this.outputFormat = 'html';
14
+ this.fonts = [
15
+ { font: 'Inter', title: 'Inter' },
16
+ { font: 'Roboto', title: 'Roboto' },
17
+ { font: 'serif', title: 'Serif' },
18
+ { font: 'monospace', title: 'Monospace' },
19
+ ];
14
20
  /**
15
21
  * Placeholder is displayed when there is no content in the editor.
16
22
  */
@@ -53,6 +59,7 @@ class RichText extends ComponentRender {
53
59
  this.formatGetter = this.getInitValue('formatGetter', props.formatGetter, this.formatGetter);
54
60
  this.content = this.getInitValue('content', props.content, this.content);
55
61
  this.value = this.getInitValue('value', props.value, this.value);
62
+ this.fonts = this.getInitValue('fonts', props.fonts, this.fonts);
56
63
  this.createAccessors();
57
64
  }
58
65
  get value() {
@@ -69,6 +76,36 @@ class RichText extends ComponentRender {
69
76
  element, component: this, key, content: this.content,
70
77
  });
71
78
  }
79
+ input(text, event, element) {
80
+ this.callEvent('input', {
81
+ text,
82
+ event,
83
+ element,
84
+ component: this,
85
+ });
86
+ }
87
+ onChange(text, event, element) {
88
+ this.callEvent('onChange', {
89
+ text,
90
+ event,
91
+ element,
92
+ component: this,
93
+ });
94
+ }
95
+ onBlur(event, element) {
96
+ this.callEvent('onBlur', {
97
+ event,
98
+ element,
99
+ component: this,
100
+ });
101
+ }
102
+ onFocus(event, element) {
103
+ this.callEvent('onFocus', {
104
+ event,
105
+ element,
106
+ component: this,
107
+ });
108
+ }
72
109
  }
73
110
 
74
111
  const packageContent = require('../package.json');
@@ -14,6 +14,12 @@
14
14
  * The content output format.
15
15
  */
16
16
  this.outputFormat = 'html';
17
+ this.fonts = [
18
+ { font: 'Inter', title: 'Inter' },
19
+ { font: 'Roboto', title: 'Roboto' },
20
+ { font: 'serif', title: 'Serif' },
21
+ { font: 'monospace', title: 'Monospace' },
22
+ ];
17
23
  /**
18
24
  * Placeholder is displayed when there is no content in the editor.
19
25
  */
@@ -56,6 +62,7 @@
56
62
  this.formatGetter = this.getInitValue('formatGetter', props.formatGetter, this.formatGetter);
57
63
  this.content = this.getInitValue('content', props.content, this.content);
58
64
  this.value = this.getInitValue('value', props.value, this.value);
65
+ this.fonts = this.getInitValue('fonts', props.fonts, this.fonts);
59
66
  this.createAccessors();
60
67
  }
61
68
  get value() {
@@ -72,6 +79,36 @@
72
79
  element, component: this, key, content: this.content,
73
80
  });
74
81
  }
82
+ input(text, event, element) {
83
+ this.callEvent('input', {
84
+ text,
85
+ event,
86
+ element,
87
+ component: this,
88
+ });
89
+ }
90
+ onChange(text, event, element) {
91
+ this.callEvent('onChange', {
92
+ text,
93
+ event,
94
+ element,
95
+ component: this,
96
+ });
97
+ }
98
+ onBlur(event, element) {
99
+ this.callEvent('onBlur', {
100
+ event,
101
+ element,
102
+ component: this,
103
+ });
104
+ }
105
+ onFocus(event, element) {
106
+ this.callEvent('onFocus', {
107
+ event,
108
+ element,
109
+ component: this,
110
+ });
111
+ }
75
112
  }
76
113
 
77
114
  const packageContent = require('../package.json');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/zd-richtext-common",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "description": "RichTextCommon by BVR",
5
5
  "main": "dist/rich-text-common.umd.js",
6
6
  "module": "dist/rich-text-common.esm.js",
@@ -23,5 +23,5 @@
23
23
  "@zeedhi/common": "*",
24
24
  "@zeedhi/core": "*"
25
25
  },
26
- "gitHead": "5f202495829e7a912b0492c29f743ed5cc5a0c98"
26
+ "gitHead": "dd32b1059b0544a88a2c91098d03b16d3608ecab"
27
27
  }
@@ -1,5 +1,5 @@
1
- import { IEventParam, IEvent, IDictionary } from '@zeedhi/core';
2
1
  import { IComponentEvents, IComponentRender } from '@zeedhi/common';
2
+ import { IDictionary, IEvent, IEventParam } from '@zeedhi/core';
3
3
  export interface IRichText extends IComponentRender {
4
4
  outputFormat?: string;
5
5
  placeholder?: string;
@@ -12,7 +12,16 @@ export interface IRichText extends IComponentRender {
12
12
  width?: number | string;
13
13
  height?: number | string;
14
14
  fillHeight?: boolean;
15
+ fonts?: IFonts[];
16
+ }
17
+ export interface IFonts {
18
+ font: string;
19
+ title: string;
15
20
  }
16
21
  export interface IRickTextEvents<T = IEventParam<any>> extends IComponentEvents<T> {
17
22
  onKeyDown?: IEvent<T> | string;
23
+ onChange?: IEvent<T> | string;
24
+ onBlur?: IEvent<T> | string;
25
+ onFocus?: IEvent<T> | string;
26
+ input?: IEvent<T> | string;
18
27
  }
@@ -1,6 +1,6 @@
1
1
  import { ComponentRender } from '@zeedhi/common';
2
2
  import { IDictionary } from '@zeedhi/core';
3
- import { IRichText, IRickTextEvents } from './interfaces';
3
+ import { IFonts, IRichText, IRickTextEvents } from './interfaces';
4
4
  /**
5
5
  * Base class for Rich Text component.
6
6
  */
@@ -9,6 +9,7 @@ export declare class RichText extends ComponentRender implements IRichText {
9
9
  * The content output format.
10
10
  */
11
11
  outputFormat: string;
12
+ fonts: IFonts[];
12
13
  /**
13
14
  * Placeholder is displayed when there is no content in the editor.
14
15
  */
@@ -51,4 +52,8 @@ export declare class RichText extends ComponentRender implements IRichText {
51
52
  content: string;
52
53
  constructor(props: IRichText);
53
54
  onKeyDown(element?: HTMLElement, key?: string): void;
55
+ input(text: string, event?: Event, element?: HTMLElement): void;
56
+ onChange(text: string, event?: Event, element?: HTMLElement): void;
57
+ onBlur(event?: Event, element?: HTMLElement): void;
58
+ onFocus(event?: Event, element?: HTMLElement): void;
54
59
  }