Commit c051c746 authored by NikulinR's avatar NikulinR

FF fixes

parent 0e88de01
...@@ -26,3 +26,8 @@ If you need to include one of these characters as a static part of the mask, you ...@@ -26,3 +26,8 @@ If you need to include one of these characters as a static part of the mask, you
```vue ```vue
<masked-input v-model="phone" mask="+\\1 (111) 111-1111" placeholder="Phone number" type="tel" /> <masked-input v-model="phone" mask="+\\1 (111) 111-1111" placeholder="Phone number" type="tel" />
``` ```
## Known issues/TODO
* Copy/cut/paste in FF
* Copy/cut/paste in mobile Chrome
* Cyrillic chars are not supported in mobile Chrome
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<li># – alphanumeric, forced to upper case when entered</li> <li># – alphanumeric, forced to upper case when entered</li>
</ul> </ul>
<h4>Date: </h4> <h4>Date: </h4>
<masked-input v-model="date" mask="11 / 11 / 1111" placeholder="Date" /><span v-if="">{{ date }}</span> <masked-input v-model="date" mask="11 / 11 / 1111" placeholder="Date"/><span v-if="">{{ date }}</span>
<p class="code"> <p class="code">
&lt;masked-input v-model="date" mask="11 / 11 / 1111" placeholder="Date" /&gt; &lt;masked-input v-model="date" mask="11 / 11 / 1111" placeholder="Date" /&gt;
</p> </p>
......
...@@ -62,7 +62,8 @@ export default { ...@@ -62,7 +62,8 @@ export default {
pattern: this.mask, pattern: this.mask,
value: this.default value: this.default
}) })
this.$refs.input.value = this.mask_core.setValue = this.default this.$refs.input.value = this.default
this.mask_core.setValue(this.default)
this.mask_core.setSelection({ this.mask_core.setSelection({
start: 0, start: 0,
end: 0 end: 0
...@@ -173,19 +174,28 @@ export default { ...@@ -173,19 +174,28 @@ export default {
} }
}, },
keyPress(e) { //works only on Desktop input(e) {
}, },
textInput(e) { keyPress(e) { //works only on Desktop //Dirty FF hack
if (navigator.userAgent.indexOf('Firefox') != -1 &&
parseFloat(navigator.userAgent.substring(navigator.userAgent.indexOf('Firefox') + 8)) >= 3.6) {
e.preventDefault() e.preventDefault()
e.data = e.key
this.textInput(e)
}
},
textInput(e) {
if (e.preventDefault) e.preventDefault()
if (this.mask_core.input(e.data)) { if (this.mask_core.input(e.data)) {
this.updateToCoreState()
this.updateAfterAll = true this.updateAfterAll = true
} }
this.updateToCoreState()
}, },
keyUp(e) { keyUp(e) {
if (this.updateAfterAll) this.updateToCoreState() this.updateToCoreState()
this.updateAfterAll = false this.updateAfterAll = false
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment