@zeedhi/zd-richtext-common 1.6.0 → 1.6.1

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.
@@ -63,10 +63,11 @@ class RichText extends ComponentRender {
63
63
  this.height = this.getInitValue('height', props.height, this.height);
64
64
  this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
65
65
  this.formatGetter = this.getInitValue('formatGetter', props.formatGetter, this.formatGetter);
66
- this.content = this.getInitValue('content', props.content, this.content);
67
- this.value = this.getInitValue('value', props.value, this.value);
66
+ this.content = this.getInitValue('content', props.value, this.content);
67
+ this.value = this.getInitValue('value', props.value || props.content, this.content);
68
68
  this.fonts = this.getInitValue('fonts', props.fonts, this.fonts);
69
69
  this.label = this.getInitValue('label', props.label, this.label);
70
+ this.readonly = this.getInitValue('readonly', props.readonly, this.readonly);
70
71
  this.enableFullscreen = this.getInitValue('enableFullscreen', props.enableFullscreen, this.enableFullscreen);
71
72
  this.createAccessors();
72
73
  }
@@ -66,10 +66,11 @@
66
66
  this.height = this.getInitValue('height', props.height, this.height);
67
67
  this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
68
68
  this.formatGetter = this.getInitValue('formatGetter', props.formatGetter, this.formatGetter);
69
- this.content = this.getInitValue('content', props.content, this.content);
70
- this.value = this.getInitValue('value', props.value, this.value);
69
+ this.content = this.getInitValue('content', props.value, this.content);
70
+ this.value = this.getInitValue('value', props.value || props.content, this.content);
71
71
  this.fonts = this.getInitValue('fonts', props.fonts, this.fonts);
72
72
  this.label = this.getInitValue('label', props.label, this.label);
73
+ this.readonly = this.getInitValue('readonly', props.readonly, this.readonly);
73
74
  this.enableFullscreen = this.getInitValue('enableFullscreen', props.enableFullscreen, this.enableFullscreen);
74
75
  this.createAccessors();
75
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/zd-richtext-common",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
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": "^1.74.0",
24
24
  "@zeedhi/core": "^1.74.0"
25
25
  },
26
- "gitHead": "dc6bba1349b8510e1d9c9db68cd893773269d44b"
26
+ "gitHead": "0bb43f4fb5bb45c661bee1a771d04e62619259bf"
27
27
  }
@@ -1,91 +0,0 @@
1
- var n = Object.defineProperty;
2
- var a = (o, i, t) => i in o ? n(o, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[i] = t;
3
- var e = (o, i, t) => a(o, typeof i != "symbol" ? i + "" : i, t);
4
- import { ComponentRender as s } from "@zeedhi/common";
5
- class d extends s {
6
- constructor(t) {
7
- super(t);
8
- /**
9
- * The content output format.
10
- */
11
- e(this, "outputFormat", "html");
12
- e(this, "fonts", [
13
- { font: "Inter", title: "Inter" },
14
- { font: "Roboto", title: "Roboto" },
15
- { font: "serif", title: "Serif" },
16
- { font: "monospace", title: "Monospace" }
17
- ]);
18
- /**
19
- * Placeholder is displayed when there is no content in the editor.
20
- */
21
- e(this, "placeholder", "");
22
- /**
23
- * Disable the component
24
- */
25
- e(this, "disabled", !1);
26
- /**
27
- * Turn the component into a readonly
28
- */
29
- e(this, "readonly", !1);
30
- /**
31
- * Toolbar color
32
- */
33
- e(this, "toolbarColor");
34
- /**
35
- * Card color
36
- */
37
- e(this, "cardColor", "");
38
- /**
39
- * Removes elevation and adds a thin border.
40
- */
41
- e(this, "outlined", !1);
42
- /**
43
- * Component width.
44
- */
45
- e(this, "width", "");
46
- /**
47
- * Component height.
48
- */
49
- e(this, "height", "");
50
- e(this, "fillHeight", !1);
51
- e(this, "formatGetter", {});
52
- /**
53
- * Rich text content
54
- */
55
- e(this, "content", "");
56
- this.outputFormat = this.getInitValue("outputFormat", t.outputFormat, this.outputFormat), this.placeholder = this.getInitValue("placeHolder", t.placeholder, this.placeholder), this.disabled = this.getInitValue("disabled", t.disabled, this.disabled), this.toolbarColor = this.getInitValue("toolbarColor", t.toolbarColor, this.toolbarColor), this.cardColor = this.getInitValue("cardColor", t.cardColor, this.cardColor), this.outlined = this.getInitValue("outlined", t.outlined, this.outlined), this.width = this.getInitValue("width", t.width, this.width), this.height = this.getInitValue("height", t.height, this.height), this.fillHeight = this.getInitValue("fillHeight", t.fillHeight, this.fillHeight), this.formatGetter = this.getInitValue("formatGetter", t.formatGetter, this.formatGetter), this.content = this.getInitValue("content", t.content, this.content), this.value = this.getInitValue("value", t.value, this.value), this.fonts = this.getInitValue("fonts", t.fonts, this.fonts), this.readonly = this.getInitValue("readonly", t.readonly, this.readonly), this.createAccessors();
57
- }
58
- get value() {
59
- return typeof this.formatGetter[this.outputFormat] == "function" ? this.formatGetter[this.outputFormat]() : this.content;
60
- }
61
- set value(t) {
62
- this.content = t;
63
- }
64
- keydown(t, l) {
65
- this.callEvent("keydown", {
66
- event: t,
67
- component: this,
68
- key: l,
69
- content: this.content
70
- });
71
- }
72
- input(t, l, h) {
73
- this.callEvent("input", {
74
- text: t,
75
- event: l,
76
- element: h,
77
- component: this
78
- });
79
- }
80
- change(t, l, h) {
81
- this.callEvent("change", {
82
- text: t,
83
- event: l,
84
- element: h,
85
- component: this
86
- });
87
- }
88
- }
89
- export {
90
- d as RichText
91
- };
@@ -1,2 +0,0 @@
1
- export * from './rich-text';
2
- export * from './interfaces';
@@ -1,26 +0,0 @@
1
- import { IComponentEvents, IComponentRender } from '@zeedhi/common';
2
- import { IDictionary, IEvent, IEventParam } from '@zeedhi/core';
3
- export interface IRichText extends IComponentRender {
4
- outputFormat?: string;
5
- placeholder?: string;
6
- disabled?: boolean;
7
- readonly?: boolean;
8
- toolbarColor?: string;
9
- formatGetter?: IDictionary<() => any>;
10
- value?: any;
11
- cardColor?: string;
12
- outlined?: boolean;
13
- width?: number | string;
14
- height?: number | string;
15
- fillHeight?: boolean;
16
- fonts?: IFonts[];
17
- }
18
- export interface IFonts {
19
- font: string;
20
- title: string;
21
- }
22
- export interface IRickTextEvents<T = IEventParam<any>> extends IComponentEvents<T> {
23
- keydown?: IEvent<T> | string;
24
- change?: IEvent<T> | string;
25
- input?: IEvent<T> | string;
26
- }
@@ -1,57 +0,0 @@
1
- import { ComponentRender } from '@zeedhi/common';
2
- import { IDictionary } from '@zeedhi/core';
3
- import { IFonts, IRichText } from './interfaces';
4
- /**
5
- * Base class for Rich Text component.
6
- */
7
- export declare class RichText extends ComponentRender implements IRichText {
8
- /**
9
- * The content output format.
10
- */
11
- outputFormat: string;
12
- fonts: IFonts[];
13
- /**
14
- * Placeholder is displayed when there is no content in the editor.
15
- */
16
- placeholder: string;
17
- /**
18
- * Disable the component
19
- */
20
- disabled: boolean;
21
- /**
22
- * Turn the component into a readonly
23
- */
24
- readonly: boolean;
25
- /**
26
- * Toolbar color
27
- */
28
- toolbarColor?: string;
29
- /**
30
- * Card color
31
- */
32
- cardColor: string;
33
- /**
34
- * Removes elevation and adds a thin border.
35
- */
36
- outlined: boolean;
37
- /**
38
- * Component width.
39
- */
40
- width: string;
41
- /**
42
- * Component height.
43
- */
44
- height: string;
45
- get value(): any;
46
- set value(value: any);
47
- fillHeight: boolean;
48
- formatGetter: IDictionary<() => any>;
49
- /**
50
- * Rich text content
51
- */
52
- content: string;
53
- constructor(props: IRichText);
54
- keydown(event?: KeyboardEvent, key?: string | HTMLElement): void;
55
- input(text: string, event?: Event, element?: HTMLElement): void;
56
- change(text: string, event?: Event, element?: HTMLElement): void;
57
- }