Commit cef596e4 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander.Trofimov

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49595 954022d7-b5bf-4e40-9824-e11837661b57
parent 046c3bee
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
} }
window.USER_AGENT_SAFARI_MACOS = (navigator.userAgent.toLowerCase().indexOf('safari') > -1 && navigator.userAgent.toLowerCase().indexOf('mac') > -1) ? true : false; window.USER_AGENT_SAFARI_MACOS = (navigator.userAgent.toLowerCase().indexOf('safari') > -1 && navigator.userAgent.toLowerCase().indexOf('mac') > -1) ? true : false;
window.GlobalPasteFlagCounter = 0;
var COPY_ELEMENT_ID = "SelectId"; var COPY_ELEMENT_ID = "SelectId";
var PASTE_ELEMENT_ID = "wrd_pastebin"; var PASTE_ELEMENT_ID = "wrd_pastebin";
...@@ -1890,6 +1891,8 @@ function CanPaste(oDocument) ...@@ -1890,6 +1891,8 @@ function CanPaste(oDocument)
}; };
function Editor_Paste(api, bClean) function Editor_Paste(api, bClean)
{ {
window.GlobalPasteFlagCounter = 1;
var oWordControl = api.WordControl; var oWordControl = api.WordControl;
oWordControl.bIsEventPaste = false; oWordControl.bIsEventPaste = false;
var oDocument = oWordControl.m_oLogicDocument; var oDocument = oWordControl.m_oLogicDocument;
...@@ -1932,8 +1935,18 @@ function Editor_Paste(api, bClean) ...@@ -1932,8 +1935,18 @@ function Editor_Paste(api, bClean)
} }
} }
//���� ���������� paste //���� ���������� paste
window.setTimeout( function()
{ var func_timeout = function() {
if (window.USER_AGENT_SAFARI_MACOS)
{
if (window.GlobalPasteFlagCounter != 2)
{
window.setTimeout(func_timeout, 10);
return;
}
}
document.body.style.MozUserSelect = "none"; document.body.style.MozUserSelect = "none";
document.body.style["-khtml-user-select"] = "none"; document.body.style["-khtml-user-select"] = "none";
document.body.style["-o-user-select"] = "none"; document.body.style["-o-user-select"] = "none";
...@@ -1941,10 +1954,13 @@ function Editor_Paste(api, bClean) ...@@ -1941,10 +1954,13 @@ function Editor_Paste(api, bClean)
document.body.style["-webkit-user-select"] = "none"; document.body.style["-webkit-user-select"] = "none";
if(!oWordControl.bIsEventPaste) if(!oWordControl.bIsEventPaste)
{
Editor_Paste_Exec(api, pastebin); Editor_Paste_Exec(api, pastebin);
}
else else
pastebin.style.display = ELEMENT_DISPAY_STYLE; pastebin.style.display = ELEMENT_DISPAY_STYLE;
}, 0 ); };
window.setTimeout( func_timeout, 0 );
}; };
function CopyPasteCorrectString(str) function CopyPasteCorrectString(str)
{ {
...@@ -2301,6 +2317,8 @@ PasteProcessor.prototype = ...@@ -2301,6 +2317,8 @@ PasteProcessor.prototype =
this.oRecalcDocument.Recalculate(); this.oRecalcDocument.Recalculate();
this.oLogicDocument.Document_UpdateInterfaceState(); this.oLogicDocument.Document_UpdateInterfaceState();
} }
window.GlobalPasteFlagCounter = 0;
}, },
InsertInPlace : function(oDoc, aNewContent) InsertInPlace : function(oDoc, aNewContent)
{ {
...@@ -4679,7 +4697,11 @@ function Editor_CopyPaste_Create(api) ...@@ -4679,7 +4697,11 @@ function Editor_CopyPaste_Create(api)
ElemToSelect.onpaste = function(e){ ElemToSelect.onpaste = function(e){
//Editor_Paste(api, true); //Editor_Paste(api, true);
Body_Paste(api,e); if (window.GlobalPasteFlagCounter == 1)
{
Body_Paste(api,e);
window.GlobalPasteFlagCounter = 2;
}
}; };
var TIME_PREVIOS_ONBEFORE_EVENTS = new Date().getTime(); var TIME_PREVIOS_ONBEFORE_EVENTS = new Date().getTime();
......
...@@ -525,6 +525,30 @@ function CFontInfo(sName, thumbnail, type, indexR, faceIndexR, indexI, faceIndex ...@@ -525,6 +525,30 @@ function CFontInfo(sName, thumbnail, type, indexR, faceIndexR, indexI, faceIndex
return isNeed; return isNeed;
} }
this.CheckFontLoadStylesNoLoad = function(global_loader)
{
var fonts = (FONT_TYPE_EMBEDDED == this.Type) ? global_loader.embeddedFontFiles : global_loader.fontFiles;
var _isNeed = false;
if ((-1 != this.indexR) && (fonts[this.indexR].CheckLoaded() === false))
{
_isNeed = true;
}
if ((-1 != this.indexI) && (fonts[this.indexI].CheckLoaded() === false))
{
_isNeed = true;
}
if ((-1 != this.indexB) && (fonts[this.indexB].CheckLoaded() === false))
{
_isNeed = true;
}
if ((-1 != this.indexBI) && (fonts[this.indexBI].CheckLoaded() === false))
{
_isNeed = true;
}
return _isNeed;
}
this.LoadFontsFromServer = function(global_loader) this.LoadFontsFromServer = function(global_loader)
{ {
var fonts = global_loader.fontFiles; var fonts = global_loader.fontFiles;
......
...@@ -329,6 +329,18 @@ var ASC_DOCS_API_USE_OPEN_SOURCE_FONTS_ONLY = false; ...@@ -329,6 +329,18 @@ var ASC_DOCS_API_USE_OPEN_SOURCE_FONTS_ONLY = false;
this._LoadFonts(); this._LoadFonts();
} }
this.CheckFontsNeedLoading = function(_fonts)
{
for (var i in _fonts)
{
var info = this.fontInfos[this.map_font_index[_fonts[i].name]];
var _isNeed = info.CheckFontLoadStylesNoLoad(this);
if (_isNeed === true)
return true;
}
return false;
}
this.LoadDocumentFonts2 = function(_fonts) this.LoadDocumentFonts2 = function(_fonts)
{ {
// сначала заполняем массив this.fonts_loading объекстами fontinfo // сначала заполняем массив this.fonts_loading объекстами fontinfo
......
...@@ -7762,7 +7762,22 @@ CDocument.prototype = ...@@ -7762,7 +7762,22 @@ CDocument.prototype =
if ( false === this.Document_Is_SelectionLocked(changestype_Paragraph_Content) ) if ( false === this.Document_Is_SelectionLocked(changestype_Paragraph_Content) )
{ {
this.Create_NewHistoryPoint(); this.Create_NewHistoryPoint();
Editor_Paste(this.DrawingDocument.m_oWordControl.m_oApi, true);
if (!window.USER_AGENT_SAFARI_MACOS)
{
Editor_Paste(this.DrawingDocument.m_oWordControl.m_oApi, true);
//не возвращаем true чтобы не было preventDefault
}
else
{
SafariIntervalFocus();
if (0 === window.GlobalPasteFlagCounter)
{
Editor_Paste(this.DrawingDocument.m_oWordControl.m_oApi, true);
//не возвращаем true чтобы не было preventDefault
}
}
} }
//не возвращаем true чтобы не было preventDefault //не возвращаем true чтобы не было preventDefault
} }
...@@ -7995,8 +8010,21 @@ CDocument.prototype = ...@@ -7995,8 +8010,21 @@ CDocument.prototype =
} }
else // Ctrl + V - paste else // Ctrl + V - paste
{ {
Editor_Paste(this.DrawingDocument.m_oWordControl.m_oApi, true); if (!window.USER_AGENT_SAFARI_MACOS)
//не возвращаем true чтобы не было preventDefault {
Editor_Paste(this.DrawingDocument.m_oWordControl.m_oApi, true);
//не возвращаем true чтобы не было preventDefault
}
else
{
SafariIntervalFocus();
if (0 === window.GlobalPasteFlagCounter)
{
Editor_Paste(this.DrawingDocument.m_oWordControl.m_oApi, true);
//не возвращаем true чтобы не было preventDefault
}
}
} }
} }
} }
......
...@@ -6107,6 +6107,18 @@ asc_docs_api.prototype.pre_Paste = function(_fonts, _images, callback) ...@@ -6107,6 +6107,18 @@ asc_docs_api.prototype.pre_Paste = function(_fonts, _images, callback)
this.isPasteFonts_Images = true; this.isPasteFonts_Images = true;
this.pasteCallback = callback; this.pasteCallback = callback;
this.pasteImageMap = _images; this.pasteImageMap = _images;
var _count = 0;
for (var i in this.pasteImageMap)
++_count;
if (0 == _count && false === this.FontLoader.CheckFontsNeedLoading(_fonts))
{
// никаких евентов. ничего грузить не нужно. сделано для сафари под макОс.
// там при LongActions теряется фокус и вставляются пробелы
this.pasteCallback();
return;
}
this.FontLoader.LoadDocumentFonts2(_fonts); this.FontLoader.LoadDocumentFonts2(_fonts);
} }
......
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