Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/release/v7.1.0' into dev…
Browse files Browse the repository at this point in the history
…elop
  • Loading branch information
KirillovIlya committed Apr 10, 2022
2 parents 8840965 + be2ead6 commit 456a36d
Show file tree
Hide file tree
Showing 18 changed files with 360 additions and 122 deletions.
169 changes: 167 additions & 2 deletions cell/native/native.js
Original file line number Diff line number Diff line change
Expand Up @@ -6857,8 +6857,8 @@ function onApiLongActionEnd(type, id) {
function onApiError(id, level, errData) {
var info = {
"level" : level,
"id" : id,
"errData" : JSON.prune(errData, 4),
"id" : id
// "errData" : JSON.prune(errData, 4)
};
postDataAsJSONString(info, 26104); // ASC_MENU_EVENT_TYPE_API_ERROR
}
Expand Down Expand Up @@ -7241,3 +7241,168 @@ window["AscCommon"].getFullImageSrc2 = function (src) {

return src;
}

// // JSON.prune : a function to stringify any object without overflow
// // two additional optional parameters :
// // - the maximal depth (default : 6)
// // - the maximal length of arrays (default : 50)
// // You can also pass an "options" object.
// // examples :
// // var json = JSON.prune(window)
// // var arr = Array.apply(0,Array(1000)); var json = JSON.prune(arr, 4, 20)
// // var json = JSON.prune(window.location, {inheritedProperties:true})
// // Web site : http://dystroy.org/JSON.prune/
// // JSON.prune on github : https://github.com/Canop/JSON.prune
// // This was discussed here : http://stackoverflow.com/q/13861254/263525
// // The code is based on Douglas Crockford's code : https://github.com/douglascrockford/JSON-js/blob/master/json2.js
// // No effort was done to support old browsers. JSON.prune will fail on IE8.
// (function () {
// 'use strict';

// var DEFAULT_MAX_DEPTH = 6;
// var DEFAULT_ARRAY_MAX_LENGTH = 50;
// var DEFAULT_PRUNED_VALUE = '"-pruned-"';
// var seen; // Same variable used for all stringifications
// var iterator; // either forEachEnumerableOwnProperty, forEachEnumerableProperty or forEachProperty

// // iterates on enumerable own properties (default behavior)
// var forEachEnumerableOwnProperty = function(obj, callback) {
// for (var k in obj) {
// if (Object.prototype.hasOwnProperty.call(obj, k)) callback(k);
// }
// };
// // iterates on enumerable properties
// var forEachEnumerableProperty = function(obj, callback) {
// for (var k in obj) callback(k);
// };
// // iterates on properties, even non enumerable and inherited ones
// // This is dangerous
// var forEachProperty = function(obj, callback, excluded) {
// if (obj==null) return;
// excluded = excluded || {};
// Object.getOwnPropertyNames(obj).forEach(function(k){
// if (!excluded[k]) {
// callback(k);
// excluded[k] = true;
// }
// });
// forEachProperty(Object.getPrototypeOf(obj), callback, excluded);
// };

// Object.defineProperty(Date.prototype, "toPrunedJSON", {value:Date.prototype.toJSON});

// var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
// escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
// meta = { // table of character substitutions
// '\b': '\\b',
// '\t': '\\t',
// '\n': '\\n',
// '\f': '\\f',
// '\r': '\\r',
// '"' : '\\"',
// '\\': '\\\\'
// };

// function quote(string) {
// escapable.lastIndex = 0;
// return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
// var c = meta[a];
// return typeof c === 'string'
// ? c
// : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
// }) + '"' : '"' + string + '"';
// }


// var prune = function (value, depthDecr, arrayMaxLength) {
// var prunedString = DEFAULT_PRUNED_VALUE;
// var replacer;
// if (typeof depthDecr == "object") {
// var options = depthDecr;
// depthDecr = options.depthDecr;
// arrayMaxLength = options.arrayMaxLength;
// iterator = options.iterator || forEachEnumerableOwnProperty;
// if (options.allProperties) iterator = forEachProperty;
// else if (options.inheritedProperties) iterator = forEachEnumerableProperty
// if ("prunedString" in options) {
// prunedString = options.prunedString;
// }
// if (options.replacer) {
// replacer = options.replacer;
// }
// } else {
// iterator = forEachEnumerableOwnProperty;
// }
// seen = [];
// depthDecr = depthDecr || DEFAULT_MAX_DEPTH;
// arrayMaxLength = arrayMaxLength || DEFAULT_ARRAY_MAX_LENGTH;
// function str(key, holder, depthDecr) {
// var i, k, v, length, partial, value = holder[key];

// if (value && typeof value === 'object' && typeof value.toPrunedJSON === 'function') {
// value = value.toPrunedJSON(key);
// }
// if (value && typeof value.toJSON === 'function') {
// value = value.toJSON();
// }

// switch (typeof value) {
// case 'string':
// return quote(value);
// case 'number':
// return isFinite(value) ? String(value) : 'null';
// case 'boolean':
// case 'null':
// return String(value);
// case 'object':
// if (!value) {
// return 'null';
// }
// if (depthDecr<=0 || seen.indexOf(value)!==-1) {
// if (replacer) {
// var replacement = replacer(value, prunedString, true);
// return replacement===undefined ? undefined : ''+replacement;
// }
// return prunedString;
// }
// seen.push(value);
// partial = [];
// if (Object.prototype.toString.apply(value) === '[object Array]') {
// length = Math.min(value.length, arrayMaxLength);
// for (i = 0; i < length; i += 1) {
// partial[i] = str(i, value, depthDecr-1) || 'null';
// }
// v = '[' + partial.join(',') + ']';
// if (replacer && value.length>arrayMaxLength) return replacer(value, v, false);
// return v;
// }
// if (value instanceof RegExp) {
// return quote(value.toString());
// }
// iterator(value, function(k) {
// try {
// v = str(k, value, depthDecr-1);
// if (v) partial.push(quote(k) + ':' + v);
// } catch (e) {
// // this try/catch due to forbidden accessors on some objects
// }
// });
// return '{' + partial.join(',') + '}';
// case 'function':
// case 'undefined':
// return replacer ? replacer(value, undefined, false) : undefined;
// }
// }
// return str('', {'': value}, depthDecr);
// };

// prune.log = function() {
// console.log.apply(console, Array.prototype.map.call(arguments, function(v) {
// return JSON.parse(JSON.prune(v));
// }));
// };
// prune.forEachProperty = forEachProperty; // you might want to also assign it to Object.forEachProperty

// if (typeof module !== "undefined") module.exports = prune;
// else JSON.prune = prune;
// }());
19 changes: 15 additions & 4 deletions common/Drawings/CommonController.js
Original file line number Diff line number Diff line change
Expand Up @@ -7945,12 +7945,23 @@ DrawingObjectsController.prototype =
}
}
}
if(oDrawingSelectionState.timingSelection)

if(this.selectedObjects.length > 0)
{
var oTiming = this.drawingObjects.timing;
if(oTiming)
if(this.drawingObjects && this.drawingObjects.timing)
{
this.drawingObjects.timing.onChangeDrawingsSelection();
}
}
else
{
if(oDrawingSelectionState.timingSelection)
{
oTiming.setSelectionState(oDrawingSelectionState.timingSelection);
var oTiming = this.drawingObjects.timing;
if(oTiming)
{
oTiming.setSelectionState(oDrawingSelectionState.timingSelection);
}
}
}
}
Expand Down
Binary file modified common/Images/cursors/grab.cur
Binary file not shown.
Binary file modified common/Images/cursors/grab_2x.cur
Binary file not shown.
Binary file modified common/Images/cursors/grabbing.cur
Binary file not shown.
Binary file modified common/Images/cursors/grabbing_2x.cur
Binary file not shown.
2 changes: 1 addition & 1 deletion common/Native/native.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ function NativeOpenFileData(data, version, xlsx_file_path, options)
{
Api = new window["Asc"]["asc_docs_api"]({});
if (options && options["documentLayout"] && undefined !== options["documentLayout"]["openedAt"])
Api.openedAt = options["documentLayout"]["openedAt"];
Api.setOpenedAt(options["documentLayout"]["openedAt"]);
Api.asc_nativeOpenFile(data, version);
}
else
Expand Down
30 changes: 14 additions & 16 deletions common/apiBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -795,17 +795,7 @@

if (this.isUseNativeViewer)
{
switch (this.documentFormat)
{
case "pdf":
case "xps":
case "oxps":
case "djvu":
rData["convertToOrigin"] = true;
break;
default:
break;
}
rData["convertToOrigin"] = '.pdf.xps.oxps.djvu';
}

if (versionHistory)
Expand Down Expand Up @@ -895,8 +885,9 @@
baseEditorsApi.prototype._onNeedParams = function(data, opt_isPassword)
{
};
baseEditorsApi.prototype.asyncServerIdEndLoaded = function()
baseEditorsApi.prototype.asyncServerIdEndLoaded = function(openedAt)
{
this.setOpenedAt(openedAt);
// С сервером соединились, возможно стоит подождать загрузку шрифтов
this.ServerIdWaitComplete = true;
this._openDocumentEndCallback();
Expand Down Expand Up @@ -1222,9 +1213,9 @@
{
AscCommon.g_oIdCounter.Set_UserId('' + e);
};
this.CoAuthoringApi.onFirstLoadChangesEnd = function()
this.CoAuthoringApi.onFirstLoadChangesEnd = function(openedAt)
{
t.asyncServerIdEndLoaded();
t.asyncServerIdEndLoaded(openedAt);
};
this.CoAuthoringApi.onFirstConnect = function()
{
Expand Down Expand Up @@ -1421,12 +1412,13 @@
switch (input["status"]) {
case "updateversion":
case "ok":
t.openedAt = input["openedAt"];
//call setOpenedAt twice in case of waitAuth
t.setOpenedAt(input["openedAt"]);
var urls = input["data"];
AscCommon.g_oDocumentUrls.init(urls);
var documentUrl = urls['Editor.bin'];
if (t.isUseNativeViewer && !documentUrl)
documentUrl = urls['origin.pdf'] || urls['origin.xps'] || urls['origin.oxps'] || urls['origin.djvu'];
documentUrl = urls['origin.' + t.documentFormat] || urls['origin.pdf'] || urls['origin.xps'] || urls['origin.oxps'] || urls['origin.djvu'];
if (null != documentUrl) {
if ('ok' === input["status"] || t.getViewMode()) {
t._onOpenCommand(documentUrl);
Expand Down Expand Up @@ -3744,6 +3736,11 @@
}
};

baseEditorsApi.prototype.setOpenedAt = function(val)
{
this.openedAt = val;
};

//----------------------------------------------------------export----------------------------------------------------
window['AscCommon'] = window['AscCommon'] || {};
window['AscCommon'].baseEditorsApi = baseEditorsApi;
Expand Down Expand Up @@ -3779,6 +3776,7 @@
prot['asc_wopi_renameFile'] = prot.asc_wopi_renameFile;
prot['asc_setShapeNames'] = prot.asc_setShapeNames;
prot['asc_generateChartPreviews'] = prot.asc_generateChartPreviews;
prot['setOpenedAt'] = prot.setOpenedAt;

prot['asc_isCrypto'] = prot.asc_isCrypto;

Expand Down
10 changes: 5 additions & 5 deletions common/docscoapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@
this._CoAuthoringApi.onWarning = function(e) {
t.callback_OnWarning(e);
};
this._CoAuthoringApi.onFirstLoadChangesEnd = function() {
t.callback_OnFirstLoadChangesEnd();
this._CoAuthoringApi.onFirstLoadChangesEnd = function(openedAt) {
t.callback_OnFirstLoadChangesEnd(openedAt);
};
this._CoAuthoringApi.onConnectionStateChanged = function(e) {
t.callback_OnConnectionStateChanged(e);
Expand Down Expand Up @@ -490,9 +490,9 @@
}
};

CDocsCoApi.prototype.callback_OnFirstLoadChangesEnd = function() {
CDocsCoApi.prototype.callback_OnFirstLoadChangesEnd = function(openedAt) {
if (this.onFirstLoadChangesEnd) {
this.onFirstLoadChangesEnd();
this.onFirstLoadChangesEnd(openedAt);
}
};

Expand Down Expand Up @@ -1584,7 +1584,7 @@
this._updateAuthChanges();
// Посылать нужно всегда, т.к. на это рассчитываем при открытии
if (this.onFirstLoadChangesEnd) {
this.onFirstLoadChangesEnd();
this.onFirstLoadChangesEnd(data['openedAt']);
}

//Apply prebuffered
Expand Down
Binary file modified pdf/src/engine/drawingfile.js.mem
Binary file not shown.
Binary file modified pdf/src/engine/drawingfile.wasm
Binary file not shown.
80 changes: 40 additions & 40 deletions pdf/src/engine/drawingfile_ie.js

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions pdf/src/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@

if (this.isXP)
{
AscCommon.g_oHtmlCursor.register("grab", "grab", "0 0", "pointer");
AscCommon.g_oHtmlCursor.register("grabbing", "grabbing", "0 0", "pointer");
AscCommon.g_oHtmlCursor.register("grab", "grab", "7 8", "pointer");
AscCommon.g_oHtmlCursor.register("grabbing", "grabbing", "6 6", "pointer");
}

var oThis = this;
Expand Down Expand Up @@ -981,7 +981,10 @@
}
else
{
this.sendEvent("onHyperlinkClick", link["link"]);
var url = link["link"];
var typeUrl = AscCommon.getUrlType(url);
url = AscCommon.prepareUrl(url, typeUrl);
this.sendEvent("onHyperlinkClick", url);
}

//console.log(link["link"]);
Expand Down Expand Up @@ -2010,6 +2013,8 @@
if ((pageCoords.y + pageCoords.h) > y)
break;
}
if (pageIndex > this.endVisiblePage)
pageIndex = this.endVisiblePage;

if (!pageCoords)
pageCoords = {x:0, y:0, w:1, h:1};
Expand Down
14 changes: 11 additions & 3 deletions slide/Editor/Format/Presentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -8191,13 +8191,21 @@ CPresentation.prototype.Notes_Draw = function (SlideIndex, graphics) {
CPresentation.prototype.Create_NewHistoryPoint = function (Description) {
this.History.Create_NewPoint(Description);
};

CPresentation.prototype.IsFastMultipleUsers = function() {
return !!(this.Api && this.CollaborativeEditing && true === this.CollaborativeEditing.Is_Fast() && true !== this.CollaborativeEditing.Is_SingleUser());
};
CPresentation.prototype.CanAddChangesToHistory = function() {
return this.History.CanAddChanges();
};
CPresentation.prototype.IsEditingInFastMultipleUsers = function() {
return this.IsFastMultipleUsers() && this.CanAddChangesToHistory();
};
CPresentation.prototype.Document_Undo = function (Options) {

if (true === AscCommon.CollaborativeEditing.Get_GlobalLock())
return;

if (true !== this.History.Can_Undo() && this.Api && this.CollaborativeEditing && true === this.CollaborativeEditing.Is_Fast() && true !== this.CollaborativeEditing.Is_SingleUser()) {
if (true !== this.History.Can_Undo() && this.IsFastMultipleUsers()) {
if (this.CollaborativeEditing.CanUndo() && true === this.Api.canSave) {
this.CollaborativeEditing.Set_GlobalLock(true);
this.Api.forceSaveUndoRequest = true;
Expand Down Expand Up @@ -10854,7 +10862,7 @@ CPresentation.prototype.AddAnimation = function(nPresetClass, nPresetId, nPreset
this.Document_UpdateInterfaceState();
if(bPreview && aAddedEffects.length > 0) {
oSlide.graphicObjects.resetSelection();
oSlide.timing.resetSelection();
this.GetCurTiming().resetSelection();
for(var nEffect = 0; nEffect < aAddedEffects.length; ++nEffect) {
aAddedEffects[nEffect].select();
}
Expand Down
Loading

0 comments on commit 456a36d

Please sign in to comment.