@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/Component.vue +38 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kvass/rich-text",
3
- "version": "1.4.14",
3
+ "version": "1.4.16",
4
4
  "description": "rich text component for kvass",
5
5
  "main": "index.js",
6
6
  "scripts": {
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="{ 'is-active': editor.isActive(item.stateKey) }"
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="{ 'is-active': editor.isActive(item.stateKey) }"
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', 'heading'],
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({ href: value, target: this.isInternalUrl(value) ? '_self' : '_blank' })
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