@afeefa/vue-app 0.0.97 → 0.0.98

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- 0.0.97
1
+ 0.0.98
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.97",
3
+ "version": "0.0.98",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -80,10 +80,10 @@
80
80
  <v-btn
81
81
  small
82
82
  class="menu-button"
83
- :class="{ 'is-active': editorFocus && editorSelectionIs('#0000FF')}"
83
+ :class="{ 'is-active': editorFocus && editor.isActive('highlight', { color: '#6161FF' })}"
84
84
  title="blau"
85
85
  color="blue--text"
86
- @click="editorSelectionIs('#0000FF') ? editor.chain().focus().unsetColor().run() : editor.chain().focus().setColor('#0000FF').run()"
86
+ @click="editor.chain().focus().toggleHighlight({ color: '#6161FF' }).run()"
87
87
  >
88
88
  <v-icon>$paletteIcon</v-icon>
89
89
  </v-btn>
@@ -91,10 +91,10 @@
91
91
  <v-btn
92
92
  small
93
93
  class="menu-button"
94
- :class="{ 'is-active': editorFocus && editorSelectionIs('#FF0000')}"
94
+ :class="{ 'is-active': editorFocus && editor.isActive('highlight', { color: '#FF0000' })}"
95
95
  title="rot"
96
96
  color="red--text"
97
- @click="editorSelectionIs('#FF0000') ? editor.chain().focus().unsetColor().run() : editor.chain().focus().setColor('#FF0000').run()"
97
+ @click="editor.chain().focus().toggleHighlight({ color: '#FF0000' }).run()"
98
98
  >
99
99
  <v-icon>$paletteIcon</v-icon>
100
100
  </v-btn>
@@ -141,7 +141,7 @@ import {
141
141
  mdiRotateRight
142
142
  } from '@mdi/js'
143
143
  import { Color } from '@tiptap/extension-color'
144
- import TextStyle from '@tiptap/extension-text-style'
144
+ import Highlight from '@tiptap/extension-highlight'
145
145
 
146
146
  @Component({
147
147
  props: ['value', 'validator', 'focus'],
@@ -183,7 +183,7 @@ export default class ARichTextArea extends Vue {
183
183
  autofocus: this.focus ? 'end' : false,
184
184
  extensions: [
185
185
  StarterKit,
186
- TextStyle,
186
+ Highlight.configure({ multicolor: true }),
187
187
  Color
188
188
  ],
189
189
  onUpdate: () => {
@@ -204,10 +204,6 @@ export default class ARichTextArea extends Vue {
204
204
  this.editor.destroy()
205
205
  }
206
206
 
207
- editorSelectionIs (color) {
208
- return this.editor.isActive('textStyle', { color: color })
209
- }
210
-
211
207
  /**
212
208
  * reset the text area to disable the undo button
213
209
  * e.g. after saving the form while keeping it open
@@ -5,6 +5,7 @@
5
5
  */
6
6
 
7
7
  class CascadingWindowEventDispatcher {
8
+ windowListeners = {}
8
9
  listeners = {}
9
10
 
10
11
  addEventListener (event, listener) {
@@ -12,9 +13,7 @@ class CascadingWindowEventDispatcher {
12
13
  this.listeners[event] = []
13
14
  }
14
15
 
15
- if (!this.listeners[event].length) {
16
- this.listeners[event] = []
17
-
16
+ if (!this.windowListeners[event]) {
18
17
  window.addEventListener(event, e => {
19
18
  for (const listener of this.listeners[event]) {
20
19
  const result = listener(e)
@@ -23,6 +22,8 @@ class CascadingWindowEventDispatcher {
23
22
  }
24
23
  }
25
24
  })
25
+
26
+ this.windowListeners[event] = true
26
27
  }
27
28
 
28
29
  this.listeners[event].unshift(listener)