mirror of
https://github.com/hodgef/simple-keyboard.git
synced 2025-04-17 06:33:16 +08:00
Caret bounds fix
This commit is contained in:
parent
280956dba3
commit
9633c99dad
@ -1,6 +1,6 @@
|
|||||||
/*!
|
/*!
|
||||||
*
|
*
|
||||||
* simple-keyboard v2.5.0
|
* simple-keyboard v2.5.1
|
||||||
* https://github.com/hodgef/simple-keyboard
|
* https://github.com/hodgef/simple-keyboard
|
||||||
*
|
*
|
||||||
* Copyright (c) Francisco Hodge (https://github.com/hodgef)
|
* Copyright (c) Francisco Hodge (https://github.com/hodgef)
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "simple-keyboard",
|
"name": "simple-keyboard",
|
||||||
"version": "2.5.0",
|
"version": "2.5.1",
|
||||||
"description": "On-screen Javascript Virtual Keyboard",
|
"description": "On-screen Javascript Virtual Keyboard",
|
||||||
"main": "build/index.js",
|
"main": "build/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -175,7 +175,8 @@ class Utilities {
|
|||||||
|
|
||||||
updateCaretPos = (length, minus) => {
|
updateCaretPos = (length, minus) => {
|
||||||
if(minus){
|
if(minus){
|
||||||
this.simpleKeyboardInstance.caretPosition = this.simpleKeyboardInstance.caretPosition - length
|
if(this.simpleKeyboardInstance.caretPosition > 0)
|
||||||
|
this.simpleKeyboardInstance.caretPosition = this.simpleKeyboardInstance.caretPosition - length
|
||||||
} else {
|
} else {
|
||||||
this.simpleKeyboardInstance.caretPosition = this.simpleKeyboardInstance.caretPosition + length;
|
this.simpleKeyboardInstance.caretPosition = this.simpleKeyboardInstance.caretPosition + length;
|
||||||
}
|
}
|
||||||
@ -212,7 +213,7 @@ class Utilities {
|
|||||||
* Emojis are made out of two characters, so we must take a custom approach to trim them.
|
* Emojis are made out of two characters, so we must take a custom approach to trim them.
|
||||||
* For more info: https://mathiasbynens.be/notes/javascript-unicode
|
* For more info: https://mathiasbynens.be/notes/javascript-unicode
|
||||||
*/
|
*/
|
||||||
if(position){
|
if(position && position >= 0){
|
||||||
prevTwoChars = source.substring(position - 2, position)
|
prevTwoChars = source.substring(position - 2, position)
|
||||||
emojiMatched = prevTwoChars.match(emojiMatchedReg);
|
emojiMatched = prevTwoChars.match(emojiMatchedReg);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user