Commit 5356b047 authored by Oleg.Korshul's avatar Oleg.Korshul

работа с дексктопным редактором на базе хромиума

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@61954 954022d7-b5bf-4e40-9824-e11837661b57
parent 746e5336
......@@ -263,6 +263,47 @@ function Editor_Copy(api, bCut)
}
}
if (window["AscDesktopEditorButtonMode"] === true && window["AscDesktopEditor"]) {
if (bCut)
{
var __oncut = ElemToSelect.oncut;
ElemToSelect.oncut = function (e) {
ElemToSelect.oncut = __oncut;
__oncut = null;
if (false === api.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content)) {
ElemToSelect.innerHTML = "";
Editor_Copy_Event(e, ElemToSelect);
api.WordControl.m_oLogicDocument.Remove(1, true, true);
api.WordControl.m_oLogicDocument.Document_UpdateSelectionState();
}
}
window["AscDesktopEditor"]["Cut"]();
}
else
{
var __oncopy = ElemToSelect.oncopy;
ElemToSelect.oncopy = function (e) {
ElemToSelect.oncopy = __oncopy;
__oncopy = null;
ElemToSelect.innerHTML = "";
Editor_Copy_Event(e, ElemToSelect);
}
window["AscDesktopEditor"]["Copy"]();
}
return;
}
//���� ���������� copy
var time_interval = 200;
if (window.USER_AGENT_SAFARI_MACOS)
......@@ -2332,6 +2373,33 @@ function Editor_Paste(api, bClean)
rangeToSelect.select ();
}
}
if (window["AscDesktopEditorButtonMode"] === true && window["AscDesktopEditor"])
{
var __onpaste = pastebin.onpaste;
pastebin.onpaste = function (e) {
pastebin.onpaste = __onpaste;
__onpaste = null;
if (!window.GlobalPasteFlag)
return;
// тут onpaste не обрубаем, так как он в сафари под macos приходить должен
if (window.GlobalPasteFlagCounter == 1) {
Body_Paste(api, e);
if (window.GlobalPasteFlag)
window.GlobalPasteFlagCounter = 2;
}
}
window["AscDesktopEditor"]["Paste"]();
return;
}
//���� ���������� paste
var func_timeout = function() {
......
......@@ -349,6 +349,18 @@ function CFontFileLoader(id)
this.LoadFontAsync = function(basePath, _callback)
{
if (window["AscDesktopEditor"] !== undefined)
{
if (-1 != this.Status)
return true;
this.callback = null;
this.Status = 2;
window["AscDesktopEditor"]["LoadFontBase64"](this.Id);
this._callback_font_load();
return;
}
if (ASC_DOCS_API_USE_FONTS_ORIGINAL_FORMAT && // проставляется в true на этапе сборки
this.CanUseOriginalFormat && // false if load embedded fonts
bIsSupportOriginalFormatFonts && // false if work on ie9
......
......@@ -295,6 +295,11 @@ var DocumentPageSize = new function() {
/** @constructor */
function asc_docs_api(name)
{
if (window["AscDesktopEditor"])
{
window["AscDesktopEditor"]["CreateEditorApi"]();
}
g_fontApplication.Init();
var CDocsCoApi = window["CDocsCoApi"];
......@@ -2198,6 +2203,20 @@ asc_docs_api.prototype.Redo = function()
};
asc_docs_api.prototype.Copy = function()
{
if (window["AscDesktopEditor"])
{
window["AscDesktopEditorButtonMode"] = true;
var _e = new CKeyboardEvent();
_e.CtrlKey = true;
_e.KeyCode = 67;
this.WordControl.m_oLogicDocument.OnKeyDown(_e);
window["AscDesktopEditorButtonMode"] = false;
return;
}
return Editor_Copy_Button(this)
};
asc_docs_api.prototype.Update_ParaTab = function(Default_Tab, ParaTabs){
......@@ -2205,10 +2224,39 @@ asc_docs_api.prototype.Update_ParaTab = function(Default_Tab, ParaTabs){
};
asc_docs_api.prototype.Cut = function()
{
if (window["AscDesktopEditor"])
{
window["AscDesktopEditorButtonMode"] = true;
var _e = new CKeyboardEvent();
_e.CtrlKey = true;
_e.KeyCode = 88;
this.WordControl.m_oLogicDocument.OnKeyDown(_e);
window["AscDesktopEditorButtonMode"] = false;
return;
}
return Editor_Copy_Button(this, true);
};
asc_docs_api.prototype.Paste = function()
{
if (window["AscDesktopEditor"])
{
window["AscDesktopEditorButtonMode"] = true;
var _e = new CKeyboardEvent();
_e.CtrlKey = true;
_e.KeyCode = 86;
this.WordControl.m_oLogicDocument.OnKeyDown(_e);
window["AscDesktopEditorButtonMode"] = false;
return;
}
if (false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content))
{
if (!window.GlobalPasteFlag)
......@@ -5269,6 +5317,8 @@ asc_docs_api.prototype.asc_getDefaultLanguage = function()
asc_docs_api.prototype.asc_getKeyboardLanguage = function()
{
if (undefined !== window["asc_current_keyboard_layout"])
return window["asc_current_keyboard_layout"];
return -1;
};
......@@ -6757,6 +6807,10 @@ function spellCheck (editor, rdata) {
// push data to native QT code
window['qtDocBridge']['spellCheck'] (JSON.stringify(rdata));
}
else if (undefined !== window["AscDesktopEditor"])
{
window["AscDesktopEditor"]["SpellCheck"](JSON.stringify(rdata));
}
else
{
editor.SpellCheckApi.spellCheck(JSON.stringify(rdata));
......@@ -6766,6 +6820,12 @@ function spellCheck (editor, rdata) {
}
}
window["asc_nativeOnSpellCheck"] = function (response)
{
var incomeObject = JSON.parse(response);
SpellCheck_CallBack(incomeObject);
};
function _onSpellCheck_Callback2 (response)
{
var incomeObject = JSON.parse(response);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment