@zeedhi/zd-richtext-common 1.0.5 → 1.1.3

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.
@@ -0,0 +1,62 @@
1
+ import { ComponentRender } from '@zeedhi/common';
2
+
3
+ /**
4
+ * Base class for Rich Text component.
5
+ */
6
+ class RichText extends ComponentRender {
7
+ constructor(props) {
8
+ super(props);
9
+ /**
10
+ * The content output format.
11
+ */
12
+ this.outputFormat = 'json';
13
+ /**
14
+ * Placeholder is displayed when there is no content in the editor.
15
+ */
16
+ this.placeholder = '';
17
+ /**
18
+ * Disable the component
19
+ */
20
+ this.disabled = false;
21
+ /**
22
+ * Toolbar color
23
+ */
24
+ this.toolbarColor = 'var(--v-primary-base)';
25
+ /**
26
+ * Card color
27
+ */
28
+ this.cardColor = '';
29
+ /**
30
+ * Removes elevation and adds a thin border.
31
+ */
32
+ this.outlined = false;
33
+ /**
34
+ * Component width.
35
+ */
36
+ this.width = '';
37
+ /**
38
+ * Component height.
39
+ */
40
+ this.height = '';
41
+ /**
42
+ * Rich text content
43
+ */
44
+ this.content = '';
45
+ this.outputFormat = this.getInitValue('outputFormat', props.outputFormat, this.outputFormat);
46
+ this.placeholder = this.getInitValue('placeHolder', props.placeholder, this.placeholder);
47
+ this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
48
+ this.toolbarColor = this.getInitValue('toolbarColor', props.toolbarColor, this.toolbarColor);
49
+ this.cardColor = this.getInitValue('cardColor', props.cardColor, this.cardColor);
50
+ this.outlined = this.getInitValue('outlined', props.outlined, this.outlined);
51
+ this.width = this.getInitValue('width', props.width, this.width);
52
+ this.height = this.getInitValue('height', props.height, this.height);
53
+ this.createAccessors();
54
+ }
55
+ onkeydown(element, key) {
56
+ this.callEvent('onKeyDown', {
57
+ element, component: this, key, content: this.content,
58
+ });
59
+ }
60
+ }
61
+
62
+ export { RichText };
@@ -0,0 +1,70 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@zeedhi/common')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@zeedhi/common'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@zeedhi/zd-richtext-common"] = {}, global["@zeedhi/common"]));
5
+ })(this, (function (exports, common) { 'use strict';
6
+
7
+ /**
8
+ * Base class for Rich Text component.
9
+ */
10
+ class RichText extends common.ComponentRender {
11
+ constructor(props) {
12
+ super(props);
13
+ /**
14
+ * The content output format.
15
+ */
16
+ this.outputFormat = 'json';
17
+ /**
18
+ * Placeholder is displayed when there is no content in the editor.
19
+ */
20
+ this.placeholder = '';
21
+ /**
22
+ * Disable the component
23
+ */
24
+ this.disabled = false;
25
+ /**
26
+ * Toolbar color
27
+ */
28
+ this.toolbarColor = 'var(--v-primary-base)';
29
+ /**
30
+ * Card color
31
+ */
32
+ this.cardColor = '';
33
+ /**
34
+ * Removes elevation and adds a thin border.
35
+ */
36
+ this.outlined = false;
37
+ /**
38
+ * Component width.
39
+ */
40
+ this.width = '';
41
+ /**
42
+ * Component height.
43
+ */
44
+ this.height = '';
45
+ /**
46
+ * Rich text content
47
+ */
48
+ this.content = '';
49
+ this.outputFormat = this.getInitValue('outputFormat', props.outputFormat, this.outputFormat);
50
+ this.placeholder = this.getInitValue('placeHolder', props.placeholder, this.placeholder);
51
+ this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
52
+ this.toolbarColor = this.getInitValue('toolbarColor', props.toolbarColor, this.toolbarColor);
53
+ this.cardColor = this.getInitValue('cardColor', props.cardColor, this.cardColor);
54
+ this.outlined = this.getInitValue('outlined', props.outlined, this.outlined);
55
+ this.width = this.getInitValue('width', props.width, this.width);
56
+ this.height = this.getInitValue('height', props.height, this.height);
57
+ this.createAccessors();
58
+ }
59
+ onkeydown(element, key) {
60
+ this.callEvent('onKeyDown', {
61
+ element, component: this, key, content: this.content,
62
+ });
63
+ }
64
+ }
65
+
66
+ exports.RichText = RichText;
67
+
68
+ Object.defineProperty(exports, '__esModule', { value: true });
69
+
70
+ }));
package/package.json CHANGED
@@ -1,18 +1,27 @@
1
1
  {
2
2
  "name": "@zeedhi/zd-richtext-common",
3
- "version": "1.0.5",
3
+ "version": "1.1.3",
4
4
  "description": "RichTextCommon by BVR",
5
5
  "main": "dist/rich-text-common.umd.js",
6
6
  "module": "dist/rich-text-common.esm.js",
7
7
  "typings": "types/index.d.ts",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
8
11
  "scripts": {
9
12
  "build": "rollup -c",
10
13
  "lint": "eslint . --fix --ext .ts",
14
+ "test": "jest",
11
15
  "watch": "npm run build -- -w"
12
16
  },
17
+ "devDependencies": {
18
+ "@types/jest": "^26.0.19",
19
+ "jest": "^26.6.3",
20
+ "ts-jest": "^26.4.4"
21
+ },
13
22
  "peerDependencies": {
14
23
  "@zeedhi/common": "*",
15
24
  "@zeedhi/core": "*"
16
25
  },
17
- "gitHead": "6167df0f22df4a4694cc987de22de584f8e4fc2a"
26
+ "gitHead": "c98c8914c914ea773b0881c890ae0601361fabcf"
18
27
  }
@@ -0,0 +1,2 @@
1
+ export * from './rich-text';
2
+ export * from './interfaces';
@@ -0,0 +1,15 @@
1
+ import { IEventParam, IEvent } from '@zeedhi/core';
2
+ import { IComponentEvents, IComponentRender } from '@zeedhi/common';
3
+ export interface IRichText extends IComponentRender {
4
+ outputFormat?: string;
5
+ placeholder?: string;
6
+ disabled?: boolean;
7
+ toolbarColor?: string;
8
+ cardColor?: string;
9
+ outlined?: boolean;
10
+ width?: number | string;
11
+ height?: number | string;
12
+ }
13
+ export interface IRickTextEvents<T = IEventParam<any>> extends IComponentEvents<T> {
14
+ keydown?: IEvent<T> | string;
15
+ }
@@ -0,0 +1,49 @@
1
+ import { ComponentRender } from '@zeedhi/common';
2
+ import { IRichText, IRickTextEvents } from './interfaces';
3
+ /**
4
+ * Base class for Rich Text component.
5
+ */
6
+ export declare class RichText extends ComponentRender implements IRichText {
7
+ /**
8
+ * The content output format.
9
+ */
10
+ outputFormat: string;
11
+ /**
12
+ * Placeholder is displayed when there is no content in the editor.
13
+ */
14
+ placeholder: string;
15
+ /**
16
+ * Disable the component
17
+ */
18
+ disabled: boolean;
19
+ /**
20
+ * Toolbar color
21
+ */
22
+ toolbarColor: string;
23
+ /**
24
+ * Card color
25
+ */
26
+ cardColor: string;
27
+ /**
28
+ * Removes elevation and adds a thin border.
29
+ */
30
+ outlined: boolean;
31
+ /**
32
+ * Component width.
33
+ */
34
+ width: number | string;
35
+ /**
36
+ * Component height.
37
+ */
38
+ height: number | string;
39
+ /**
40
+ * Events registered to the Rich Text
41
+ */
42
+ events: IRickTextEvents;
43
+ constructor(props: IRichText);
44
+ /**
45
+ * Rich text content
46
+ */
47
+ content: string;
48
+ onkeydown(element?: HTMLElement, key?: string): void;
49
+ }