Commit da8609e8 authored by Ilya Kirillov's avatar Ilya Kirillov

Search and replace function was added to API for plugins.

parent 348f2ef8
......@@ -286,7 +286,7 @@ CDocument.prototype.Search_Select = function(Id)
this.Document_UpdateSelectionState();
this.Document_UpdateRulersState();
};
CDocument.prototype.Search_Replace = function(NewStr, bAll, Id)
CDocument.prototype.Search_Replace = function(NewStr, bAll, Id, bInterfaceEvent)
{
var bResult = false;
......@@ -340,13 +340,13 @@ CDocument.prototype.Search_Replace = function(NewStr, bAll, Id)
bResult = true;
if ( true === bAll )
editor.sync_ReplaceAllCallback(AllCount, AllCount);
if (true === bAll && false !== bInterfaceEvent)
editor.sync_ReplaceAllCallback(AllCount, AllCount);
}
else
{
if ( true === bAll )
editor.sync_ReplaceAllCallback(0, AllCount);
if (true === bAll && false !== bInterfaceEvent)
editor.sync_ReplaceAllCallback(0, AllCount);
}
this.Document_UpdateInterfaceState();
......
......@@ -8255,6 +8255,26 @@ background-repeat: no-repeat;\
{
return this.asc_GetCurrentContentControl();
};
/**
* Find and replace text.
* @param {Object} oProperties The properties for find and replace.
* @param {string} oProperties.searchString Search string.
* @param {string} oProperties.replaceString Replacement string.
* @param {string} [oProperties.matchCase=true]
*
*/
window["asc_docs_api"].prototype["pluginMethod_SearchAndReplace"] = function(oProperties)
{
var sSearch = oProperties["searchString"];
var sReplace = oProperties["replaceString"];
var isMatchCase = undefined !== oProperties["matchCase"] ? oProperties.matchCase : true;
var oSearchEngine = this.WordControl.m_oLogicDocument.Search(sSearch, {MatchCase : isMatchCase});
if (!oSearchEngine)
return;
this.WordControl.m_oLogicDocument.Search_Replace(sReplace, true, null, false);
};
/********************************************************************/
......
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