@inpageedit/core 0.8.0 → 0.9.0
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/{IconQuickEdit-YVn1ANbm.js → IconQuickEdit-CAL1HXIb.js} +4 -4
- package/dist/IconQuickEdit-CAL1HXIb.js.map +1 -0
- package/dist/__test__/utils/constants.d.ts +2 -2
- package/dist/{index-DpLwTw4C.js → index-9Z4ds-WM.js} +2627 -2095
- package/dist/index-9Z4ds-WM.js.map +1 -0
- package/dist/{index-DlgTb4XY.js → index-BB9MXkUv.js} +3 -3
- package/dist/{index-DlgTb4XY.js.map → index-BB9MXkUv.js.map} +1 -1
- package/dist/{index-VzP81S7B.js → index-BDVcDlsf.js} +2 -2
- package/dist/{index-VzP81S7B.js.map → index-BDVcDlsf.js.map} +1 -1
- package/dist/{index--xn9BebC.js → index-CADkQBg0.js} +61 -69
- package/dist/{index--xn9BebC.js.map → index-CADkQBg0.js.map} +1 -1
- package/dist/{index-DTA86mHU.js → index-CBQsBfc2.js} +31 -33
- package/dist/index-CBQsBfc2.js.map +1 -0
- package/dist/{index-BT1mN_St.js → index-CNsB3Vcb.js} +2 -2
- package/dist/{index-BT1mN_St.js.map → index-CNsB3Vcb.js.map} +1 -1
- package/dist/index-CYdxWw9g.js +355 -0
- package/dist/index-CYdxWw9g.js.map +1 -0
- package/dist/{index-C0V2s48o.js → index-D7SQwFxl.js} +38 -33
- package/dist/index-D7SQwFxl.js.map +1 -0
- package/dist/index-DMNUP3fg.js +193 -0
- package/dist/index-DMNUP3fg.js.map +1 -0
- package/dist/{index-TzKe6Ebm.js → index-G3k3kjCU.js} +2 -2
- package/dist/{index-TzKe6Ebm.js.map → index-G3k3kjCU.js.map} +1 -1
- package/dist/{index-DDWds9Jg.js → index-dp6_MU68.js} +28 -28
- package/dist/index-dp6_MU68.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/models/WikiTitle/index.d.ts +1 -0
- package/dist/plugins/in-article-links/index.d.ts +1 -1
- package/dist/plugins/quick-delete/index.d.ts +1 -1
- package/dist/plugins/quick-diff/PluginQuickDiffCore.d.ts +1 -1
- package/dist/plugins/quick-edit/index.d.ts +1 -1
- package/dist/plugins/quick-preview/index.d.ts +1 -1
- package/dist/services/CurrentPageService.d.ts +28 -0
- package/dist/services/{ModalService/index.d.ts → ModalService.d.ts} +4 -4
- package/dist/services/WikiMetadataService.d.ts +1 -1
- package/dist/services/WikiTitleService.d.ts +19 -7
- package/dist/style.css +1 -1
- package/lib/index.umd.js +36 -35
- package/lib/index.umd.js.map +1 -1
- package/lib/style.css +1 -1
- package/package.json +8 -7
- package/dist/IconQuickEdit-YVn1ANbm.js.map +0 -1
- package/dist/index-C0V2s48o.js.map +0 -1
- package/dist/index-DDWds9Jg.js.map +0 -1
- package/dist/index-DDef1ojx.js +0 -166
- package/dist/index-DDef1ojx.js.map +0 -1
- package/dist/index-DTA86mHU.js.map +0 -1
- package/dist/index-DpLwTw4C.js.map +0 -1
- package/dist/index-loWqosf7.js +0 -331
- package/dist/index-loWqosf7.js.map +0 -1
- package/dist/services/ModalService/IPEModal.d.ts +0 -235
package/dist/index-loWqosf7.js
DELETED
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
import { j as i, F as b, P as T } from "./index-CvhkVj_L.js";
|
|
2
|
-
import { B as C, W as m, I as M, S as h } from "./index-DpLwTw4C.js";
|
|
3
|
-
import { m as A } from "./makeCallable-LDU0xZMJ.js";
|
|
4
|
-
import { R as B } from "./Preferences-Bg3J5Ur9.js";
|
|
5
|
-
import { M as S } from "./index-lZkYoUca.js";
|
|
6
|
-
import { I as F } from "./InputBox-BV4m05Xs.js";
|
|
7
|
-
import { R as O } from "./RadioBox-nJqWsxW2.js";
|
|
8
|
-
import { C as _ } from "./CheckBox-D3rHnX7I.js";
|
|
9
|
-
import { n as E } from "./noop-ClDc6zv4.js";
|
|
10
|
-
const j = (t = 0) => new Promise((e) => setTimeout(e, t));
|
|
11
|
-
var L = Object.create, x = Object.defineProperty, D = Object.getOwnPropertyDescriptor, y = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), P = (t) => {
|
|
12
|
-
throw TypeError(t);
|
|
13
|
-
}, R = (t, e, c) => e in t ? x(t, e, { enumerable: !0, configurable: !0, writable: !0, value: c }) : t[e] = c, U = (t, e) => x(t, "name", { value: e, configurable: !0 }), W = (t) => [, , , L(t?.[y("metadata")] ?? null)], z = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], q = (t) => t !== void 0 && typeof t != "function" ? P("Function expected") : t, Q = (t, e, c, l, s) => ({ kind: z[t], name: e, metadata: l, addInitializer: (d) => c._ ? P("Already initialized") : s.push(q(d || null)) }), Y = (t, e) => R(e, y("metadata"), t[3]), K = (t, e, c, l) => {
|
|
14
|
-
for (var s = 0, d = t[e >> 1], n = d && d.length; s < n; s++) d[s].call(c);
|
|
15
|
-
return l;
|
|
16
|
-
}, G = (t, e, c, l, s, d) => {
|
|
17
|
-
var n, r, a, u = e & 7, p = !1, g = 0, o = t[g] || (t[g] = []), f = u && (s = s.prototype, u < 5 && (u > 3 || !p) && D(s, c));
|
|
18
|
-
U(s, c);
|
|
19
|
-
for (var v = l.length - 1; v >= 0; v--)
|
|
20
|
-
a = Q(u, c, r = {}, t[3], o), n = (0, l[v])(s, a), r._ = 1, q(n) && (s = n);
|
|
21
|
-
return Y(t, s), f && x(s, c, f), p ? u ^ 4 ? d : f : s;
|
|
22
|
-
}, I, k, N;
|
|
23
|
-
I = [M(["api", "wikiPage", "wikiTitle", "wiki", "modal", "preferences"]), B(
|
|
24
|
-
h.object({
|
|
25
|
-
"quickEdit.editSummary": h.string().description("Default edit summary for quick edits").default("[IPE-NEXT] Quick edit"),
|
|
26
|
-
"quickEdit.editMinor": h.boolean().description("Whether to mark the edit as minor").default(!1),
|
|
27
|
-
"quickEdit.outSideClose": h.boolean().description("Whether to close the modal outside").default(!0),
|
|
28
|
-
"quickEdit.watchList": h.union([
|
|
29
|
-
h.const(m.preferences).description("Follow my preferences"),
|
|
30
|
-
h.const(m.nochange).description("Keep the current watchlist status"),
|
|
31
|
-
h.const(m.watch).description("Add the page to watchlist"),
|
|
32
|
-
h.const(m.unwatch).description("Remove the page from watchlist")
|
|
33
|
-
]).description("Watchlist options").default(m.preferences),
|
|
34
|
-
"quickEdit.keyshortcut.save": h.string().default("ctrl-s").description("save button key shortcut (blank to disable)")
|
|
35
|
-
}).description("Quick edit options").extra("category", "edit")
|
|
36
|
-
)];
|
|
37
|
-
class w extends (N = C) {
|
|
38
|
-
constructor(e) {
|
|
39
|
-
super(e, {}, "quick-edit"), this.ctx = e, this.DEFAULT_OPTIONS = {
|
|
40
|
-
title: "",
|
|
41
|
-
pageId: 0,
|
|
42
|
-
revision: 0,
|
|
43
|
-
section: void 0,
|
|
44
|
-
editMinor: !1,
|
|
45
|
-
editSummary: "",
|
|
46
|
-
createOnly: !1,
|
|
47
|
-
reloadAfterSave: !0
|
|
48
|
-
}, this.ctx.root.set("quickEdit", A(this, "showModal"));
|
|
49
|
-
}
|
|
50
|
-
start() {
|
|
51
|
-
this.ctx.inject(["toolbox"], (e) => {
|
|
52
|
-
this.injectToolbox(e), e.on("dispose", () => {
|
|
53
|
-
this.removeToolbox(e);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
async showModal(e) {
|
|
58
|
-
if (typeof e > "u" ? e = {} : typeof e == "string" && (e = {
|
|
59
|
-
title: e
|
|
60
|
-
}), e?.page && (e.title = e.page, delete e.page), !e.title && !e.pageId && !e.revision) {
|
|
61
|
-
this.logger.warn("None of the title, pageId or revision provided. Using defaults.");
|
|
62
|
-
const o = new URLSearchParams(window.location.search);
|
|
63
|
-
e = {
|
|
64
|
-
...e,
|
|
65
|
-
title: this.ctx.wikiTitle.currentTitle.getPrefixedDBKey(),
|
|
66
|
-
revision: o.has("oldid") ? Number(o.get("oldid")) : void 0,
|
|
67
|
-
pageId: o.has("curid") ? Number(o.get("curid")) : void 0
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
const c = await this.ctx.preferences.get("quickEdit.outSideClose"), l = await this.ctx.preferences.get("quickEdit.watchList"), s = typeof e.editSummary == "string" ? e.editSummary : await this.ctx.preferences.get("quickEdit.editSummary"), d = typeof e.editMinor == "boolean" ? e.editMinor : await this.ctx.preferences.get("quickEdit.editMinor"), n = {
|
|
71
|
-
...this.DEFAULT_OPTIONS,
|
|
72
|
-
editSummary: s,
|
|
73
|
-
editMinor: d,
|
|
74
|
-
...e
|
|
75
|
-
};
|
|
76
|
-
n.editSummary || (n.editSummary = await this.ctx.preferences.get("quickEdit.editSummary") || ""), n || this.ctx.emit("quick-edit/init-options", { ctx: this.ctx, options: n });
|
|
77
|
-
const r = this.ctx.modal.createObject({
|
|
78
|
-
className: "ipe-quickEdit",
|
|
79
|
-
sizeClass: "large",
|
|
80
|
-
// backdrop: false,
|
|
81
|
-
// draggable: true,
|
|
82
|
-
center: !1,
|
|
83
|
-
outSideClose: c
|
|
84
|
-
}).init();
|
|
85
|
-
r.setTitle(
|
|
86
|
-
/* @__PURE__ */ i(b, { children: [
|
|
87
|
-
"Loading: ",
|
|
88
|
-
/* @__PURE__ */ i("u", { children: n.title })
|
|
89
|
-
] })
|
|
90
|
-
), r.setContent(
|
|
91
|
-
/* @__PURE__ */ i(
|
|
92
|
-
"section",
|
|
93
|
-
{
|
|
94
|
-
className: "ipe-quickEdit-loading",
|
|
95
|
-
style: {
|
|
96
|
-
height: "70vh",
|
|
97
|
-
display: "flex",
|
|
98
|
-
flexDirection: "column",
|
|
99
|
-
justifyContent: "center",
|
|
100
|
-
alignItems: "center"
|
|
101
|
-
},
|
|
102
|
-
children: /* @__PURE__ */ i(T, {})
|
|
103
|
-
}
|
|
104
|
-
)
|
|
105
|
-
), r.addButton({
|
|
106
|
-
side: "right",
|
|
107
|
-
type: "button",
|
|
108
|
-
className: "is-danger is-ghost",
|
|
109
|
-
label: "Cancel",
|
|
110
|
-
method() {
|
|
111
|
-
r.close();
|
|
112
|
-
}
|
|
113
|
-
}), r.show(), this.ctx.emit("quick-edit/show-modal", { ctx: this.ctx, modal: r, options: n });
|
|
114
|
-
let a;
|
|
115
|
-
try {
|
|
116
|
-
if (a = await this.getWikiPageFromPayload(n), a.pageInfo.special)
|
|
117
|
-
throw new Error("Special page is not editable");
|
|
118
|
-
} catch (o) {
|
|
119
|
-
r.off(r.Event.Close), r.close(), this.ctx.modal.notify("error", {
|
|
120
|
-
content: o instanceof Error ? o.message : String(o)
|
|
121
|
-
});
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
r.setTitle(
|
|
125
|
-
/* @__PURE__ */ i(b, { children: [
|
|
126
|
-
"Quick ",
|
|
127
|
-
a.pageInfo.pageid === 0 ? "Create" : "Edit",
|
|
128
|
-
":",
|
|
129
|
-
" ",
|
|
130
|
-
/* @__PURE__ */ i("u", { children: a.pageInfo.title })
|
|
131
|
-
] })
|
|
132
|
-
);
|
|
133
|
-
const u = [];
|
|
134
|
-
a.pageInfo.pageid === 0 && u.push(
|
|
135
|
-
/* @__PURE__ */ i(S, { title: "Attention", type: "important", children: /* @__PURE__ */ i("p", { children: "This page does not exist." }) })
|
|
136
|
-
), a.pageInfo.pageid && a.pageInfo.lastrevid !== a.revisions[0]?.revid && u.push(
|
|
137
|
-
/* @__PURE__ */ i(S, { title: "Attention", type: "warning", children: /* @__PURE__ */ i("p", { children: [
|
|
138
|
-
"You are editing a ",
|
|
139
|
-
/* @__PURE__ */ i("em", { children: "historical version" }),
|
|
140
|
-
"; the content is not the latest!"
|
|
141
|
-
] }) })
|
|
142
|
-
), this.ctx.emit("quick-edit/edit-notice", {
|
|
143
|
-
ctx: this.ctx,
|
|
144
|
-
options: n,
|
|
145
|
-
modal: r,
|
|
146
|
-
wikiPage: a,
|
|
147
|
-
editNotices: u
|
|
148
|
-
});
|
|
149
|
-
const p = /* @__PURE__ */ i("form", { className: "ipe-quickEdit__form", children: [
|
|
150
|
-
/* @__PURE__ */ i("div", { className: "ipe-quickEdit__notices", children: u }),
|
|
151
|
-
/* @__PURE__ */ i("div", { className: "ipe-quickEdit__content", children: /* @__PURE__ */ i("textarea", { className: "ipe-quickEdit__textarea", name: "text", id: "wpTextbox1", children: a.revisions[0]?.content || "" }) }),
|
|
152
|
-
/* @__PURE__ */ i(
|
|
153
|
-
"div",
|
|
154
|
-
{
|
|
155
|
-
class: "ipe-quickEdit__options",
|
|
156
|
-
style: {
|
|
157
|
-
display: "flex",
|
|
158
|
-
flexDirection: "column",
|
|
159
|
-
gap: "1rem",
|
|
160
|
-
marginTop: "1rem"
|
|
161
|
-
},
|
|
162
|
-
children: [
|
|
163
|
-
/* @__PURE__ */ i(F, { label: "Summary", id: "summary", name: "summary", value: n.editSummary }),
|
|
164
|
-
/* @__PURE__ */ i("div", { className: "ipe-input-box", children: [
|
|
165
|
-
/* @__PURE__ */ i("label", { htmlFor: "watchlist", style: { display: "block" }, children: "Watchlist" }),
|
|
166
|
-
/* @__PURE__ */ i("div", { style: { display: "flex", gap: "1rem" }, children: [
|
|
167
|
-
m.preferences,
|
|
168
|
-
m.nochange,
|
|
169
|
-
m.watch,
|
|
170
|
-
m.unwatch
|
|
171
|
-
].map((o) => /* @__PURE__ */ i(
|
|
172
|
-
O,
|
|
173
|
-
{
|
|
174
|
-
name: "watchlist",
|
|
175
|
-
value: o,
|
|
176
|
-
inputProps: { checked: l === o },
|
|
177
|
-
children: o
|
|
178
|
-
},
|
|
179
|
-
o
|
|
180
|
-
)) })
|
|
181
|
-
] }),
|
|
182
|
-
/* @__PURE__ */ i("div", { style: { display: "flex", gap: "1rem" }, children: [
|
|
183
|
-
/* @__PURE__ */ i(_, { name: "minor", id: "minor", checked: n.editMinor, children: "Minor edit" }),
|
|
184
|
-
/* @__PURE__ */ i(_, { name: "reloadAfterSave", id: "reloadAfterSave", checked: n.reloadAfterSave, children: "Reload after save" })
|
|
185
|
-
] })
|
|
186
|
-
]
|
|
187
|
-
}
|
|
188
|
-
),
|
|
189
|
-
!1
|
|
190
|
-
] });
|
|
191
|
-
r.setContent(p), r.addButton(
|
|
192
|
-
{
|
|
193
|
-
side: "left",
|
|
194
|
-
className: "is-primary submit-btn",
|
|
195
|
-
label: "Submit",
|
|
196
|
-
keyPress: await this.ctx.preferences.get("quickEdit.keyshortcut.save") || void 0,
|
|
197
|
-
method: () => {
|
|
198
|
-
const o = new FormData(p);
|
|
199
|
-
r.setLoadingState(!0), this.handleSubmit({
|
|
200
|
-
wikiPage: a,
|
|
201
|
-
text: o.get("text"),
|
|
202
|
-
summary: o.get("summary"),
|
|
203
|
-
minor: o.get("minor") === "on",
|
|
204
|
-
section: n.section,
|
|
205
|
-
createonly: a.pageid === 0,
|
|
206
|
-
watchlist: l
|
|
207
|
-
}).then(async () => {
|
|
208
|
-
r.setOptions({
|
|
209
|
-
beforeClose: E
|
|
210
|
-
}), r.close(), this.ctx.modal.notify("success", {
|
|
211
|
-
title: "Submission Successful",
|
|
212
|
-
content: "Your changes have been saved."
|
|
213
|
-
}), o.get("reloadAfterSave") && (await j(500), location.reload());
|
|
214
|
-
}).catch((f) => {
|
|
215
|
-
this.ctx.modal.notify("error", {
|
|
216
|
-
title: "Submission Error",
|
|
217
|
-
content: f instanceof Error ? f.message : String(f)
|
|
218
|
-
}), r.setLoadingState(!1);
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
0
|
|
223
|
-
), r.setOptions({
|
|
224
|
-
beforeClose: () => {
|
|
225
|
-
const o = a.revisions[0]?.content || "";
|
|
226
|
-
return (p.querySelector("textarea")?.value || "") === o ? !0 : (this.ctx.modal.confirm(
|
|
227
|
-
{
|
|
228
|
-
className: "is-primary",
|
|
229
|
-
title: "Unsaved Changes",
|
|
230
|
-
content: "All edit contents will be lost after closing the modal. Are you sure you want to close?",
|
|
231
|
-
center: !0,
|
|
232
|
-
okBtn: {
|
|
233
|
-
label: "Give Up",
|
|
234
|
-
className: "is-danger is-ghost"
|
|
235
|
-
},
|
|
236
|
-
cancelBtn: {
|
|
237
|
-
label: "Continue Editing",
|
|
238
|
-
className: "is-primary is-ghost"
|
|
239
|
-
}
|
|
240
|
-
},
|
|
241
|
-
(v) => (v && (r.setOptions({
|
|
242
|
-
beforeClose: E
|
|
243
|
-
}), r.close()), !0)
|
|
244
|
-
), !1);
|
|
245
|
-
}
|
|
246
|
-
}), this.ctx.emit("quick-edit/wiki-page", {
|
|
247
|
-
ctx: this.ctx,
|
|
248
|
-
options: n,
|
|
249
|
-
modal: r,
|
|
250
|
-
wikiPage: a
|
|
251
|
-
});
|
|
252
|
-
const g = (o) => p.querySelector("textarea")?.value === a.revisions[0]?.content ? !0 : (o.preventDefault(), "You have unsaved changes. Are you sure you want to leave?");
|
|
253
|
-
window.addEventListener("beforeunload", g), r.on(r.Event.Close, () => {
|
|
254
|
-
window.removeEventListener("beforeunload", g);
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
async handleSubmit(e) {
|
|
258
|
-
const c = e.wikiPage, l = e.summary || "", s = e.text || "", d = e.minor, n = e.createonly, r = e.watchlist, a = e.section;
|
|
259
|
-
return c.edit(
|
|
260
|
-
{
|
|
261
|
-
summary: l,
|
|
262
|
-
text: s,
|
|
263
|
-
watchlist: r,
|
|
264
|
-
section: a
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
minor: d,
|
|
268
|
-
createonly: n
|
|
269
|
-
}
|
|
270
|
-
);
|
|
271
|
-
}
|
|
272
|
-
async getWikiPageFromPayload(e) {
|
|
273
|
-
if (e.revision)
|
|
274
|
-
return this.ctx.wikiPage.newFromRevision(e.revision, e.section);
|
|
275
|
-
if (e.pageId)
|
|
276
|
-
return this.ctx.wikiPage.newFromPageId(e.pageId, e.section);
|
|
277
|
-
if (e.title)
|
|
278
|
-
return this.ctx.wikiPage.newFromTitle(e.title, !1, e.section);
|
|
279
|
-
throw new Error("Invalid payload");
|
|
280
|
-
}
|
|
281
|
-
injectToolbox(e) {
|
|
282
|
-
const c = this.ctx.wikiTitle.currentTitle, l = this.ctx.wiki.hasRight("edit") && c.getNamespaceId() >= 0;
|
|
283
|
-
e.toolbox.addButton({
|
|
284
|
-
id: "quick-edit",
|
|
285
|
-
group: "group1",
|
|
286
|
-
index: 0,
|
|
287
|
-
icon: /* @__PURE__ */ i(
|
|
288
|
-
"svg",
|
|
289
|
-
{
|
|
290
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
291
|
-
width: "24",
|
|
292
|
-
height: "24",
|
|
293
|
-
viewBox: "0 0 24 24",
|
|
294
|
-
fill: "none",
|
|
295
|
-
stroke: "currentColor",
|
|
296
|
-
"stroke-width": "2",
|
|
297
|
-
"stroke-linecap": "round",
|
|
298
|
-
"stroke-linejoin": "round",
|
|
299
|
-
class: "icon icon-tabler icons-tabler-outline icon-tabler-edit",
|
|
300
|
-
children: [
|
|
301
|
-
/* @__PURE__ */ i("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
302
|
-
/* @__PURE__ */ i("path", { d: "M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1" }),
|
|
303
|
-
/* @__PURE__ */ i("path", { d: "M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z" }),
|
|
304
|
-
/* @__PURE__ */ i("path", { d: "M16 5l3 3" })
|
|
305
|
-
]
|
|
306
|
-
}
|
|
307
|
-
),
|
|
308
|
-
buttonProps: {
|
|
309
|
-
disabled: !l
|
|
310
|
-
},
|
|
311
|
-
tooltip: l ? "Quick Edit" : "Not editable",
|
|
312
|
-
onClick: () => {
|
|
313
|
-
const s = new URLSearchParams(window.location.search).get("oldid");
|
|
314
|
-
this.showModal({
|
|
315
|
-
title: c.getPrefixedText(),
|
|
316
|
-
revision: s ? Number(s) : void 0
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
removeToolbox(e) {
|
|
322
|
-
e.toolbox.removeButton("quick-edit");
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
k = W(N);
|
|
326
|
-
w = G(k, 0, "PluginQuickEdit", I, w);
|
|
327
|
-
K(k, 1, w);
|
|
328
|
-
export {
|
|
329
|
-
w as PluginQuickEdit
|
|
330
|
-
};
|
|
331
|
-
//# sourceMappingURL=index-loWqosf7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-loWqosf7.js","sources":["../src/utils/sleep.ts","../src/plugins/quick-edit/index.tsx"],"sourcesContent":["export const sleep = (ms: number = 0) =>\r\n new Promise((resolve) => setTimeout(resolve, ms))\r\n","import { Inject, InPageEdit, Schema } from '@/InPageEdit'\nimport { IWikiPage } from '@/models/WikiPage'\nimport { WatchlistAction } from '@/models/WikiPage/types/WatchlistAction'\nimport { IPEModal } from '@/services/ModalService/IPEModal'\nimport { ReactNode } from 'jsx-dom'\nimport { makeCallable } from '@/utils/makeCallable.js'\n\ndeclare module '@/InPageEdit' {\n interface InPageEdit {\n quickEdit: PluginQuickEdit & {\n (...args: Parameters<PluginQuickEdit['showModal']>): ReturnType<PluginQuickEdit['showModal']>\n }\n }\n interface Events {\n 'quick-edit/init-options'(payload: Omit<QuickEditEventPayload, 'modal' | 'wikiPage'>): void\n 'quick-edit/show-modal'(payload: Omit<QuickEditEventPayload, 'wikiPage'>): void\n 'quick-edit/wiki-page'(payload: QuickEditEventPayload): void\n 'quick-edit/edit-notice'(payload: QuickEditEventPayload & { editNotices: ReactNode[] }): void\n }\n}\n\nexport interface QuickEditOptions {\n title: string\n pageId: number\n revision: number\n /**\n * - `undefined` for full article edit\n * - `0` for the first section\n * - `\"new\"` for a new section\n */\n section: number | 'new' | undefined\n editMinor: boolean\n editSummary: string\n createOnly: boolean\n reloadAfterSave: boolean\n}\n\nexport interface QuickEditEventPayload {\n ctx: InPageEdit\n options: QuickEditOptions\n modal: IPEModal\n wikiPage: IWikiPage\n}\n\nexport interface QuickEditSubmitPayload {\n wikiPage: IWikiPage\n text?: string\n summary?: string\n section?: number | 'new' | undefined\n minor?: boolean\n createonly?: boolean\n watchlist?: WatchlistAction\n}\n\n@Inject(['api', 'wikiPage', 'wikiTitle', 'wiki', 'modal', 'preferences'])\n@RegisterPreferences(\n Schema.object({\n 'quickEdit.editSummary': Schema.string()\n .description('Default edit summary for quick edits')\n .default('[IPE-NEXT] Quick edit'),\n 'quickEdit.editMinor': Schema.boolean()\n .description('Whether to mark the edit as minor')\n .default(false),\n 'quickEdit.outSideClose': Schema.boolean()\n .description('Whether to close the modal outside')\n .default(true),\n 'quickEdit.watchList': Schema.union([\n Schema.const(WatchlistAction.preferences).description('Follow my preferences'),\n Schema.const(WatchlistAction.nochange).description('Keep the current watchlist status'),\n Schema.const(WatchlistAction.watch).description('Add the page to watchlist'),\n Schema.const(WatchlistAction.unwatch).description('Remove the page from watchlist'),\n ])\n .description('Watchlist options')\n .default(WatchlistAction.preferences),\n 'quickEdit.keyshortcut.save': Schema.string()\n .default('ctrl-s')\n .description('save button key shortcut (blank to disable)'),\n })\n .description('Quick edit options')\n .extra('category', 'edit')\n)\nexport class PluginQuickEdit extends BasePlugin {\n private readonly DEFAULT_OPTIONS: QuickEditOptions = {\n title: '',\n pageId: 0,\n revision: 0,\n section: undefined,\n editMinor: false,\n editSummary: '',\n createOnly: false,\n reloadAfterSave: true,\n }\n\n constructor(public ctx: InPageEdit) {\n super(ctx, {}, 'quick-edit')\n this.ctx.root.set('quickEdit', makeCallable(this, 'showModal'))\n }\n\n protected start(): Promise<void> | void {\n this.ctx.inject(['toolbox'], (ctx) => {\n this.injectToolbox(ctx)\n ctx.on('dispose', () => {\n this.removeToolbox(ctx)\n })\n })\n }\n\n async showModal(payload?: string | Partial<QuickEditOptions>) {\n if (typeof payload === 'undefined') {\n payload = {}\n } else if (typeof payload === 'string') {\n payload = {\n title: payload,\n } as Partial<QuickEditOptions>\n }\n\n // @ts-expect-error legacy `page` option\n if (payload?.page) {\n // @ts-expect-error\n payload.title = payload.page\n // @ts-expect-error\n delete payload.page\n }\n\n if (!payload.title && !payload.pageId && !payload.revision) {\n this.logger.warn('None of the title, pageId or revision provided. Using defaults.')\n const searchParams = new URLSearchParams(window.location.search)\n payload = {\n ...payload,\n title: this.ctx.wikiTitle.currentTitle.getPrefixedDBKey(),\n revision: searchParams.has('oldid') ? Number(searchParams.get('oldid')) : undefined,\n pageId: searchParams.has('curid') ? Number(searchParams.get('curid')) : undefined,\n }\n }\n\n const outSideClose = (await this.ctx.preferences.get<boolean>('quickEdit.outSideClose'))!\n const watchList = (await this.ctx.preferences.get<WatchlistAction>('quickEdit.watchList'))!\n const editSummary =\n typeof payload.editSummary === 'string'\n ? payload.editSummary\n : (await this.ctx.preferences.get<string>('quickEdit.editSummary'))!\n const editMinor =\n typeof payload.editMinor === 'boolean'\n ? payload.editMinor\n : (await this.ctx.preferences.get<boolean>('quickEdit.editMinor'))!\n\n const options: QuickEditOptions = {\n ...this.DEFAULT_OPTIONS,\n editSummary,\n editMinor,\n ...payload,\n }\n if (!options.editSummary) {\n options.editSummary = (await this.ctx.preferences.get<string>('quickEdit.editSummary')) || ''\n }\n if (!options) this.ctx.emit('quick-edit/init-options', { ctx: this.ctx, options })\n\n const modal = this.ctx.modal\n .createObject({\n className: 'ipe-quickEdit',\n sizeClass: 'large',\n // backdrop: false,\n // draggable: true,\n center: false,\n outSideClose,\n })\n .init()\n modal.setTitle(\n (\n <>\n Loading: <u>{options.title}</u>\n </>\n ) as HTMLElement\n )\n modal.setContent(\n (\n <section\n className=\"ipe-quickEdit-loading\"\n style={{\n height: '70vh',\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <ProgressBar />\n </section>\n ) as HTMLElement\n )\n modal.addButton({\n side: 'right',\n type: 'button',\n className: 'is-danger is-ghost',\n label: 'Cancel',\n method() {\n modal.close()\n },\n })\n modal.show()\n this.ctx.emit('quick-edit/show-modal', { ctx: this.ctx, modal, options })\n\n let wikiPage: IWikiPage\n try {\n wikiPage = await this.getWikiPageFromPayload(options)\n if (wikiPage.pageInfo.special) {\n throw new Error('Special page is not editable')\n }\n } catch (e) {\n modal.off(modal.Event.Close)\n modal.close()\n this.ctx.modal.notify('error', {\n content: e instanceof Error ? e.message : String(e),\n })\n return\n }\n modal.setTitle(\n (\n <>\n Quick {wikiPage.pageInfo.pageid === 0 ? 'Create' : 'Edit'}:{' '}\n <u>{wikiPage.pageInfo.title}</u>\n </>\n ) as HTMLElement\n )\n\n const editNotices = [] as ReactNode[]\n // Page not exists\n if (wikiPage.pageInfo.pageid === 0) {\n editNotices.push(\n <MBox title=\"Attention\" type=\"important\">\n <p>This page does not exist.</p>\n </MBox>\n )\n }\n // Edit based on old revision\n if (wikiPage.pageInfo.pageid && wikiPage.pageInfo.lastrevid !== wikiPage.revisions[0]?.revid) {\n editNotices.push(\n <MBox title=\"Attention\" type=\"warning\">\n <p>\n You are editing a <em>historical version</em>; the content is not the latest!\n </p>\n </MBox>\n )\n }\n this.ctx.emit('quick-edit/edit-notice', {\n ctx: this.ctx,\n options,\n modal,\n wikiPage,\n editNotices,\n })\n\n const editForm = (\n <form className=\"ipe-quickEdit__form\">\n <div className=\"ipe-quickEdit__notices\">{editNotices}</div>\n <div className=\"ipe-quickEdit__content\">\n <textarea className=\"ipe-quickEdit__textarea\" name=\"text\" id=\"wpTextbox1\">\n {wikiPage.revisions[0]?.content || ''}\n </textarea>\n </div>\n <div\n class=\"ipe-quickEdit__options\"\n style={{\n display: 'flex',\n flexDirection: 'column',\n gap: '1rem',\n marginTop: '1rem',\n }}\n >\n <InputBox label=\"Summary\" id=\"summary\" name=\"summary\" value={options.editSummary} />\n <div className=\"ipe-input-box\">\n <label htmlFor=\"watchlist\" style={{ display: 'block' }}>\n Watchlist\n </label>\n <div style={{ display: 'flex', gap: '1rem' }}>\n {[\n WatchlistAction.preferences,\n WatchlistAction.nochange,\n WatchlistAction.watch,\n WatchlistAction.unwatch,\n ].map((action) => (\n <RadioBox\n key={action}\n name=\"watchlist\"\n value={action}\n inputProps={{ checked: watchList === action }}\n >\n {action}\n </RadioBox>\n ))}\n </div>\n </div>\n <div style={{ display: 'flex', gap: '1rem' }}>\n <CheckBox name=\"minor\" id=\"minor\" checked={options.editMinor}>\n Minor edit\n </CheckBox>\n <CheckBox name=\"reloadAfterSave\" id=\"reloadAfterSave\" checked={options.reloadAfterSave}>\n Reload after save\n </CheckBox>\n </div>\n </div>\n {/* Debug Info */}\n {import.meta.env.DEV && (\n <div className=\"debug\" style={{ marginTop: '1rem' }}>\n <details>\n <pre>{JSON.stringify(wikiPage.pageInfo, null, 2)}</pre>\n </details>\n </div>\n )}\n </form>\n ) as HTMLFormElement\n modal.setContent(editForm)\n // shamefully fix: make sure the submit button is always the first\n modal.addButton(\n {\n side: 'left',\n className: 'is-primary submit-btn',\n label: 'Submit',\n keyPress:\n (await this.ctx.preferences.get<string>('quickEdit.keyshortcut.save')) || undefined,\n method: () => {\n const formData = new FormData(editForm)\n console.info(wikiPage, editForm, {\n text: formData.get('text') as string,\n summary: formData.get('summary') as string,\n minor: formData.get('minor') === 'on',\n })\n modal.setLoadingState(true)\n this.handleSubmit({\n wikiPage,\n text: formData.get('text') as string,\n summary: formData.get('summary') as string,\n minor: formData.get('minor') === 'on',\n section: options.section,\n createonly: wikiPage.pageid === 0,\n watchlist: watchList,\n })\n .then(async () => {\n modal.setOptions({\n beforeClose: noop,\n })\n modal.close()\n this.ctx.modal.notify('success', {\n title: 'Submission Successful',\n content: 'Your changes have been saved.',\n })\n if (formData.get('reloadAfterSave')) {\n await sleep(500)\n location.reload()\n }\n })\n .catch((error) => {\n this.ctx.modal.notify('error', {\n title: 'Submission Error',\n content: error instanceof Error ? error.message : String(error),\n })\n modal.setLoadingState(false)\n })\n },\n },\n 0\n )\n modal.setOptions({\n beforeClose: () => {\n const oldStr = wikiPage.revisions[0]?.content || ''\n const newStr = editForm.querySelector('textarea')?.value || ''\n if (newStr === oldStr) {\n return true\n } else {\n this.ctx.modal.confirm(\n {\n className: 'is-primary',\n title: 'Unsaved Changes',\n content:\n 'All edit contents will be lost after closing the modal. Are you sure you want to close?',\n center: true,\n okBtn: {\n label: 'Give Up',\n className: 'is-danger is-ghost',\n },\n cancelBtn: {\n label: 'Continue Editing',\n className: 'is-primary is-ghost',\n },\n },\n (confirmed) => {\n if (confirmed) {\n modal.setOptions({\n beforeClose: noop,\n })\n modal.close()\n }\n return true\n }\n )\n return false\n }\n },\n })\n this.ctx.emit('quick-edit/wiki-page', {\n ctx: this.ctx,\n options,\n modal,\n wikiPage,\n })\n\n const beforeUnload = (e: BeforeUnloadEvent) => {\n if (editForm.querySelector('textarea')?.value === wikiPage.revisions[0]?.content) {\n return true\n }\n e.preventDefault()\n return 'You have unsaved changes. Are you sure you want to leave?'\n }\n window.addEventListener('beforeunload', beforeUnload)\n modal.on(modal.Event.Close, () => {\n window.removeEventListener('beforeunload', beforeUnload)\n })\n }\n\n async handleSubmit(payload: QuickEditSubmitPayload) {\n const wikiPage = payload.wikiPage\n const summary = payload.summary || ''\n const text = payload.text || ''\n const minor = payload.minor\n const createonly = payload.createonly\n const watchlist = payload.watchlist\n const section = payload.section\n\n return wikiPage.edit(\n {\n summary,\n text,\n watchlist,\n section,\n },\n {\n minor,\n createonly,\n }\n )\n }\n\n async getWikiPageFromPayload(payload: Partial<QuickEditOptions>) {\n if (payload.revision) {\n return this.ctx.wikiPage.newFromRevision(payload.revision, payload.section)\n } else if (payload.pageId) {\n return this.ctx.wikiPage.newFromPageId(payload.pageId, payload.section)\n } else if (payload.title) {\n return this.ctx.wikiPage.newFromTitle(payload.title, false, payload.section)\n }\n throw new Error('Invalid payload')\n }\n\n private injectToolbox(ctx: InPageEdit) {\n const title = this.ctx.wikiTitle.currentTitle\n const canEdit = this.ctx.wiki.hasRight('edit') && title.getNamespaceId() >= 0\n ctx.toolbox.addButton({\n id: 'quick-edit',\n group: 'group1',\n index: 0,\n icon: (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"icon icon-tabler icons-tabler-outline icon-tabler-edit\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1\" />\n <path d=\"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z\" />\n <path d=\"M16 5l3 3\" />\n </svg>\n ) as HTMLElement,\n buttonProps: {\n disabled: !canEdit,\n },\n tooltip: canEdit ? 'Quick Edit' : 'Not editable',\n onClick: () => {\n const revision = new URLSearchParams(window.location.search).get('oldid')\n this.showModal({\n title: title.getPrefixedText(),\n revision: revision ? Number(revision) : undefined,\n })\n },\n })\n }\n\n protected removeToolbox(ctx: InPageEdit) {\n ctx.toolbox.removeButton('quick-edit')\n }\n}\n"],"names":["sleep","ms","resolve","_PluginQuickEdit_decorators","_init","_a","Inject","RegisterPreferences","Schema","WatchlistAction","PluginQuickEdit","BasePlugin","ctx","makeCallable","payload","searchParams","outSideClose","watchList","editSummary","editMinor","options","modal","jsxs","Fragment","jsx","ProgressBar","wikiPage","e","editNotices","MBox","editForm","InputBox","action","RadioBox","CheckBox","formData","noop","error","oldStr","confirmed","beforeUnload","summary","text","minor","createonly","watchlist","section","title","canEdit","revision","__decoratorStart","__decorateElement","__runInitializers"],"mappings":";;;;;;;;;AAAO,MAAMA,IAAQ,CAACC,IAAa,MACjC,IAAI,QAAQ,CAACC,MAAY,WAAWA,GAASD,CAAE,CAAC;;;;;;;;;;;;GCDlDE,GAAAC,GAAAC;AAsDAF,IAAA,CAACG,EAAO,CAAC,OAAO,YAAY,aAAa,QAAQ,SAAS,aAAa,CAAC,GACvEC;AAAA,EACCC,EAAO,OAAO;AA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aAAa,YAAY;AAAA,EACvC;AACF;AA/ZOR,IAAA8C,EAAA7C,CAAA;AAAMK,IAANyC,2BA3BPhD,GA2BaO,CAAA;AAAN0C,EAAAhD,GAAA,GAAMM,CAAA;"}
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
export type SsiModalSizeClass = 'dialog' | 'small' | 'smallToMedium' | 'medium' | 'mediumToLarge' | 'large' | 'full' | 'auto';
|
|
2
|
-
export type IPEModalAnimation = string | {
|
|
3
|
-
/** animation name when showing; set false to disable */
|
|
4
|
-
show?: string | false;
|
|
5
|
-
/** animation name when hiding; set false to disable */
|
|
6
|
-
hide?: string | false;
|
|
7
|
-
} | false;
|
|
8
|
-
export type AnyContent = string | Node | any;
|
|
9
|
-
export interface IPEModalButtonOptions {
|
|
10
|
-
/** Button label content (text node by default; not parsed as HTML). */
|
|
11
|
-
label: AnyContent;
|
|
12
|
-
/** Render as <button> (default) or <a>. */
|
|
13
|
-
type?: 'button' | 'link';
|
|
14
|
-
/** Extra class names. */
|
|
15
|
-
className?: string;
|
|
16
|
-
/** Enable the button after N ms; set false to skip. */
|
|
17
|
-
enableAfter?: number | false;
|
|
18
|
-
/** Element id attribute. */
|
|
19
|
-
id?: string;
|
|
20
|
-
/** Click handler; `this` is the element; receives mouse event and modal instance. */
|
|
21
|
-
method?: (this: HTMLButtonElement | HTMLAnchorElement, event: MouseEvent, modal: IPEModal) => void;
|
|
22
|
-
/** Button group side within footer. */
|
|
23
|
-
side?: 'left' | 'right';
|
|
24
|
-
/** Keyboard shortcut for this button (e.g. 'Enter' | 'Escape' | 'y'). */
|
|
25
|
-
keyPress?: string;
|
|
26
|
-
/** Close modal after N ms once the button is clicked; set false to skip. */
|
|
27
|
-
closeAfter?: number | false;
|
|
28
|
-
/** Only for type:'link'. */
|
|
29
|
-
href?: string;
|
|
30
|
-
}
|
|
31
|
-
export interface IPEModalOptions {
|
|
32
|
-
/** Extra class names applied to the window element. */
|
|
33
|
-
className?: string;
|
|
34
|
-
/** Predefined size class. */
|
|
35
|
-
sizeClass?: SsiModalSizeClass;
|
|
36
|
-
/** Center the modal (adds .is-centered on host). */
|
|
37
|
-
center?: boolean;
|
|
38
|
-
/** Keep a fixed height (px) or enable fixed-height mode; layout via CSS. */
|
|
39
|
-
fixedHeight?: boolean | number;
|
|
40
|
-
/** Fullscreen layout helper. */
|
|
41
|
-
fitScreen?: boolean;
|
|
42
|
-
/** Render icon-style buttons in header (styling only). */
|
|
43
|
-
iconButtons?: boolean;
|
|
44
|
-
/** Show close (×) icon in header. */
|
|
45
|
-
closeIcon?: boolean;
|
|
46
|
-
title?: AnyContent;
|
|
47
|
-
content?: AnyContent;
|
|
48
|
-
buttons?: Partial<IPEModalButtonOptions>[];
|
|
49
|
-
/**
|
|
50
|
-
* Backdrop behavior:
|
|
51
|
-
* - true (default): dedicated backdrop per modal
|
|
52
|
-
* - 'shared' or 'byKindShared': reserved for external coordination
|
|
53
|
-
* - false: no backdrop (floating window)
|
|
54
|
-
*/
|
|
55
|
-
backdrop?: boolean | 'shared' | 'byKindShared';
|
|
56
|
-
/**
|
|
57
|
-
* Close when clicking on the backdrop. Ignored when `backdrop === false`.
|
|
58
|
-
*/
|
|
59
|
-
outSideClose?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Allow body scrolling while the modal is open. Default: **false** (lock scroll).
|
|
62
|
-
*/
|
|
63
|
-
bodyScroll?: boolean;
|
|
64
|
-
/** Stack behavior placeholder (kept for parity). */
|
|
65
|
-
stack?: boolean;
|
|
66
|
-
/** Navigation placeholder (kept for parity). */
|
|
67
|
-
navigation?: boolean;
|
|
68
|
-
/** Enable drag only when `backdrop === false`. */
|
|
69
|
-
draggable?: boolean;
|
|
70
|
-
/** Window animation (or legacy `animation`). */
|
|
71
|
-
animation?: IPEModalAnimation;
|
|
72
|
-
/** Preferred: animation for modal window element. */
|
|
73
|
-
modalAnimation?: IPEModalAnimation;
|
|
74
|
-
/** Animation for backdrop element. */
|
|
75
|
-
backdropAnimation?: IPEModalAnimation;
|
|
76
|
-
/**
|
|
77
|
-
* Fallback duration (ms) used when CSS events are not observable.
|
|
78
|
-
*/
|
|
79
|
-
animationSpeed?: number;
|
|
80
|
-
/** Auto-close options. */
|
|
81
|
-
closeAfter?: {
|
|
82
|
-
/**
|
|
83
|
-
* Close the modal/toast after `time` ms. For toast: defaults to 3000ms.
|
|
84
|
-
*/
|
|
85
|
-
time: number;
|
|
86
|
-
/** Not used by library (reserved for UI display). */
|
|
87
|
-
displayTime?: number;
|
|
88
|
-
/** Reset countdown when hovered. */
|
|
89
|
-
resetOnHover?: boolean;
|
|
90
|
-
} | number;
|
|
91
|
-
/** Kept for parity; CSS controls actual layout. */
|
|
92
|
-
position?: 'right top' | 'right bottom' | 'left top' | 'left bottom' | 'center top' | 'center bottom';
|
|
93
|
-
/** Return false to cancel showing. */
|
|
94
|
-
beforeShow?: (modal: IPEModal) => boolean | void;
|
|
95
|
-
onShow?: (modal: IPEModal) => void;
|
|
96
|
-
/** Return false to cancel closing. */
|
|
97
|
-
beforeClose?: (modal: IPEModal) => boolean | void;
|
|
98
|
-
onClose?: (modal: IPEModal) => void;
|
|
99
|
-
/**
|
|
100
|
-
* Called when clicking the close icon. If a function returns false or value is `false`,
|
|
101
|
-
* the modal will NOT close. If value is `true` or omitted, it closes as usual.
|
|
102
|
-
*/
|
|
103
|
-
onClickClose?: boolean | ((modal: IPEModal) => boolean | void);
|
|
104
|
-
}
|
|
105
|
-
export type IPEModalNotifyType = 'default' | 'info' | 'success' | 'warning' | 'error' | 'confirm' | string;
|
|
106
|
-
export type IPEModalNotifyPosition = 'top right' | 'top left' | 'bottom right' | 'bottom left';
|
|
107
|
-
export declare enum IPEModalEvent {
|
|
108
|
-
Init = "modal.init",
|
|
109
|
-
BeforeShow = "modal.beforeShow",
|
|
110
|
-
Show = "modal.show",
|
|
111
|
-
BeforeClose = "modal.beforeClose",
|
|
112
|
-
Close = "modal.close",
|
|
113
|
-
Destroy = "modal.destroy",
|
|
114
|
-
ToastShow = "toast.show",
|
|
115
|
-
ToastClose = "toast.close"
|
|
116
|
-
}
|
|
117
|
-
export type IPEModalHook = (ev: CustomEvent<IPEModal>) => boolean | void;
|
|
118
|
-
declare global {
|
|
119
|
-
interface HTMLElementEventMap {
|
|
120
|
-
'modal.init': CustomEvent<IPEModal>;
|
|
121
|
-
'modal.beforeShow': CustomEvent<IPEModal>;
|
|
122
|
-
'modal.show': CustomEvent<IPEModal>;
|
|
123
|
-
'modal.beforeClose': CustomEvent<IPEModal>;
|
|
124
|
-
'modal.close': CustomEvent<IPEModal>;
|
|
125
|
-
'modal.destroy': CustomEvent<IPEModal>;
|
|
126
|
-
'toast.show': CustomEvent<IPEModal>;
|
|
127
|
-
'toast.close': CustomEvent<IPEModal>;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
export declare class IPEModal {
|
|
131
|
-
readonly backdropId: string;
|
|
132
|
-
readonly modalId: string;
|
|
133
|
-
readonly numberId: string;
|
|
134
|
-
private _isDestroyed;
|
|
135
|
-
get isDestroyed(): boolean;
|
|
136
|
-
options: IPEModalOptions;
|
|
137
|
-
/** Logical grouping for stack ops (e.g., 'toast'). */
|
|
138
|
-
pluginName: string;
|
|
139
|
-
private $backdrop?;
|
|
140
|
-
private $modal?;
|
|
141
|
-
private $window?;
|
|
142
|
-
private $header?;
|
|
143
|
-
private $title?;
|
|
144
|
-
private $icons?;
|
|
145
|
-
private $content?;
|
|
146
|
-
private $footer?;
|
|
147
|
-
private $buttonsLeft?;
|
|
148
|
-
private $buttonsRight?;
|
|
149
|
-
private buttonElsLeft;
|
|
150
|
-
private buttonElsRight;
|
|
151
|
-
private keyMap;
|
|
152
|
-
private isOpen;
|
|
153
|
-
private lastFocused?;
|
|
154
|
-
private closeTimer?;
|
|
155
|
-
private isToast;
|
|
156
|
-
private isDragging;
|
|
157
|
-
private dragStartX;
|
|
158
|
-
private dragStartY;
|
|
159
|
-
private modalStartX;
|
|
160
|
-
private modalStartY;
|
|
161
|
-
Event: typeof IPEModalEvent;
|
|
162
|
-
DEFAULT_OPTIONS: IPEModalOptions;
|
|
163
|
-
constructor(options?: Partial<IPEModalOptions>);
|
|
164
|
-
init(): this;
|
|
165
|
-
show(): this;
|
|
166
|
-
close(): this;
|
|
167
|
-
/** Immediately removes DOM and listeners */
|
|
168
|
-
destroy(): this;
|
|
169
|
-
get$backdrop(): HTMLDivElement | undefined;
|
|
170
|
-
get$modal(): HTMLDivElement;
|
|
171
|
-
get$window(): HTMLDivElement;
|
|
172
|
-
get$header(): HTMLDivElement;
|
|
173
|
-
get$title(): HTMLHeadingElement;
|
|
174
|
-
get$content(): HTMLDivElement;
|
|
175
|
-
get$icons(): HTMLDivElement;
|
|
176
|
-
get$buttons(type?: 'buttons' | 'leftButtons' | 'rightButtons'): HTMLDivElement;
|
|
177
|
-
setTitle(title: AnyContent): this;
|
|
178
|
-
setContent(content: AnyContent, method?: 'replace' | 'append' | 'prepend'): this;
|
|
179
|
-
setIcons(icons: {
|
|
180
|
-
className: string;
|
|
181
|
-
method: () => void;
|
|
182
|
-
}[]): this;
|
|
183
|
-
setButtons(buttons: Partial<IPEModalButtonOptions>[], area?: HTMLElement): this;
|
|
184
|
-
generateButton(opts: Partial<IPEModalButtonOptions>): HTMLButtonElement | HTMLAnchorElement;
|
|
185
|
-
/** Dynamically add button(s) into footer. Supports insertion index per side. */
|
|
186
|
-
addButton(opts: Partial<IPEModalButtonOptions>, index?: number): this;
|
|
187
|
-
/** Remove button by element / id / global index (left first, then right). */
|
|
188
|
-
removeButton(target: number | string | HTMLElement | '*'): this;
|
|
189
|
-
changePreviewState(): this;
|
|
190
|
-
setModalHeight(offset: number, option?: 'height' | 'min-height' | 'max-height'): number;
|
|
191
|
-
setOptions<T extends keyof IPEModalOptions>(option: T, value: IPEModalOptions[T]): this;
|
|
192
|
-
setOptions(options: Partial<IPEModalOptions>): this;
|
|
193
|
-
setPluginName(name: string): this;
|
|
194
|
-
private applyAnimation;
|
|
195
|
-
private _hooks;
|
|
196
|
-
on(type: IPEModalEvent, listener: IPEModalHook): () => this;
|
|
197
|
-
off(type: IPEModalEvent, listener?: IPEModalHook): this;
|
|
198
|
-
once(type: IPEModalEvent, listener: IPEModalHook): () => this;
|
|
199
|
-
private emit;
|
|
200
|
-
private focusFirst;
|
|
201
|
-
private onKeyDown;
|
|
202
|
-
private startCloseTimer;
|
|
203
|
-
private stopCloseTimer;
|
|
204
|
-
setZIndex(z: number): void;
|
|
205
|
-
/** Bring this modal to the top of the stack. */
|
|
206
|
-
bringToFront(): this;
|
|
207
|
-
private isAnimationDisabled;
|
|
208
|
-
private shouldLockBodyOnOpen;
|
|
209
|
-
private shouldUnlockBodyOnClose;
|
|
210
|
-
private onDragStart;
|
|
211
|
-
private onDragMove;
|
|
212
|
-
private onDragEnd;
|
|
213
|
-
/** Show as toast (no backdrop, container stack). */
|
|
214
|
-
showToast(options: Partial<{
|
|
215
|
-
position: IPEModalNotifyPosition;
|
|
216
|
-
}>): this;
|
|
217
|
-
static show(options: Partial<IPEModalOptions>, _element?: AnyContent): IPEModal;
|
|
218
|
-
static createObject(options: Partial<IPEModalOptions>, _element?: AnyContent): IPEModal;
|
|
219
|
-
static close(modalId?: string | HTMLElement): IPEModal | undefined;
|
|
220
|
-
static closeAll(group?: string | string[], except?: string | string[]): IPEModal;
|
|
221
|
-
static removeAll(): void;
|
|
222
|
-
static dialog(options: Partial<IPEModalOptions>, method: (e: MouseEvent, m: IPEModal) => void): IPEModal;
|
|
223
|
-
static confirm(options: Partial<IPEModalOptions> & Partial<{
|
|
224
|
-
okBtn: Pick<IPEModalButtonOptions, 'label' | 'className'>;
|
|
225
|
-
cancelBtn: Pick<IPEModalButtonOptions, 'label' | 'className'>;
|
|
226
|
-
}>, method: (e: MouseEvent, m: IPEModal) => void): IPEModal;
|
|
227
|
-
static getDefaultNotifyIcon(type: IPEModalNotifyType): import('jsx-dom').ReactElement | null;
|
|
228
|
-
static notify(type: IPEModalNotifyType, options: Partial<IPEModalOptions> & Partial<{
|
|
229
|
-
icon: string | Element;
|
|
230
|
-
okBtn: Pick<IPEModalButtonOptions, 'label' | 'className'>;
|
|
231
|
-
cancelBtn: Pick<IPEModalButtonOptions, 'label' | 'className'>;
|
|
232
|
-
overrideOther: boolean;
|
|
233
|
-
position: IPEModalNotifyPosition;
|
|
234
|
-
}>, callback?: (result: boolean) => void): IPEModal;
|
|
235
|
-
}
|