Skip to content

Commit

Permalink
Feature/event macros (#3026)
Browse files Browse the repository at this point in the history
* [se] Added description for macros event "onWorsheetChange".

* [se] Added sescription for missed properties in apiBuilder and removed "attachEvent" from this api.
[de] Added description for "attachEvent" in apiBuilder.

* [de] Added description for "detachEvent" in apiBuilder.
  • Loading branch information
AlexeyMatveev686 authored Oct 5, 2022
1 parent 2bba905 commit 9ffe9e0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
4 changes: 4 additions & 0 deletions cell/apiBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
* @property {Array} Sheets - Returns the Sheets collection that represents all the sheets in the active workbook.
* @property {ApiWorksheet} ActiveSheet - Returns an object that represents the active sheet.
* @property {ApiRange} Selection - Returns an object that represents the selected range.
* @event onWorksheetChange - Calls the callback function when the sheet is changed.
*/
var Api = window["Asc"]["spreadsheet_api"];

Expand Down Expand Up @@ -86,6 +87,7 @@
* @property {number} Col - Returns the column number for the selected cell.
* @property {ApiRange} Rows - Returns the ApiRange object that represents the rows of the specified range.
* @property {ApiRange} Cols - Returns the ApiRange object that represents the columns of the specified range.
* @property {ApiRange} Cells - Returns a Range object that represents all the cells in the specified range or a specified cell.
* @property {number} Count - Returns the rows or columns count.
* @property {string} Address - Returns the range address.
* @property {string} Value - Returns a value from the first cell of the specified range or sets it to this cell.
Expand All @@ -103,8 +105,10 @@
* @property {'center' | 'bottom' | 'top' | 'distributed' | 'justify'} AlignVertical - Sets the text vertical alignment to the current cell range.
* @property {'left' | 'right' | 'center' | 'justify'} AlignHorizontal - Sets the text horizontal alignment to the current cell range.
* @property {boolean} Bold - Sets the bold property to the text characters from the current cell or cell range.
* @property {boolean} Italic - Sets the italic property to the text characters in the current cell or cell range.
* @property {'none' | 'single' | 'singleAccounting' | 'double' | 'doubleAccounting'} Underline - Sets the type of underline applied to the font.
* @property {boolean} Strikeout - Sets a value that indicates whether the contents of the current cell or cell range are displayed struck through.
* @property {boolean} WrapText - Returns the information about the wrapping cell style or specifies whether the words in the cell must be wrapped to fit the cell size or not.
* @property {ApiColor|'No Fill'} FillColor - Returns or sets the background color of the current cell range.
* @property {string} NumberFormat - Sets a value that represents the format code for the object.
* @property {ApiRange} MergeArea - Returns the cell or cell range from the merge area.
Expand Down
4 changes: 2 additions & 2 deletions common/apiBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -3998,13 +3998,13 @@
};

// ---------------------------------------------------- internal events ----------------------------------------------
baseEditorsApi.prototype["attachEvent"] = function(name, callback, listenerId)
baseEditorsApi.prototype.attachEvent = function(name, callback, listenerId)
{
if (!this.internalEvents.hasOwnProperty(name))
this.internalEvents[name] = {};
this.internalEvents[name]["" + ((undefined === listenerId) ? 0 : listenerId)] = callback;
};
baseEditorsApi.prototype["detachEvent"] = function(name, listenerId)
baseEditorsApi.prototype.detachEvent = function(name, listenerId)
{
if (!this.internalEvents.hasOwnProperty(name))
return;
Expand Down
17 changes: 16 additions & 1 deletion word/apiBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -4777,7 +4777,22 @@
return false;
};


/**
* Subscribing to an event and calling the callback function when the event was called.
* @memberof Api
* @typeofeditors ["CDE", "CSE", "CPE"]
* @param {string} eventName - The name of the event.
* @param {function} callback - Function to be called when the sheet is changed.
*/
Api.prototype["attachEvent"] = Api.prototype.attachEvent;

/**
* Unsubscribing to an event.
* @memberof Api
* @typeofeditors ["CDE", "CSE", "CPE"]
* @param {string} eventName - The name of the event.
*/
Api.prototype["detachEvent"] = Api.prototype.detachEvent;

//------------------------------------------------------------------------------------------------------------------
//
Expand Down

0 comments on commit 9ffe9e0

Please sign in to comment.