Commit 9b3a062a 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@66410 954022d7-b5bf-4e40-9824-e11837661b57
parent 6f7ccac5
"use strict";
/////////////////////////////////////////////////////////
////////////// FONTS ////////////////////////
/////////////////////////////////////////////////////////
CFontFileLoader.prototype.LoadFontAsync = function(basePath, _callback, isEmbed)
{
this.callback = _callback;
if (-1 != this.Status)
return true;
var oThis = this;
this.Status = 2;
if (window["AscDesktopEditor"] !== undefined && !this.CanUseOriginalFormat)
{
this.callback = null;
window["AscDesktopEditor"]["LoadFontBase64"](this.Id);
this._callback_font_load();
return;
}
var xhr = new XMLHttpRequest();
xhr.open('GET', "ascdesktop://fonts/" + this.Id, true);
xhr.responseType = 'arraybuffer';
if (xhr.overrideMimeType)
xhr.overrideMimeType('text/plain; charset=x-user-defined');
else
xhr.setRequestHeader('Accept-Charset', 'x-user-defined');
xhr.onload = function()
{
if (this.status != 200)
{
oThis.Status = 1;
return;
}
oThis.Status = 0;
if (this.response)
{
var __font_data_idx = g_fonts_streams.length;
var _uintData = new Uint8Array(this.response);
g_fonts_streams[__font_data_idx] = new FT_Stream(_uintData, _uintData.length);
oThis.SetStreamIndex(__font_data_idx);
}
else
{
var __font_data_idx = g_fonts_streams.length;
g_fonts_streams[__font_data_idx] = CreateFontData3(this.responseText);
oThis.SetStreamIndex(__font_data_idx);
if (null != oThis.callback)
oThis.callback();
}
};
xhr.send(null);
};
/////////////////////////////////////////////////////////
////////////// IMAGES ////////////////////////
/////////////////////////////////////////////////////////
function DocumentUrls()
{
this.urls = {};
this.documentUrl = "";
this.imageCount = 0;
}
DocumentUrls.prototype =
{
mediaPrefix: 'media/',
init: function (urls) {
},
getUrls: function () {
return this.urls;
},
addUrls : function(urls){
},
addImageUrl : function(strPath, url){
},
getImageUrl : function(strPath){
return this.documentUrl + "/media/" + strPath;
},
getImageLocal : function(url){
var _first = this.documentUrl + "/media/";
if (0 == url.indexOf(_first))
return url.substring(_first.length);
return null;
},
imagePath2Local : function(imageLocal){
return this.getImageLocal(imageLocal);
},
getUrl : function(strPath){
return this.documentUrl + "/media/" + strPath;
},
getLocal : function(url){
return this.getImageLocal(url);
},
getMaxIndex : function(url){
return this.imageCount;
}
};
g_oDocumentUrls = new DocumentUrls();
function sendImgUrls(api, images, callback)
{
var _data = [];
for (var i = 0; i < images.length; i++)
{
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](images[i]);
_data[i] = { url: images[i], path : g_oDocumentUrls.getImageUrl(_url) };
}
callback(_data);
}
/////////////////////////////////////////////////////////
//////////////// SAVE //////////////////////
/////////////////////////////////////////////////////////
function DesktopOfflineUpdateLocalName(_api)
{
var _name = window["AscDesktopEditor"]["LocalFileGetSourcePath"]();
var _ind1 = _name.lastIndexOf("\\");
var _ind2 = _name.lastIndexOf("/");
if (_ind1 == -1)
_ind1 = 1000000;
if (_ind2 == -1)
_ind2 = 1000000;
var _ind = Math.min(_ind1, _ind2);
if (_ind != 1000000)
_name = _name.substring(_ind + 1);
_api.documentTitle = _name;
window["AscDesktopEditor"]["SetDocumentName"](_name);
}
window["CDocsCoApi"].prototype.askSaveChanges = function(callback)
{
callback({"saveLock": false});
};
window["NativeCorrectImageUrlOnCopy"] = function(url)
{
g_oDocumentUrls.getImageUrl(url);
};
window["NativeCorrectImageUrlOnPaste"] = function(url)
{
return window["AscDesktopEditor"]["LocalFileGetImageUrl"](url);
};
\ No newline at end of file
...@@ -165,4 +165,8 @@ baseEditorsApi.prototype.asc_getTextArtPreviews = function() { ...@@ -165,4 +165,8 @@ baseEditorsApi.prototype.asc_getTextArtPreviews = function() {
baseEditorsApi.prototype.asc_showRevision = function(newObj) { baseEditorsApi.prototype.asc_showRevision = function(newObj) {
}; };
baseEditorsApi.prototype.asc_undoAllChanges = function() { baseEditorsApi.prototype.asc_undoAllChanges = function() {
};
baseEditorsApi.prototype.asc_isOffline = function() {
return false;
}; };
\ No newline at end of file
"use strict"; "use strict";
/////////////////////////////////////////////////////////
////////////// FONTS ////////////////////////
/////////////////////////////////////////////////////////
CFontFileLoader.prototype.LoadFontAsync = function(basePath, _callback, isEmbed)
{
this.callback = _callback;
if (-1 != this.Status)
return true;
var oThis = this;
this.Status = 2;
if (window["AscDesktopEditor"] !== undefined && !this.CanUseOriginalFormat)
{
this.callback = null;
window["AscDesktopEditor"]["LoadFontBase64"](this.Id);
this._callback_font_load();
return;
}
var xhr = new XMLHttpRequest();
xhr.open('GET', "ascdesktop://fonts/" + this.Id, true);
xhr.responseType = 'arraybuffer';
if (xhr.overrideMimeType)
xhr.overrideMimeType('text/plain; charset=x-user-defined');
else
xhr.setRequestHeader('Accept-Charset', 'x-user-defined');
xhr.onload = function()
{
if (this.status != 200)
{
oThis.Status = 1;
return;
}
oThis.Status = 0;
if (this.response)
{
var __font_data_idx = g_fonts_streams.length;
var _uintData = new Uint8Array(this.response);
g_fonts_streams[__font_data_idx] = new FT_Stream(_uintData, _uintData.length);
oThis.SetStreamIndex(__font_data_idx);
}
else
{
var __font_data_idx = g_fonts_streams.length;
g_fonts_streams[__font_data_idx] = CreateFontData3(this.responseText);
oThis.SetStreamIndex(__font_data_idx);
if (null != oThis.callback)
oThis.callback();
}
};
xhr.send(null);
};
/////////////////////////////////////////////////////////
////////////// IMAGES ////////////////////////
/////////////////////////////////////////////////////////
function DocumentUrls(){
this.urls = {};
this.documentUrl = "";
this.imageCount = 0;
}
DocumentUrls.prototype = {
mediaPrefix: 'media/',
init: function (urls) {
},
getUrls: function () {
return this.urls;
},
addUrls : function(urls){
},
addImageUrl : function(strPath, url){
},
getImageUrl : function(strPath){
return this.documentUrl + "/media/" + strPath;
},
getImageLocal : function(url){
return "";
},
imagePath2Local : function(imageLocal){
return "";
},
getUrl : function(strPath){
return this.documentUrl + "/media/" + strPath;
},
getLocal : function(url){
return null;
},
getMaxIndex : function(url){
return this.imageCount;
}
};
g_oDocumentUrls = new DocumentUrls();
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
////////////// OPEN //////////////////////// ////////////// OPEN ////////////////////////
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
...@@ -126,6 +27,7 @@ g_oDocumentUrls = new DocumentUrls(); ...@@ -126,6 +27,7 @@ g_oDocumentUrls = new DocumentUrls();
var wb = this._openDocument(_data); var wb = this._openDocument(_data);
window.OfflineOpenCallback({returnCode: 0, val: wb}); window.OfflineOpenCallback({returnCode: 0, val: wb});
window.OfflineOpenCallback = undefined; window.OfflineOpenCallback = undefined;
History.UserSaveMode = true;
} }
}; };
})(jQuery, window); })(jQuery, window);
...@@ -139,13 +41,97 @@ window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data) ...@@ -139,13 +41,97 @@ window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data)
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
////////////// CHANGES ///////////////////// ////////////// CHANGES /////////////////////
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
window["CDocsCoApi"].prototype.saveChanges = function(arrayChanges, deleteIndex, excelAdditionalInfo) CHistory.prototype.Reset_SavedIndex = function(IsUserSave)
{
if (true === this.Is_UserSaveMode())
{
if (this.Index == -1)
return;
this.SavedIndex = this.Index;
if (true === IsUserSave)
{
this.UserSavedIndex = this.Index;
this.ForceSave = false;
}
}
else
{
this.SavedIndex = this.Index;
this.ForceSave = false;
}
};
CHistory.prototype.Have_Changes = function(IsUserSave)
{ {
window["AscDesktopEditor"]["LocalFileSaveChanges"](arrayChanges.join("\",\""), deleteIndex, arrayChanges.length); if (true === this.Is_UserSaveMode() && false !== IsUserSave)
this.onUnSaveLock(); {
if (-1 === this.Index && null === this.UserSavedIndex && false === this.ForceSave)
{
if (0 != window["AscDesktopEditor"]["LocalFileGetOpenChangesCount"]())
return true;
if (!window["AscDesktopEditor"]["LocalFileGetSaved"]())
return true;
return false;
}
if (this.Index != this.UserSavedIndex || true === this.ForceSave)
return true;
return false;
}
else
{
if (-1 === this.Index && null === this.SavedIndex && false === this.ForceSave)
return false;
if (this.Index != this.SavedIndex || true === this.ForceSave)
return true;
return false;
}
}; };
window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes) window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes)
{ {
window["Asc"]["editor"].asc_nativeApplyChanges(_changes); window["Asc"]["editor"].asc_nativeApplyChanges(_changes);
window["Asc"]["editor"].asc_nativeCalculateFile(); window["Asc"]["editor"].asc_nativeCalculateFile();
}; };
\ No newline at end of file
/////////////////////////////////////////////////////////
//////////////// SAVE //////////////////////
/////////////////////////////////////////////////////////
window["Asc"]['spreadsheet_api'].prototype.asc_Save = function (isNoUserSave)
{
if (true !== isNoUserSave)
this.IsUserSave = true;
if (true === this.canSave && !this.asc_IsLongAction())
{
var _isNaturalSave = this.IsUserSave;
this.canSave = false;
this.CoAuthoringApi.askSaveChanges(window["Asc"]["editor"].onSaveCallback);
if (this.CoAuthoringApi.onUnSaveLock)
this.CoAuthoringApi.onUnSaveLock();
if (_isNaturalSave === true)
window["DesktopOfflineAppDocumentStartSave"]();
}
};
window["DesktopOfflineAppDocumentStartSave"] = function()
{
window["Asc"]["editor"].sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save);
window["AscDesktopEditor"]["LocalFileSave"]();
};
window["DesktopOfflineAppDocumentEndSave"] = function(isCancel)
{
window["Asc"]["editor"].sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save);
if (isCancel !== true)
DesktopOfflineUpdateLocalName(window["Asc"]["editor"]);
};
window["Asc"]['spreadsheet_api'].prototype.asc_isOffline = function()
{
return true;
};
window["Asc"]['spreadsheet_api'].prototype["asc_Save"] = window["Asc"]['spreadsheet_api'].prototype.asc_Save;
window["Asc"]['spreadsheet_api'].prototype["asc_isOffline"] = window["Asc"]['spreadsheet_api'].prototype.asc_isOffline;
\ No newline at end of file
...@@ -3604,4 +3604,6 @@ var editor; ...@@ -3604,4 +3604,6 @@ var editor;
prot["asc_nativePrint"] = prot.asc_nativePrint; prot["asc_nativePrint"] = prot.asc_nativePrint;
prot["asc_nativePrintPagesCount"] = prot.asc_nativePrintPagesCount; prot["asc_nativePrintPagesCount"] = prot.asc_nativePrintPagesCount;
prot["asc_nativeGetPDF"] = prot.asc_nativeGetPDF; prot["asc_nativeGetPDF"] = prot.asc_nativeGetPDF;
prot['asc_isOffline'] = prot.asc_isOffline;
})(jQuery, window); })(jQuery, window);
"use strict"; "use strict";
/////////////////////////////////////////////////////////
////////////// FONTS ////////////////////////
/////////////////////////////////////////////////////////
CFontFileLoader.prototype.LoadFontAsync = function(basePath, _callback, isEmbed)
{
this.callback = _callback;
if (-1 != this.Status)
return true;
var oThis = this;
this.Status = 2;
if (window["AscDesktopEditor"] !== undefined && !this.CanUseOriginalFormat)
{
this.callback = null;
window["AscDesktopEditor"]["LoadFontBase64"](this.Id);
this._callback_font_load();
return;
}
var xhr = new XMLHttpRequest();
xhr.open('GET', "ascdesktop://fonts/" + this.Id, true);
xhr.responseType = 'arraybuffer';
if (xhr.overrideMimeType)
xhr.overrideMimeType('text/plain; charset=x-user-defined');
else
xhr.setRequestHeader('Accept-Charset', 'x-user-defined');
xhr.onload = function()
{
if (this.status != 200)
{
oThis.Status = 1;
return;
}
oThis.Status = 0;
if (this.response)
{
var __font_data_idx = g_fonts_streams.length;
var _uintData = new Uint8Array(this.response);
g_fonts_streams[__font_data_idx] = new FT_Stream(_uintData, _uintData.length);
oThis.SetStreamIndex(__font_data_idx);
}
else
{
var __font_data_idx = g_fonts_streams.length;
g_fonts_streams[__font_data_idx] = CreateFontData3(this.responseText);
oThis.SetStreamIndex(__font_data_idx);
if (null != oThis.callback)
oThis.callback();
}
};
xhr.send(null);
};
/////////////////////////////////////////////////////////
////////////// IMAGES ////////////////////////
/////////////////////////////////////////////////////////
function DocumentUrls(){
this.urls = {};
this.documentUrl = "";
this.imageCount = 0;
}
DocumentUrls.prototype = {
mediaPrefix: 'media/',
init: function (urls) {
},
getUrls: function () {
return this.urls;
},
addUrls : function(urls){
},
addImageUrl : function(strPath, url){
},
getImageUrl : function(strPath){
return this.documentUrl + "/media/" + strPath;
},
getImageLocal : function(url){
var _first = this.documentUrl + "/media/";
if (0 == url.indexOf(_first))
return url.substring(_first.length);
return null;
},
imagePath2Local : function(imageLocal){
return this.getImageLocal(imageLocal);
},
getUrl : function(strPath){
return this.documentUrl + "/media/" + strPath;
},
getLocal : function(url){
return this.getImageLocal(url);
},
getMaxIndex : function(url){
return this.imageCount;
}
};
g_oDocumentUrls = new DocumentUrls();
function sendImgUrls(api, images, callback)
{
var _data = [];
for (var i = 0; i < images.length; i++)
{
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](images[i]);
_data[i] = { url: images[i], path : g_oDocumentUrls.getImageUrl(_url) };
}
callback(_data);
}
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
////////////// OPEN //////////////////////// ////////////// OPEN ////////////////////////
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
...@@ -186,11 +73,6 @@ CHistory.prototype.Have_Changes = function(IsUserSave) ...@@ -186,11 +73,6 @@ CHistory.prototype.Have_Changes = function(IsUserSave)
} }
}; };
window["CDocsCoApi"].prototype.saveChanges = function(arrayChanges, deleteIndex, excelAdditionalInfo)
{
window["AscDesktopEditor"]["LocalFileSaveChanges"](arrayChanges.join("\",\""), deleteIndex, arrayChanges.length);
this.onUnSaveLock();
};
window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes) window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes)
{ {
editor["asc_nativeApplyChanges"](_changes); editor["asc_nativeApplyChanges"](_changes);
...@@ -200,30 +82,6 @@ window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes) ...@@ -200,30 +82,6 @@ window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes)
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
//////////////// SAVE ////////////////////// //////////////// SAVE //////////////////////
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
function DesktopOfflineUpdateLocalName(_api)
{
var _name = window["AscDesktopEditor"]["LocalFileGetSourcePath"]();
var _ind1 = _name.lastIndexOf("\\");
var _ind2 = _name.lastIndexOf("/");
if (_ind1 == -1)
_ind1 = 1000000;
if (_ind2 == -1)
_ind2 = 1000000;
var _ind = Math.min(_ind1, _ind2);
if (_ind != 1000000)
_name = _name.substring(_ind + 1);
_api.documentTitle = _name;
window["AscDesktopEditor"]["SetDocumentName"](_name);
}
window["CDocsCoApi"].prototype.askSaveChanges = function(callback)
{
callback({"saveLock": false});
};
asc_docs_api.prototype.asc_Save = function (isNoUserSave) asc_docs_api.prototype.asc_Save = function (isNoUserSave)
{ {
if (true !== isNoUserSave) if (true !== isNoUserSave)
...@@ -251,7 +109,7 @@ window["DesktopOfflineAppDocumentEndSave"] = function(isCancel) ...@@ -251,7 +109,7 @@ window["DesktopOfflineAppDocumentEndSave"] = function(isCancel)
{ {
editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save); editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save);
if (isCancel !== true) if (isCancel !== true)
DesktopOfflineUpdateLocalName(this); DesktopOfflineUpdateLocalName(editor);
}; };
asc_docs_api.prototype.AddImageUrl = function(url, imgProp) asc_docs_api.prototype.AddImageUrl = function(url, imgProp)
...@@ -263,9 +121,14 @@ asc_docs_api.prototype.AddImage = function() ...@@ -263,9 +121,14 @@ asc_docs_api.prototype.AddImage = function()
{ {
window["AscDesktopEditor"]["LocalFileGetImageUrlFromOpenFileDialog"](); window["AscDesktopEditor"]["LocalFileGetImageUrlFromOpenFileDialog"]();
}; };
asc_docs_api.prototype.asc_isOffline = function()
{
return true;
};
asc_docs_api.prototype["AddImageUrl"] = asc_docs_api.prototype.AddImageUrl; asc_docs_api.prototype["AddImageUrl"] = asc_docs_api.prototype.AddImageUrl;
asc_docs_api.prototype["AddImage"] = asc_docs_api.prototype.AddImage; asc_docs_api.prototype["AddImage"] = asc_docs_api.prototype.AddImage;
asc_docs_api.prototype["asc_Save"] = asc_docs_api.prototype.asc_Save; asc_docs_api.prototype["asc_Save"] = asc_docs_api.prototype.asc_Save;
asc_docs_api.prototype["asc_isOffline"] = asc_docs_api.prototype.asc_isOffline;
window["DesktopOfflineAppDocumentAddImageEnd"] = function(url) window["DesktopOfflineAppDocumentAddImageEnd"] = function(url)
{ {
...@@ -274,12 +137,3 @@ window["DesktopOfflineAppDocumentAddImageEnd"] = function(url) ...@@ -274,12 +137,3 @@ window["DesktopOfflineAppDocumentAddImageEnd"] = function(url)
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](url); var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](url);
editor.AddImageUrlAction(g_oDocumentUrls.getImageUrl(_url)); editor.AddImageUrlAction(g_oDocumentUrls.getImageUrl(_url));
}; };
window["NativeCorrectImageUrlOnCopy"] = function(url)
{
g_oDocumentUrls.getImageUrl(url);
};
window["NativeCorrectImageUrlOnPaste"] = function(url)
{
return window["AscDesktopEditor"]["LocalFileGetImageUrl"](url);
};
\ No newline at end of file
...@@ -406,6 +406,7 @@ asc_docs_api.prototype['asc_undoAllChanges'] = asc_docs_api.prototype.asc_undoAl ...@@ -406,6 +406,7 @@ asc_docs_api.prototype['asc_undoAllChanges'] = asc_docs_api.prototype.asc_undoAl
asc_docs_api.prototype['sync_ContextMenuCallback'] = asc_docs_api.prototype.sync_ContextMenuCallback; asc_docs_api.prototype['sync_ContextMenuCallback'] = asc_docs_api.prototype.sync_ContextMenuCallback;
asc_docs_api.prototype['asc_addComment'] = asc_docs_api.prototype.asc_addComment; asc_docs_api.prototype['asc_addComment'] = asc_docs_api.prototype.asc_addComment;
asc_docs_api.prototype['asc_SetFastCollaborative'] = asc_docs_api.prototype.asc_SetFastCollaborative; asc_docs_api.prototype['asc_SetFastCollaborative'] = asc_docs_api.prototype.asc_SetFastCollaborative;
asc_docs_api.prototype['asc_isOffline'] = asc_docs_api.prototype.asc_isOffline;
window['OnSave_Callback'] = OnSave_Callback; window['OnSave_Callback'] = OnSave_Callback;
window['asc_CCommentData'] = asc_CCommentData; window['asc_CCommentData'] = asc_CCommentData;
asc_CCommentData.prototype['asc_getText'] = asc_CCommentData.prototype.asc_getText; asc_CCommentData.prototype['asc_getText'] = asc_CCommentData.prototype.asc_getText;
......
"use strict"; "use strict";
/////////////////////////////////////////////////////////
////////////// FONTS ////////////////////////
/////////////////////////////////////////////////////////
CFontFileLoader.prototype.LoadFontAsync = function(basePath, _callback, isEmbed)
{
this.callback = _callback;
if (-1 != this.Status)
return true;
var oThis = this;
this.Status = 2;
if (window["AscDesktopEditor"] !== undefined && !this.CanUseOriginalFormat)
{
this.callback = null;
window["AscDesktopEditor"]["LoadFontBase64"](this.Id);
this._callback_font_load();
return;
}
var xhr = new XMLHttpRequest();
xhr.open('GET', "ascdesktop://fonts/" + this.Id, true);
xhr.responseType = 'arraybuffer';
if (xhr.overrideMimeType)
xhr.overrideMimeType('text/plain; charset=x-user-defined');
else
xhr.setRequestHeader('Accept-Charset', 'x-user-defined');
xhr.onload = function()
{
if (this.status != 200)
{
oThis.Status = 1;
return;
}
oThis.Status = 0;
if (this.response)
{
var __font_data_idx = g_fonts_streams.length;
var _uintData = new Uint8Array(this.response);
g_fonts_streams[__font_data_idx] = new FT_Stream(_uintData, _uintData.length);
oThis.SetStreamIndex(__font_data_idx);
}
else
{
var __font_data_idx = g_fonts_streams.length;
g_fonts_streams[__font_data_idx] = CreateFontData3(this.responseText);
oThis.SetStreamIndex(__font_data_idx);
if (null != oThis.callback)
oThis.callback();
}
};
xhr.send(null);
};
/////////////////////////////////////////////////////////
////////////// IMAGES ////////////////////////
/////////////////////////////////////////////////////////
function DocumentUrls(){
this.urls = {};
this.documentUrl = "";
this.imageCount = 0;
}
DocumentUrls.prototype = {
mediaPrefix: 'media/',
init: function (urls) {
},
getUrls: function () {
return this.urls;
},
addUrls : function(urls){
},
addImageUrl : function(strPath, url){
},
getImageUrl : function(strPath){
return this.documentUrl + "/media/" + strPath;
},
getImageLocal : function(url){
var _first = this.documentUrl + "/media/";
if (0 == url.indexOf(_first))
return url.substring(_first.length);
return null;
},
imagePath2Local : function(imageLocal){
return this.getImageLocal(imageLocal);
},
getUrl : function(strPath){
return this.documentUrl + "/media/" + strPath;
},
getLocal : function(url){
return this.getImageLocal(url);
},
getMaxIndex : function(url){
return this.imageCount;
}
};
g_oDocumentUrls = new DocumentUrls();
function sendImgUrls(api, images, callback)
{
var _data = [];
for (var i = 0; i < images.length; i++)
{
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](images[i]);
_data[i] = { url: images[i], path : g_oDocumentUrls.getImageUrl(_url) };
}
callback(_data);
}
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
////////////// OPEN //////////////////////// ////////////// OPEN ////////////////////////
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
...@@ -192,11 +79,6 @@ CHistory.prototype.Have_Changes = function(IsUserSave) ...@@ -192,11 +79,6 @@ CHistory.prototype.Have_Changes = function(IsUserSave)
} }
}; };
window["CDocsCoApi"].prototype.saveChanges = function(arrayChanges, deleteIndex, excelAdditionalInfo)
{
window["AscDesktopEditor"]["LocalFileSaveChanges"](arrayChanges.join("\",\""), deleteIndex, arrayChanges.length);
this.onUnSaveLock();
};
window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes) window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes)
{ {
editor["asc_nativeApplyChanges"](_changes); editor["asc_nativeApplyChanges"](_changes);
...@@ -206,30 +88,6 @@ window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes) ...@@ -206,30 +88,6 @@ window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes)
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
//////////////// SAVE ////////////////////// //////////////// SAVE //////////////////////
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
function DesktopOfflineUpdateLocalName(_api)
{
var _name = window["AscDesktopEditor"]["LocalFileGetSourcePath"]();
var _ind1 = _name.lastIndexOf("\\");
var _ind2 = _name.lastIndexOf("/");
if (_ind1 == -1)
_ind1 = 1000000;
if (_ind2 == -1)
_ind2 = 1000000;
var _ind = Math.min(_ind1, _ind2);
if (_ind != 1000000)
_name = _name.substring(_ind + 1);
_api.documentTitle = _name;
window["AscDesktopEditor"]["SetDocumentName"](_name);
}
window["CDocsCoApi"].prototype.askSaveChanges = function(callback)
{
callback({"saveLock": false});
};
asc_docs_api.prototype.asc_Save = function (isNoUserSave) asc_docs_api.prototype.asc_Save = function (isNoUserSave)
{ {
if (true !== isNoUserSave) if (true !== isNoUserSave)
...@@ -257,7 +115,7 @@ window["DesktopOfflineAppDocumentEndSave"] = function(isCancel) ...@@ -257,7 +115,7 @@ window["DesktopOfflineAppDocumentEndSave"] = function(isCancel)
{ {
editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save); editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save);
if (isCancel !== true) if (isCancel !== true)
DesktopOfflineUpdateLocalName(this); DesktopOfflineUpdateLocalName(editor);
}; };
asc_docs_api.prototype.AddImageUrl = function(url, imgProp) asc_docs_api.prototype.AddImageUrl = function(url, imgProp)
...@@ -269,9 +127,14 @@ asc_docs_api.prototype.AddImage = function() ...@@ -269,9 +127,14 @@ asc_docs_api.prototype.AddImage = function()
{ {
window["AscDesktopEditor"]["LocalFileGetImageUrlFromOpenFileDialog"](); window["AscDesktopEditor"]["LocalFileGetImageUrlFromOpenFileDialog"]();
}; };
asc_docs_api.prototype.asc_isOffline = function()
{
return true;
};
asc_docs_api.prototype["AddImageUrl"] = asc_docs_api.prototype.AddImageUrl; asc_docs_api.prototype["AddImageUrl"] = asc_docs_api.prototype.AddImageUrl;
asc_docs_api.prototype["AddImage"] = asc_docs_api.prototype.AddImage; asc_docs_api.prototype["AddImage"] = asc_docs_api.prototype.AddImage;
asc_docs_api.prototype["asc_Save"] = asc_docs_api.prototype.asc_Save; asc_docs_api.prototype["asc_Save"] = asc_docs_api.prototype.asc_Save;
asc_docs_api.prototype["asc_isOffline"] = asc_docs_api.prototype.asc_isOffline;
window["DesktopOfflineAppDocumentAddImageEnd"] = function(url) window["DesktopOfflineAppDocumentAddImageEnd"] = function(url)
{ {
...@@ -279,13 +142,4 @@ window["DesktopOfflineAppDocumentAddImageEnd"] = function(url) ...@@ -279,13 +142,4 @@ window["DesktopOfflineAppDocumentAddImageEnd"] = function(url)
return; return;
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](url); var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](url);
editor.AddImageUrlAction(g_oDocumentUrls.getImageUrl(_url)); editor.AddImageUrlAction(g_oDocumentUrls.getImageUrl(_url));
};
window["NativeCorrectImageUrlOnCopy"] = function(url)
{
g_oDocumentUrls.getImageUrl(url);
};
window["NativeCorrectImageUrlOnPaste"] = function(url)
{
return window["AscDesktopEditor"]["LocalFileGetImageUrl"](url);
}; };
\ No newline at end of file
...@@ -535,6 +535,7 @@ asc_docs_api.prototype['asc_undoAllChanges'] = asc_docs_api.prototype.asc_undoAl ...@@ -535,6 +535,7 @@ asc_docs_api.prototype['asc_undoAllChanges'] = asc_docs_api.prototype.asc_undoAl
asc_docs_api.prototype['asc_CloseFile'] = asc_docs_api.prototype.asc_CloseFile; asc_docs_api.prototype['asc_CloseFile'] = asc_docs_api.prototype.asc_CloseFile;
asc_docs_api.prototype['asc_addComment'] = asc_docs_api.prototype.asc_addComment; asc_docs_api.prototype['asc_addComment'] = asc_docs_api.prototype.asc_addComment;
asc_docs_api.prototype['asc_SetFastCollaborative'] = asc_docs_api.prototype.asc_SetFastCollaborative; asc_docs_api.prototype['asc_SetFastCollaborative'] = asc_docs_api.prototype.asc_SetFastCollaborative;
asc_docs_api.prototype['asc_isOffline'] = asc_docs_api.prototype.asc_isOffline;
window['CMathProp'] = CMathProp; window['CMathProp'] = CMathProp;
CMathProp.prototype['get_Type'] = CMathProp.prototype.get_Type; CMathProp.prototype['get_Type'] = CMathProp.prototype.get_Type;
window['CParagraphPropEx'] = CParagraphPropEx; window['CParagraphPropEx'] = CParagraphPropEx;
......
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