@zeedhi/zd-richtext-vue 1.5.1 → 3.0.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.
@@ -1,874 +0,0 @@
1
- import { I18n, VersionService } from '@zeedhi/core';
2
- import { PropWatch, ZdComponentRender, setFillHeight, Vuetify } from '@zeedhi/vuetify';
3
- import { locale, createVuetifyProTipTap, VuetifyTiptap } from '@zeedhi/zd-vuetify-pro-tiptap';
4
- import '@zeedhi/zd-vuetify-pro-tiptap/lib/style.css';
5
- import Vue, { ref } from 'vue';
6
- import { FontFamily as FontFamily$1 } from '@tiptap/extension-font-family';
7
- import { EditorContent } from '@tiptap/vue-2';
8
- import { RichText } from '@zeedhi/zd-richtext-common';
9
- import { Watch, Component as Component$1 } from 'vue-property-decorator';
10
- import Component from 'vue-class-component';
11
-
12
- /*! *****************************************************************************
13
- Copyright (c) Microsoft Corporation.
14
-
15
- Permission to use, copy, modify, and/or distribute this software for any
16
- purpose with or without fee is hereby granted.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
19
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
20
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
21
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
22
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
23
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
24
- PERFORMANCE OF THIS SOFTWARE.
25
- ***************************************************************************** */
26
-
27
- function __decorate(decorators, target, key, desc) {
28
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
29
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
30
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
31
- return c > 3 && r && Object.defineProperty(target, key, r), r;
32
- }
33
-
34
- function __metadata(metadataKey, metadataValue) {
35
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
36
- }
37
-
38
- const fonts = [
39
- { font: 'Inter', title: 'Inter' },
40
- { font: 'Roboto', title: 'Roboto' },
41
- { font: 'serif', title: 'Serif' },
42
- { font: 'monospace', title: 'Monospace' },
43
- ];
44
- let FontFamily = class FontFamily extends ZdComponentRender {
45
- setFontStyle(editor, font) {
46
- editor.chain().focus().setFontFamily(font).run();
47
- }
48
- };
49
- __decorate([
50
- PropWatch({ type: Object, default: '' }),
51
- __metadata("design:type", Object)
52
- ], FontFamily.prototype, "editor", void 0);
53
- __decorate([
54
- PropWatch({ type: Object, default: '' }),
55
- __metadata("design:type", Object)
56
- ], FontFamily.prototype, "attrs", void 0);
57
- __decorate([
58
- PropWatch({ type: Array, default: () => (fonts) }),
59
- __metadata("design:type", Array)
60
- ], FontFamily.prototype, "fonts", void 0);
61
- FontFamily = __decorate([
62
- Component
63
- ], FontFamily);
64
- var script$1 = FontFamily;
65
-
66
- let installed = false;
67
- const setInstalled = () => {
68
- installed = true;
69
- };
70
- const getInstalled = () => installed;
71
-
72
- let ZdRichText = class ZdRichText extends ZdComponentRender {
73
- constructor() {
74
- super(...arguments);
75
- this.instanceType = RichText;
76
- this.isMounted = false;
77
- this.extensions = [FontFamily$1];
78
- this.toolbar = ref([
79
- 'bold',
80
- 'italic',
81
- 'underline',
82
- 'strike',
83
- 'color',
84
- // "highlight",
85
- '|',
86
- 'h1',
87
- 'h2',
88
- 'h3',
89
- 'h4',
90
- 'h5',
91
- // "h6",
92
- // "p",
93
- '|',
94
- 'left',
95
- 'center',
96
- 'right',
97
- 'justify',
98
- '|',
99
- 'bulletList',
100
- 'orderedList',
101
- // "taskList",
102
- // "indent",
103
- // "outdent",
104
- '|',
105
- // "link",
106
- 'image',
107
- // "video",
108
- // "table",
109
- // "blockquote",
110
- 'rule',
111
- 'code',
112
- '|',
113
- // "codeBlock",
114
- // "|",
115
- // "clear",
116
- // "fullscreen",
117
- // "undo",
118
- // "redo",
119
- '#fontFamily',
120
- ]);
121
- this.toolbarReadonly = ref([
122
- // 'bold',
123
- ]);
124
- }
125
- onKeyDown(event) {
126
- this.instance.onKeyDown(this.$el, event.key);
127
- }
128
- changeLanguage() {
129
- const newLanguage = I18n.instance.language.split('-')[0];
130
- locale.setLang(newLanguage);
131
- }
132
- hasClass() {
133
- return this.isMounted && this.$el.classList.contains('zd-form-child');
134
- }
135
- input(instanceInput) {
136
- if (instanceInput) {
137
- this.instance.input(this.content);
138
- }
139
- }
140
- onFocus(event) {
141
- this.instance.onFocus(event);
142
- this.initialFocusValue = this.instance.content;
143
- }
144
- onBlur(event) {
145
- this.instance.onBlur(event);
146
- if (this.initialFocusValue !== this.instance.content) {
147
- this.instance.onChange(this.instance.content);
148
- }
149
- }
150
- created() {
151
- if (!getInstalled()) {
152
- console.error('[ZdRichText]: A partir da versão 1.5.0 o componente ZdRichText deve ser instalado'
153
- + ' usando o Vue.use() ao invés do Vue.component(). Veja a documentação para mais detalhes.');
154
- }
155
- }
156
- mounted() {
157
- var _a;
158
- if (this.$refs.tiptap.editor) {
159
- this.instance.formatGetter.html = this.$refs.tiptap.editor.getHTML.bind(this.$refs.tiptap.editor);
160
- this.instance.formatGetter.json = this.$refs.tiptap.editor.getJSON.bind(this.$refs.tiptap.editor);
161
- this.$refs.tiptap.editor.on('focus', this.onFocus);
162
- this.$refs.tiptap.editor.on('blur', this.onBlur);
163
- }
164
- if (!this.readonly) {
165
- const header = this.$el.querySelector('header.py-1.ps-1.vuetify-pro-tiptap-editor__toolbar.v-sheet.v-toolbar');
166
- (_a = header) === null || _a === void 0 ? void 0 : _a.style.setProperty('background-color', this.toolbarColor || 'var(--v-primary-base)', 'important');
167
- if (this.cardColor) {
168
- const card = this.$el.querySelector('.vuetify-pro-tiptap-editor__content');
169
- card.style.setProperty('background-color', this.cardColor, 'important');
170
- }
171
- }
172
- this.changeLanguage();
173
- if (this.instance.fillHeight) {
174
- setFillHeight(this.$el);
175
- }
176
- I18n.registerChangeListener(this.changeLanguage);
177
- this.setEditorDisabled();
178
- this.isMounted = true;
179
- }
180
- // set tiptap editor as disabled
181
- setEditorDisabled() {
182
- const { editor } = this.$refs.tiptap;
183
- const isEditable = !(this.instance.disabled || this.readonly);
184
- if (editor)
185
- editor.setOptions({ editable: isEditable });
186
- }
187
- beforeDestroy() {
188
- I18n.unregisterChangeListener(this.changeLanguage);
189
- this.$refs.tiptap.editor.off('focus', this.onFocus);
190
- this.$refs.tiptap.editor.off('blur', this.onBlur);
191
- }
192
- };
193
- __decorate([
194
- PropWatch({ type: String, default: 'html' }),
195
- __metadata("design:type", String)
196
- ], ZdRichText.prototype, "outputFormat", void 0);
197
- __decorate([
198
- PropWatch({ type: String, default: '' }),
199
- __metadata("design:type", String)
200
- ], ZdRichText.prototype, "placeholder", void 0);
201
- __decorate([
202
- PropWatch({
203
- type: [Boolean, String],
204
- default: false,
205
- }),
206
- __metadata("design:type", Object)
207
- ], ZdRichText.prototype, "disabled", void 0);
208
- __decorate([
209
- PropWatch({ type: Boolean, default: false }),
210
- __metadata("design:type", Boolean)
211
- ], ZdRichText.prototype, "readonly", void 0);
212
- __decorate([
213
- PropWatch({ type: String, default: undefined }),
214
- __metadata("design:type", String)
215
- ], ZdRichText.prototype, "toolbarColor", void 0);
216
- __decorate([
217
- PropWatch({ type: String, default: '' }),
218
- __metadata("design:type", String)
219
- ], ZdRichText.prototype, "content", void 0);
220
- __decorate([
221
- PropWatch({ type: String, default: '' }),
222
- __metadata("design:type", String)
223
- ], ZdRichText.prototype, "cardColor", void 0);
224
- __decorate([
225
- PropWatch({ type: Array, default: () => (fonts) }),
226
- __metadata("design:type", Array)
227
- ], ZdRichText.prototype, "fonts", void 0);
228
- __decorate([
229
- PropWatch({
230
- type: [Boolean, String],
231
- default: false,
232
- }),
233
- __metadata("design:type", Object)
234
- ], ZdRichText.prototype, "outlined", void 0);
235
- __decorate([
236
- PropWatch({
237
- type: [Number, String],
238
- default: '',
239
- }),
240
- __metadata("design:type", Object)
241
- ], ZdRichText.prototype, "width", void 0);
242
- __decorate([
243
- PropWatch({
244
- type: [Number, String],
245
- default: '',
246
- }),
247
- __metadata("design:type", Object)
248
- ], ZdRichText.prototype, "height", void 0);
249
- __decorate([
250
- PropWatch({
251
- type: [Object],
252
- default: () => { },
253
- }),
254
- __metadata("design:type", Object)
255
- ], ZdRichText.prototype, "formatGetter", void 0);
256
- __decorate([
257
- PropWatch({
258
- type: String,
259
- default: '',
260
- }),
261
- __metadata("design:type", String)
262
- ], ZdRichText.prototype, "value", void 0);
263
- __decorate([
264
- PropWatch({
265
- type: [Boolean, String],
266
- default: false,
267
- }),
268
- __metadata("design:type", Boolean)
269
- ], ZdRichText.prototype, "fillHeight", void 0);
270
- __decorate([
271
- Watch('instance.content'),
272
- __metadata("design:type", Function),
273
- __metadata("design:paramtypes", [String]),
274
- __metadata("design:returntype", void 0)
275
- ], ZdRichText.prototype, "input", null);
276
- ZdRichText = __decorate([
277
- Component$1({
278
- components: { EditorContent },
279
- })
280
- ], ZdRichText);
281
- var script = ZdRichText;
282
-
283
- function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
284
- if (typeof shadowMode !== 'boolean') {
285
- createInjectorSSR = createInjector;
286
- createInjector = shadowMode;
287
- shadowMode = false;
288
- }
289
- // Vue.extend constructor export interop.
290
- const options = typeof script === 'function' ? script.options : script;
291
- // render functions
292
- if (template && template.render) {
293
- options.render = template.render;
294
- options.staticRenderFns = template.staticRenderFns;
295
- options._compiled = true;
296
- // functional template
297
- if (isFunctionalTemplate) {
298
- options.functional = true;
299
- }
300
- }
301
- // scopedId
302
- if (scopeId) {
303
- options._scopeId = scopeId;
304
- }
305
- let hook;
306
- if (moduleIdentifier) {
307
- // server build
308
- hook = function (context) {
309
- // 2.3 injection
310
- context =
311
- context || // cached call
312
- (this.$vnode && this.$vnode.ssrContext) || // stateful
313
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional
314
- // 2.2 with runInNewContext: true
315
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
316
- context = __VUE_SSR_CONTEXT__;
317
- }
318
- // inject component styles
319
- if (style) {
320
- style.call(this, createInjectorSSR(context));
321
- }
322
- // register component module identifier for async chunk inference
323
- if (context && context._registeredComponents) {
324
- context._registeredComponents.add(moduleIdentifier);
325
- }
326
- };
327
- // used by ssr in case component is cached and beforeCreate
328
- // never gets called
329
- options._ssrRegister = hook;
330
- }
331
- else if (style) {
332
- hook = shadowMode
333
- ? function (context) {
334
- style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
335
- }
336
- : function (context) {
337
- style.call(this, createInjector(context));
338
- };
339
- }
340
- if (hook) {
341
- if (options.functional) {
342
- // register for functional component in vue file
343
- const originalRender = options.render;
344
- options.render = function renderWithStyleInjection(h, context) {
345
- hook.call(context);
346
- return originalRender(h, context);
347
- };
348
- }
349
- else {
350
- // inject component registration as beforeCreate hook
351
- const existing = options.beforeCreate;
352
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
353
- }
354
- }
355
- return script;
356
- }
357
-
358
- const isOldIE = typeof navigator !== 'undefined' &&
359
- /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
360
- function createInjector(context) {
361
- return (id, style) => addStyle(id, style);
362
- }
363
- let HEAD;
364
- const styles = {};
365
- function addStyle(id, css) {
366
- const group = isOldIE ? css.media || 'default' : id;
367
- const style = styles[group] || (styles[group] = { ids: new Set(), styles: [] });
368
- if (!style.ids.has(id)) {
369
- style.ids.add(id);
370
- let code = css.source;
371
- if (css.map) {
372
- // https://developer.chrome.com/devtools/docs/javascript-debugging
373
- // this makes source maps inside style tags work properly in Chrome
374
- code += '\n/*# sourceURL=' + css.map.sources[0] + ' */';
375
- // http://stackoverflow.com/a/26603875
376
- code +=
377
- '\n/*# sourceMappingURL=data:application/json;base64,' +
378
- btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) +
379
- ' */';
380
- }
381
- if (!style.element) {
382
- style.element = document.createElement('style');
383
- style.element.type = 'text/css';
384
- if (css.media)
385
- style.element.setAttribute('media', css.media);
386
- if (HEAD === undefined) {
387
- HEAD = document.head || document.getElementsByTagName('head')[0];
388
- }
389
- HEAD.appendChild(style.element);
390
- }
391
- if ('styleSheet' in style.element) {
392
- style.styles.push(code);
393
- style.element.styleSheet.cssText = style.styles
394
- .filter(Boolean)
395
- .join('\n');
396
- }
397
- else {
398
- const index = style.ids.size - 1;
399
- const textNode = document.createTextNode(code);
400
- const nodes = style.element.childNodes;
401
- if (nodes[index])
402
- style.element.removeChild(nodes[index]);
403
- if (nodes.length)
404
- style.element.insertBefore(textNode, nodes[index]);
405
- else
406
- style.element.appendChild(textNode);
407
- }
408
- }
409
- }
410
-
411
- /* script */
412
- const __vue_script__$1 = script;
413
-
414
- /* template */
415
- var __vue_render__$1 = function () {
416
- var _vm = this;
417
- var _h = _vm.$createElement;
418
- var _c = _vm._self._c || _h;
419
- return _c(
420
- "div",
421
- {
422
- directives: [
423
- {
424
- name: "show",
425
- rawName: "v-show",
426
- value: _vm.instance.isVisible,
427
- expression: "instance.isVisible",
428
- },
429
- ],
430
- class: ["zd-rich-text", "zd-elevation-2", _vm.instance.cssClass],
431
- style: {
432
- height: _vm.$formatSize(_vm.instance.height),
433
- },
434
- attrs: { id: _vm.instance.name, name: _vm.instance.name },
435
- on: {
436
- keydown: function ($event) {
437
- return _vm.onKeyDown($event)
438
- },
439
- },
440
- },
441
- [
442
- _c("vuetify-tiptap", {
443
- ref: "tiptap",
444
- class: [
445
- { "zd-rich-text--disabled": _vm.instance.disabled },
446
- _vm.readonly && !_vm.hasClass() && "zd-rich-text--readonly",
447
- ],
448
- attrs: {
449
- markdownTheme: false,
450
- dark: _vm.instance.dark,
451
- disabled: _vm.instance.disabled,
452
- readonly: _vm.instance.readonly,
453
- outlined: _vm.instance.outlined,
454
- placeholder: _vm.instance.placeholder,
455
- toolbar: _vm.readonly ? _vm.toolbarReadonly : _vm.toolbar,
456
- rounded: "",
457
- "max-width": _vm.instance.width,
458
- extensions: _vm.extensions,
459
- },
460
- scopedSlots: _vm._u([
461
- {
462
- key: "editor",
463
- fn: function (ref) {
464
- var editor = ref.editor;
465
- var attrs = ref.attrs;
466
- return [
467
- _c("editor-content", {
468
- staticClass:
469
- "vuetify-pro-tiptap-editor__content zd-rich-text-content markdown-theme-github",
470
- class: [{ __dark: attrs.isDark }, attrs.editorClass],
471
- style: attrs.contentDynamicStyles,
472
- attrs: { editor: editor, "data-testid": "value" },
473
- }),
474
- ]
475
- },
476
- },
477
- {
478
- key: "bottom",
479
- fn: function (ref) {
480
- return [_c("span")]
481
- },
482
- },
483
- {
484
- key: "fontFamily",
485
- fn: function (ref) {
486
- var editor = ref.editor;
487
- var attrs = ref.attrs;
488
- return [
489
- _c("FontFamily", {
490
- attrs: {
491
- name: _vm.instance.name + "-fontFamily",
492
- editor: editor,
493
- attrs: attrs,
494
- fonts: _vm.instance.fonts,
495
- },
496
- }),
497
- ]
498
- },
499
- },
500
- ]),
501
- model: {
502
- value: _vm.instance.content,
503
- callback: function ($$v) {
504
- _vm.$set(_vm.instance, "content", $$v);
505
- },
506
- expression: "instance.content",
507
- },
508
- }),
509
- ],
510
- 1
511
- )
512
- };
513
- var __vue_staticRenderFns__$1 = [];
514
- __vue_render__$1._withStripped = true;
515
-
516
- /* style */
517
- const __vue_inject_styles__$1 = function (inject) {
518
- if (!inject) return
519
- inject("data-v-45ed460e_0", { source: ".zd-rich-text #tippy-1 {\n display: none;\n}\n.zd-rich-text .vuetify-pro-tiptap-editor.v-card.v-card--flat.v-sheet.theme--light.rounded {\n background-color: #ffffff !important;\n}\n.zd-rich-text .vuetify-pro-tiptap-editor.v-card.v-card--flat.v-sheet.theme--dark.rounded {\n background-color: #383838 !important;\n}\n.zd-rich-text .zd-rich-text--disabled .vuetify-pro-tiptap-editor__toolbar {\n pointer-events: none;\n opacity: 0.5;\n}\n.zd-rich-text .zd-rich-text--readonly {\n width: 741px;\n}\n.zd-rich-text .v-toolbar__content button.v-btn {\n color: #ffffff !important;\n}", map: undefined, media: undefined });
520
-
521
- };
522
- /* scoped */
523
- const __vue_scope_id__$1 = undefined;
524
- /* module identifier */
525
- const __vue_module_identifier__$1 = undefined;
526
- /* functional template */
527
- const __vue_is_functional_template__$1 = false;
528
- /* style inject SSR */
529
-
530
- /* style inject shadow dom */
531
-
532
-
533
-
534
- const __vue_component__$1 = /*#__PURE__*/normalizeComponent(
535
- { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },
536
- __vue_inject_styles__$1,
537
- __vue_script__$1,
538
- __vue_scope_id__$1,
539
- __vue_is_functional_template__$1,
540
- __vue_module_identifier__$1,
541
- false,
542
- createInjector,
543
- undefined,
544
- undefined
545
- );
546
-
547
- /* script */
548
- const __vue_script__ = script$1;
549
-
550
- /* template */
551
- var __vue_render__ = function () {
552
- var _vm = this;
553
- var _h = _vm.$createElement;
554
- var _c = _vm._self._c || _h;
555
- return _c(
556
- "v-menu",
557
- {
558
- attrs: { "offset-y": "" },
559
- scopedSlots: _vm._u([
560
- {
561
- key: "activator",
562
- fn: function (ref) {
563
- var onMenu = ref.on;
564
- var attrs = ref.attrs;
565
- return [
566
- _c(
567
- "v-tooltip",
568
- {
569
- attrs: { bottom: "" },
570
- scopedSlots: _vm._u(
571
- [
572
- {
573
- key: "activator",
574
- fn: function (ref) {
575
- var onTooltip = ref.on;
576
- return [
577
- _c(
578
- "v-btn",
579
- _vm._g(
580
- _vm._b(
581
- {
582
- attrs: {
583
- color: "primary",
584
- dark: "",
585
- text: "",
586
- "aria-label": "Font Family",
587
- },
588
- },
589
- "v-btn",
590
- attrs,
591
- false
592
- ),
593
- Object.assign({}, onMenu, onTooltip)
594
- ),
595
- [
596
- _c("v-icon", [
597
- _vm._v(
598
- _vm._s(_vm.$getIcon("mdi-format-font"))
599
- ),
600
- ]),
601
- ],
602
- 1
603
- ),
604
- ]
605
- },
606
- },
607
- ],
608
- null,
609
- true
610
- ),
611
- },
612
- [_vm._v(" "), _c("span", [_vm._v("Font Family")])]
613
- ),
614
- ]
615
- },
616
- },
617
- ]),
618
- },
619
- [
620
- _vm._v(" "),
621
- _c(
622
- "v-list",
623
- _vm._l(_vm.fonts, function (item, index) {
624
- return _c(
625
- "v-list-item",
626
- {
627
- key: index,
628
- on: {
629
- click: function ($event) {
630
- return _vm.setFontStyle(_vm.editor, item.font)
631
- },
632
- },
633
- },
634
- [_c("v-list-item-title", [_vm._v(_vm._s(item.title))])],
635
- 1
636
- )
637
- }),
638
- 1
639
- ),
640
- ],
641
- 1
642
- )
643
- };
644
- var __vue_staticRenderFns__ = [];
645
- __vue_render__._withStripped = true;
646
-
647
- /* style */
648
- const __vue_inject_styles__ = undefined;
649
- /* scoped */
650
- const __vue_scope_id__ = undefined;
651
- /* module identifier */
652
- const __vue_module_identifier__ = undefined;
653
- /* functional template */
654
- const __vue_is_functional_template__ = false;
655
- /* style inject */
656
-
657
- /* style inject SSR */
658
-
659
- /* style inject shadow dom */
660
-
661
-
662
-
663
- const __vue_component__ = /*#__PURE__*/normalizeComponent(
664
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
665
- __vue_inject_styles__,
666
- __vue_script__,
667
- __vue_scope_id__,
668
- __vue_is_functional_template__,
669
- __vue_module_identifier__,
670
- false,
671
- undefined,
672
- undefined,
673
- undefined
674
- );
675
-
676
- /**
677
- * Function called when uploading an image to the editor
678
- * it will read the file and return a base64 string
679
- */
680
- function upload(file) {
681
- return new Promise((resolve) => {
682
- const reader = new FileReader();
683
- reader.onload = (event) => {
684
- var _a;
685
- if (typeof ((_a = event.target) === null || _a === void 0 ? void 0 : _a.result) === 'string') {
686
- resolve(event.target.result);
687
- }
688
- else {
689
- resolve('');
690
- }
691
- };
692
- reader.onerror = () => resolve('');
693
- reader.readAsDataURL(file);
694
- });
695
- }
696
-
697
- const packageContent = require('../package.json');
698
- VersionService.addPackageVersion(packageContent.name, packageContent.version);
699
- locale.setMessage('pt', {
700
- 'editor.words': 'PALAVRAS',
701
- 'editor.characters': 'CARACTERES',
702
- 'editor.bold.tooltip': 'Negrito',
703
- 'editor.italic.tooltip': 'Itálico',
704
- 'editor.underline.tooltip': 'Sublinhado',
705
- 'editor.strike.tooltip': 'Riscado',
706
- 'editor.color.tooltip': 'Cor',
707
- 'editor.highlight.tooltip': 'Realçar',
708
- 'editor.heading.h1.tooltip': 'Título 1',
709
- 'editor.heading.h2.tooltip': 'Título 2',
710
- 'editor.heading.h3.tooltip': 'Título 3',
711
- 'editor.heading.h4.tooltip': 'Título 4',
712
- 'editor.heading.h5.tooltip': 'Título 5',
713
- 'editor.heading.h6.tooltip': 'Título 6',
714
- 'editor.paragraph.tooltip': 'Parágrafo',
715
- 'editor.left.tooltip': 'Alinhar à Esquerda',
716
- 'editor.center.tooltip': 'Centralizar',
717
- 'editor.right.tooltip': 'Alinhar à Direita',
718
- 'editor.justify.tooltip': 'Justificar',
719
- 'editor.bulletlist.tooltip': 'Lista com Marcadores',
720
- 'editor.orderedlist.tooltip': 'Lista Numerada',
721
- 'editor.tasklist.tooltip': 'Lista de Tarefas',
722
- 'editor.indent.tooltip': 'Recuar',
723
- 'editor.outdent.tooltip': 'Recuar Menos',
724
- 'editor.link.tooltip': 'Link',
725
- 'editor.link.dialog.title': 'Inserir link',
726
- 'editor.link.dialog.link': 'link',
727
- 'editor.link.dialog.button.apply': 'aplicar',
728
- 'editor.image.tooltip': 'Imagem',
729
- 'editor.image.float.left.tooltip': 'Flutuar à Esquerda',
730
- 'editor.image.float.none.tooltip': 'Sem Flutuação',
731
- 'editor.image.float.right.tooltip': 'Flutuar à Direita',
732
- 'editor.image.size.small.tooltip': 'Pequeno',
733
- 'editor.image.size.medium.tooltip': 'Médio',
734
- 'editor.image.size.large.tooltip': 'Grande',
735
- 'editor.image.remove.tooltip': 'Remover',
736
- 'editor.image.dialog.title': 'Inserir imagem',
737
- 'editor.image.dialog.tab.url': 'URL',
738
- 'editor.image.dialog.tab.upload': 'Upload',
739
- 'editor.image.dialog.form.link': 'Link',
740
- 'editor.image.dialog.form.alt': 'Alt',
741
- 'editor.image.dialog.form.aspectRatio': 'Manter Proporções Originais',
742
- 'editor.image.dialog.form.file': 'Arquivo',
743
- 'editor.image.dialog.button.apply': 'Aplicar',
744
- 'editor.video.tooltip': 'Vídeo',
745
- 'editor.video.dialog.title': 'Inserir vídeo',
746
- 'editor.video.dialog.link': 'link',
747
- 'editor.video.dialog.button.apply': 'Aplicar',
748
- 'editor.video.remove.tooltip': 'Remover',
749
- 'editor.table.tooltip': 'Tabela',
750
- 'editor.table.menu.insert_table': 'Inserir Tabela',
751
- 'editor.table.menu.insert_table.with_header_row': 'Com Linha de Cabeçalho',
752
- 'editor.table.menu.add_column_before': 'Adicionar Coluna Antes',
753
- 'editor.table.menu.add_column_after': 'Adicionar Coluna Depois',
754
- 'editor.table.menu.delete_column': 'Excluir Coluna',
755
- 'editor.table.menu.add_row_before': 'Adicionar Linha Antes',
756
- 'editor.table.menu.add_row_after': 'Adicionar Linha Depois',
757
- 'editor.table.menu.delete_row': 'Excluir Linha',
758
- 'editor.table.menu.merge_or_split_cells': 'Mesclar ou Dividir Células',
759
- 'editor.table.menu.delete_table': 'Excluir Tabela',
760
- 'editor.blockquote.tooltip': 'Citação',
761
- 'editor.horizontalrule.tooltip': 'Linha Horizontal',
762
- 'editor.code.tooltip': 'Código',
763
- 'editor.codeblock.tooltip': 'Bloco de Código',
764
- 'editor.clear.tooltip': 'Limpar Formatação',
765
- 'editor.undo.tooltip': 'Desfazer',
766
- 'editor.redo.tooltip': 'Refazer',
767
- 'editor.fullscreen.tooltip.fullscreen': 'Tela Cheia',
768
- 'editor.fullscreen.tooltip.exit': 'Sair da Tela Cheia',
769
- });
770
- locale.setMessage('es', {
771
- 'editor.words': 'PALABRAS',
772
- 'editor.characters': 'CARACTERES',
773
- 'editor.bold.tooltip': 'Negrita',
774
- 'editor.italic.tooltip': 'Cursiva',
775
- 'editor.underline.tooltip': 'Subrayado',
776
- 'editor.strike.tooltip': 'Tachado',
777
- 'editor.color.tooltip': 'Color',
778
- 'editor.highlight.tooltip': 'Resaltar',
779
- 'editor.heading.h1.tooltip': 'Encabezado 1',
780
- 'editor.heading.h2.tooltip': 'Encabezado 2',
781
- 'editor.heading.h3.tooltip': 'Encabezado 3',
782
- 'editor.heading.h4.tooltip': 'Encabezado 4',
783
- 'editor.heading.h5.tooltip': 'Encabezado 5',
784
- 'editor.heading.h6.tooltip': 'Encabezado 6',
785
- 'editor.paragraph.tooltip': 'Párrafo',
786
- 'editor.left.tooltip': 'Alinear a la Izquierda',
787
- 'editor.center.tooltip': 'Centrar',
788
- 'editor.right.tooltip': 'Alinear a la Derecha',
789
- 'editor.justify.tooltip': 'Justificar',
790
- 'editor.bulletlist.tooltip': 'Lista con Viñetas',
791
- 'editor.orderedlist.tooltip': 'Lista Numerada',
792
- 'editor.tasklist.tooltip': 'Lista de Tareas',
793
- 'editor.indent.tooltip': 'Sangrar',
794
- 'editor.outdent.tooltip': 'Reducir Sangría',
795
- 'editor.link.tooltip': 'Enlace',
796
- 'editor.link.dialog.title': 'Insertar enlace',
797
- 'editor.link.dialog.link': 'enlace',
798
- 'editor.link.dialog.button.apply': 'aplicar',
799
- 'editor.image.tooltip': 'Imagen',
800
- 'editor.image.float.left.tooltip': 'Alinear a la Izquierda',
801
- 'editor.image.float.none.tooltip': 'Sin Alineación',
802
- 'editor.image.float.right.tooltip': 'Alinear a la Derecha',
803
- 'editor.image.size.small.tooltip': 'Pequeño',
804
- 'editor.image.size.medium.tooltip': 'Mediano',
805
- 'editor.image.size.large.tooltip': 'Grande',
806
- 'editor.image.remove.tooltip': 'Eliminar',
807
- 'editor.image.dialog.title': 'Insertar imagen',
808
- 'editor.image.dialog.tab.url': 'URL',
809
- 'editor.image.dialog.tab.upload': 'Subir',
810
- 'editor.image.dialog.form.link': 'Enlace',
811
- 'editor.image.dialog.form.alt': 'Texto Alternativo',
812
- 'editor.image.dialog.form.aspectRatio': 'Mantener proporciones originales',
813
- 'editor.image.dialog.form.file': 'Archivo',
814
- 'editor.image.dialog.button.apply': 'Aplicar',
815
- 'editor.video.tooltip': 'Video',
816
- 'editor.video.dialog.title': 'Insertar video',
817
- 'editor.video.dialog.link': 'Enlace',
818
- 'editor.video.dialog.button.apply': 'Aplicar',
819
- 'editor.video.remove.tooltip': 'Eliminar',
820
- 'editor.table.tooltip': 'Tabla',
821
- 'editor.table.menu.insert_table': 'Insertar tabla',
822
- 'editor.table.menu.insert_table.with_header_row': 'Con fila de encabezado',
823
- 'editor.table.menu.add_column_before': 'Agregar columna antes',
824
- 'editor.table.menu.add_column_after': 'Agregar columna después',
825
- 'editor.table.menu.delete_column': 'Eliminar columna',
826
- 'editor.table.menu.add_row_before': 'Agregar fila antes',
827
- 'editor.table.menu.add_row_after': 'Agregar fila después',
828
- 'editor.table.menu.delete_row': 'Eliminar fila',
829
- 'editor.table.menu.merge_or_split_cells': 'Combinar o dividir celdas',
830
- 'editor.table.menu.delete_table': 'Eliminar tabla',
831
- 'editor.blockquote.tooltip': 'Cita en bloque',
832
- 'editor.horizontalrule.tooltip': 'Línea horizontal',
833
- 'editor.code.tooltip': 'Código',
834
- 'editor.codeblock.tooltip': 'Bloque de código',
835
- 'editor.clear.tooltip': 'Borrar formato',
836
- 'editor.undo.tooltip': 'Deshacer',
837
- 'editor.redo.tooltip': 'Rehacer',
838
- 'editor.fullscreen.tooltip.fullscreen': 'Pantalla completa',
839
- 'editor.fullscreen.tooltip.exit': 'Salir de pantalla completa',
840
- });
841
- // install VuetifyProTipTap creating a new vuetify instance
842
- // in case the user installs RichText using Vue.component()
843
- const vuetify = new Vuetify();
844
- const VuetifyProTipTap = createVuetifyProTipTap({
845
- vuetify,
846
- components: {
847
- VuetifyTiptap,
848
- FontFamily: __vue_component__,
849
- },
850
- });
851
- Vue.use(VuetifyProTipTap);
852
- // in case the user installs RichText using Vue.use()
853
- // should install VuetifyProTipTap using the already existing vuetify instance
854
- const RichTextPlugin = {
855
- install(AppVue, options) {
856
- setInstalled();
857
- const ConfiguredTiptap = createVuetifyProTipTap({
858
- vuetify: options.vuetify,
859
- components: {
860
- VuetifyTiptap,
861
- FontFamily: __vue_component__,
862
- },
863
- config: {
864
- image: {
865
- upload,
866
- },
867
- },
868
- });
869
- AppVue.use(ConfiguredTiptap);
870
- AppVue.component('ZdRichText', __vue_component__$1);
871
- },
872
- };
873
-
874
- export { RichTextPlugin, __vue_component__$1 as ZdRichText };