@fileverse-dev/ddoc 3.3.8-searchreplace-3 → 3.3.8-searchreplace-4
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/dist/index.es.js
CHANGED
|
@@ -192237,74 +192237,77 @@ function IYe(e) {
|
|
|
192237
192237
|
return MYe(t.current, r) ? t.current : t.current = r;
|
|
192238
192238
|
};
|
|
192239
192239
|
}
|
|
192240
|
-
const OYe = ({
|
|
192241
|
-
|
|
192240
|
+
const OYe = ({
|
|
192241
|
+
editor: e,
|
|
192242
|
+
viewerMode: t
|
|
192243
|
+
}) => {
|
|
192244
|
+
const [, n] = m8((_) => _ + 1, 0);
|
|
192242
192245
|
_e(() => {
|
|
192243
192246
|
if (e)
|
|
192244
|
-
return e.on("transaction",
|
|
192245
|
-
e.off("transaction",
|
|
192247
|
+
return e.on("transaction", n), () => {
|
|
192248
|
+
e.off("transaction", n);
|
|
192246
192249
|
};
|
|
192247
192250
|
}, [e]);
|
|
192248
|
-
const [
|
|
192249
|
-
IYe((
|
|
192250
|
-
searchTerm:
|
|
192251
|
-
replaceTerm:
|
|
192252
|
-
showSearchReplacePopover:
|
|
192251
|
+
const [r, o] = Me(!1), i = Te(null), { searchTerm: s, replaceTerm: a, showSearchReplacePopover: l } = ND(
|
|
192252
|
+
IYe((_) => ({
|
|
192253
|
+
searchTerm: _.searchTerm,
|
|
192254
|
+
replaceTerm: _.replaceTerm,
|
|
192255
|
+
showSearchReplacePopover: _.showSearchReplacePopover
|
|
192253
192256
|
}))
|
|
192254
|
-
), { setShowReplacePopover:
|
|
192255
|
-
function
|
|
192256
|
-
e && e.commands.setSearchTerm(""),
|
|
192257
|
+
), { setShowReplacePopover: u, setSearchTerm: c, setReplaceTerm: d } = ND((_) => _.actions);
|
|
192258
|
+
function p() {
|
|
192259
|
+
e && e.commands.setSearchTerm(""), u(!1);
|
|
192257
192260
|
}
|
|
192258
|
-
Bz("keydown", (
|
|
192259
|
-
|
|
192260
|
-
}), Bte(
|
|
192261
|
-
const
|
|
192262
|
-
function
|
|
192263
|
-
|
|
192261
|
+
Bz("keydown", (_) => {
|
|
192262
|
+
t === "suggest" || t == "view-only" || _.code === "KeyF" && _.metaKey && (_.preventDefault(), e && kq(e));
|
|
192263
|
+
}), Bte(p);
|
|
192264
|
+
const f = e == null ? void 0 : e.storage.searchAndReplace.results, g = e == null ? void 0 : e.storage.searchAndReplace.resultIndex;
|
|
192265
|
+
function m() {
|
|
192266
|
+
o((_) => !_);
|
|
192264
192267
|
}
|
|
192265
|
-
function
|
|
192268
|
+
function b(_) {
|
|
192266
192269
|
if (!e) return;
|
|
192267
|
-
const { value:
|
|
192268
|
-
|
|
192270
|
+
const { value: I } = _.target;
|
|
192271
|
+
c(I), e.commands.setSearchTerm(I), e.commands.resetIndex();
|
|
192269
192272
|
}
|
|
192270
|
-
function
|
|
192273
|
+
function y(_) {
|
|
192271
192274
|
if (!e) return;
|
|
192272
|
-
const { value:
|
|
192273
|
-
|
|
192275
|
+
const { value: I } = _.target;
|
|
192276
|
+
d(I), e.commands.setReplaceTerm(I), e.commands.resetIndex();
|
|
192274
192277
|
}
|
|
192275
|
-
function
|
|
192278
|
+
function F() {
|
|
192276
192279
|
e && e.commands.replace();
|
|
192277
192280
|
}
|
|
192278
|
-
function
|
|
192281
|
+
function v() {
|
|
192279
192282
|
e && e.commands.replaceAll();
|
|
192280
192283
|
}
|
|
192281
|
-
function
|
|
192284
|
+
function D() {
|
|
192282
192285
|
if (!e) return;
|
|
192283
|
-
const { results:
|
|
192284
|
-
if (!
|
|
192285
|
-
const { node:
|
|
192286
|
-
|
|
192287
|
-
el:
|
|
192286
|
+
const { results: _, resultIndex: I } = e.storage.searchAndReplace, j = _[I];
|
|
192287
|
+
if (!j) return;
|
|
192288
|
+
const { node: A } = e.view.domAtPos(j.from);
|
|
192289
|
+
A instanceof HTMLElement && Bme({
|
|
192290
|
+
el: A,
|
|
192288
192291
|
editorRoot: e.view.dom,
|
|
192289
192292
|
isNativeMobile: !1
|
|
192290
192293
|
});
|
|
192291
192294
|
}
|
|
192292
|
-
function D() {
|
|
192293
|
-
e && (e.commands.nextSearchResult(), v());
|
|
192294
|
-
}
|
|
192295
192295
|
function w() {
|
|
192296
|
-
e && (e.commands.
|
|
192296
|
+
e && (e.commands.nextSearchResult(), D());
|
|
192297
|
+
}
|
|
192298
|
+
function k() {
|
|
192299
|
+
e && (e.commands.previousSearchResult(), D());
|
|
192297
192300
|
}
|
|
192298
|
-
function
|
|
192299
|
-
if (
|
|
192300
|
-
if (
|
|
192301
|
-
|
|
192301
|
+
function C(_) {
|
|
192302
|
+
if (_.code === "Enter") {
|
|
192303
|
+
if (_.shiftKey) {
|
|
192304
|
+
k();
|
|
192302
192305
|
return;
|
|
192303
192306
|
}
|
|
192304
|
-
|
|
192307
|
+
w();
|
|
192305
192308
|
}
|
|
192306
192309
|
}
|
|
192307
|
-
return /* @__PURE__ */ x.jsxs(Dh, { open:
|
|
192310
|
+
return /* @__PURE__ */ x.jsxs(Dh, { open: l, children: [
|
|
192308
192311
|
/* @__PURE__ */ x.jsx(qne, { className: "absolute right-0" }),
|
|
192309
192312
|
/* @__PURE__ */ x.jsx(
|
|
192310
192313
|
kh,
|
|
@@ -192321,15 +192324,15 @@ const OYe = ({ editor: e }) => {
|
|
|
192321
192324
|
Ba,
|
|
192322
192325
|
{
|
|
192323
192326
|
placeholder: "Search text...",
|
|
192324
|
-
value:
|
|
192325
|
-
ref:
|
|
192327
|
+
value: s,
|
|
192328
|
+
ref: i,
|
|
192326
192329
|
className: "border-none p-0",
|
|
192327
|
-
onChange:
|
|
192328
|
-
onKeyDown:
|
|
192330
|
+
onChange: b,
|
|
192331
|
+
onKeyDown: C
|
|
192329
192332
|
}
|
|
192330
192333
|
),
|
|
192331
|
-
|
|
192332
|
-
|
|
192334
|
+
f && /* @__PURE__ */ x.jsx(x.Fragment, { children: f.length > 0 ? /* @__PURE__ */ x.jsx("span", { className: "color-text-secondary text-sm", children: `${typeof g == "number" ? g + 1 : "?"}/${f.length}` }) : /* @__PURE__ */ x.jsx("span", { className: "color-text-secondary text-xs shrink-0", children: "No results found." }) }),
|
|
192335
|
+
f && f.length > 0 && /* @__PURE__ */ x.jsxs("div", { className: "flex items-center", children: [
|
|
192333
192336
|
/* @__PURE__ */ x.jsxs("div", { className: "flex items-center", children: [
|
|
192334
192337
|
/* @__PURE__ */ x.jsx(cn, { text: "Previous", children: /* @__PURE__ */ x.jsx(
|
|
192335
192338
|
Yt,
|
|
@@ -192337,7 +192340,7 @@ const OYe = ({ editor: e }) => {
|
|
|
192337
192340
|
icon: "ArrowUp",
|
|
192338
192341
|
variant: "ghost",
|
|
192339
192342
|
size: "sm",
|
|
192340
|
-
onClick:
|
|
192343
|
+
onClick: k
|
|
192341
192344
|
}
|
|
192342
192345
|
) }),
|
|
192343
192346
|
/* @__PURE__ */ x.jsx(cn, { text: "Next", children: /* @__PURE__ */ x.jsx(
|
|
@@ -192346,7 +192349,7 @@ const OYe = ({ editor: e }) => {
|
|
|
192346
192349
|
icon: "ArrowDown",
|
|
192347
192350
|
variant: "ghost",
|
|
192348
192351
|
size: "sm",
|
|
192349
|
-
onClick:
|
|
192352
|
+
onClick: w
|
|
192350
192353
|
}
|
|
192351
192354
|
) })
|
|
192352
192355
|
] }),
|
|
@@ -192356,13 +192359,13 @@ const OYe = ({ editor: e }) => {
|
|
|
192356
192359
|
icon: "Replace",
|
|
192357
192360
|
variant: "ghost",
|
|
192358
192361
|
size: "sm",
|
|
192359
|
-
onClick:
|
|
192362
|
+
onClick: m
|
|
192360
192363
|
}
|
|
192361
192364
|
) })
|
|
192362
192365
|
] }),
|
|
192363
|
-
/* @__PURE__ */ x.jsx(_x, { asChild: !0, onClick:
|
|
192366
|
+
/* @__PURE__ */ x.jsx(_x, { asChild: !0, onClick: p, children: /* @__PURE__ */ x.jsx(Yt, { icon: "X", variant: "ghost", size: "sm" }) })
|
|
192364
192367
|
] }),
|
|
192365
|
-
/* @__PURE__ */ x.jsx(np, { children:
|
|
192368
|
+
/* @__PURE__ */ x.jsx(np, { children: r && /* @__PURE__ */ x.jsxs(
|
|
192366
192369
|
Is.div,
|
|
192367
192370
|
{
|
|
192368
192371
|
className: "space-y-2 overflow-clip",
|
|
@@ -192375,8 +192378,8 @@ const OYe = ({ editor: e }) => {
|
|
|
192375
192378
|
Ba,
|
|
192376
192379
|
{
|
|
192377
192380
|
placeholder: "Replace with...",
|
|
192378
|
-
value:
|
|
192379
|
-
onChange:
|
|
192381
|
+
value: a,
|
|
192382
|
+
onChange: y,
|
|
192380
192383
|
className: "border-none p-0"
|
|
192381
192384
|
}
|
|
192382
192385
|
) }),
|
|
@@ -192387,7 +192390,7 @@ const OYe = ({ editor: e }) => {
|
|
|
192387
192390
|
variant: "secondary",
|
|
192388
192391
|
size: "sm",
|
|
192389
192392
|
className: "min-w-0 text-body-sm-bold",
|
|
192390
|
-
onClick:
|
|
192393
|
+
onClick: v,
|
|
192391
192394
|
children: "Replace All"
|
|
192392
192395
|
}
|
|
192393
192396
|
),
|
|
@@ -192397,7 +192400,7 @@ const OYe = ({ editor: e }) => {
|
|
|
192397
192400
|
variant: "default",
|
|
192398
192401
|
size: "sm",
|
|
192399
192402
|
className: "min-w-0 text-body-sm-bold",
|
|
192400
|
-
onClick:
|
|
192403
|
+
onClick: F,
|
|
192401
192404
|
children: "Replace"
|
|
192402
192405
|
}
|
|
192403
192406
|
)
|
|
@@ -193288,7 +193291,7 @@ const OYe = ({ editor: e }) => {
|
|
|
193288
193291
|
),
|
|
193289
193292
|
style: $e ? void 0 : xt(),
|
|
193290
193293
|
children: [
|
|
193291
|
-
/* @__PURE__ */ x.jsx(OYe, { editor: jt }),
|
|
193294
|
+
/* @__PURE__ */ x.jsx(OYe, { editor: jt, viewerMode: t }),
|
|
193292
193295
|
/* @__PURE__ */ x.jsx(
|
|
193293
193296
|
"nav",
|
|
193294
193297
|
{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Editor } from '@tiptap/core';
|
|
2
2
|
|
|
3
|
-
declare const SearchReplace: ({ editor }: {
|
|
3
|
+
declare const SearchReplace: ({ editor, viewerMode, }: {
|
|
4
4
|
editor: Editor | null;
|
|
5
|
+
viewerMode?: "suggest" | "view-only";
|
|
5
6
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export default SearchReplace;
|