@kvass/rich-text 1.4.14 → 1.4.16
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/package.json +1 -1
- package/src/Component.vue +38 -4
package/package.json
CHANGED
package/src/Component.vue
CHANGED
|
@@ -32,7 +32,9 @@
|
|
|
32
32
|
v-for="(item, index) in getCommands('bubble')"
|
|
33
33
|
:key="'bubble' + index"
|
|
34
34
|
class="richtext__bubble-button"
|
|
35
|
-
:class="{
|
|
35
|
+
:class="{
|
|
36
|
+
'is-active': editor.isActive(item.isActiveKey || item.stateKey, item.commandProps),
|
|
37
|
+
}"
|
|
36
38
|
:disabled="disabled || item.disabled"
|
|
37
39
|
@click="
|
|
38
40
|
item.customFunc
|
|
@@ -55,7 +57,9 @@
|
|
|
55
57
|
v-for="(item, index) in getCommands('menu')"
|
|
56
58
|
:key="'menubar' + index"
|
|
57
59
|
type="button"
|
|
58
|
-
:class="{
|
|
60
|
+
:class="{
|
|
61
|
+
'is-active': editor.isActive(item.isActiveKey || item.stateKey, item.commandProps),
|
|
62
|
+
}"
|
|
59
63
|
:disabled="disabled || item.disabled"
|
|
60
64
|
@click="
|
|
61
65
|
item.customFunc
|
|
@@ -80,6 +84,7 @@ import StarterKit from '@tiptap/starter-kit'
|
|
|
80
84
|
|
|
81
85
|
const DefaultCommands = [
|
|
82
86
|
'heading',
|
|
87
|
+
'heading-h3',
|
|
83
88
|
'bold',
|
|
84
89
|
'italic',
|
|
85
90
|
'superscript',
|
|
@@ -140,12 +145,24 @@ export default {
|
|
|
140
145
|
stateKey: 'heading',
|
|
141
146
|
commandKey: 'toggleHeading',
|
|
142
147
|
commandProps: { level: 2 },
|
|
143
|
-
icon: ['far', '
|
|
148
|
+
icon: ['far', 'h2'],
|
|
144
149
|
appearance: {
|
|
145
150
|
menu: true,
|
|
146
151
|
bubble: false,
|
|
147
152
|
},
|
|
148
153
|
},
|
|
154
|
+
{
|
|
155
|
+
stateKey: 'heading-h3',
|
|
156
|
+
isActiveKey: 'heading',
|
|
157
|
+
commandKey: 'toggleHeading',
|
|
158
|
+
commandProps: { level: 3 },
|
|
159
|
+
icon: ['far', 'h3'],
|
|
160
|
+
appearance: {
|
|
161
|
+
menu: true,
|
|
162
|
+
bubble: false,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
|
|
149
166
|
{
|
|
150
167
|
stateKey: 'bold',
|
|
151
168
|
commandKey: 'toggleBold',
|
|
@@ -247,7 +264,12 @@ export default {
|
|
|
247
264
|
case 'link':
|
|
248
265
|
if (value)
|
|
249
266
|
editor
|
|
250
|
-
.setLink({
|
|
267
|
+
.setLink({
|
|
268
|
+
href: value,
|
|
269
|
+
target: this.isInternalUrl(value) ? '_self' : '_blank',
|
|
270
|
+
//reset rel to prevent nofollow to be set
|
|
271
|
+
rel: '',
|
|
272
|
+
})
|
|
251
273
|
.run()
|
|
252
274
|
else editor.unsetLink().run()
|
|
253
275
|
break
|
|
@@ -258,6 +280,8 @@ export default {
|
|
|
258
280
|
href: value,
|
|
259
281
|
'data-cta': this.bubbleOptions.theme,
|
|
260
282
|
target: this.isInternalUrl(value) ? '_self' : '_blank',
|
|
283
|
+
//reset rel to prevent nofollow to be set
|
|
284
|
+
rel: '',
|
|
261
285
|
})
|
|
262
286
|
.run()
|
|
263
287
|
else editor.unsetCta().run()
|
|
@@ -292,6 +316,8 @@ export default {
|
|
|
292
316
|
content: this.value,
|
|
293
317
|
onUpdate: () => {
|
|
294
318
|
let html = this.editor.getHTML().replace(/^<p>\s*<\/p>$/, '')
|
|
319
|
+
|
|
320
|
+
console.log(html)
|
|
295
321
|
this.$emit('input', html)
|
|
296
322
|
},
|
|
297
323
|
onSelectionUpdate: ({ editor }) => {
|
|
@@ -331,6 +357,14 @@ export default {
|
|
|
331
357
|
border-radius: var(--border-radius, 3px);
|
|
332
358
|
}
|
|
333
359
|
|
|
360
|
+
h2 {
|
|
361
|
+
font-size: 1.5em !important;
|
|
362
|
+
}
|
|
363
|
+
h3 {
|
|
364
|
+
font-size: 1.17em !important;
|
|
365
|
+
margin: 0;
|
|
366
|
+
}
|
|
367
|
+
|
|
334
368
|
&__editor {
|
|
335
369
|
flex-grow: 1;
|
|
336
370
|
|