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