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
90d6cdda
Commit
90d6cdda
authored
Jun 14, 2016
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
теперь все готово к встраиванию во все редакторы
parent
c0e75fa0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
30 deletions
+126
-30
common/apiBase.js
common/apiBase.js
+35
-0
common/text_input.js
common/text_input.js
+28
-30
word/api.js
word/api.js
+63
-0
No files found.
common/apiBase.js
View file @
90d6cdda
...
...
@@ -919,6 +919,41 @@
{
};
// input
baseEditorsApi
.
prototype
.
Begin_CompositeInput
=
function
()
{
};
baseEditorsApi
.
prototype
.
Add_CompositeText
=
function
(
nCharCode
)
{
};
baseEditorsApi
.
prototype
.
Remove_CompositeText
=
function
(
nCount
)
{
};
baseEditorsApi
.
prototype
.
Replace_CompositeText
=
function
(
arrCharCodes
)
{
};
baseEditorsApi
.
prototype
.
Set_CursorPosInCompositeText
=
function
(
nPos
)
{
};
baseEditorsApi
.
prototype
.
Get_CursorPosInCompositeText
=
function
()
{
};
baseEditorsApi
.
prototype
.
End_CompositeInput
=
function
()
{
};
baseEditorsApi
.
prototype
.
Get_MaxCursorPosInCompositeText
=
function
()
{
};
baseEditorsApi
.
prototype
.
onKeyDown
=
function
(
e
)
{
};
baseEditorsApi
.
prototype
.
onKeyPress
=
function
(
e
)
{
};
baseEditorsApi
.
prototype
.
onKeyUp
=
function
(
e
)
{
};
//----------------------------------------------------------export----------------------------------------------------
window
[
'
AscCommon
'
]
=
window
[
'
AscCommon
'
]
||
{};
...
...
common/text_input.js
View file @
90d6cdda
...
...
@@ -2,6 +2,20 @@
(
function
(
window
,
undefined
)
{
///
// такие методы нужны в апи
// baseEditorsApi.prototype.Begin_CompositeInput = function()
// baseEditorsApi.prototype.Replace_CompositeText = function(arrCharCodes)
// baseEditorsApi.prototype.Set_CursorPosInCompositeText = function(nPos)
// baseEditorsApi.prototype.Get_CursorPosInCompositeText = function()
// baseEditorsApi.prototype.End_CompositeInput = function()
// baseEditorsApi.prototype.Get_MaxCursorPosInCompositeText = function()
// baseEditorsApi.prototype.onKeyDown = function(e)
// baseEditorsApi.prototype.onKeyPress = function(e)
// baseEditorsApi.prototype.onKeyUp = function(e)
///
var
c_oCompositionState
=
{
start
:
0
,
process
:
1
,
...
...
@@ -20,7 +34,6 @@
this
.
HtmlAreaOffset
=
60
;
this
.
Listener
=
null
;
this
.
LockerTargetTimer
=
-
1
;
this
.
KeyDownFlag
=
false
;
...
...
@@ -82,8 +95,6 @@
this
.
HtmlArea
.
addEventListener
(
"
compositionupdate
"
,
function
(
e
)
{
return
oThis
.
onCompositionUpdate
(
e
);
},
false
);
this
.
HtmlArea
.
addEventListener
(
"
compositionend
"
,
function
(
e
)
{
return
oThis
.
onCompositionEnd
(
e
);
},
false
);
this
.
Listener
=
this
.
Api
.
WordControl
.
m_oLogicDocument
;
this
.
show
(
false
);
// TODO:
...
...
@@ -125,9 +136,6 @@
onInput
:
function
(
e
)
{
if
(
!
this
.
checkListener
())
return
;
if
(
AscCommon
.
AscBrowser
.
isMozilla
)
{
if
(
c_oCompositionState
.
process
==
this
.
compositionState
)
...
...
@@ -138,10 +146,10 @@
if
(
!
this
.
KeyDownFlag
&&
c_oCompositionState
.
end
==
this
.
compositionState
&&
!
this
.
TextInputAfterComposition
&&
this
.
HtmlArea
.
value
!=
""
)
{
this
.
Listener
.
Begin_CompositeInput
();
this
.
Api
.
Begin_CompositeInput
();
this
.
checkCompositionData
(
this
.
HtmlArea
.
value
);
this
.
Listener
.
Replace_CompositeText
(
this
.
compositionValue
);
this
.
Listener
.
End_CompositeInput
();
this
.
Api
.
Replace_CompositeText
(
this
.
compositionValue
);
this
.
Api
.
End_CompositeInput
();
}
this
.
TextInputAfterComposition
=
false
;
...
...
@@ -165,7 +173,7 @@
if
(
_code
!=
8
&&
_code
!=
46
)
this
.
KeyDownFlag
=
true
;
return
this
.
Api
.
WordControl
.
onKeyDown
(
e
);
return
this
.
Api
.
onKeyDown
(
e
);
},
onKeyPress
:
function
(
e
)
...
...
@@ -173,7 +181,7 @@
if
(
c_oCompositionState
.
end
!=
this
.
compositionState
)
return
;
return
this
.
Api
.
WordControl
.
onKeyPress
(
e
);
return
this
.
Api
.
onKeyPress
(
e
);
},
onKeyUp
:
function
(
e
)
...
...
@@ -181,7 +189,7 @@
this
.
KeyDownFlag
=
false
;
if
(
c_oCompositionState
.
end
==
this
.
compositionState
)
return
this
.
Api
.
WordControl
.
onKeyUp
(
e
);
return
this
.
Api
.
onKeyUp
(
e
);
if
(
AscCommon
.
AscBrowser
.
isChrome
||
AscCommon
.
AscBrowser
.
isSafari
||
...
...
@@ -195,7 +203,7 @@
{
var
_offset
=
this
.
HtmlArea
.
selectionEnd
;
_offset
-=
(
this
.
HtmlArea
.
value
.
length
-
this
.
compositionValue
.
length
);
this
.
Listener
.
Set_CursorPosInCompositeText
(
_offset
);
this
.
Api
.
Set_CursorPosInCompositeText
(
_offset
);
this
.
unlockTarget
();
},
...
...
@@ -228,11 +236,8 @@
onCompositionStart
:
function
(
e
)
{
if
(
!
this
.
checkListener
())
return
;
this
.
compositionState
=
c_oCompositionState
.
start
;
this
.
Listener
.
Begin_CompositeInput
();
this
.
Api
.
Begin_CompositeInput
();
},
onCompositionUpdate
:
function
(
e
,
isLockTarget
)
...
...
@@ -265,14 +270,14 @@
var
_max
=
0
;
if
(
_isNeedSavePos
)
{
_old
=
this
.
Listener
.
Get_CursorPosInCompositeText
();
_max
=
this
.
Listener
.
Get_MaxCursorPosInCompositeText
();
_old
=
this
.
Api
.
Get_CursorPosInCompositeText
();
_max
=
this
.
Api
.
Get_MaxCursorPosInCompositeText
();
}
this
.
Listener
.
Replace_CompositeText
(
this
.
compositionValue
);
this
.
Api
.
Replace_CompositeText
(
this
.
compositionValue
);
if
(
_isNeedSavePos
)
{
if
(
_old
!=
_max
)
this
.
Listener
.
Set_CursorPosInCompositeText
(
_old
);
this
.
Api
.
Set_CursorPosInCompositeText
(
_old
);
}
}
...
...
@@ -295,10 +300,10 @@
this
.
onCompositionUpdate
(
e
,
false
);
}
this
.
Listener
.
Set_CursorPosInCompositeText
(
1000
);
// max
this
.
Api
.
Set_CursorPosInCompositeText
(
1000
);
// max
this
.
clear
();
this
.
Listener
.
End_CompositeInput
();
this
.
Api
.
End_CompositeInput
();
this
.
unlockTarget
();
this
.
TextInputAfterComposition
=
true
;
...
...
@@ -328,13 +333,6 @@
}
}
}
},
checkListener
:
function
()
{
if
(
!
this
.
Listener
)
this
.
Listener
=
this
.
Api
.
WordControl
.
m_oLogicDocument
;
return
!!
this
.
Listener
;
}
};
...
...
word/api.js
View file @
90d6cdda
...
...
@@ -7856,6 +7856,69 @@ background-repeat: no-repeat;\
return
true
;
};
// input
asc_docs_api
.
prototype
.
Begin_CompositeInput
=
function
()
{
if
(
this
.
WordControl
.
m_oLogicDocument
)
return
this
.
WordControl
.
m_oLogicDocument
.
Begin_CompositeInput
();
return
null
;
};
asc_docs_api
.
prototype
.
Add_CompositeText
=
function
(
nCharCode
)
{
if
(
this
.
WordControl
.
m_oLogicDocument
)
return
this
.
WordControl
.
m_oLogicDocument
.
Add_CompositeText
(
nCharCode
);
return
null
;
};
asc_docs_api
.
prototype
.
Remove_CompositeText
=
function
(
nCount
)
{
if
(
this
.
WordControl
.
m_oLogicDocument
)
return
this
.
WordControl
.
m_oLogicDocument
.
Remove_CompositeText
(
nCount
);
return
null
;
};
asc_docs_api
.
prototype
.
Replace_CompositeText
=
function
(
arrCharCodes
)
{
if
(
this
.
WordControl
.
m_oLogicDocument
)
return
this
.
WordControl
.
m_oLogicDocument
.
Replace_CompositeText
(
arrCharCodes
);
return
null
;
};
asc_docs_api
.
prototype
.
Set_CursorPosInCompositeText
=
function
(
nPos
)
{
if
(
this
.
WordControl
.
m_oLogicDocument
)
return
this
.
WordControl
.
m_oLogicDocument
.
Set_CursorPosInCompositeText
(
nPos
);
return
null
;
};
asc_docs_api
.
prototype
.
Get_CursorPosInCompositeText
=
function
()
{
if
(
this
.
WordControl
.
m_oLogicDocument
)
return
this
.
WordControl
.
m_oLogicDocument
.
Get_CursorPosInCompositeText
();
return
0
;
};
asc_docs_api
.
prototype
.
End_CompositeInput
=
function
()
{
if
(
this
.
WordControl
.
m_oLogicDocument
)
return
this
.
WordControl
.
m_oLogicDocument
.
End_CompositeInput
();
return
null
;
};
asc_docs_api
.
prototype
.
Get_MaxCursorPosInCompositeText
=
function
()
{
if
(
this
.
WordControl
.
m_oLogicDocument
)
return
this
.
WordControl
.
m_oLogicDocument
.
Get_MaxCursorPosInCompositeText
();
return
0
;
};
asc_docs_api
.
prototype
.
onKeyDown
=
function
(
e
)
{
return
this
.
WordControl
.
onKeyDown
(
e
);
};
asc_docs_api
.
prototype
.
onKeyPress
=
function
(
e
)
{
return
this
.
WordControl
.
onKeyPress
(
e
);
};
asc_docs_api
.
prototype
.
onKeyUp
=
function
(
e
)
{
return
this
.
WordControl
.
onKeyUp
(
e
);
};
window
[
"
asc_docs_api
"
]
=
asc_docs_api
;
window
[
"
asc_docs_api
"
].
prototype
[
"
asc_nativeOpenFile
"
]
=
function
(
base64File
,
version
)
{
...
...
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