goodteditor-ui 1.0.100 → 1.0.102

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goodteditor-ui",
3
- "version": "1.0.100",
3
+ "version": "1.0.102",
4
4
  "main": "index.js",
5
5
  "homepage": "https://goodt-ui.netlify.app/",
6
6
  "scripts": {
@@ -7,9 +7,7 @@
7
7
  @keydown.stop="onKeydown"
8
8
  @keyup.stop="onKeyup"
9
9
  @focus="onFocus"
10
- @focusin.stop="onFocus"
11
10
  @blur="onBlur"
12
- @focusout.stop="onBlur"
13
11
  @click.stop
14
12
  v-on="{
15
13
  [event]: onActivate
@@ -22,7 +20,6 @@
22
20
  </div>
23
21
  </template>
24
22
  <script>
25
-
26
23
  const Size = {
27
24
  SMALL: { name: 'small', class: ['text-small'] },
28
25
  NORMAL: { name: 'normal', class: [] },
@@ -105,6 +102,10 @@ export default {
105
102
  classes.push('is-edited');
106
103
  }
107
104
 
105
+ if (this.isValid === false) {
106
+ classes.push('invalid');
107
+ }
108
+
108
109
  return classes;
109
110
  },
110
111
  isValid() {
@@ -168,11 +169,16 @@ export default {
168
169
  setValue(value) {
169
170
  this.$el.textContent = value;
170
171
  this.valueLast = value;
171
- this.$emit('input', value);
172
- this.$emit('change', value);
172
+ if (value !== this.valueLast) {
173
+ this.$emit('input', value);
174
+ this.$emit('change', value);
175
+ }
173
176
  },
174
177
  commitValue() {
175
- this.setValue(this.isValid ? this.valueDirty : this.valueLast);
178
+ if (this.isValid === false) {
179
+ this.valueDirty = this.valueLast;
180
+ }
181
+ this.setValue(this.valueDirty);
176
182
  this.setIsEdited(false);
177
183
  },
178
184
  onFocus() {
@@ -216,7 +222,7 @@ export default {
216
222
  &:empty {
217
223
  border-bottom: 2px dotted var(--color-primary);
218
224
  &:before {
219
- content: ' '
225
+ content: ' ';
220
226
  }
221
227
  }
222
228
 
@@ -236,6 +242,11 @@ export default {
236
242
 
237
243
  &.is-edited {
238
244
  white-space: pre-line;
245
+
246
+ &.invalid {
247
+ color: var(--color-red);
248
+ outline-color: var(--color-red);
249
+ }
239
250
  }
240
251
  }
241
252
  </style>