Commit f6eb9f43 authored by Alexander Trofimov's avatar Alexander Trofimov Committed by GitHub

Merge pull request #35 from ONLYOFFICE/release/4.0.1

fix bug 32795
parents 7e8b9f2f 0aa192f7
...@@ -11088,38 +11088,37 @@ ...@@ -11088,38 +11088,37 @@
return this._replaceCellsText( aReplaceCells, options, lockDraw, callback ); return this._replaceCellsText( aReplaceCells, options, lockDraw, callback );
}; };
WorksheetView.prototype._replaceCellsText = function ( aReplaceCells, options, lockDraw, callback ) { WorksheetView.prototype._replaceCellsText = function (aReplaceCells, options, lockDraw, callback) {
var t = this; var t = this;
var findFlags = "g"; // Заменяем все вхождения var findFlags = "g"; // Заменяем все вхождения
if ( true !== options.isMatchCase ) { if (true !== options.isMatchCase) {
findFlags += "i"; findFlags += "i";
} // Не чувствителен к регистру } // Не чувствителен к регистру
var valueForSearching = options.findWhat var valueForSearching = options.findWhat
.replace( /(\\)/g, "\\\\" ).replace( /(\^)/g, "\\^" ) .replace(/(\\)/g, "\\\\").replace(/(\^)/g, "\\^")
.replace( /(\()/g, "\\(" ).replace( /(\))/g, "\\)" ) .replace(/(\()/g, "\\(").replace(/(\))/g, "\\)")
.replace( /(\+)/g, "\\+" ).replace( /(\[)/g, "\\[" ) .replace(/(\+)/g, "\\+").replace(/(\[)/g, "\\[")
.replace( /(\])/g, "\\]" ).replace( /(\{)/g, "\\{" ) .replace(/(\])/g, "\\]").replace(/(\{)/g, "\\{")
.replace( /(\})/g, "\\}" ).replace( /(\$)/g, "\\$" ) .replace(/(\})/g, "\\}").replace(/(\$)/g, "\\$")
.replace( /(~)?\*/g, function ( $0, $1 ) { .replace(/(~)?\*/g, function ($0, $1) {
return $1 ? $0 : '(.*)'; return $1 ? $0 : '(.*)';
} ) })
.replace( /(~)?\?/g, function ( $0, $1 ) { .replace(/(~)?\?/g, function ($0, $1) {
return $1 ? $0 : '.'; return $1 ? $0 : '.';
} ) })
.replace( /(~\*)/g, "\\*" ).replace( /(~\?)/g, "\\?" ); .replace(/(~\*)/g, "\\*").replace(/(~\?)/g, "\\?").replace(/(\.)/g, "\\.");
valueForSearching = new RegExp( valueForSearching, findFlags ); valueForSearching = new RegExp(valueForSearching, findFlags);
options.indexInArray = 0; options.indexInArray = 0;
options.countFind = aReplaceCells.length; options.countFind = aReplaceCells.length;
options.countReplace = 0; options.countReplace = 0;
if ( options.isReplaceAll && false === this.collaborativeEditing.getCollaborativeEditing() ) { if (options.isReplaceAll && false === this.collaborativeEditing.getCollaborativeEditing()) {
this._isLockedCells( aReplaceCells, /*subType*/null, function () { this._isLockedCells(aReplaceCells, /*subType*/null, function () {
t._replaceCellText( aReplaceCells, valueForSearching, options, lockDraw, callback, true ); t._replaceCellText(aReplaceCells, valueForSearching, options, lockDraw, callback, true);
} ); });
} } else {
else { this._replaceCellText(aReplaceCells, valueForSearching, options, lockDraw, callback, false);
this._replaceCellText( aReplaceCells, valueForSearching, options, lockDraw, callback, 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