@zeedhi/zd-richtext-vue 1.2.0 → 1.2.2

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,74 +1,74 @@
1
- # Componente Rich Text para Zeedhi
2
- O componente de Rich Text é um editor de texto enriquecido com algumas funcionalidades.
3
-
4
- ![Alt Text](https://i.ibb.co/wCyr6jC/zd-rich-text.png)
5
-
6
- ## Instalação
7
- <code>npm i @zeedhi/zd-richtext</code>
8
- Com isso, dois pacotes serão instalados: o **@zeedhi/zd-richtext-common** e o **@zeedhi/zd-richtext-vue**.
9
-
10
- Após a instalação, é necessário que você você importe o pacote **@zeedhi/zd-richtext-vue** dentro de seu arquivo de configuração <code>zeedhi.ts</code>
11
- ```ts
12
- import { ZdRichText } from '@zeedhi/zd-richtext';
13
-
14
- Vue.component('ZdRichText', ZdRichText);
15
- ```
16
-
17
- Já o pacote **@zeedhi/zd-rich-text-common** deve ser importado no arquivo <code>controller</code> do componente.
18
-
19
- ## Uso Básico
20
- Para usar, defina a propriedade <code>component</code> como 'ZdRichText'.
21
-
22
- ```json
23
- {
24
- "name": "rich-text-example",
25
- "component": "ZdRichText"
26
- }
27
- ```
28
-
29
- ## Propriedades
30
-
31
- ### outputFormat
32
- <p>Tipo: <code>string</code></p>
33
- <p>Default: <code>json</code></p>
34
- <p>Descrição: Define o formato de saída do conteúdo digitado ('json' ou 'html')</p>
35
-
36
- ### placeholder
37
- <p>Tipo: <code>string</code></p>
38
- <p>Default: <code>''</code></p>
39
- <p>Descrição: Texto mostrado enquanto o editor estiver sem conteúdo</p>
40
-
41
- ### disabled
42
- <p>Tipo: <code>boolean</code></p>
43
- <p>Default: <code>false</code></p>
44
- <p>Descrição: Desabilita o componente</p>
45
-
46
- ### toolbarColor
47
- <p>Tipo: <code>string</code></p>
48
- <p>Default: <code>'#772583'</code></p>
49
- <p>Descrição: Define a cor da barra de tarefas</p>
50
-
51
- ### cardColor
52
- <p>Tipo: <code>string</code></p>
53
- <p>Default: <code>''</code></p>
54
- <p>Descrição: Define a cor do cartão de entrada de texto</p>
55
-
56
- ### outlined
57
- <p>Tipo: <code>boolean</code></p>
58
- <p>Default: <code>false</code></p>
59
- <p>Descrição: Remove a elevação e adiciona uma borda fina ao cartão de entrada de texto</p>
60
-
61
- ### width
62
- <p>Tipo: <code>number | string</code></p>
63
- <p>Default: <code>''</code></p>
64
- <p>Descrição: Define a largura do componente</p>
65
-
66
- ### height
67
- <p>Tipo: <code>number | string</code></p>
68
- <p>Default: <code>''</code></p>
69
- <p>Descrição: Define a altura do componente</p>
70
-
71
- ## Eventos
72
- <p>Nome: <code>onKeyDown</code></p>
73
- <p><code>{ element, component, key, content }: IEventParam</code></p>
74
- <p>Descrição: Disparado quando uma tecla é digitada no editor</p>
1
+ # Componente Rich Text para Zeedhi
2
+ O componente de Rich Text é um editor de texto enriquecido com algumas funcionalidades.
3
+
4
+ ![Alt Text](https://i.ibb.co/wCyr6jC/zd-rich-text.png)
5
+
6
+ ## Instalação
7
+ <code>npm i @zeedhi/zd-richtext</code>
8
+ Com isso, dois pacotes serão instalados: o **@zeedhi/zd-richtext-common** e o **@zeedhi/zd-richtext-vue**.
9
+
10
+ Após a instalação, é necessário que você você importe o pacote **@zeedhi/zd-richtext-vue** dentro de seu arquivo de configuração <code>zeedhi.ts</code>
11
+ ```ts
12
+ import { ZdRichText } from '@zeedhi/zd-richtext';
13
+
14
+ Vue.component('ZdRichText', ZdRichText);
15
+ ```
16
+
17
+ Já o pacote **@zeedhi/zd-rich-text-common** deve ser importado no arquivo <code>controller</code> do componente.
18
+
19
+ ## Uso Básico
20
+ Para usar, defina a propriedade <code>component</code> como 'ZdRichText'.
21
+
22
+ ```json
23
+ {
24
+ "name": "rich-text-example",
25
+ "component": "ZdRichText"
26
+ }
27
+ ```
28
+
29
+ ## Propriedades
30
+
31
+ ### outputFormat
32
+ <p>Tipo: <code>string</code></p>
33
+ <p>Default: <code>json</code></p>
34
+ <p>Descrição: Define o formato de saída do conteúdo digitado ('json' ou 'html')</p>
35
+
36
+ ### placeholder
37
+ <p>Tipo: <code>string</code></p>
38
+ <p>Default: <code>''</code></p>
39
+ <p>Descrição: Texto mostrado enquanto o editor estiver sem conteúdo</p>
40
+
41
+ ### disabled
42
+ <p>Tipo: <code>boolean</code></p>
43
+ <p>Default: <code>false</code></p>
44
+ <p>Descrição: Desabilita o componente</p>
45
+
46
+ ### toolbarColor
47
+ <p>Tipo: <code>string</code></p>
48
+ <p>Default: <code>'#772583'</code></p>
49
+ <p>Descrição: Define a cor da barra de tarefas</p>
50
+
51
+ ### cardColor
52
+ <p>Tipo: <code>string</code></p>
53
+ <p>Default: <code>''</code></p>
54
+ <p>Descrição: Define a cor do cartão de entrada de texto</p>
55
+
56
+ ### outlined
57
+ <p>Tipo: <code>boolean</code></p>
58
+ <p>Default: <code>false</code></p>
59
+ <p>Descrição: Remove a elevação e adiciona uma borda fina ao cartão de entrada de texto</p>
60
+
61
+ ### width
62
+ <p>Tipo: <code>number | string</code></p>
63
+ <p>Default: <code>''</code></p>
64
+ <p>Descrição: Define a largura do componente</p>
65
+
66
+ ### height
67
+ <p>Tipo: <code>number | string</code></p>
68
+ <p>Default: <code>''</code></p>
69
+ <p>Descrição: Define a altura do componente</p>
70
+
71
+ ## Eventos
72
+ <p>Nome: <code>onKeyDown</code></p>
73
+ <p><code>{ element, component, key, content }: IEventParam</code></p>
74
+ <p>Descrição: Disparado quando uma tecla é digitada no editor</p>
@@ -40,7 +40,8 @@ let ZdRichText = class ZdRichText extends ZdComponentRender {
40
40
  Italic,
41
41
  Strike,
42
42
  Underline,
43
- [Heading,
43
+ [
44
+ Heading,
44
45
  {
45
46
  options: {
46
47
  levels: [1, 2, 3],
@@ -56,7 +57,7 @@ let ZdRichText = class ZdRichText extends ZdComponentRender {
56
57
  this.instanceType = RichText;
57
58
  }
58
59
  onKeyDown(event) {
59
- this.instance.onkeydown(this.$el, event.key);
60
+ this.instance.onKeyDown(this.$el, event.key);
60
61
  }
61
62
  };
62
63
  __decorate([
@@ -68,11 +69,14 @@ __decorate([
68
69
  __metadata("design:type", String)
69
70
  ], ZdRichText.prototype, "placeholder", void 0);
70
71
  __decorate([
71
- PropWatch({ type: [Boolean, String], default: false }),
72
+ PropWatch({
73
+ type: [Boolean, String],
74
+ default: false,
75
+ }),
72
76
  __metadata("design:type", Object)
73
77
  ], ZdRichText.prototype, "disabled", void 0);
74
78
  __decorate([
75
- PropWatch({ type: String, default: 'var(--v-primary-base)' }),
79
+ PropWatch({ type: String, default: undefined }),
76
80
  __metadata("design:type", String)
77
81
  ], ZdRichText.prototype, "toolbarColor", void 0);
78
82
  __decorate([
@@ -80,15 +84,24 @@ __decorate([
80
84
  __metadata("design:type", String)
81
85
  ], ZdRichText.prototype, "cardColor", void 0);
82
86
  __decorate([
83
- PropWatch({ type: [Boolean, String], default: false }),
87
+ PropWatch({
88
+ type: [Boolean, String],
89
+ default: false,
90
+ }),
84
91
  __metadata("design:type", Object)
85
92
  ], ZdRichText.prototype, "outlined", void 0);
86
93
  __decorate([
87
- PropWatch({ type: [Number, String], default: '' }),
94
+ PropWatch({
95
+ type: [Number, String],
96
+ default: '',
97
+ }),
88
98
  __metadata("design:type", Object)
89
99
  ], ZdRichText.prototype, "width", void 0);
90
100
  __decorate([
91
- PropWatch({ type: [Number, String], default: '' }),
101
+ PropWatch({
102
+ type: [Number, String],
103
+ default: '',
104
+ }),
92
105
  __metadata("design:type", Object)
93
106
  ], ZdRichText.prototype, "height", void 0);
94
107
  ZdRichText = __decorate([
@@ -232,36 +245,59 @@ var __vue_render__ = function () {
232
245
  var _vm = this;
233
246
  var _h = _vm.$createElement;
234
247
  var _c = _vm._self._c || _h;
235
- return _c("tiptap-vuetify", {
236
- staticClass: "zd-rich-text",
237
- attrs: {
238
- id: _vm.instance.name,
239
- "output-format": _vm.instance.outputFormat,
240
- extensions: _vm.extensions,
241
- "toolbar-attributes": {
242
- color: _vm.instance.toolbarColor,
243
- class: "rounded-t",
244
- width: _vm.instance.width,
245
- },
246
- "card-props": {
247
- color: _vm.instance.cardColor,
248
- class: "rounded-b-md",
249
- outlined: _vm.instance.outlined,
250
- width: _vm.instance.width,
251
- height: _vm.instance.height,
252
- },
253
- placeholder: _vm.instance.placeholder,
254
- disabled: _vm.instance.disabled,
248
+ return _c(
249
+ "div",
250
+ {
251
+ directives: [
252
+ {
253
+ name: "show",
254
+ rawName: "v-show",
255
+ value: _vm.instance.isVisible,
256
+ expression: "instance.isVisible",
257
+ },
258
+ ],
259
+ class: ["zd-rich-text", _vm.instance.cssClass],
260
+ attrs: { id: _vm.instance.name, name: _vm.instance.name },
255
261
  },
256
- on: { keydown: _vm.onKeyDown },
257
- model: {
258
- value: _vm.instance.content,
259
- callback: function ($$v) {
260
- _vm.$set(_vm.instance, "content", $$v);
261
- },
262
- expression: "instance.content",
263
- },
264
- })
262
+ [
263
+ _c("tiptap-vuetify", {
264
+ attrs: {
265
+ "output-format": _vm.instance.outputFormat,
266
+ extensions: _vm.extensions,
267
+ "toolbar-attributes": {
268
+ color: _vm.instance.toolbarColor,
269
+ class: "zd-rich-text-header rounded-t",
270
+ width: _vm.instance.width,
271
+ },
272
+ "card-props": {
273
+ color: _vm.instance.cardColor,
274
+ class: "zd-rich-text-content rounded-b-md",
275
+ outlined: _vm.instance.outlined,
276
+ width: _vm.instance.width,
277
+ height: _vm.instance.height,
278
+ style: _vm.instance.cssStyle,
279
+ dark: _vm.instance.dark,
280
+ light: _vm.instance.light,
281
+ },
282
+ placeholder: _vm.instance.placeholder,
283
+ disabled: _vm.instance.disabled,
284
+ },
285
+ on: {
286
+ keydown: function ($event) {
287
+ return _vm.onKeyDown($event)
288
+ },
289
+ },
290
+ model: {
291
+ value: _vm.instance.content,
292
+ callback: function ($$v) {
293
+ _vm.$set(_vm.instance, "content", $$v);
294
+ },
295
+ expression: "instance.content",
296
+ },
297
+ }),
298
+ ],
299
+ 1
300
+ )
265
301
  };
266
302
  var __vue_staticRenderFns__ = [];
267
303
  __vue_render__._withStripped = true;
@@ -269,7 +305,7 @@ __vue_render__._withStripped = true;
269
305
  /* style */
270
306
  const __vue_inject_styles__ = function (inject) {
271
307
  if (!inject) return
272
- inject("data-v-354eed49_0", { source: ".zd-rich-text button.v-btn.v-btn--icon.v-btn--round.theme--light.v-size--small.tiptap-vuetify-editor__action-render-btn {\n color: #ffffff;\n}\n.zd-rich-text div.v-card {\n display: flex;\n flex-direction: column;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__toolbar {\n display: flex;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content {\n flex-grow: 1;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content .ProseMirror {\n margin: var(--spacing-2) !important;\n height: 100%;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content .ProseMirror p {\n margin-top: var(--spacing-2) !important;\n margin-bottom: var(--spacing-2) !important;\n}", map: undefined, media: undefined });
308
+ inject("data-v-6f6ebaf8_0", { source: ".zd-rich-text button.v-btn {\n color: #ffffff !important;\n}\n.zd-rich-text-content.theme--dark {\n background-color: #383838;\n}\n.zd-rich-text div.v-card {\n display: flex;\n flex-direction: column;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__toolbar {\n display: flex;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__toolbar header {\n background-color: var(--v-primary-base);\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content {\n flex-grow: 1;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content .ProseMirror {\n margin: var(--spacing-2) !important;\n height: 100%;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content .ProseMirror p {\n margin-top: var(--spacing-2) !important;\n margin-bottom: var(--spacing-2) !important;\n}", map: undefined, media: undefined });
273
309
 
274
310
  };
275
311
  /* scoped */
@@ -43,7 +43,8 @@
43
43
  Italic,
44
44
  Strike,
45
45
  Underline,
46
- [Heading,
46
+ [
47
+ Heading,
47
48
  {
48
49
  options: {
49
50
  levels: [1, 2, 3],
@@ -59,7 +60,7 @@
59
60
  this.instanceType = zdRichtextCommon.RichText;
60
61
  }
61
62
  onKeyDown(event) {
62
- this.instance.onkeydown(this.$el, event.key);
63
+ this.instance.onKeyDown(this.$el, event.key);
63
64
  }
64
65
  };
65
66
  __decorate([
@@ -71,11 +72,14 @@
71
72
  __metadata("design:type", String)
72
73
  ], ZdRichText.prototype, "placeholder", void 0);
73
74
  __decorate([
74
- vuetify.PropWatch({ type: [Boolean, String], default: false }),
75
+ vuetify.PropWatch({
76
+ type: [Boolean, String],
77
+ default: false,
78
+ }),
75
79
  __metadata("design:type", Object)
76
80
  ], ZdRichText.prototype, "disabled", void 0);
77
81
  __decorate([
78
- vuetify.PropWatch({ type: String, default: 'var(--v-primary-base)' }),
82
+ vuetify.PropWatch({ type: String, default: undefined }),
79
83
  __metadata("design:type", String)
80
84
  ], ZdRichText.prototype, "toolbarColor", void 0);
81
85
  __decorate([
@@ -83,15 +87,24 @@
83
87
  __metadata("design:type", String)
84
88
  ], ZdRichText.prototype, "cardColor", void 0);
85
89
  __decorate([
86
- vuetify.PropWatch({ type: [Boolean, String], default: false }),
90
+ vuetify.PropWatch({
91
+ type: [Boolean, String],
92
+ default: false,
93
+ }),
87
94
  __metadata("design:type", Object)
88
95
  ], ZdRichText.prototype, "outlined", void 0);
89
96
  __decorate([
90
- vuetify.PropWatch({ type: [Number, String], default: '' }),
97
+ vuetify.PropWatch({
98
+ type: [Number, String],
99
+ default: '',
100
+ }),
91
101
  __metadata("design:type", Object)
92
102
  ], ZdRichText.prototype, "width", void 0);
93
103
  __decorate([
94
- vuetify.PropWatch({ type: [Number, String], default: '' }),
104
+ vuetify.PropWatch({
105
+ type: [Number, String],
106
+ default: '',
107
+ }),
95
108
  __metadata("design:type", Object)
96
109
  ], ZdRichText.prototype, "height", void 0);
97
110
  ZdRichText = __decorate([
@@ -235,36 +248,59 @@
235
248
  var _vm = this;
236
249
  var _h = _vm.$createElement;
237
250
  var _c = _vm._self._c || _h;
238
- return _c("tiptap-vuetify", {
239
- staticClass: "zd-rich-text",
240
- attrs: {
241
- id: _vm.instance.name,
242
- "output-format": _vm.instance.outputFormat,
243
- extensions: _vm.extensions,
244
- "toolbar-attributes": {
245
- color: _vm.instance.toolbarColor,
246
- class: "rounded-t",
247
- width: _vm.instance.width,
248
- },
249
- "card-props": {
250
- color: _vm.instance.cardColor,
251
- class: "rounded-b-md",
252
- outlined: _vm.instance.outlined,
253
- width: _vm.instance.width,
254
- height: _vm.instance.height,
255
- },
256
- placeholder: _vm.instance.placeholder,
257
- disabled: _vm.instance.disabled,
251
+ return _c(
252
+ "div",
253
+ {
254
+ directives: [
255
+ {
256
+ name: "show",
257
+ rawName: "v-show",
258
+ value: _vm.instance.isVisible,
259
+ expression: "instance.isVisible",
260
+ },
261
+ ],
262
+ class: ["zd-rich-text", _vm.instance.cssClass],
263
+ attrs: { id: _vm.instance.name, name: _vm.instance.name },
258
264
  },
259
- on: { keydown: _vm.onKeyDown },
260
- model: {
261
- value: _vm.instance.content,
262
- callback: function ($$v) {
263
- _vm.$set(_vm.instance, "content", $$v);
264
- },
265
- expression: "instance.content",
266
- },
267
- })
265
+ [
266
+ _c("tiptap-vuetify", {
267
+ attrs: {
268
+ "output-format": _vm.instance.outputFormat,
269
+ extensions: _vm.extensions,
270
+ "toolbar-attributes": {
271
+ color: _vm.instance.toolbarColor,
272
+ class: "zd-rich-text-header rounded-t",
273
+ width: _vm.instance.width,
274
+ },
275
+ "card-props": {
276
+ color: _vm.instance.cardColor,
277
+ class: "zd-rich-text-content rounded-b-md",
278
+ outlined: _vm.instance.outlined,
279
+ width: _vm.instance.width,
280
+ height: _vm.instance.height,
281
+ style: _vm.instance.cssStyle,
282
+ dark: _vm.instance.dark,
283
+ light: _vm.instance.light,
284
+ },
285
+ placeholder: _vm.instance.placeholder,
286
+ disabled: _vm.instance.disabled,
287
+ },
288
+ on: {
289
+ keydown: function ($event) {
290
+ return _vm.onKeyDown($event)
291
+ },
292
+ },
293
+ model: {
294
+ value: _vm.instance.content,
295
+ callback: function ($$v) {
296
+ _vm.$set(_vm.instance, "content", $$v);
297
+ },
298
+ expression: "instance.content",
299
+ },
300
+ }),
301
+ ],
302
+ 1
303
+ )
268
304
  };
269
305
  var __vue_staticRenderFns__ = [];
270
306
  __vue_render__._withStripped = true;
@@ -272,7 +308,7 @@
272
308
  /* style */
273
309
  const __vue_inject_styles__ = function (inject) {
274
310
  if (!inject) return
275
- inject("data-v-354eed49_0", { source: ".zd-rich-text button.v-btn.v-btn--icon.v-btn--round.theme--light.v-size--small.tiptap-vuetify-editor__action-render-btn {\n color: #ffffff;\n}\n.zd-rich-text div.v-card {\n display: flex;\n flex-direction: column;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__toolbar {\n display: flex;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content {\n flex-grow: 1;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content .ProseMirror {\n margin: var(--spacing-2) !important;\n height: 100%;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content .ProseMirror p {\n margin-top: var(--spacing-2) !important;\n margin-bottom: var(--spacing-2) !important;\n}", map: undefined, media: undefined });
311
+ inject("data-v-6f6ebaf8_0", { source: ".zd-rich-text button.v-btn {\n color: #ffffff !important;\n}\n.zd-rich-text-content.theme--dark {\n background-color: #383838;\n}\n.zd-rich-text div.v-card {\n display: flex;\n flex-direction: column;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__toolbar {\n display: flex;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__toolbar header {\n background-color: var(--v-primary-base);\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content {\n flex-grow: 1;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content .ProseMirror {\n margin: var(--spacing-2) !important;\n height: 100%;\n}\n.zd-rich-text div.v-card div.tiptap-vuetify-editor__content .ProseMirror p {\n margin-top: var(--spacing-2) !important;\n margin-bottom: var(--spacing-2) !important;\n}", map: undefined, media: undefined });
276
312
 
277
313
  };
278
314
  /* scoped */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/zd-richtext-vue",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "RichTextVue by BVR",
5
5
  "main": "dist/rich-text-vue.umd.js",
6
6
  "module": "dist/rich-text-vue.esm.js",
@@ -14,6 +14,7 @@
14
14
  "watch": "rollup -cw"
15
15
  },
16
16
  "dependencies": {
17
+ "tiptap-extensions": "^1.35.2",
17
18
  "tiptap-vuetify": "^2.24.0"
18
19
  },
19
20
  "peerDependencies": {
@@ -23,5 +24,5 @@
23
24
  "vue-class-component": "^7.2.6",
24
25
  "vue-property-decorator": "^9.1.2"
25
26
  },
26
- "gitHead": "e4e4e252e4ea83919f14a67364af75edbfdc5686"
27
+ "gitHead": "afcd93321d2805e8ac7e3f0bd55b39a636736f05"
27
28
  }