Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/release/v7.5.0' into dev…
Browse files Browse the repository at this point in the history
…elop
  • Loading branch information
KirillovIlya committed Oct 17, 2023
2 parents 533def6 + 0426658 commit e0bfd7e
Show file tree
Hide file tree
Showing 118 changed files with 5,496 additions and 2,658 deletions.
3 changes: 2 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

## Sdkjs

JavaScript SDK which is a part of [ONLYOFFICE Document Server][2] and [ONLYOFFICE Desktop Editors][4]. Contains API for all the included components client-side interaction.
JavaScript SDK which is a part of [ONLYOFFICE Document Server][2] and [ONLYOFFICE Desktop Editors][4]. Contains API for all the included components client-side interaction and implementation of [Office JavaScript APIs][5].

## Project Information

Expand All @@ -21,6 +21,7 @@ If you have any problems with or questions about [ONLYOFFICE Document Server][2]
[2]: https://github.com/ONLYOFFICE/DocumentServer
[3]: http://stackoverflow.com/questions/tagged/onlyoffice
[4]: https://github.com/ONLYOFFICE/DesktopEditors
[5]: https://github.com/ONLYOFFICE/office-js-api

## License

Expand Down
24 changes: 24 additions & 0 deletions cell/Local/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,30 @@ var c_oAscError = Asc.c_oAscError;
return printOptionsObj;
};

spreadsheet_api.prototype["asc_changeExternalReference"] = function(eR)
{
let wb = this.wb;
if (!wb) {
return;
}
window["AscDesktopEditor"]["OpenFilenameDialog"]("cell", false, function(_file) {
let file = _file;
if (Array.isArray(file))
file = file[0];
if (!file)
return;

//if not saved - put absolute path
let isSavedFile = window["AscDesktopEditor"]["LocalFileGetSaved"]();
let relativePath = isSavedFile && window["AscDesktopEditor"]["LocalFileGetRelativePath"](file);

let obj = {};
obj["path"] = relativePath;
obj["filePath"] = file;
wb.changeExternalReference(eR, obj);
});
};

/////////////////////////////////////////////////////////
////////////// CHANGES /////////////////////
/////////////////////////////////////////////////////////
Expand Down
15 changes: 14 additions & 1 deletion cell/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -8934,6 +8934,18 @@ var editor;
return ws.removeTraceArrows(type);
};

/** Returns array of function info
* @param {number} pos - cursor position
* @param {string} s - cell text
* @returns {asc_CCompleteMenu[]}
*/
spreadsheet_api.prototype.asc_GetEditableFunctions = function(pos, s) {
let wb = this.wb;
if (!wb) {
return;
}
return wb.getEditableFunctions(pos, s);
};
spreadsheet_api.prototype.getSelectionState = function() {
let wb = this.wb;
if (!wb) {
Expand Down Expand Up @@ -9522,6 +9534,8 @@ var editor;
prot["asc_ResetAllPageBreaks"] = prot.asc_ResetAllPageBreaks;
prot["asc_GetPageBreaksDisableType"]= prot.asc_GetPageBreaksDisableType;

prot["asc_GetEditableFunctions"]= prot.asc_GetEditableFunctions;

prot["asc_StartGoalSeek"]= prot.asc_StartGoalSeek;
prot["asc_CloseGoalClose"]= prot.asc_CloseGoalClose;
prot["asc_PauseGoalSeek"]= prot.asc_PauseGoalSeek;
Expand All @@ -9532,5 +9546,4 @@ var editor;




})(window);
2 changes: 2 additions & 0 deletions cell/apiBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,7 @@

/**
* Subscribes to the specified event and calls the callback function when the event fires.
* @function
* @memberof Api
* @typeofeditors ["CSE"]
* @param {string} eventName - The event name.
Expand All @@ -839,6 +840,7 @@

/**
* Unsubscribes from the specified event.
* @function
* @memberof Api
* @typeofeditors ["CSE"]
* @param {string} eventName - The event name.
Expand Down
1 change: 1 addition & 0 deletions cell/api_plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
* @typedef {Object} CommentData
* The comment data.
* @property {string} UserName - The comment author.
* @property {string} QuoteText - The quote comment text.
* @property {string} Text - The comment text.
* @property {string} Time - The time when the comment was posted (in milliseconds).
* @property {boolean} Solved - Specifies if the comment is resolved (**true**) or not (**false**).
Expand Down
30 changes: 21 additions & 9 deletions cell/model/FormulaObjects/lookupandreferenceFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1424,12 +1424,12 @@ function (window, undefined) {
cINDIRECT.prototype.ca = true;
cINDIRECT.prototype.argumentsType = [argType.text, argType.logical];
cINDIRECT.prototype.Calculate = function (arg) {
var t = this, arg0 = arg[0].tocString(), arg1 = arg[1] ? arg[1] : new cBool(true), ws = arguments[3],
let t = this, arg0 = arg[0].tocString(), arg1 = arg[1] ? arg[1] : new cBool(true), ws = arguments[3],
wb = ws.workbook, o = {
Formula: "", pCurrPos: 0
}, ref, found_operand, ret;

var _getWorksheetByName = function(name){
const _getWorksheetByName = function(name) {
if(!name) {
return null;
}
Expand All @@ -1441,10 +1441,10 @@ function (window, undefined) {
};

function parseReference() {
let _tableTMP;
if ((ref = parserHelp.is3DRef.call(o, o.Formula, o.pCurrPos, true))[0]) {
var _tableTMP;
var wsFrom = _getWorksheetByName(ref[1]);
var wsTo = (null !== ref[2]) ? _getWorksheetByName(ref[2]) : wsFrom;
let wsFrom = _getWorksheetByName(ref[1]);
let wsTo = (null !== ref[2]) ? _getWorksheetByName(ref[2]) : wsFrom;
if (!(wsFrom && wsTo)) {
return new cError(cErrorType.bad_reference);
}
Expand Down Expand Up @@ -3445,7 +3445,11 @@ function (window, undefined) {

let a2Value;
if (cElementType.array === arg2.type || cElementType.cellsRange === arg2.type || cElementType.cellsRange3D === arg2.type) {
a2Value = arg2.getFirstElement().tocNumber();
a2Value = arg2.getFirstElement();
if (!a2Value) {
a2Value = new cEmpty();
}
a2Value = a2Value.tocNumber();
} else if (cElementType.error === arg2.type) {
return arg2;
} else {
Expand All @@ -3466,7 +3470,11 @@ function (window, undefined) {

let a3Value;
if (cElementType.array === arg3.type || cElementType.cellsRange === arg3.type || cElementType.cellsRange3D === arg3.type) {
a3Value = arg3.getFirstElement().tocNumber();
a3Value = arg3.getFirstElement();
if (!a3Value) {
a3Value = new cEmpty();
}
a3Value = a3Value.tocNumber();
} else if (cElementType.error === arg3.type) {
return arg3;
} else {
Expand Down Expand Up @@ -4404,7 +4412,7 @@ function (window, undefined) {
};

function wrapRowsCols(arg, argument1, toCol) {
var argError = cBaseFunction.prototype._checkErrorArg.call(this, arg);
let argError = cBaseFunction.prototype._checkErrorArg.call(this, arg);
if (argError) {
return argError;
}
Expand All @@ -4413,7 +4421,7 @@ function (window, undefined) {
if (arg1.type === cElementType.empty) {
return new cError(cErrorType.wrong_value_type);
}
var arg0Dimensions = arg1.getDimensions();
let arg0Dimensions = arg1.getDimensions();
if (arg0Dimensions.col > 1 && arg0Dimensions.row > 1) {
return new cError(cErrorType.wrong_value_type);
}
Expand All @@ -4426,6 +4434,10 @@ function (window, undefined) {
} else if (arg2.type === cElementType.empty) {
return new cError(cErrorType.not_numeric);
}
if (!arg2) {
arg2 = new cEmpty();
}

arg2 = arg2.tocNumber();
if (arg2.type === cElementType.error) {
return arg2;
Expand Down
12 changes: 10 additions & 2 deletions cell/model/FormulaObjects/parserFormula.js
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,11 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
return v;
};
cArea.prototype.tocString = function () {
return this.getValue()[0].tocString();
let val = this.getValue()[0];
if (!val) {
return new cString("");
}
return val.tocString();
};
cArea.prototype.tocBool = function () {
return new cError(cErrorType.wrong_value_type);
Expand Down Expand Up @@ -1479,7 +1483,11 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
return this.getValue()[0].tocNumber();
};
cArea3D.prototype.tocString = function () {
return this.getValue()[0].tocString();
let val = this.getValue()[0];
if (!val) {
return new cString("");
}
return val.tocString();
};
cArea3D.prototype.tocBool = function () {
return new cError(cErrorType.wrong_value_type);
Expand Down
8 changes: 6 additions & 2 deletions cell/model/FormulaObjects/textanddataFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,17 @@ function (window, undefined) {
let instance_num = newArgs[2] && !(newArgs[2].type === cElementType.empty) ? newArgs[2] : new cNumber(1);
let match_mode = newArgs[3] && !(newArgs[3].type === cElementType.empty) ? newArgs[3] : new cBool(false);
let match_end = newArgs[4] && !(newArgs[4].type === cElementType.empty) ? newArgs[4] : new cBool(false);

match_mode = match_mode.tocBool();
match_end = match_end.tocBool();

if (instance_num.type === cElementType.error) {
return instance_num;
}
if (match_mode.type === match_mode.error) {
if (match_mode.type === cElementType.error) {
return match_mode;
}
if (match_end.type === match_end.error) {
if (match_end.type === cElementType.error) {
return match_end;
}

Expand Down
Loading

0 comments on commit e0bfd7e

Please sign in to comment.