@univerjs/docs-find-replace 1.0.0-alpha.8 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +9 -18
- package/lib/es/index.js +9 -18
- package/lib/index.js +9 -18
- package/lib/umd/index.js +1 -1
- package/package.json +8 -8
package/lib/cjs/index.js
CHANGED
|
@@ -9,7 +9,7 @@ let rxjs = require("rxjs");
|
|
|
9
9
|
|
|
10
10
|
//#region package.json
|
|
11
11
|
var name = "@univerjs/docs-find-replace";
|
|
12
|
-
var version = "1.0.0-
|
|
12
|
+
var version = "1.0.0-beta.1";
|
|
13
13
|
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/config/config.ts
|
|
@@ -46,15 +46,14 @@ function findDocRanges(body, query, disabled, resolved = {
|
|
|
46
46
|
const expression = _univerjs_core.regexp.createLiteralRegExp(query.findString, query.caseSensitive ? "gu" : "giu");
|
|
47
47
|
const wordRanges = query.matchesTheWholeWord ? new Set(Array.from(new Intl.Segmenter(void 0, { granularity: "word" }).segment(resolved.text)).filter((item) => item.isWordLike).map((item) => `${item.index}:${item.index + item.segment.length}`)) : null;
|
|
48
48
|
return Array.from(resolved.text.matchAll(expression)).filter((match) => {
|
|
49
|
-
|
|
50
|
-
return (_wordRanges$has = wordRanges === null || wordRanges === void 0 ? void 0 : wordRanges.has(`${match.index}:${match.index + match[0].length}`)) !== null && _wordRanges$has !== void 0 ? _wordRanges$has : true;
|
|
49
|
+
return (wordRanges === null || wordRanges === void 0 ? void 0 : wordRanges.has(`${match.index}:${match.index + match[0].length}`)) ?? true;
|
|
51
50
|
}).flatMap((match) => {
|
|
52
|
-
var _body$customRanges
|
|
51
|
+
var _body$customRanges;
|
|
53
52
|
const characters = resolved.characters.slice(match.index, match.index + match[0].length);
|
|
54
53
|
if (!characters.length) return [];
|
|
55
54
|
const startOffset = Math.min(...characters.map((character) => character.startOffset));
|
|
56
55
|
const endOffset = Math.max(...characters.map((character) => character.endOffset));
|
|
57
|
-
const overlapsWholeEntity = (
|
|
56
|
+
const overlapsWholeEntity = ((_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.some((range) => range.wholeEntity && range.startIndex < endOffset && range.endIndex + 1 > startOffset)) ?? false;
|
|
58
57
|
return [{
|
|
59
58
|
startOffset,
|
|
60
59
|
endOffset,
|
|
@@ -235,8 +234,7 @@ let DocsFindModel = class DocsFindModel extends _univerjs_find_replace.FindModel
|
|
|
235
234
|
this.disposeWithMe((0, _univerjs_core.toDisposable)(this._skeletonManager.currentSkeleton$.subscribe(() => this._refreshHighlights())));
|
|
236
235
|
}
|
|
237
236
|
get currentMatch() {
|
|
238
|
-
|
|
239
|
-
return this._position < 0 ? null : (_this$_matches$this$_ = this._matches[this._position]) !== null && _this$_matches$this$_ !== void 0 ? _this$_matches$this$_ : null;
|
|
237
|
+
return this._position < 0 ? null : this._matches[this._position] ?? null;
|
|
240
238
|
}
|
|
241
239
|
dispose() {
|
|
242
240
|
super.dispose();
|
|
@@ -261,10 +259,7 @@ let DocsFindModel = class DocsFindModel extends _univerjs_find_replace.FindModel
|
|
|
261
259
|
else {
|
|
262
260
|
const selection = this._selectionManager.getActiveTextRange();
|
|
263
261
|
const selectedMatch = (params === null || params === void 0 ? void 0 : params.stayIfOnMatch) ? this._selectionMatchIndex() : -1;
|
|
264
|
-
index = selectedMatch >= 0 ? selectedMatch : this._matches.findIndex((match) =>
|
|
265
|
-
var _selection$endOffset;
|
|
266
|
-
return match.range.startOffset >= ((_selection$endOffset = selection === null || selection === void 0 ? void 0 : selection.endOffset) !== null && _selection$endOffset !== void 0 ? _selection$endOffset : 0);
|
|
267
|
-
});
|
|
262
|
+
index = selectedMatch >= 0 ? selectedMatch : this._matches.findIndex((match) => match.range.startOffset >= ((selection === null || selection === void 0 ? void 0 : selection.endOffset) ?? 0));
|
|
268
263
|
}
|
|
269
264
|
if (index < 0 || index >= this._matches.length) index = (params === null || params === void 0 ? void 0 : params.loop) ? 0 : -1;
|
|
270
265
|
if (index < 0) {
|
|
@@ -283,10 +278,7 @@ let DocsFindModel = class DocsFindModel extends _univerjs_find_replace.FindModel
|
|
|
283
278
|
else {
|
|
284
279
|
const selection = this._selectionManager.getActiveTextRange();
|
|
285
280
|
const selectedMatch = (params === null || params === void 0 ? void 0 : params.stayIfOnMatch) ? this._selectionMatchIndex() : -1;
|
|
286
|
-
index = selectedMatch >= 0 ? selectedMatch : this._matches.findLastIndex((match) =>
|
|
287
|
-
var _selection$startOffse;
|
|
288
|
-
return match.range.endOffset <= ((_selection$startOffse = selection === null || selection === void 0 ? void 0 : selection.startOffset) !== null && _selection$startOffse !== void 0 ? _selection$startOffse : 0);
|
|
289
|
-
});
|
|
281
|
+
index = selectedMatch >= 0 ? selectedMatch : this._matches.findLastIndex((match) => match.range.endOffset <= ((selection === null || selection === void 0 ? void 0 : selection.startOffset) ?? 0));
|
|
290
282
|
}
|
|
291
283
|
if (index < 0) index = (params === null || params === void 0 ? void 0 : params.loop) ? this._matches.length - 1 : -1;
|
|
292
284
|
if (index < 0) {
|
|
@@ -308,16 +300,15 @@ let DocsFindModel = class DocsFindModel extends _univerjs_find_replace.FindModel
|
|
|
308
300
|
return (result === null || result === void 0 ? void 0 : result.success) === 1;
|
|
309
301
|
}
|
|
310
302
|
async replaceAll(replaceString) {
|
|
311
|
-
var _await$this$_commandS;
|
|
312
303
|
if (!this._query) return {
|
|
313
304
|
success: 0,
|
|
314
305
|
failure: 0
|
|
315
306
|
};
|
|
316
|
-
return
|
|
307
|
+
return await this._commandService.executeCommand(DocsReplaceCommand.id, {
|
|
317
308
|
unitId: this.unitId,
|
|
318
309
|
query: this._query,
|
|
319
310
|
replaceString
|
|
320
|
-
})
|
|
311
|
+
}) ?? {
|
|
321
312
|
success: 0,
|
|
322
313
|
failure: this._matches.length
|
|
323
314
|
};
|
package/lib/es/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Subject, debounceTime, filter, map, merge as merge$1 } from "rxjs";
|
|
|
8
8
|
|
|
9
9
|
//#region package.json
|
|
10
10
|
var name = "@univerjs/docs-find-replace";
|
|
11
|
-
var version = "1.0.0-
|
|
11
|
+
var version = "1.0.0-beta.1";
|
|
12
12
|
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/config/config.ts
|
|
@@ -45,15 +45,14 @@ function findDocRanges(body, query, disabled, resolved = {
|
|
|
45
45
|
const expression = regexp.createLiteralRegExp(query.findString, query.caseSensitive ? "gu" : "giu");
|
|
46
46
|
const wordRanges = query.matchesTheWholeWord ? new Set(Array.from(new Intl.Segmenter(void 0, { granularity: "word" }).segment(resolved.text)).filter((item) => item.isWordLike).map((item) => `${item.index}:${item.index + item.segment.length}`)) : null;
|
|
47
47
|
return Array.from(resolved.text.matchAll(expression)).filter((match) => {
|
|
48
|
-
|
|
49
|
-
return (_wordRanges$has = wordRanges === null || wordRanges === void 0 ? void 0 : wordRanges.has(`${match.index}:${match.index + match[0].length}`)) !== null && _wordRanges$has !== void 0 ? _wordRanges$has : true;
|
|
48
|
+
return (wordRanges === null || wordRanges === void 0 ? void 0 : wordRanges.has(`${match.index}:${match.index + match[0].length}`)) ?? true;
|
|
50
49
|
}).flatMap((match) => {
|
|
51
|
-
var _body$customRanges
|
|
50
|
+
var _body$customRanges;
|
|
52
51
|
const characters = resolved.characters.slice(match.index, match.index + match[0].length);
|
|
53
52
|
if (!characters.length) return [];
|
|
54
53
|
const startOffset = Math.min(...characters.map((character) => character.startOffset));
|
|
55
54
|
const endOffset = Math.max(...characters.map((character) => character.endOffset));
|
|
56
|
-
const overlapsWholeEntity = (
|
|
55
|
+
const overlapsWholeEntity = ((_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.some((range) => range.wholeEntity && range.startIndex < endOffset && range.endIndex + 1 > startOffset)) ?? false;
|
|
57
56
|
return [{
|
|
58
57
|
startOffset,
|
|
59
58
|
endOffset,
|
|
@@ -234,8 +233,7 @@ let DocsFindModel = class DocsFindModel extends FindModel {
|
|
|
234
233
|
this.disposeWithMe(toDisposable(this._skeletonManager.currentSkeleton$.subscribe(() => this._refreshHighlights())));
|
|
235
234
|
}
|
|
236
235
|
get currentMatch() {
|
|
237
|
-
|
|
238
|
-
return this._position < 0 ? null : (_this$_matches$this$_ = this._matches[this._position]) !== null && _this$_matches$this$_ !== void 0 ? _this$_matches$this$_ : null;
|
|
236
|
+
return this._position < 0 ? null : this._matches[this._position] ?? null;
|
|
239
237
|
}
|
|
240
238
|
dispose() {
|
|
241
239
|
super.dispose();
|
|
@@ -260,10 +258,7 @@ let DocsFindModel = class DocsFindModel extends FindModel {
|
|
|
260
258
|
else {
|
|
261
259
|
const selection = this._selectionManager.getActiveTextRange();
|
|
262
260
|
const selectedMatch = (params === null || params === void 0 ? void 0 : params.stayIfOnMatch) ? this._selectionMatchIndex() : -1;
|
|
263
|
-
index = selectedMatch >= 0 ? selectedMatch : this._matches.findIndex((match) =>
|
|
264
|
-
var _selection$endOffset;
|
|
265
|
-
return match.range.startOffset >= ((_selection$endOffset = selection === null || selection === void 0 ? void 0 : selection.endOffset) !== null && _selection$endOffset !== void 0 ? _selection$endOffset : 0);
|
|
266
|
-
});
|
|
261
|
+
index = selectedMatch >= 0 ? selectedMatch : this._matches.findIndex((match) => match.range.startOffset >= ((selection === null || selection === void 0 ? void 0 : selection.endOffset) ?? 0));
|
|
267
262
|
}
|
|
268
263
|
if (index < 0 || index >= this._matches.length) index = (params === null || params === void 0 ? void 0 : params.loop) ? 0 : -1;
|
|
269
264
|
if (index < 0) {
|
|
@@ -282,10 +277,7 @@ let DocsFindModel = class DocsFindModel extends FindModel {
|
|
|
282
277
|
else {
|
|
283
278
|
const selection = this._selectionManager.getActiveTextRange();
|
|
284
279
|
const selectedMatch = (params === null || params === void 0 ? void 0 : params.stayIfOnMatch) ? this._selectionMatchIndex() : -1;
|
|
285
|
-
index = selectedMatch >= 0 ? selectedMatch : this._matches.findLastIndex((match) =>
|
|
286
|
-
var _selection$startOffse;
|
|
287
|
-
return match.range.endOffset <= ((_selection$startOffse = selection === null || selection === void 0 ? void 0 : selection.startOffset) !== null && _selection$startOffse !== void 0 ? _selection$startOffse : 0);
|
|
288
|
-
});
|
|
280
|
+
index = selectedMatch >= 0 ? selectedMatch : this._matches.findLastIndex((match) => match.range.endOffset <= ((selection === null || selection === void 0 ? void 0 : selection.startOffset) ?? 0));
|
|
289
281
|
}
|
|
290
282
|
if (index < 0) index = (params === null || params === void 0 ? void 0 : params.loop) ? this._matches.length - 1 : -1;
|
|
291
283
|
if (index < 0) {
|
|
@@ -307,16 +299,15 @@ let DocsFindModel = class DocsFindModel extends FindModel {
|
|
|
307
299
|
return (result === null || result === void 0 ? void 0 : result.success) === 1;
|
|
308
300
|
}
|
|
309
301
|
async replaceAll(replaceString) {
|
|
310
|
-
var _await$this$_commandS;
|
|
311
302
|
if (!this._query) return {
|
|
312
303
|
success: 0,
|
|
313
304
|
failure: 0
|
|
314
305
|
};
|
|
315
|
-
return
|
|
306
|
+
return await this._commandService.executeCommand(DocsReplaceCommand.id, {
|
|
316
307
|
unitId: this.unitId,
|
|
317
308
|
query: this._query,
|
|
318
309
|
replaceString
|
|
319
|
-
})
|
|
310
|
+
}) ?? {
|
|
320
311
|
success: 0,
|
|
321
312
|
failure: this._matches.length
|
|
322
313
|
};
|
package/lib/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Subject, debounceTime, filter, map, merge as merge$1 } from "rxjs";
|
|
|
8
8
|
|
|
9
9
|
//#region package.json
|
|
10
10
|
var name = "@univerjs/docs-find-replace";
|
|
11
|
-
var version = "1.0.0-
|
|
11
|
+
var version = "1.0.0-beta.1";
|
|
12
12
|
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/config/config.ts
|
|
@@ -45,15 +45,14 @@ function findDocRanges(body, query, disabled, resolved = {
|
|
|
45
45
|
const expression = regexp.createLiteralRegExp(query.findString, query.caseSensitive ? "gu" : "giu");
|
|
46
46
|
const wordRanges = query.matchesTheWholeWord ? new Set(Array.from(new Intl.Segmenter(void 0, { granularity: "word" }).segment(resolved.text)).filter((item) => item.isWordLike).map((item) => `${item.index}:${item.index + item.segment.length}`)) : null;
|
|
47
47
|
return Array.from(resolved.text.matchAll(expression)).filter((match) => {
|
|
48
|
-
|
|
49
|
-
return (_wordRanges$has = wordRanges === null || wordRanges === void 0 ? void 0 : wordRanges.has(`${match.index}:${match.index + match[0].length}`)) !== null && _wordRanges$has !== void 0 ? _wordRanges$has : true;
|
|
48
|
+
return (wordRanges === null || wordRanges === void 0 ? void 0 : wordRanges.has(`${match.index}:${match.index + match[0].length}`)) ?? true;
|
|
50
49
|
}).flatMap((match) => {
|
|
51
|
-
var _body$customRanges
|
|
50
|
+
var _body$customRanges;
|
|
52
51
|
const characters = resolved.characters.slice(match.index, match.index + match[0].length);
|
|
53
52
|
if (!characters.length) return [];
|
|
54
53
|
const startOffset = Math.min(...characters.map((character) => character.startOffset));
|
|
55
54
|
const endOffset = Math.max(...characters.map((character) => character.endOffset));
|
|
56
|
-
const overlapsWholeEntity = (
|
|
55
|
+
const overlapsWholeEntity = ((_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.some((range) => range.wholeEntity && range.startIndex < endOffset && range.endIndex + 1 > startOffset)) ?? false;
|
|
57
56
|
return [{
|
|
58
57
|
startOffset,
|
|
59
58
|
endOffset,
|
|
@@ -234,8 +233,7 @@ let DocsFindModel = class DocsFindModel extends FindModel {
|
|
|
234
233
|
this.disposeWithMe(toDisposable(this._skeletonManager.currentSkeleton$.subscribe(() => this._refreshHighlights())));
|
|
235
234
|
}
|
|
236
235
|
get currentMatch() {
|
|
237
|
-
|
|
238
|
-
return this._position < 0 ? null : (_this$_matches$this$_ = this._matches[this._position]) !== null && _this$_matches$this$_ !== void 0 ? _this$_matches$this$_ : null;
|
|
236
|
+
return this._position < 0 ? null : this._matches[this._position] ?? null;
|
|
239
237
|
}
|
|
240
238
|
dispose() {
|
|
241
239
|
super.dispose();
|
|
@@ -260,10 +258,7 @@ let DocsFindModel = class DocsFindModel extends FindModel {
|
|
|
260
258
|
else {
|
|
261
259
|
const selection = this._selectionManager.getActiveTextRange();
|
|
262
260
|
const selectedMatch = (params === null || params === void 0 ? void 0 : params.stayIfOnMatch) ? this._selectionMatchIndex() : -1;
|
|
263
|
-
index = selectedMatch >= 0 ? selectedMatch : this._matches.findIndex((match) =>
|
|
264
|
-
var _selection$endOffset;
|
|
265
|
-
return match.range.startOffset >= ((_selection$endOffset = selection === null || selection === void 0 ? void 0 : selection.endOffset) !== null && _selection$endOffset !== void 0 ? _selection$endOffset : 0);
|
|
266
|
-
});
|
|
261
|
+
index = selectedMatch >= 0 ? selectedMatch : this._matches.findIndex((match) => match.range.startOffset >= ((selection === null || selection === void 0 ? void 0 : selection.endOffset) ?? 0));
|
|
267
262
|
}
|
|
268
263
|
if (index < 0 || index >= this._matches.length) index = (params === null || params === void 0 ? void 0 : params.loop) ? 0 : -1;
|
|
269
264
|
if (index < 0) {
|
|
@@ -282,10 +277,7 @@ let DocsFindModel = class DocsFindModel extends FindModel {
|
|
|
282
277
|
else {
|
|
283
278
|
const selection = this._selectionManager.getActiveTextRange();
|
|
284
279
|
const selectedMatch = (params === null || params === void 0 ? void 0 : params.stayIfOnMatch) ? this._selectionMatchIndex() : -1;
|
|
285
|
-
index = selectedMatch >= 0 ? selectedMatch : this._matches.findLastIndex((match) =>
|
|
286
|
-
var _selection$startOffse;
|
|
287
|
-
return match.range.endOffset <= ((_selection$startOffse = selection === null || selection === void 0 ? void 0 : selection.startOffset) !== null && _selection$startOffse !== void 0 ? _selection$startOffse : 0);
|
|
288
|
-
});
|
|
280
|
+
index = selectedMatch >= 0 ? selectedMatch : this._matches.findLastIndex((match) => match.range.endOffset <= ((selection === null || selection === void 0 ? void 0 : selection.startOffset) ?? 0));
|
|
289
281
|
}
|
|
290
282
|
if (index < 0) index = (params === null || params === void 0 ? void 0 : params.loop) ? this._matches.length - 1 : -1;
|
|
291
283
|
if (index < 0) {
|
|
@@ -307,16 +299,15 @@ let DocsFindModel = class DocsFindModel extends FindModel {
|
|
|
307
299
|
return (result === null || result === void 0 ? void 0 : result.success) === 1;
|
|
308
300
|
}
|
|
309
301
|
async replaceAll(replaceString) {
|
|
310
|
-
var _await$this$_commandS;
|
|
311
302
|
if (!this._query) return {
|
|
312
303
|
success: 0,
|
|
313
304
|
failure: 0
|
|
314
305
|
};
|
|
315
|
-
return
|
|
306
|
+
return await this._commandService.executeCommand(DocsReplaceCommand.id, {
|
|
316
307
|
unitId: this.unitId,
|
|
317
308
|
query: this._query,
|
|
318
309
|
replaceString
|
|
319
|
-
})
|
|
310
|
+
}) ?? {
|
|
320
311
|
success: 0,
|
|
321
312
|
failure: this._matches.length
|
|
322
313
|
};
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("@univerjs/engine-render"),require("@univerjs/find-replace"),require("@univerjs/ui"),require("rxjs")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/docs`,`@univerjs/docs-ui`,`@univerjs/engine-render`,`@univerjs/find-replace`,`@univerjs/ui`,`rxjs`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverDocsFindReplace={},e.UniverCore,e.UniverDocs,e.UniverDocsUi,e.UniverEngineRender,e.UniverFindReplace,e.UniverUi,e.rxjs))})(this,function(e,t,n,r,i,a,o,s){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var c=`@univerjs/docs-find-replace`,l=`1.0.0-alpha.8`;let u={};function d(e,n,r,i={text:e.dataStream,characters:Array.from({length:e.dataStream.length},(e,t)=>({startOffset:t,endOffset:t+1,replaceable:!0}))}){if(!n.findString)return[];let a=t.regexp.createLiteralRegExp(n.findString,n.caseSensitive?`gu`:`giu`),o=n.matchesTheWholeWord?new Set(Array.from(new Intl.Segmenter(void 0,{granularity:`word`}).segment(i.text)).filter(e=>e.isWordLike).map(e=>`${e.index}:${e.index+e.segment.length}`)):null;return Array.from(i.text.matchAll(a)).filter(e=>{var t;return(t=o==null?void 0:o.has(`${e.index}:${e.index+e[0].length}`))==null||t}).flatMap(t=>{var n,a;let o=i.characters.slice(t.index,t.index+t[0].length);if(!o.length)return[];let s=Math.min(...o.map(e=>e.startOffset)),c=Math.max(...o.map(e=>e.endOffset)),l=(n=(a=e.customRanges)==null?void 0:a.some(e=>e.wholeEntity&&e.startIndex<c&&e.endIndex+1>s))!=null&&n;return[{startOffset:s,endOffset:c,replaceable:!r&&!l&&o.every(e=>e.replaceable)}]})}let f={id:`docs.command.replace`,type:t.CommandType.COMMAND,handler:(e,r)=>{if(!r)return{success:0,failure:0};let i=e.get(t.IUniverInstanceService),a=e.get(t.ICommandService),o=i.getUnit(r.unitId,t.UniverInstanceType.UNIVER_DOC),s=o==null?void 0:o.getBody();if(!o||!s)return{success:0,failure:+!!r.range};let c=d(s,r.query,!!o.getSnapshot().disabled),l=r.range?c.filter(e=>e.startOffset===r.range.startOffset&&e.endOffset===r.range.endOffset):c,u=l.filter(e=>e.replaceable),f=(r.range&&l.length===0?1:l.length)-u.length;if(!u.length)return{success:0,failure:f};let p=new t.TextX,m=new t.MemoryCursor;for(let e of u){var h,g;let n=o.sliceBody(e.startOffset,e.endOffset),i=r.replaceString?{dataStream:r.replaceString,textRuns:n!=null&&(h=n.textRuns)!=null&&h.length?[{...n.textRuns[0],st:0,ed:r.replaceString.length}]:void 0,customRanges:n!=null&&(g=n.customRanges)!=null&&g.length?[{...n.customRanges[0],startIndex:0,endIndex:r.replaceString.length-1}]:void 0}:null;p.push(...t.BuildTextUtils.selection.delete([{startOffset:e.startOffset,endOffset:e.endOffset,collapsed:!1}],s,m.cursor,i,!1)),m.moveCursorTo(e.endOffset)}let _=t.JSONX.getInstance().editOp(p.serialize(),(0,t.getRichTextEditPath)(o));return a.syncExecuteCommand(n.RichTextEditingMutation.id,{unitId:r.unitId,actions:_,textRanges:[]})?{success:u.length,failure:f}:{success:0,failure:f+u.length}}};function p(e){let n=e.get(t.IContextService);return{id:a.OpenFindDialogOperation.id,icon:`SearchIcon`,tooltip:`find-replace.toolbar`,type:o.MenuItemType.BUTTON,disabled$:n.subscribeContextValue$(t.FOCUSING_DOC).pipe((0,s.map)(e=>!e))}}let m={[o.RibbonStartGroup.OTHERS]:{[a.OpenFindDialogOperation.id]:{order:3,menuItemFactory:p}}};function h(e){"@babel/helpers - typeof";return h=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},h(e)}function g(e,t){if(h(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(h(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function _(e){var t=g(e,`string`);return h(t)==`symbol`?t:t+``}function v(e,t,n){return(t=_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e,t){return function(n,r){t(n,r,e)}}function b(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let x=class extends a.FindModel{constructor(e,r,i,a,o,c,l){super(),this._doc=e,this._skeletonManager=r,this._selectionManager=i,this._renderManagerService=a,this._commandService=o,this._themeService=c,this._textResolverService=l,v(this,`_matchesUpdate$`,new s.Subject),v(this,`matchesUpdate$`,this._matchesUpdate$.asObservable()),v(this,`_activelyChangingMatch$`,new s.Subject),v(this,`activelyChangingMatch$`,this._activelyChangingMatch$.asObservable()),v(this,`_matches`,[]),v(this,`_position`,-1),v(this,`_query`,null),v(this,`_highlights`,[]),v(this,`unitId`,void 0),this.unitId=e.getUnitId(),this.disposeWithMe((0,t.toDisposable)((0,s.merge)((0,t.fromCallback)(this._commandService.onCommandExecuted.bind(this._commandService)).pipe((0,s.filter)(([e])=>e.id===n.RichTextEditingMutation.id&&S(e.params)===this.unitId)),this._textResolverService.textChanged$.pipe((0,s.filter)(e=>e===this.unitId))).pipe((0,s.debounceTime)(220)).subscribe(()=>this._scan(!0)))),this.disposeWithMe((0,t.toDisposable)(this._skeletonManager.currentSkeleton$.subscribe(()=>this._refreshHighlights())))}get currentMatch(){var e;return this._position<0||(e=this._matches[this._position])==null?null:e}dispose(){super.dispose(),this._disposeHighlights(),this._matchesUpdate$.complete(),this._activelyChangingMatch$.complete()}getMatches(){return this._matches}start(e){this._query=e,this._position=-1,this._scan(!1)}moveToNextMatch(e){if(!this._matches.length)return null;if(e!=null&&e.stayIfOnMatch&&this.currentMatch)return this._activate(this._position,e.noFocus);let t;if(e!=null&&e.ignoreSelection)t=0;else if(this._position>=0)t=this._position+1;else{let n=this._selectionManager.getActiveTextRange(),r=e!=null&&e.stayIfOnMatch?this._selectionMatchIndex():-1;t=r>=0?r:this._matches.findIndex(e=>{var t;return e.range.startOffset>=((t=n==null?void 0:n.endOffset)==null?0:t)})}return(t<0||t>=this._matches.length)&&(t=e!=null&&e.loop?0:-1),t<0?(this._position=-1,this._refreshHighlights(),null):this._activate(t,e==null?void 0:e.noFocus)}moveToPreviousMatch(e){if(!this._matches.length)return null;if(e!=null&&e.stayIfOnMatch&&this.currentMatch)return this._activate(this._position,e.noFocus);let t;if(e!=null&&e.ignoreSelection)t=this._matches.length-1;else if(this._position>=0)t=this._position-1;else{let n=this._selectionManager.getActiveTextRange(),r=e!=null&&e.stayIfOnMatch?this._selectionMatchIndex():-1;t=r>=0?r:this._matches.findLastIndex(e=>{var t;return e.range.endOffset<=((t=n==null?void 0:n.startOffset)==null?0:t)})}return t<0&&(t=e!=null&&e.loop?this._matches.length-1:-1),t<0?(this._position=-1,this._refreshHighlights(),null):this._activate(t,e==null?void 0:e.noFocus)}async replace(e){let t=this.currentMatch;if(!(t!=null&&t.replaceable)||!this._query)return!1;let n=await this._commandService.executeCommand(f.id,{unitId:this.unitId,query:this._query,replaceString:e,range:t.range});return(n==null?void 0:n.success)===1}async replaceAll(e){var t;return this._query?(t=await this._commandService.executeCommand(f.id,{unitId:this.unitId,query:this._query,replaceString:e}))==null?{success:0,failure:this._matches.length}:t:{success:0,failure:0}}focusSelection(){this.currentMatch&&this._focusMatch(this.currentMatch)}_scan(e){var t;if(!this._query)return;let n=this._doc.getBody();if(!n){this._matches=[],this._position=-1,this._disposeHighlights(),e&&this._matchesUpdate$.next([]);return}let r=(t=this.currentMatch)==null?void 0:t.range.startOffset;this._matches=d(n,this._query,!!this._doc.getSnapshot().disabled,this._textResolverService.resolve(this.unitId,n)).map(e=>({provider:`docs-find-replace-provider`,unitId:this.unitId,range:{...e,collapsed:!1},replaceable:e.replaceable})),this._position=r==null?-1:this._matches.findIndex(e=>e.range.startOffset>=r),this._refreshHighlights(),e&&this._matchesUpdate$.next(this._matches)}_selectionMatchIndex(){let e=this._selectionManager.getActiveTextRange();return e?this._matches.findIndex(t=>t.range.startOffset<=e.startOffset&&t.range.endOffset>=e.endOffset):-1}_activate(e,t=!1){let n=this._matches[e];return n?(this._position=e,t?this._refreshHighlights():this._focusMatch(n),n):null}_focusMatch(e){var t;this._selectionManager.replaceDocRanges([e.range],{unitId:this.unitId,subUnitId:this.unitId},!0,{shouldFocus:!1}),(t=this._renderManagerService.getRenderUnitById(this.unitId))==null||t.with(r.DocBackScrollRenderController).scrollToRange(e.range),this._activelyChangingMatch$.next(e),this._refreshHighlights()}_refreshHighlights(){this._disposeHighlights();let e=this._renderManagerService.getRenderUnitById(this.unitId),n=this._skeletonManager.getSkeleton(),i=e==null?void 0:e.mainComponent;if(!e||!n||!i)return;let a=this._themeService.getColorFromTheme(`yellow.400`),o={strokeWidth:0,stroke:`rgba(0,0,0,0)`,strokeActive:`rgba(0,0,0,0)`,fill:new t.ColorKit(a).setAlpha(.3).toRgbString()},s={...o,fill:new t.ColorKit(a).setAlpha(.65).toRgbString()};this._matches.forEach((t,a)=>{let c=(0,r.getTextRangeFromCharIndex)(t.range.startOffset,t.range.endOffset,e.scene,i,n,a===this._position?s:o,``,-1);c&&this._highlights.push(c)})}_disposeHighlights(){this._highlights.forEach(e=>e.dispose()),this._highlights=[]}};x=b([y(2,(0,t.Inject)(n.DocSelectionManagerService)),y(3,i.IRenderManagerService),y(4,t.ICommandService),y(5,(0,t.Inject)(t.ThemeService)),y(6,(0,t.Inject)(n.DocTextResolverService))],x);function S(e){return typeof e==`object`&&e&&`unitId`in e&&typeof e.unitId==`string`?e.unitId:void 0}let C=class extends t.Disposable{constructor(e,t,n){super(),this._instanceService=e,this._renderManagerService=t,this._injector=n,v(this,`capabilities`,{caseSensitive:!0,matchesTheWholeWord:!0,matchesTheWholeCell:!1,findDirection:!1,findScope:!1,findBy:!1}),v(this,`_model`,null)}isSupported(e){return e.type===t.UniverInstanceType.UNIVER_DOC}async find(e){var r;this.terminate();let i=this._instanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_DOC);if(!i)return[];let a=(r=this._renderManagerService.getRenderUnitById(i.getUnitId()))==null?void 0:r.with(n.DocSkeletonManagerService);return a?(this._model=this._injector.createInstance(x,i,a),this._model.start(e),[this._model]):[]}terminate(){var e;(e=this._model)==null||e.dispose(),this._model=null}dispose(){this.terminate(),super.dispose()}};C=b([y(0,t.IUniverInstanceService),y(1,i.IRenderManagerService),y(2,(0,t.Inject)(t.Injector))],C);let w=class extends t.Disposable{constructor(e,t,n,r){super(),this.disposeWithMe(e),this.disposeWithMe(t.registerFindReplaceProvider(e)),this.disposeWithMe(n.registerCommand(f)),r.mergeMenu(m)}};w=b([y(0,(0,t.Inject)(C)),y(1,a.IFindReplaceService),y(2,t.ICommandService),y(3,o.IMenuManagerService)],w);let T=class extends t.Plugin{constructor(e=u,n,r){super(),this._config=e,this._injector=n,this._configService=r;let{...i}=(0,t.merge)({},u,this._config);this._configService.setConfig(`docs-find-replace.config`,i)}onStarting(){this._injector.add([C]),this._injector.add([w])}onSteady(){this._injector.get(w)}};v(T,`pluginName`,`DOCS_FIND_REPLACE_PLUGIN`),v(T,`packageName`,c),v(T,`version`,l),v(T,`type`,t.UniverInstanceType.UNIVER_DOC),T=b([(0,t.DependentOn)(n.UniverDocsPlugin,i.UniverRenderEnginePlugin,r.UniverDocsUIPlugin,a.UniverFindReplacePlugin),y(1,(0,t.Inject)(t.Injector)),y(2,t.IConfigService)],T),Object.defineProperty(e,"UniverDocsFindReplacePlugin",{enumerable:!0,get:function(){return T}})});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("@univerjs/engine-render"),require("@univerjs/find-replace"),require("@univerjs/ui"),require("rxjs")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/docs`,`@univerjs/docs-ui`,`@univerjs/engine-render`,`@univerjs/find-replace`,`@univerjs/ui`,`rxjs`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverDocsFindReplace={},e.UniverCore,e.UniverDocs,e.UniverDocsUi,e.UniverEngineRender,e.UniverFindReplace,e.UniverUi,e.rxjs))})(this,function(e,t,n,r,i,a,o,s){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var c=`@univerjs/docs-find-replace`,l=`1.0.0-beta.1`;let u={};function d(e,n,r,i={text:e.dataStream,characters:Array.from({length:e.dataStream.length},(e,t)=>({startOffset:t,endOffset:t+1,replaceable:!0}))}){if(!n.findString)return[];let a=t.regexp.createLiteralRegExp(n.findString,n.caseSensitive?`gu`:`giu`),o=n.matchesTheWholeWord?new Set(Array.from(new Intl.Segmenter(void 0,{granularity:`word`}).segment(i.text)).filter(e=>e.isWordLike).map(e=>`${e.index}:${e.index+e.segment.length}`)):null;return Array.from(i.text.matchAll(a)).filter(e=>(o==null?void 0:o.has(`${e.index}:${e.index+e[0].length}`))??!0).flatMap(t=>{var n;let a=i.characters.slice(t.index,t.index+t[0].length);if(!a.length)return[];let o=Math.min(...a.map(e=>e.startOffset)),s=Math.max(...a.map(e=>e.endOffset)),c=((n=e.customRanges)==null?void 0:n.some(e=>e.wholeEntity&&e.startIndex<s&&e.endIndex+1>o))??!1;return[{startOffset:o,endOffset:s,replaceable:!r&&!c&&a.every(e=>e.replaceable)}]})}let f={id:`docs.command.replace`,type:t.CommandType.COMMAND,handler:(e,r)=>{if(!r)return{success:0,failure:0};let i=e.get(t.IUniverInstanceService),a=e.get(t.ICommandService),o=i.getUnit(r.unitId,t.UniverInstanceType.UNIVER_DOC),s=o==null?void 0:o.getBody();if(!o||!s)return{success:0,failure:+!!r.range};let c=d(s,r.query,!!o.getSnapshot().disabled),l=r.range?c.filter(e=>e.startOffset===r.range.startOffset&&e.endOffset===r.range.endOffset):c,u=l.filter(e=>e.replaceable),f=(r.range&&l.length===0?1:l.length)-u.length;if(!u.length)return{success:0,failure:f};let p=new t.TextX,m=new t.MemoryCursor;for(let e of u){var h,g;let n=o.sliceBody(e.startOffset,e.endOffset),i=r.replaceString?{dataStream:r.replaceString,textRuns:n!=null&&(h=n.textRuns)!=null&&h.length?[{...n.textRuns[0],st:0,ed:r.replaceString.length}]:void 0,customRanges:n!=null&&(g=n.customRanges)!=null&&g.length?[{...n.customRanges[0],startIndex:0,endIndex:r.replaceString.length-1}]:void 0}:null;p.push(...t.BuildTextUtils.selection.delete([{startOffset:e.startOffset,endOffset:e.endOffset,collapsed:!1}],s,m.cursor,i,!1)),m.moveCursorTo(e.endOffset)}let _=t.JSONX.getInstance().editOp(p.serialize(),(0,t.getRichTextEditPath)(o));return a.syncExecuteCommand(n.RichTextEditingMutation.id,{unitId:r.unitId,actions:_,textRanges:[]})?{success:u.length,failure:f}:{success:0,failure:f+u.length}}};function p(e){let n=e.get(t.IContextService);return{id:a.OpenFindDialogOperation.id,icon:`SearchIcon`,tooltip:`find-replace.toolbar`,type:o.MenuItemType.BUTTON,disabled$:n.subscribeContextValue$(t.FOCUSING_DOC).pipe((0,s.map)(e=>!e))}}let m={[o.RibbonStartGroup.OTHERS]:{[a.OpenFindDialogOperation.id]:{order:3,menuItemFactory:p}}};function h(e){"@babel/helpers - typeof";return h=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},h(e)}function g(e,t){if(h(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(h(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function _(e){var t=g(e,`string`);return h(t)==`symbol`?t:t+``}function v(e,t,n){return(t=_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e,t){return function(n,r){t(n,r,e)}}function b(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let x=class extends a.FindModel{constructor(e,r,i,a,o,c,l){super(),this._doc=e,this._skeletonManager=r,this._selectionManager=i,this._renderManagerService=a,this._commandService=o,this._themeService=c,this._textResolverService=l,v(this,`_matchesUpdate$`,new s.Subject),v(this,`matchesUpdate$`,this._matchesUpdate$.asObservable()),v(this,`_activelyChangingMatch$`,new s.Subject),v(this,`activelyChangingMatch$`,this._activelyChangingMatch$.asObservable()),v(this,`_matches`,[]),v(this,`_position`,-1),v(this,`_query`,null),v(this,`_highlights`,[]),v(this,`unitId`,void 0),this.unitId=e.getUnitId(),this.disposeWithMe((0,t.toDisposable)((0,s.merge)((0,t.fromCallback)(this._commandService.onCommandExecuted.bind(this._commandService)).pipe((0,s.filter)(([e])=>e.id===n.RichTextEditingMutation.id&&S(e.params)===this.unitId)),this._textResolverService.textChanged$.pipe((0,s.filter)(e=>e===this.unitId))).pipe((0,s.debounceTime)(220)).subscribe(()=>this._scan(!0)))),this.disposeWithMe((0,t.toDisposable)(this._skeletonManager.currentSkeleton$.subscribe(()=>this._refreshHighlights())))}get currentMatch(){return this._position<0?null:this._matches[this._position]??null}dispose(){super.dispose(),this._disposeHighlights(),this._matchesUpdate$.complete(),this._activelyChangingMatch$.complete()}getMatches(){return this._matches}start(e){this._query=e,this._position=-1,this._scan(!1)}moveToNextMatch(e){if(!this._matches.length)return null;if(e!=null&&e.stayIfOnMatch&&this.currentMatch)return this._activate(this._position,e.noFocus);let t;if(e!=null&&e.ignoreSelection)t=0;else if(this._position>=0)t=this._position+1;else{let n=this._selectionManager.getActiveTextRange(),r=e!=null&&e.stayIfOnMatch?this._selectionMatchIndex():-1;t=r>=0?r:this._matches.findIndex(e=>e.range.startOffset>=((n==null?void 0:n.endOffset)??0))}return(t<0||t>=this._matches.length)&&(t=e!=null&&e.loop?0:-1),t<0?(this._position=-1,this._refreshHighlights(),null):this._activate(t,e==null?void 0:e.noFocus)}moveToPreviousMatch(e){if(!this._matches.length)return null;if(e!=null&&e.stayIfOnMatch&&this.currentMatch)return this._activate(this._position,e.noFocus);let t;if(e!=null&&e.ignoreSelection)t=this._matches.length-1;else if(this._position>=0)t=this._position-1;else{let n=this._selectionManager.getActiveTextRange(),r=e!=null&&e.stayIfOnMatch?this._selectionMatchIndex():-1;t=r>=0?r:this._matches.findLastIndex(e=>e.range.endOffset<=((n==null?void 0:n.startOffset)??0))}return t<0&&(t=e!=null&&e.loop?this._matches.length-1:-1),t<0?(this._position=-1,this._refreshHighlights(),null):this._activate(t,e==null?void 0:e.noFocus)}async replace(e){let t=this.currentMatch;if(!(t!=null&&t.replaceable)||!this._query)return!1;let n=await this._commandService.executeCommand(f.id,{unitId:this.unitId,query:this._query,replaceString:e,range:t.range});return(n==null?void 0:n.success)===1}async replaceAll(e){return this._query?await this._commandService.executeCommand(f.id,{unitId:this.unitId,query:this._query,replaceString:e})??{success:0,failure:this._matches.length}:{success:0,failure:0}}focusSelection(){this.currentMatch&&this._focusMatch(this.currentMatch)}_scan(e){var t;if(!this._query)return;let n=this._doc.getBody();if(!n){this._matches=[],this._position=-1,this._disposeHighlights(),e&&this._matchesUpdate$.next([]);return}let r=(t=this.currentMatch)==null?void 0:t.range.startOffset;this._matches=d(n,this._query,!!this._doc.getSnapshot().disabled,this._textResolverService.resolve(this.unitId,n)).map(e=>({provider:`docs-find-replace-provider`,unitId:this.unitId,range:{...e,collapsed:!1},replaceable:e.replaceable})),this._position=r==null?-1:this._matches.findIndex(e=>e.range.startOffset>=r),this._refreshHighlights(),e&&this._matchesUpdate$.next(this._matches)}_selectionMatchIndex(){let e=this._selectionManager.getActiveTextRange();return e?this._matches.findIndex(t=>t.range.startOffset<=e.startOffset&&t.range.endOffset>=e.endOffset):-1}_activate(e,t=!1){let n=this._matches[e];return n?(this._position=e,t?this._refreshHighlights():this._focusMatch(n),n):null}_focusMatch(e){var t;this._selectionManager.replaceDocRanges([e.range],{unitId:this.unitId,subUnitId:this.unitId},!0,{shouldFocus:!1}),(t=this._renderManagerService.getRenderUnitById(this.unitId))==null||t.with(r.DocBackScrollRenderController).scrollToRange(e.range),this._activelyChangingMatch$.next(e),this._refreshHighlights()}_refreshHighlights(){this._disposeHighlights();let e=this._renderManagerService.getRenderUnitById(this.unitId),n=this._skeletonManager.getSkeleton(),i=e==null?void 0:e.mainComponent;if(!e||!n||!i)return;let a=this._themeService.getColorFromTheme(`yellow.400`),o={strokeWidth:0,stroke:`rgba(0,0,0,0)`,strokeActive:`rgba(0,0,0,0)`,fill:new t.ColorKit(a).setAlpha(.3).toRgbString()},s={...o,fill:new t.ColorKit(a).setAlpha(.65).toRgbString()};this._matches.forEach((t,a)=>{let c=(0,r.getTextRangeFromCharIndex)(t.range.startOffset,t.range.endOffset,e.scene,i,n,a===this._position?s:o,``,-1);c&&this._highlights.push(c)})}_disposeHighlights(){this._highlights.forEach(e=>e.dispose()),this._highlights=[]}};x=b([y(2,(0,t.Inject)(n.DocSelectionManagerService)),y(3,i.IRenderManagerService),y(4,t.ICommandService),y(5,(0,t.Inject)(t.ThemeService)),y(6,(0,t.Inject)(n.DocTextResolverService))],x);function S(e){return typeof e==`object`&&e&&`unitId`in e&&typeof e.unitId==`string`?e.unitId:void 0}let C=class extends t.Disposable{constructor(e,t,n){super(),this._instanceService=e,this._renderManagerService=t,this._injector=n,v(this,`capabilities`,{caseSensitive:!0,matchesTheWholeWord:!0,matchesTheWholeCell:!1,findDirection:!1,findScope:!1,findBy:!1}),v(this,`_model`,null)}isSupported(e){return e.type===t.UniverInstanceType.UNIVER_DOC}async find(e){var r;this.terminate();let i=this._instanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_DOC);if(!i)return[];let a=(r=this._renderManagerService.getRenderUnitById(i.getUnitId()))==null?void 0:r.with(n.DocSkeletonManagerService);return a?(this._model=this._injector.createInstance(x,i,a),this._model.start(e),[this._model]):[]}terminate(){var e;(e=this._model)==null||e.dispose(),this._model=null}dispose(){this.terminate(),super.dispose()}};C=b([y(0,t.IUniverInstanceService),y(1,i.IRenderManagerService),y(2,(0,t.Inject)(t.Injector))],C);let w=class extends t.Disposable{constructor(e,t,n,r){super(),this.disposeWithMe(e),this.disposeWithMe(t.registerFindReplaceProvider(e)),this.disposeWithMe(n.registerCommand(f)),r.mergeMenu(m)}};w=b([y(0,(0,t.Inject)(C)),y(1,a.IFindReplaceService),y(2,t.ICommandService),y(3,o.IMenuManagerService)],w);let T=class extends t.Plugin{constructor(e=u,n,r){super(),this._config=e,this._injector=n,this._configService=r;let{...i}=(0,t.merge)({},u,this._config);this._configService.setConfig(`docs-find-replace.config`,i)}onStarting(){this._injector.add([C]),this._injector.add([w])}onSteady(){this._injector.get(w)}};v(T,`pluginName`,`DOCS_FIND_REPLACE_PLUGIN`),v(T,`packageName`,c),v(T,`version`,l),v(T,`type`,t.UniverInstanceType.UNIVER_DOC),T=b([(0,t.DependentOn)(n.UniverDocsPlugin,i.UniverRenderEnginePlugin,r.UniverDocsUIPlugin,a.UniverFindReplacePlugin),y(1,(0,t.Inject)(t.Injector)),y(2,t.IConfigService)],T),Object.defineProperty(e,"UniverDocsFindReplacePlugin",{enumerable:!0,get:function(){return T}})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/docs-find-replace",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Find and replace support for Univer Docs.",
|
|
6
6
|
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
|
|
@@ -52,19 +52,19 @@
|
|
|
52
52
|
"rxjs": ">=7.0.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@univerjs/core": "1.0.0-
|
|
56
|
-
"@univerjs/docs": "1.0.0-
|
|
57
|
-
"@univerjs/docs
|
|
58
|
-
"@univerjs/engine-render": "1.0.0-
|
|
59
|
-
"@univerjs/
|
|
60
|
-
"@univerjs/
|
|
55
|
+
"@univerjs/core": "1.0.0-beta.1",
|
|
56
|
+
"@univerjs/docs-ui": "1.0.0-beta.1",
|
|
57
|
+
"@univerjs/docs": "1.0.0-beta.1",
|
|
58
|
+
"@univerjs/engine-render": "1.0.0-beta.1",
|
|
59
|
+
"@univerjs/find-replace": "1.0.0-beta.1",
|
|
60
|
+
"@univerjs/ui": "1.0.0-beta.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"react": "18.3.1",
|
|
64
64
|
"rxjs": "^7.8.2",
|
|
65
65
|
"typescript": "^6.0.3",
|
|
66
66
|
"vitest": "^4.1.10",
|
|
67
|
-
"@univerjs-infra/shared": "1.0.0-
|
|
67
|
+
"@univerjs-infra/shared": "1.0.0-beta.1"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"test": "vitest run",
|