Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
4365cbbc
Commit
4365cbbc
authored
Jul 29, 2016
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input bug
parent
b456372f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
10 deletions
+73
-10
common/text_input.js
common/text_input.js
+73
-10
No files found.
common/text_input.js
View file @
4365cbbc
...
@@ -133,6 +133,17 @@
...
@@ -133,6 +133,17 @@
this
.
isDebug
=
false
;
this
.
isDebug
=
false
;
this
.
isSystem
=
false
;
this
.
isSystem
=
false
;
this
.
isShow
=
false
;
this
.
isShow
=
false
;
// в хроме бывают случаи, когда приходит keyDown, но не приходит keyPress
// и это без композитного ввода (например китайский язык, набирать кнопки 0 -- 9)
// следим так: на onInput - если
// 1) был keyDown, и на нем "ждем" keyPress
// 2) не было keyPress, composition events
// 3) тогда вставляем
// в ie такие же проблемы. приходят только пустые start и end
// поэтому учитываем только update, заодно запоминаем дату на старте (только для ие)
this
.
isChromeKeysNoKeyPressPresent
=
false
;
this
.
isChromeKeysNoKeyPressPresentStartValue
=
""
;
}
}
CTextInput
.
prototype
=
CTextInput
.
prototype
=
...
@@ -502,6 +513,21 @@
...
@@ -502,6 +513,21 @@
this
.
TextInputAfterComposition
=
false
;
this
.
TextInputAfterComposition
=
false
;
if
(
this
.
isChromeKeysNoKeyPressPresent
&&
c_oCompositionState
.
end
==
this
.
compositionState
)
{
this
.
Api
.
Begin_CompositeInput
();
if
(
this
.
isChromeKeysNoKeyPressPresentStartValue
!=
""
)
{
if
(
0
==
_value
.
indexOf
(
this
.
isChromeKeysNoKeyPressPresentStartValue
))
_value
=
_value
.
substr
(
this
.
isChromeKeysNoKeyPressPresentStartValue
.
length
);
}
this
.
checkCompositionData
(
_value
);
this
.
Api
.
Replace_CompositeText
(
this
.
compositionValue
);
this
.
Api
.
End_CompositeInput
();
}
if
(
c_oCompositionState
.
end
==
this
.
compositionState
)
if
(
c_oCompositionState
.
end
==
this
.
compositionState
)
{
{
if
(
AscCommon
.
AscBrowser
.
isChrome
&&
AscCommon
.
AscBrowser
.
isLinuxOS
)
if
(
AscCommon
.
AscBrowser
.
isChrome
&&
AscCommon
.
AscBrowser
.
isLinuxOS
)
...
@@ -518,7 +544,10 @@
...
@@ -518,7 +544,10 @@
charCode
:
0
,
charCode
:
0
,
which
:
0
,
which
:
0
,
keyCode
:
12288
,
keyCode
:
12288
,
code
:
"
space
"
code
:
"
space
"
,
preventDefault
:
function
()
{},
stopPropagation
:
function
()
{}
};
};
this
.
Api
.
onKeyDown
(
_e
);
this
.
Api
.
onKeyDown
(
_e
);
this
.
Api
.
onKeyUp
(
_e
);
this
.
Api
.
onKeyUp
(
_e
);
...
@@ -538,14 +567,6 @@
...
@@ -538,14 +567,6 @@
this
.
clear
();
this
.
clear
();
}
}
}
}
if
(
this
.
IsUseFirstTextInputAfterComposition
&&
c_oCompositionState
.
process
==
this
.
compositionState
)
{
// chrome escape input. empty data and textInput not called
this
.
onCompositionEnd
(
e
,
""
);
this
.
IsUseFirstTextInputAfterComposition
=
false
;
}
},
},
onTextInput
:
function
(
e
)
onTextInput
:
function
(
e
)
...
@@ -744,6 +765,7 @@
...
@@ -744,6 +765,7 @@
onKeyDown
:
function
(
e
)
onKeyDown
:
function
(
e
)
{
{
this
.
isChromeKeysNoKeyPressPresent
=
false
;
if
(
this
.
isSystem
&&
this
.
isShow
)
if
(
this
.
isSystem
&&
this
.
isShow
)
{
{
// нужно проверить на enter
// нужно проверить на enter
...
@@ -809,11 +831,14 @@
...
@@ -809,11 +831,14 @@
}
}
}
}
return
this
.
Api
.
onKeyDown
(
e
);
var
_ret
=
this
.
Api
.
onKeyDown
(
e
);
if
(
!
e
.
defaultPrevented
&&
(
AscCommon
.
AscBrowser
.
isIE
||
AscCommon
.
AscBrowser
.
isChrome
))
this
.
isChromeKeysNoKeyPressPresent
=
true
;
},
},
onKeyPress
:
function
(
e
)
onKeyPress
:
function
(
e
)
{
{
this
.
isChromeKeysNoKeyPressPresent
=
false
;
if
(
this
.
isSystem
)
if
(
this
.
isSystem
)
return
;
return
;
...
@@ -825,6 +850,7 @@
...
@@ -825,6 +850,7 @@
onKeyUp
:
function
(
e
)
onKeyUp
:
function
(
e
)
{
{
this
.
isChromeKeysNoKeyPressPresent
=
false
;
if
(
this
.
isSystem
&&
this
.
isShow
)
if
(
this
.
isSystem
&&
this
.
isShow
)
return
;
return
;
...
@@ -851,6 +877,14 @@
...
@@ -851,6 +877,14 @@
{
{
this
.
checkTargetPosition
();
this
.
checkTargetPosition
();
}
}
if
(
this
.
IsUseFirstTextInputAfterComposition
&&
c_oCompositionState
.
process
==
this
.
compositionState
)
{
// chrome escape input. empty data and textInput not called
this
.
onCompositionEnd
(
e
,
""
);
this
.
IsUseFirstTextInputAfterComposition
=
false
;
}
},
},
checkTargetPosition
:
function
(
isCorrect
)
checkTargetPosition
:
function
(
isCorrect
)
...
@@ -919,8 +953,14 @@
...
@@ -919,8 +953,14 @@
onCompositionStart
:
function
(
e
)
onCompositionStart
:
function
(
e
)
{
{
if
(
!
AscCommon
.
AscBrowser
.
isIE
)
this
.
isChromeKeysNoKeyPressPresent
=
false
;
if
(
this
.
isSystem
)
if
(
this
.
isSystem
)
{
this
.
isChromeKeysNoKeyPressPresent
=
false
;
return
;
return
;
}
ti_console_log2
(
"
begin
"
);
ti_console_log2
(
"
begin
"
);
if
(
this
.
compositionState
==
c_oCompositionState
.
end
)
if
(
this
.
compositionState
==
c_oCompositionState
.
end
)
...
@@ -930,6 +970,11 @@
...
@@ -930,6 +970,11 @@
this
.
isFirstCompositionUpdateAfterStart
=
true
;
this
.
isFirstCompositionUpdateAfterStart
=
true
;
if
(
AscCommon
.
AscBrowser
.
isIE
)
{
this
.
isChromeKeysNoKeyPressPresentStartValue
=
this
.
getAreaValue
();
}
ti_console_log
(
"
ti: onCompositionStart
"
);
ti_console_log
(
"
ti: onCompositionStart
"
);
if
(
AscCommon
.
AscBrowser
.
isIE
&&
e
.
target
[
"
msGetInputContext
"
])
if
(
AscCommon
.
AscBrowser
.
isIE
&&
e
.
target
[
"
msGetInputContext
"
])
...
@@ -948,8 +993,19 @@
...
@@ -948,8 +993,19 @@
onCompositionUpdate
:
function
(
e
,
isLockTarget
,
_data
,
isFromEnd
)
onCompositionUpdate
:
function
(
e
,
isLockTarget
,
_data
,
isFromEnd
)
{
{
if
(
!
AscCommon
.
AscBrowser
.
isIE
)
this
.
isChromeKeysNoKeyPressPresent
=
false
;
else
if
(
undefined
==
isFromEnd
)
this
.
isChromeKeysNoKeyPressPresent
=
false
;
if
(
!
this
.
isChromeKeysNoKeyPressPresent
)
this
.
isChromeKeysNoKeyPressPresentStartValue
=
""
;
if
(
this
.
isSystem
)
if
(
this
.
isSystem
)
{
this
.
isChromeKeysNoKeyPressPresent
=
false
;
return
;
return
;
}
ti_console_log
(
"
ti: onCompositionUpdate:
"
+
e
.
data
);
ti_console_log
(
"
ti: onCompositionUpdate:
"
+
e
.
data
);
...
@@ -1089,8 +1145,14 @@
...
@@ -1089,8 +1145,14 @@
onCompositionEnd
:
function
(
e
,
_data
)
onCompositionEnd
:
function
(
e
,
_data
)
{
{
if
(
!
AscCommon
.
AscBrowser
.
isIE
)
this
.
isChromeKeysNoKeyPressPresent
=
false
;
if
(
this
.
isSystem
)
if
(
this
.
isSystem
)
{
this
.
isChromeKeysNoKeyPressPresent
=
false
;
return
;
return
;
}
ti_console_log
(
"
ti: onCompositionEnd
"
);
ti_console_log
(
"
ti: onCompositionEnd
"
);
...
@@ -1117,6 +1179,7 @@
...
@@ -1117,6 +1179,7 @@
{
{
// edge: не натуральный end!!!
// edge: не натуральный end!!!
this
.
compositionState
=
c_oCompositionState
.
process
;
this
.
compositionState
=
c_oCompositionState
.
process
;
this
.
isChromeKeysNoKeyPressPresent
=
false
;
return
;
return
;
}
}
else
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment