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
aef49347
Commit
aef49347
authored
Jul 06, 2016
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
focus & copy/Paste
parent
f4e7d018
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
2 deletions
+40
-2
common/clipboard_base.js
common/clipboard_base.js
+20
-2
common/text_input.js
common/text_input.js
+20
-0
No files found.
common/clipboard_base.js
View file @
aef49347
...
@@ -85,6 +85,8 @@
...
@@ -85,6 +85,8 @@
this
.
CopyPasteFocus
=
false
;
this
.
CopyPasteFocus
=
false
;
this
.
CopyPasteFocusTimer
=
-
1
;
this
.
CopyPasteFocusTimer
=
-
1
;
this
.
inputContext
=
null
;
}
}
CClipboardBase
.
prototype
=
CClipboardBase
.
prototype
=
...
@@ -109,6 +111,11 @@
...
@@ -109,6 +111,11 @@
else
else
{
{
this
.
Api
.
asc_CheckCopy
(
this
,
AscCommon
.
c_oAscClipboardDataFormat
.
Text
|
AscCommon
.
c_oAscClipboardDataFormat
.
Html
|
AscCommon
.
c_oAscClipboardDataFormat
.
Internal
);
this
.
Api
.
asc_CheckCopy
(
this
,
AscCommon
.
c_oAscClipboardDataFormat
.
Text
|
AscCommon
.
c_oAscClipboardDataFormat
.
Html
|
AscCommon
.
c_oAscClipboardDataFormat
.
Internal
);
setTimeout
(
function
(){
g_clipboardBase
.
EndFocus
();
},
0
);
e
.
preventDefault
();
e
.
preventDefault
();
return
false
;
return
false
;
}
}
...
@@ -135,6 +142,10 @@
...
@@ -135,6 +142,10 @@
if
(
!
this
.
IsNeedDivOnCopy
)
if
(
!
this
.
IsNeedDivOnCopy
)
{
{
setTimeout
(
function
(){
g_clipboardBase
.
EndFocus
();
},
0
);
e
.
preventDefault
();
e
.
preventDefault
();
return
false
;
return
false
;
}
}
...
@@ -510,7 +521,7 @@
...
@@ -510,7 +521,7 @@
StartFocus
:
function
()
StartFocus
:
function
()
{
{
// не плодим таймеры
// не плодим таймеры
this
.
EndFocus
();
this
.
EndFocus
(
false
);
this
.
CopyPasteFocus
=
true
;
this
.
CopyPasteFocus
=
true
;
...
@@ -523,13 +534,20 @@
...
@@ -523,13 +534,20 @@
},
},
EndFocus
:
function
()
EndFocus
:
function
(
isFocusToEditor
)
{
{
this
.
CopyPasteFocus
=
false
;
this
.
CopyPasteFocus
=
false
;
if
(
-
1
!=
this
.
CopyPasteFocusTimer
)
if
(
-
1
!=
this
.
CopyPasteFocusTimer
)
{
{
clearTimeout
(
this
.
CopyPasteFocusTimer
);
clearTimeout
(
this
.
CopyPasteFocusTimer
);
this
.
CopyPasteFocusTimer
=
-
1
;
this
.
CopyPasteFocusTimer
=
-
1
;
if
(
false
!==
isFocusToEditor
&&
null
!=
this
.
inputContext
)
{
if
(
this
.
inputContext
.
HtmlArea
)
this
.
inputContext
.
HtmlArea
.
focus
();
}
}
}
},
},
...
...
common/text_input.js
View file @
aef49347
...
@@ -555,6 +555,22 @@
...
@@ -555,6 +555,22 @@
}
}
return
null
;
return
null
;
}
}
function
_getDefaultKeyboardInput
(
_elem
,
_depth
)
{
var
_elemTest
=
_elem
;
for
(
var
_level
=
0
;
_elemTest
&&
(
_level
<
_depth
);
++
_level
,
_elemTest
=
_elemTest
.
parentNode
)
{
var
_name
=
"
"
+
_elemTest
.
className
+
"
"
;
if
(
_name
.
indexOf
(
"
dropdown-menu
"
)
>
-
1
||
_name
.
indexOf
(
"
dropdown-toggle
"
)
>
-
1
||
_name
.
indexOf
(
"
dropdown-submenu
"
)
>
-
1
||
_name
.
indexOf
(
"
canfocused
"
)
>
-
1
)
{
return
"
true
"
;
}
}
return
null
;
}
window
[
'
AscCommon
'
]
=
window
[
'
AscCommon
'
]
||
{};
window
[
'
AscCommon
'
]
=
window
[
'
AscCommon
'
]
||
{};
window
[
'
AscCommon
'
].
CTextInput
=
CTextInput
;
window
[
'
AscCommon
'
].
CTextInput
=
CTextInput
;
...
@@ -564,6 +580,7 @@
...
@@ -564,6 +580,7 @@
window
[
'
AscCommon
'
].
g_inputContext
=
new
CTextInput
(
api
);
window
[
'
AscCommon
'
].
g_inputContext
=
new
CTextInput
(
api
);
window
[
'
AscCommon
'
].
g_inputContext
.
init
(
target_id
);
window
[
'
AscCommon
'
].
g_inputContext
.
init
(
target_id
);
window
[
'
AscCommon
'
].
g_clipboardBase
.
Init
(
api
);
window
[
'
AscCommon
'
].
g_clipboardBase
.
Init
(
api
);
window
[
'
AscCommon
'
].
g_clipboardBase
.
inputContext
=
window
[
'
AscCommon
'
].
g_inputContext
;
document
.
addEventListener
(
"
focus
"
,
function
(
e
)
document
.
addEventListener
(
"
focus
"
,
function
(
e
)
{
{
...
@@ -613,6 +630,9 @@
...
@@ -613,6 +630,9 @@
// нужно ли прокидывать нажатие клавиш элементу (ТОЛЬКО keyDown)
// нужно ли прокидывать нажатие клавиш элементу (ТОЛЬКО keyDown)
var
_oo_editor_keyboard
=
_getAttirbute
(
t
.
nativeFocusElement
,
"
oo_editor_keyboard
"
,
3
);
var
_oo_editor_keyboard
=
_getAttirbute
(
t
.
nativeFocusElement
,
"
oo_editor_keyboard
"
,
3
);
if
(
!
_oo_editor_input
&&
!
_oo_editor_keyboard
)
_oo_editor_input
=
_getDefaultKeyboardInput
(
t
.
nativeFocusElement
,
3
);
if
(
_oo_editor_keyboard
==
"
true
"
)
if
(
_oo_editor_keyboard
==
"
true
"
)
_oo_editor_input
=
undefined
;
_oo_editor_input
=
undefined
;
...
...
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