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
c74c14bf
Commit
c74c14bf
authored
Jul 08, 2016
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input spaces & backspace&delete in composite input
parent
ffe1a082
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
22 deletions
+61
-22
common/browser.js
common/browser.js
+2
-1
common/text_input.js
common/text_input.js
+59
-21
No files found.
common/browser.js
View file @
c74c14bf
...
...
@@ -53,7 +53,8 @@ var AscBrowser = {
isSafari
:
false
,
isArm
:
false
,
isMozilla
:
false
,
isRetina
:
false
isRetina
:
false
,
isLinuxOS
:
false
};
// user agent lower case
...
...
common/text_input.js
View file @
c74c14bf
...
...
@@ -272,7 +272,8 @@
}
}
if
(
!
this
.
KeyDownFlag
&&
c_oCompositionState
.
end
==
this
.
compositionState
&&
!
this
.
TextInputAfterComposition
&&
this
.
HtmlArea
.
value
!=
""
)
var
_value
=
this
.
HtmlArea
.
value
;
if
(
!
this
.
KeyDownFlag
&&
c_oCompositionState
.
end
==
this
.
compositionState
&&
!
this
.
TextInputAfterComposition
&&
_value
!=
""
)
{
this
.
Api
.
Begin_CompositeInput
();
this
.
checkCompositionData
(
this
.
HtmlArea
.
value
);
...
...
@@ -281,8 +282,32 @@
}
this
.
TextInputAfterComposition
=
false
;
if
(
c_oCompositionState
.
end
==
this
.
compositionState
)
{
if
(
AscCommon
.
AscBrowser
.
isChrome
&&
AscCommon
.
AscBrowser
.
isLinuxOS
)
{
// space!!!
var
_code
=
(
_value
.
length
==
1
)
?
_value
.
charCodeAt
(
0
)
:
0
;
if
(
_code
==
12288
||
_code
==
32
)
{
var
_e
=
{
altKey
:
false
,
ctrlKey
:
false
,
shiftKey
:
false
,
target
:
null
,
charCode
:
0
,
which
:
0
,
keyCode
:
12288
,
code
:
"
space
"
};
this
.
Api
.
onKeyDown
(
_e
);
this
.
Api
.
onKeyUp
(
_e
);
}
}
this
.
clear
();
}
},
onTextInput
:
function
(
e
)
...
...
@@ -348,7 +373,15 @@
onKeyDown
:
function
(
e
)
{
if
(
c_oCompositionState
.
end
!=
this
.
compositionState
)
{
if
(
this
.
IsUseFirstTextInputAfterComposition
&&
e
.
keyCode
==
8
||
e
.
keyCode
==
46
)
// del, backspace
{
this
.
onCompositionEnd
(
e
,
this
.
HtmlArea
.
value
);
this
.
IsUseFirstTextInputAfterComposition
=
false
;
}
return
;
}
if
(
null
!=
this
.
nativeFocusElement
)
{
...
...
@@ -379,6 +412,17 @@
{
this
.
KeyDownFlag
=
false
;
if
(
c_oCompositionState
.
end
!=
this
.
compositionState
)
{
if
(
this
.
IsUseFirstTextInputAfterComposition
&&
e
.
keyCode
==
8
||
e
.
keyCode
==
46
)
// del, backspace
{
this
.
onCompositionEnd
(
e
,
this
.
HtmlArea
.
value
);
this
.
IsUseFirstTextInputAfterComposition
=
false
;
}
return
;
}
if
(
c_oCompositionState
.
end
==
this
.
compositionState
)
return
this
.
Api
.
onKeyUp
(
e
);
...
...
@@ -434,10 +478,10 @@
this
.
Api
.
Begin_CompositeInput
();
},
onCompositionUpdate
:
function
(
e
,
isLockTarget
)
onCompositionUpdate
:
function
(
e
,
isLockTarget
,
_data
)
{
var
_old
=
this
.
compositionValue
.
splice
(
0
);
this
.
checkCompositionData
(
e
.
data
);
this
.
checkCompositionData
(
(
_data
!=
null
)
?
_data
:
e
.
data
);
var
_isEqualLen
=
(
_old
.
length
==
this
.
compositionValue
.
length
);
var
_isEqual
=
_isEqualLen
;
...
...
@@ -478,26 +522,20 @@
this
.
compositionState
=
c_oCompositionState
.
process
;
},
onCompositionEnd
:
function
(
e
)
onCompositionEnd
:
function
(
e
,
_data
)
{
// chrome, linux: всегда приходит пустая дата
if
(
!
this
.
IsUseFirstTextInputAfterComposition
)
{
if
(
e
.
data
===
undefined
||
(
e
.
data
==
""
&&
(
this
.
compositionValue
.
length
!=
0
)))
{
this
.
IsUseFirstTextInputAfterComposition
=
true
;
return
;
}
else
{
this
.
onCompositionUpdate
(
e
,
false
);
}
}
else
{
this
.
onCompositionUpdate
(
e
,
false
);
if
(
!
this
.
IsUseFirstTextInputAfterComposition
&&
AscCommon
.
AscBrowser
.
isChrome
&&
AscCommon
.
AscBrowser
.
isLinuxOS
&&
(
e
.
data
==
null
||
e
.
data
==
""
))
{
// always data == ""
console
.
log
(
"
chrome_linux_end
"
);
this
.
IsUseFirstTextInputAfterComposition
=
true
;
return
;
}
this
.
onCompositionUpdate
(
e
,
false
,
_data
);
this
.
Api
.
Set_CursorPosInCompositeText
(
1000
);
// max
this
.
clear
();
...
...
@@ -510,7 +548,7 @@
checkCompositionData
:
function
(
data
)
{
this
.
compositionValue
=
[];
var
_length
=
data
.
length
;
var
_length
=
(
data
!=
null
)
?
data
.
length
:
0
;
for
(
var
i
=
0
;
i
<
_length
;
i
++
)
{
var
_code
=
data
.
charCodeAt
(
i
);
...
...
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