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
Hide 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 @@
this
.
isDebug
=
false
;
this
.
isSystem
=
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
=
...
...
@@ -502,6 +513,21 @@
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
(
AscCommon
.
AscBrowser
.
isChrome
&&
AscCommon
.
AscBrowser
.
isLinuxOS
)
...
...
@@ -518,7 +544,10 @@
charCode
:
0
,
which
:
0
,
keyCode
:
12288
,
code
:
"
space
"
code
:
"
space
"
,
preventDefault
:
function
()
{},
stopPropagation
:
function
()
{}
};
this
.
Api
.
onKeyDown
(
_e
);
this
.
Api
.
onKeyUp
(
_e
);
...
...
@@ -538,14 +567,6 @@
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
)
...
...
@@ -744,6 +765,7 @@
onKeyDown
:
function
(
e
)
{
this
.
isChromeKeysNoKeyPressPresent
=
false
;
if
(
this
.
isSystem
&&
this
.
isShow
)
{
// нужно проверить на enter
...
...
@@ -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
)
{
this
.
isChromeKeysNoKeyPressPresent
=
false
;
if
(
this
.
isSystem
)
return
;
...
...
@@ -825,6 +850,7 @@
onKeyUp
:
function
(
e
)
{
this
.
isChromeKeysNoKeyPressPresent
=
false
;
if
(
this
.
isSystem
&&
this
.
isShow
)
return
;
...
...
@@ -851,6 +877,14 @@
{
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
)
...
...
@@ -919,8 +953,14 @@
onCompositionStart
:
function
(
e
)
{
if
(
!
AscCommon
.
AscBrowser
.
isIE
)
this
.
isChromeKeysNoKeyPressPresent
=
false
;
if
(
this
.
isSystem
)
{
this
.
isChromeKeysNoKeyPressPresent
=
false
;
return
;
}
ti_console_log2
(
"
begin
"
);
if
(
this
.
compositionState
==
c_oCompositionState
.
end
)
...
...
@@ -930,6 +970,11 @@
this
.
isFirstCompositionUpdateAfterStart
=
true
;
if
(
AscCommon
.
AscBrowser
.
isIE
)
{
this
.
isChromeKeysNoKeyPressPresentStartValue
=
this
.
getAreaValue
();
}
ti_console_log
(
"
ti: onCompositionStart
"
);
if
(
AscCommon
.
AscBrowser
.
isIE
&&
e
.
target
[
"
msGetInputContext
"
])
...
...
@@ -948,8 +993,19 @@
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
)
{
this
.
isChromeKeysNoKeyPressPresent
=
false
;
return
;
}
ti_console_log
(
"
ti: onCompositionUpdate:
"
+
e
.
data
);
...
...
@@ -1089,8 +1145,14 @@
onCompositionEnd
:
function
(
e
,
_data
)
{
if
(
!
AscCommon
.
AscBrowser
.
isIE
)
this
.
isChromeKeysNoKeyPressPresent
=
false
;
if
(
this
.
isSystem
)
{
this
.
isChromeKeysNoKeyPressPresent
=
false
;
return
;
}
ti_console_log
(
"
ti: onCompositionEnd
"
);
...
...
@@ -1117,6 +1179,7 @@
{
// edge: не натуральный end!!!
this
.
compositionState
=
c_oCompositionState
.
process
;
this
.
isChromeKeysNoKeyPressPresent
=
false
;
return
;
}
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