Commit 67e25f93 authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

правка под MAC

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@50030 954022d7-b5bf-4e40-9824-e11837661b57
parent fd51ca43
...@@ -760,6 +760,7 @@ ...@@ -760,6 +760,7 @@
_editorPaste: function (worksheet,callback) { _editorPaste: function (worksheet,callback) {
var t = this; var t = this;
window.GlobalPasteFlagCounter = 1;
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
document.body.style.MozUserSelect = "text"; document.body.style.MozUserSelect = "text";
delete document.body.style["-khtml-user-select"]; delete document.body.style["-khtml-user-select"];
...@@ -834,7 +835,14 @@ ...@@ -834,7 +835,14 @@
pastebin.style.lineHeight = "1px";//todo FF всегда возвращает computedStyle в px, поэтому лучше явно указать default значнение pastebin.style.lineHeight = "1px";//todo FF всегда возвращает computedStyle в px, поэтому лучше явно указать default значнение
pastebin.setAttribute("contentEditable", true); pastebin.setAttribute("contentEditable", true);
pastebin.onpaste = function(e){t._bodyPaste(worksheet,e);}; pastebin.onpaste = function(e){
// тут onpaste не обрубаем, так как он в сафари под macos приходить должен
if (window.GlobalPasteFlagCounter == 1)
{
t._bodyPaste(worksheet,e);
window.GlobalPasteFlagCounter = 2;
}
};
document.body.appendChild( pastebin ); document.body.appendChild( pastebin );
} }
else if(bClean){ else if(bClean){
...@@ -844,7 +852,14 @@ ...@@ -844,7 +852,14 @@
{ {
pastebin.removeChild(aChildNodes[i]); pastebin.removeChild(aChildNodes[i]);
} }
pastebin.onpaste = function(e){t._bodyPaste(worksheet,e);}; pastebin.onpaste = function(e){
// тут onpaste не обрубаем, так как он в сафари под macos приходить должен
if (window.GlobalPasteFlagCounter == 1)
{
t._bodyPaste(worksheet,e);
window.GlobalPasteFlagCounter = 2;
}
};
} }
return pastebin; return pastebin;
}, },
...@@ -1451,13 +1466,19 @@ ...@@ -1451,13 +1466,19 @@
if(t.copyText && t.copyText.isImage) if(t.copyText && t.copyText.isImage)
{ {
if(t._insertImages(worksheet,t.lStorage,onlyFromLocalStorage)) if(t._insertImages(worksheet,t.lStorage,onlyFromLocalStorage))
{
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
return; return;
}
} }
else else
{ {
worksheet.setSelectionInfo('paste',t,false,true); worksheet.setSelectionInfo('paste',t,false,true);
} }
} }
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
return; return;
} }
...@@ -1468,11 +1489,17 @@ ...@@ -1468,11 +1489,17 @@
if(t.copyText.isImage) if(t.copyText.isImage)
{ {
if(t._insertImages(worksheet,t.lStorage,onlyFromLocalStorage)) if(t._insertImages(worksheet,t.lStorage,onlyFromLocalStorage))
{
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
return; return;
}
} }
else else
{ {
worksheet.setSelectionInfo('paste',t,false,true); worksheet.setSelectionInfo('paste',t,false,true);
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
return; return;
} }
} }
...@@ -1845,6 +1872,8 @@ ...@@ -1845,6 +1872,8 @@
aResult.addImages = addImages; aResult.addImages = addImages;
aResult.fontsNew = fontsNew; aResult.fontsNew = fontsNew;
worksheet.setSelectionInfo('paste',aResult,t); worksheet.setSelectionInfo('paste',aResult,t);
window.GlobalPasteFlagCounter = 0;
window.GlobalPasteFlag = false;
}, },
_isEqualText: function(node, table){ _isEqualText: function(node, table){
...@@ -2594,7 +2623,17 @@ ...@@ -2594,7 +2623,17 @@
} }
)(jQuery, window); )(jQuery, window);
window.USER_AGENT_SAFARI_MACOS = (navigator.userAgent.toLowerCase().indexOf('safari') > -1 && navigator.userAgent.toLowerCase().indexOf('mac') > -1) ? true : false; window.USER_AGENT_MACOS = (navigator.userAgent.toLowerCase().indexOf('mac') > -1) ? true : false;
window.USER_AGENT_SAFARI_MACOS = (navigator.userAgent.toLowerCase().indexOf('safari') > -1 && window.USER_AGENT_MACOS) ? true : false;
if (window.USER_AGENT_SAFARI_MACOS)
{
// браузеры под мак все определяются как сафари
// проверим на дополнительные параметры
if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)
window.USER_AGENT_SAFARI_MACOS = false;
}
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
var COPY_ELEMENT_ID = "clipboard-helper"; var COPY_ELEMENT_ID = "clipboard-helper";
var PASTE_ELEMENT_ID = "wrd_pastebin"; var PASTE_ELEMENT_ID = "wrd_pastebin";
var ELEMENT_DISPAY_STYLE = "none"; var ELEMENT_DISPAY_STYLE = "none";
...@@ -2651,7 +2690,15 @@ function Editor_CopyPaste_Create(api) ...@@ -2651,7 +2690,15 @@ function Editor_CopyPaste_Create(api)
ElemToSelect.style.lineHeight = "1px"; ElemToSelect.style.lineHeight = "1px";
ElemToSelect["onpaste"] = function(e){ ElemToSelect["onpaste"] = function(e){
api.wb.clipboard._bodyPaste(api.wb.getWorksheet(), e); if (!window.GlobalPasteFlag)
return;
// тут onpaste не обрубаем, так как он в сафари под macos приходить должен
if (window.GlobalPasteFlagCounter == 1)
{
api.wb.clipboard._bodyPaste(api.wb.getWorksheet(), e);
window.GlobalPasteFlagCounter = 2;
}
}; };
ElemToSelect["onbeforecopy"] = function(e){ ElemToSelect["onbeforecopy"] = function(e){
...@@ -2708,10 +2755,6 @@ function Editor_CopyPaste_Create(api) ...@@ -2708,10 +2755,6 @@ function Editor_CopyPaste_Create(api)
else else
isNeedEmptyAfterCut = true; isNeedEmptyAfterCut = true;
}; };
/*elementText["onpaste"] = function(e){
api.wb.clipboard.pasteAsText();
};*/
document.body.appendChild(elementText); document.body.appendChild(elementText);
} }
......
...@@ -818,7 +818,30 @@ ...@@ -818,7 +818,30 @@
80: function () {stop(); t.handlers.trigger("print");}, 80: function () {stop(); t.handlers.trigger("print");},
83: function () {stop(); t.handlers.trigger("save");}, 83: function () {stop(); t.handlers.trigger("save");},
67: function () {t.handlers.trigger("copy");}, 67: function () {t.handlers.trigger("copy");},
86: function () {t.handlers.trigger("paste");}, 86: function () {
if (!window.GlobalPasteFlag)
{
if (!window.USER_AGENT_SAFARI_MACOS)
{
window.GlobalPasteFlag = true;
t.handlers.trigger("paste");
}
else
{
if (0 === window.GlobalPasteFlagCounter)
{
//SafariIntervalFocus();
window.GlobalPasteFlag = true;
t.handlers.trigger("paste");
}
}
}
else
{
if (!window.USER_AGENT_SAFARI_MACOS)
stop();
}
},
88: function () {t.handlers.trigger("cut");}, 88: function () {t.handlers.trigger("cut");},
89: function () {stop(); t.handlers.trigger("redo");}, 89: function () {stop(); t.handlers.trigger("redo");},
90: function () {stop(); t.handlers.trigger("undo");} 90: function () {stop(); t.handlers.trigger("undo");}
......
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