@kvass/rich-text 1.4.14 → 1.4.15

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 +28 -3
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.15",
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',
@@ -331,6 +348,14 @@ export default {
331
348
  border-radius: var(--border-radius, 3px);
332
349
  }
333
350
 
351
+ h2 {
352
+ font-size: 1.5em !important;
353
+ }
354
+ h3 {
355
+ font-size: 1.17em !important;
356
+ margin: 0;
357
+ }
358
+
334
359
  &__editor {
335
360
  flex-grow: 1;
336
361