Merge branch release/v9.2.0 into master

This commit is contained in:
papacarlo
2025-12-09 12:29:03 +00:00
6 changed files with 188 additions and 69 deletions

View File

@ -584,7 +584,7 @@ CHistory.prototype.UndoRedoPrepare = function (oRedoObjectParam, bUndo, bKeepTur
else
this.workbook.bRedoChanges = true;
if (!window["NATIVE_EDITOR_ENJINE"]) {
if (!window["NATIVE_EDITOR_ENJINE"] || window["IS_NATIVE_EDITOR"]) {
if(Asc["editor"].wb) {
var wsViews = Asc["editor"].wb.wsViews;
for (var i = 0; i < wsViews.length; ++i) {

View File

@ -16020,6 +16020,15 @@
case 4:
_author.Initials = s.GetString2();
break;
case 5:
let id__ = s.GetString2();
break;
case 6:
let userId__ = s.GetString2();
break;
case 7:
let providerId__ = s.GetString2();
break;
default:
break;
}

View File

@ -773,14 +773,15 @@
* @see office-js-api/Examples/{Editor}/Api/Methods/CreateShape.js
*/
Api.prototype.CreateShape = function(sType, nWidth, nHeight, oFill, oStroke){
var oCurrentSlide = private_GetCurrentSlide();
let curSlide = private_GetCurrentSlide();
let presentation = private_GetPresentation();
sType = sType || "rect";
nWidth = nWidth || 914400;
nHeight = nHeight || 914400;
oFill = oFill || editor.CreateNoFill();
oStroke = oStroke || editor.CreateStroke(0, editor.CreateNoFill());
var oTheme = oCurrentSlide && oCurrentSlide.Layout && oCurrentSlide.Layout.Master && oCurrentSlide.Layout.Master.Theme;
return new ApiShape(AscFormat.builder_CreateShape(sType, nWidth/36000, nHeight/36000, oFill.UniFill, oStroke.Ln, oCurrentSlide, oTheme, private_GetDrawingDocument(), false));
oFill = oFill || Asc.editor.CreateNoFill();
oStroke = oStroke || Asc.editor.CreateStroke(0, Asc.editor.CreateNoFill());
let theme = presentation.Get_Theme();
return new ApiShape(AscFormat.builder_CreateShape(sType, nWidth/36000, nHeight/36000, oFill.UniFill, oStroke.Ln, curSlide, theme, private_GetDrawingDocument(), false));
};
@ -1427,10 +1428,46 @@
{
if (AscFormat.isRealNumber(nCount) && nCount > 0)
{
let curSlide = this.Presentation.CurPage;
nCount = Math.min(nCount, this.GetSlidesCount());
for (var nSlide = 0; nSlide < nCount; nSlide++)
this.Presentation.removeSlide(nStart);
if (!this.Presentation.IsMasterMode())
{
if (this.GetSlidesCount() === 0)
{
curSlide = -1;
}
else
{
if (curSlide < nStart)
{
}
else if (curSlide >= nStart + nCount)
{
curSlide -= nCount;
}
else
{
curSlide = nStart - 1;
}
if (curSlide < 0)
{
curSlide = 0;
}
if (curSlide >= this.GetSlidesCount())
{
curSlide = this.GetSlidesCount() - 1;
}
}
if (curSlide !== this.Presentation.CurPage)
{
this.Presentation.CurPage = curSlide;
this.Presentation.bGoToPage = true;
}
}
return true;
}
}
@ -3560,12 +3597,12 @@
if (!this.Slide)
return false;
let oPresentation = private_GetPresentation();
let presentation = private_GetApi().GetPresentation();
let nPosToDelete = this.GetSlideIndex();
if (nPosToDelete > -1)
{
oPresentation.removeSlide(nPosToDelete);
presentation.RemoveSlides(nPosToDelete, 1);
return true;
}

View File

@ -9486,80 +9486,94 @@
}
/**
* Moves a cursor to the left.
* Moves the cursor to the left.
* @memberof ApiDocument
* @param {number} nCount - The number of characters to move left.
* @param {boolean} isShift - Specifies whether to select text during the move.
* @param {boolean} isCtl - Specifies whether to move by word instead of by character.
* @param {number} [count=1] - Number of movements.
* @param {boolean} [addToSelect=false] - Specifies whether to select text during the move.
* @param {boolean} [byWords=false] - Specifies whether to move by words instead of by character.
* @returns {boolean}
* @typeofeditors ["CDE"]
* @since 9.2.0
* @see office-js-api/Examples/{Editor}/ApiDocument/Methods/MoveCursorLeft.js
*/
ApiDocument.prototype.MoveCursorLeft = function(nCount, isShift, isCtl)
ApiDocument.prototype.MoveCursorLeft = function(count, addToSelect, byWords)
{
for(let i = 0; i < nCount; i++)
count = GetIntParameter(count, 1);
addToSelect = GetBoolParameter(addToSelect, false);
byWords = GetBoolParameter(byWords, false);
for (let i = 0; i < count; ++i)
{
this.Document.MoveCursorLeft(!!isShift, !!isCtl);
this.Document.MoveCursorLeft(addToSelect, byWords);
}
return true;
};
/**
* Moves a cursor to the right.
* Moves the cursor to the right.
* @memberof ApiDocument
* @param {number} nCount - The number of characters to move right.
* @param {boolean} isShift - Specifies whether to select text during the move.
* @param {boolean} isCtl - Specifies whether to move by word instead of by character.
* @param {number} [count=1] - Number of movements.
* @param {boolean} [addToSelect=false] - Specifies whether to select text during the move.
* @param {boolean} [byWords=false] - Specifies whether to move by words instead of by character.
* @returns {boolean}
* @typeofeditors ["CDE"]
* @since 9.2.0
* @see office-js-api/Examples/{Editor}/ApiDocument/Methods/MoveCursorRight.js
*/
ApiDocument.prototype.MoveCursorRight = function(nCount, isShift, isCtl)
ApiDocument.prototype.MoveCursorRight = function(count, addToSelect, byWords)
{
for(let i = 0; i < nCount; i++)
count = GetIntParameter(count, 1);
addToSelect = GetBoolParameter(addToSelect, false);
byWords = GetBoolParameter(byWords, false);
for (let i = 0; i < count; ++i)
{
this.Document.MoveCursorRight(!!isShift, !!isCtl);
this.Document.MoveCursorRight(addToSelect, byWords);
}
return true;
};
/**
* Moves a cursor up.
* Moves the cursor up.
* @memberof ApiDocument
* @param {number} nCount - The number of lines to move up.
* @param {boolean} isShift - Specifies whether to select text during the move.
* @param {boolean} isCtl - Specifies whether to move by paragraph instead of by line.
* @param {number} [count=1] - Number of movements.
* @param {boolean} [addToSelect=false] - Specifies whether to select text during the move.
* @returns {boolean}
* @typeofeditors ["CDE"]
* @since 9.2.0
* @see office-js-api/Examples/{Editor}/ApiDocument/Methods/MoveCursorUp.js
*/
ApiDocument.prototype.MoveCursorUp = function(nCount, isShift, isCtl)
ApiDocument.prototype.MoveCursorUp = function(count, addToSelect)
{
for(let i = 0; i < nCount; i++)
count = GetIntParameter(count, 1);
addToSelect = GetBoolParameter(addToSelect, false);
this.ForceRecalculate(this.Document.GetCurPage());
for (let i = 0; i < count; ++i)
{
this.Document.MoveCursorUp(!!isShift, !!isCtl);
this.Document.MoveCursorUp(addToSelect);
}
return true;
};
/**
* Moves a cursor down.
* Moves the cursor down.
* @memberof ApiDocument
* @param {number} nCount - The number of lines to move down.
* @param {boolean} isShift - Specifies whether to select text during the move.
* @param {boolean} isCtl - Specifies whether to move by paragraph instead of by line.
* @param {number} [count=1] - Number of movements.
* @param {boolean} [addToSelect=false] - Specifies whether to select text during the move.
* @returns {boolean}
* @typeofeditors ["CDE"]
* @since 9.2.0
* @see office-js-api/Examples/{Editor}/ApiDocument/Methods/MoveCursorDown.js
*/
ApiDocument.prototype.MoveCursorDown = function(nCount, isShift, isCtl)
ApiDocument.prototype.MoveCursorDown = function(count, addToSelect)
{
for(let i = 0; i < nCount; i++)
count = GetIntParameter(count, 1);
addToSelect = GetBoolParameter(addToSelect, false);
this.ForceRecalculate(this.Document.GetCurPage() + 1);
for (let i = 0; i < count; ++i)
{
this.Document.MoveCursorDown(!!isShift, !!isCtl);
this.Document.MoveCursorDown(addToSelect);
}
return true;
};
@ -9603,7 +9617,7 @@
/**
* Specifies a unique ID for the current paragraph.
* @memberof ApiParagraph
* @typeofeditors ["CDE", "CSE", "CPE"]
* @typeofeditors ["CDE"]
* @since 9.2.0
* @param {number} paraId - The numerical ID which will be specified for the current paragraph. Value MUST be greater than 0 and less than 0x80000000.
* @returns {boolean}

View File

@ -132,6 +132,21 @@
* @property {string} Value - The element value.
* @see office-js-api/Examples/Plugins/{Editor}/Enumeration/ContentControlListElement.js
*/
/**
* @typedef {Object} TextAnnotation
* @property {string} paragraphId - ID of the paragraph containing the annotation.
* @property {string} rangeId - ID of the annotation range.
* @property {string} [name] - Annotation type (e.g., `"grammar"`).
*/
/**
* @typedef {Object} TextAnnotationRange
* @property {string} id - Unique identifier for the range.
* @property {number} start - Starting index of the text range.
* @property {number} length - Length of the text range.
* @property {string} [name] - Annotation type (e.g., `"grammar"`).
*/
var Api = window["asc_docs_api"];
@ -1304,69 +1319,61 @@
return bookmarks.GetBookmarkByDocPos(docPos);
};
/**
* Annotate the specified paragraph.
* Adds annotations to the specified paragraph.
* @memberof Api
* @typeofeditors ["CDE"]
* @alias AnnotateParagraph
* @param {Object} obj - The response object containing annotation data
* @param {string} obj.type - The type of annotation operation (e.g., "highlightText")
* @param {string} [obj.name] - Optional name of the annotation
* @param {string} obj.paragraphId - ID of the paragraph being annotated (for highlightText type)
* @param {string} obj.recalcId - Recalculation ID for validation (for highlightText type)
* @param {Array<{start: number, length: number, id: string}>} [obj.ranges] - Array of text ranges to highlight (for highlightText type)
* @param {number} obj.ranges[].start - Starting index of the text range
* @param {number} obj.ranges[].length - Length of the text range
* @param {string} obj.ranges[].id - Unique identifier for the range
* @param {Object} data - Annotation data specifying what to annotate.
* @param {string} data.type - The type of annotation operation (e.g., `"highlightText"`).
* @param {string} [data.name] - Optional name of the annotation.
* @param {string} data.paragraphId - ID of the paragraph being annotated.
* @param {string} data.recalcId - Paragraph recalculation ID.
* @param {Array<TextAnnotationRange>} [data.ranges] - Array of text ranges to highlight (for highlightText type)
* @since 9.2.0
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/AnnotateParagraph.js
*/
Api.prototype["pluginMethod_AnnotateParagraph"] = function(obj)
Api.prototype["pluginMethod_AnnotateParagraph"] = function(data)
{
if (!obj)
if (!data)
return;
obj["guid"] = window.g_asc_plugins.getCurrentPluginGuid();
this.getTextAnnotatorEventManager().onResponse(obj);
data["guid"] = window.g_asc_plugins.getCurrentPluginGuid();
this.getTextAnnotatorEventManager().onResponse(data);
};
/**
* Selects a specific annotation range in the document.
* Selects text in a document using a given annotation.
* @memberof Api
* @typeofeditors ["CDE"]
* @alias AnnotateParagraph
* @param {Object} obj - The range selection object
* @param {string} obj.paragraphId - ID of the paragraph containing the annotation
* @param {string} obj.rangeId - ID of the specific range to select
* @param {string} [obj.name] - Optional name/type of the annotation (e.g., "grammar", "spelling", etc.)
* @alias SelectAnnotationRange
* @param {TextAnnotation} annotation - The annotation selection object.
* @since 9.2.0
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/SelectAnnotationRange.js
*/
Api.prototype["pluginMethod_SelectAnnotationRange"] = function(obj)
Api.prototype["pluginMethod_SelectAnnotationRange"] = function(annotation)
{
if (!obj)
if (!annotation)
return;
obj["guid"] = window.g_asc_plugins.getCurrentPluginGuid();
this.getTextAnnotatorEventManager().selectRange(obj);
annotation["guid"] = window.g_asc_plugins.getCurrentPluginGuid();
this.getTextAnnotatorEventManager().selectRange(annotation);
};
/**
* Remove a specific annotation range from the document.
* @memberof Api
* @typeofeditors ["CDE"]
* @alias RemoveAnnotationRange
* @param {Object} obj - The range removing object
* @param {string} obj.paragraphId - ID of the paragraph containing the annotation
* @param {string} obj.rangeId - ID of the specific range to remove
* @param {string} [obj.name] - Optional name/type of the annotation (e.g., "grammar", "spelling", etc.)
* @param {TextAnnotation} annotation - The annotation removing object.
* @param {boolean} [annotation.all=false] - Optional parameter, flag to remove all annotations for the current paragraph.
* @since 9.2.0
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/RemoveAnnotationRange.js
*/
Api.prototype["pluginMethod_RemoveAnnotationRange"] = function(obj)
Api.prototype["pluginMethod_RemoveAnnotationRange"] = function(annotation)
{
if (!obj)
if (!annotation)
return;
obj["guid"] = window.g_asc_plugins.getCurrentPluginGuid();
this.getTextAnnotatorEventManager().removeRange(obj);
annotation["guid"] = window.g_asc_plugins.getCurrentPluginGuid();
this.getTextAnnotatorEventManager().removeRange(annotation);
};
function private_ReadContentControlCommonPr(commonPr)

View File

@ -204,3 +204,55 @@
* @see office-js-api/Examples/Plugins/{Editor}/Plugin/Events/onInsertOleObjects.js
*/
/**
* Event: onBlurAnnotation
* @event Plugin#onBlurAnnotation
* @memberof Plugin
* @typeofeditors ["CDE"]
* @alias onBlurAnnotation
* @since 9.2.0
* @description The function called when an annotation loses focus.
* @param {TextAnnotation} annotation - The annotation that lost focus.
* @see office-js-api/Examples/Plugins/{Editor}/Plugin/Events/onBlurAnnotation.js
*/
/**
* Event: onFocusAnnotation
* @event Plugin#onFocusAnnotation
* @memberof Plugin
* @typeofeditors ["CDE"]
* @alias onFocusAnnotation
* @since 9.2.0
* @description The function called when an annotation receives focus.
* @param {TextAnnotation} annotation - The annotation that received focus.
* @see office-js-api/Examples/Plugins/{Editor}/Plugin/Events/onFocusAnnotation.js
*/
/**
* Event: onClickAnnotation
* @event Plugin#onClickAnnotation
* @memberof Plugin
* @typeofeditors ["CDE"]
* @alias onClickAnnotation
* @since 9.2.0
* @description The function called when the user clicks an annotation.
* @param {TextAnnotation} annotation - The annotation that was clicked.
* @see office-js-api/Examples/Plugins/{Editor}/Plugin/Events/onClickAnnotation.js
*/
/**
* Event: onParagraphText
* @event Plugin#onParagraphText
* @memberof Plugin
* @typeofeditors ["CDE"]
* @alias onParagraphText
* @since 9.2.0
* @description The function called when the paragraph text is updated in the document.
* @param {Object} data - Event data containing information about the updated paragraph.
* @property {string} data.paragraphId - ID of the paragraph whose content was changed.
* @property {string} data.recalcId - ID of the last paragraph recalculation.
* @property {string} data.text - The updated text content of the paragraph.
* @property {TextAnnotationRange[]} data.annotations - Array of updated annotation ranges.
* @see office-js-api/Examples/Plugins/{Editor}/Plugin/Events/onParagraphText.js
*/