@thinkpixellab-public/px-vue 4.1.3 → 4.1.4

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.
@@ -11,6 +11,8 @@
11
11
  @input="onInput"
12
12
  @blur="onBlur"
13
13
  @keydown="onKeydown"
14
+ @compositionstart="onCompositionStart"
15
+ @compositionend="onCompositionEnd"
14
16
  :contenteditable="enabled ? 'plaintext-only' : false"
15
17
  :placeholder="placeholder"
16
18
  :disabled="disabled ? 'disabled' : null"
@@ -49,6 +51,7 @@ export default {
49
51
  return {
50
52
  minHeight: 300,
51
53
  placeholderVisible: false,
54
+ isComposing: false,
52
55
  };
53
56
  },
54
57
  computed: {
@@ -68,10 +71,14 @@ export default {
68
71
 
69
72
  methods: {
70
73
  setValue(val) {
74
+ if (this.isComposing) {
75
+ return;
76
+ }
77
+
71
78
  const nbsp = '\u202f';
72
79
  const startPos = getCaretPosition(this.$refs.input);
73
80
  const prevValue = this.$refs.input.textContent;
74
-
81
+
75
82
  val = val || '';
76
83
 
77
84
  // if the first character is nbps, we remove it (assuming we had added it to begin with)
@@ -148,6 +155,27 @@ export default {
148
155
  selectAll() {
149
156
  this.$el.select();
150
157
  },
158
+
159
+ onCompositionStart() {
160
+ this.isComposing = true;
161
+
162
+ this.placeholderVisible = false;
163
+ },
164
+
165
+ onCompositionEnd(e) {
166
+ this.isComposing = false;
167
+
168
+ const compositionInput = e.data;
169
+
170
+ if (compositionInput) {
171
+ const value = this.text + compositionInput;
172
+
173
+ if (this.updateMode == 'input') {
174
+ this.setValue(value);
175
+ }
176
+ this.$emit('input', value);
177
+ }
178
+ },
151
179
  },
152
180
  };
153
181
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkpixellab-public/px-vue",
3
- "version": "4.1.3",
3
+ "version": "4.1.4",
4
4
  "description": "General purpose Vue components and helpers that can be used across projects.",
5
5
  "author": {
6
6
  "name": "Pixel Lab"