@inpageedit/core 0.5.2 → 0.5.3
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/Preferences-Bg3J5Ur9.js.map +1 -1
- package/dist/decorators/Preferences.d.ts +1 -1
- package/dist/{index-6bp2nmez.js → index-6pczvrx6.js} +2 -2
- package/dist/{index-6bp2nmez.js.map → index-6pczvrx6.js.map} +1 -1
- package/dist/{index-3FdvKxaN.js → index-7DsKuWsw.js} +52 -37
- package/dist/index-7DsKuWsw.js.map +1 -0
- package/dist/{index-DXvJqlhL.js → index-Bo7FhmY-.js} +3 -3
- package/dist/index-Bo7FhmY-.js.map +1 -0
- package/dist/{index-B0QzYk-q.js → index-C5nqZrGe.js} +1258 -1297
- package/dist/{index-B0QzYk-q.js.map → index-C5nqZrGe.js.map} +1 -1
- package/dist/{index-CIzmjtBz.js → index-CHb2WvLm.js} +1246 -1112
- package/dist/index-CHb2WvLm.js.map +1 -0
- package/dist/{index-DlE7PWxs.js → index-Cm67r8TX.js} +170 -140
- package/dist/index-Cm67r8TX.js.map +1 -0
- package/dist/{index-BwVAO_o4.js → index-DiCrCoWT.js} +6 -6
- package/dist/index-DiCrCoWT.js.map +1 -0
- package/dist/index-Dnu9H-Aq.js +128 -0
- package/dist/index-Dnu9H-Aq.js.map +1 -0
- package/dist/{index-D1plOuGc.js → index-Dz0VGQwY.js} +63 -63
- package/dist/{index-D1plOuGc.js.map → index-Dz0VGQwY.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/models/WikiPage/types/PageInfo.d.ts +2 -0
- package/dist/plugins/in-article-links/index.d.ts +6 -8
- package/dist/plugins/preferences/index.d.ts +5 -4
- package/dist/plugins/quick-edit/index.d.ts +8 -4
- package/dist/plugins/toolbox/index.d.ts +12 -2
- package/dist/services/ModalService/IPEModal.d.ts +4 -4
- package/dist/services/ModalService/index.d.ts +6 -14
- package/dist/services/SiteMetadataService.d.ts +3 -2
- package/dist/style.css +1 -1
- package/dist/utils/computeable.d.ts +2 -0
- package/dist/utils/makeCallable.d.ts +3 -0
- package/lib/index.umd.js +28 -28
- package/lib/index.umd.js.map +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/dist/index-3FdvKxaN.js.map +0 -1
- package/dist/index-BwVAO_o4.js.map +0 -1
- package/dist/index-CIzmjtBz.js.map +0 -1
- package/dist/index-DXvJqlhL.js.map +0 -1
- package/dist/index-DlE7PWxs.js.map +0 -1
- package/dist/index-DnpXoEP3.js +0 -142
- package/dist/index-DnpXoEP3.js.map +0 -1
- package/dist/sleep-DpyIipK-.js +0 -5
- package/dist/sleep-DpyIipK-.js.map +0 -1
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { B as
|
|
3
|
-
import { R as
|
|
4
|
-
import { R as
|
|
1
|
+
import { j as s, F as S, P as D } from "./index-CvhkVj_L.js";
|
|
2
|
+
import { B as I, a as C, S as m, W as g } from "./index-CHb2WvLm.js";
|
|
3
|
+
import { R as L } from "./Preferences-Bg3J5Ur9.js";
|
|
4
|
+
import { R as U, M as E } from "./RadioBox-CaA8VgLu.js";
|
|
5
5
|
import { I as z, C as P } from "./InputBox-FIzJ-rPN.js";
|
|
6
|
-
|
|
7
|
-
var W = Object.create, _ = Object.defineProperty, H = Object.getOwnPropertyDescriptor, N = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), $ = (t) => {
|
|
6
|
+
var Q = Object.create, _ = Object.defineProperty, W = Object.getOwnPropertyDescriptor, M = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), O = (t) => {
|
|
8
7
|
throw TypeError(t);
|
|
9
|
-
}, Y = (t, e,
|
|
10
|
-
for (var i = 0, a = t[e >> 1],
|
|
8
|
+
}, Y = (t, e, o) => e in t ? _(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o, H = (t, e) => _(t, "name", { value: e, configurable: !0 }), K = (t) => [, , , Q(t?.[M("metadata")] ?? null)], G = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], $ = (t) => t !== void 0 && typeof t != "function" ? O("Function expected") : t, X = (t, e, o, c, i) => ({ kind: G[t], name: e, metadata: c, addInitializer: (a) => o._ ? O("Already initialized") : i.push($(a || null)) }), J = (t, e) => Y(e, M("metadata"), t[3]), V = (t, e, o, c) => {
|
|
9
|
+
for (var i = 0, a = t[e >> 1], r = a && a.length; i < r; i++) a[i].call(o);
|
|
11
10
|
return c;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
for (var
|
|
16
|
-
l =
|
|
17
|
-
return
|
|
18
|
-
},
|
|
19
|
-
|
|
11
|
+
}, Z = (t, e, o, c, i, a) => {
|
|
12
|
+
var r, n, l, u = e & 7, p = !1, v = 0, d = t[v] || (t[v] = []), h = u && (i = i.prototype, u < 5 && (u > 3 || !p) && W(i, o));
|
|
13
|
+
H(i, o);
|
|
14
|
+
for (var f = c.length - 1; f >= 0; f--)
|
|
15
|
+
l = X(u, o, n = {}, t[3], d), r = (0, c[f])(i, l), n._ = 1, $(r) && (i = r);
|
|
16
|
+
return J(t, i), h && _(i, o, h), p ? u ^ 4 ? a : h : i;
|
|
17
|
+
}, q, x, N;
|
|
18
|
+
q = [C(["sitemeta", "quickEdit"]), L(
|
|
20
19
|
m.object({
|
|
21
20
|
redLinkEdit: m.boolean().description("Show quick edit entry after red links").default(!0)
|
|
22
21
|
}).description("In-article quick edit links"),
|
|
@@ -24,41 +23,41 @@ M = [q(["sitemeta", "quickEdit"]), C(
|
|
|
24
23
|
redLinkEdit: !0
|
|
25
24
|
}
|
|
26
25
|
)];
|
|
27
|
-
class w extends (
|
|
26
|
+
class w extends (N = I) {
|
|
28
27
|
constructor(e) {
|
|
29
|
-
const
|
|
28
|
+
const o = e.sitemeta.mwConfig, c = o.wgArticlePath.replace("$1", ""), i = `${location.protocol}//${o.wgServer.split("//")[1]}`;
|
|
30
29
|
super(
|
|
31
30
|
e,
|
|
32
31
|
{
|
|
33
32
|
wikiBaseUrl: i,
|
|
34
33
|
wikiArticlePath: c,
|
|
35
34
|
wikiArticleBaseUrl: `${i}${c}`,
|
|
36
|
-
wikiScriptBaseUrl: `${i}${
|
|
35
|
+
wikiScriptBaseUrl: `${i}${o.wgScriptPath}`,
|
|
37
36
|
linkClassName: "ipe-quickEdit__in-article-link"
|
|
38
37
|
},
|
|
39
38
|
"QuickEditInArticleLinks"
|
|
40
39
|
);
|
|
41
40
|
}
|
|
42
41
|
async start() {
|
|
43
|
-
mw.hook("wikipage.content").add(() => {
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
42
|
+
mw.hook("wikipage.content").add((e) => {
|
|
43
|
+
e.find("a[href]").toArray().forEach((c) => {
|
|
44
|
+
const i = this.checkEditAnchor(c);
|
|
45
|
+
if (!i || c.dataset.ipeQuickEditLink)
|
|
47
46
|
return;
|
|
48
|
-
const
|
|
47
|
+
const a = /* @__PURE__ */ s(
|
|
49
48
|
"a",
|
|
50
49
|
{
|
|
51
|
-
href: `#/IPE/quickEdit/${
|
|
50
|
+
href: `#/IPE/quickEdit/${i.title}`,
|
|
52
51
|
className: this.config.linkClassName,
|
|
53
52
|
style: {
|
|
54
53
|
userSelect: "none",
|
|
55
54
|
marginLeft: "0.2em",
|
|
56
55
|
verticalAlign: "middle"
|
|
57
56
|
},
|
|
58
|
-
onClick: (
|
|
59
|
-
|
|
57
|
+
onClick: (r) => {
|
|
58
|
+
r.preventDefault(), this.ctx.quickEdit.showModal(i);
|
|
60
59
|
},
|
|
61
|
-
children: /* @__PURE__ */
|
|
60
|
+
children: /* @__PURE__ */ s(
|
|
62
61
|
"svg",
|
|
63
62
|
{
|
|
64
63
|
style: "width: 1em; height: 1em",
|
|
@@ -73,16 +72,16 @@ class w extends (B = A) {
|
|
|
73
72
|
"stroke-linejoin": "round",
|
|
74
73
|
class: "icon icon-tabler icons-tabler-outline icon-tabler-pencil-bolt",
|
|
75
74
|
children: [
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ s("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
76
|
+
/* @__PURE__ */ s("path", { d: "M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4" }),
|
|
77
|
+
/* @__PURE__ */ s("path", { d: "M13.5 6.5l4 4" }),
|
|
78
|
+
/* @__PURE__ */ s("path", { d: "M19 16l-2 3h4l-2 3" })
|
|
80
79
|
]
|
|
81
80
|
}
|
|
82
81
|
)
|
|
83
82
|
}
|
|
84
83
|
);
|
|
85
|
-
|
|
84
|
+
c.insertAdjacentElement("afterend", a), c.dataset.ipeQuickEditLink = "true";
|
|
86
85
|
});
|
|
87
86
|
});
|
|
88
87
|
}
|
|
@@ -92,13 +91,13 @@ class w extends (B = A) {
|
|
|
92
91
|
checkEditAnchor(e) {
|
|
93
92
|
if (!(e instanceof HTMLAnchorElement))
|
|
94
93
|
return null;
|
|
95
|
-
const
|
|
96
|
-
if (!
|
|
94
|
+
const o = e.href || "";
|
|
95
|
+
if (!o.startsWith(this.config.wikiArticleBaseUrl) && !o.startsWith(this.config.wikiScriptBaseUrl))
|
|
97
96
|
return null;
|
|
98
|
-
const c = new URL(
|
|
97
|
+
const c = new URL(o), i = c.searchParams, a = i.get("action") || "view", r = i.get("title") || decodeURI(c.pathname.substring(this.config.wikiArticlePath.length)) || "", n = i.get("section")?.replace(/^T-/, "") || void 0, l = i.get("oldid");
|
|
99
98
|
if (
|
|
100
99
|
// 不合法的 title
|
|
101
|
-
!
|
|
100
|
+
!r || r.endsWith(".php") || // 不是 edit 相关操作
|
|
102
101
|
!["edit", "editsource", "editredlink", "submit"].includes(a) || // 暂时未兼容 undo
|
|
103
102
|
i.get("undo") || // 暂时未兼容 preload
|
|
104
103
|
i.get("preload")
|
|
@@ -106,50 +105,80 @@ class w extends (B = A) {
|
|
|
106
105
|
return null;
|
|
107
106
|
let u;
|
|
108
107
|
return n === "new" ? u = "new" : n && /^\d+$/.test(n) && (u = parseInt(n, 10)), {
|
|
109
|
-
title:
|
|
108
|
+
title: r,
|
|
110
109
|
section: u,
|
|
111
110
|
revision: parseInt("" + l, 10) || 0,
|
|
112
111
|
createOnly: !!i.get("redlink")
|
|
113
112
|
};
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
|
-
x =
|
|
117
|
-
w =
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
x = K(N);
|
|
116
|
+
w = Z(x, 0, "PluginQuickEditInArticleLinks", q, w);
|
|
117
|
+
V(x, 1, w);
|
|
118
|
+
const ee = Symbol("@@apply"), te = Symbol("@@ctor");
|
|
119
|
+
function ie(t, e) {
|
|
120
|
+
if (typeof t != "object" || t === null || Array.isArray(t))
|
|
121
|
+
throw new TypeError("instance is not an object");
|
|
122
|
+
const o = (...a) => {
|
|
123
|
+
const r = t[e];
|
|
124
|
+
if (typeof r != "function")
|
|
125
|
+
throw new TypeError(`Property "${String(e)}" is not a function`);
|
|
126
|
+
return r.apply(t, a);
|
|
127
|
+
};
|
|
128
|
+
o[ee] = o, o[te] = t;
|
|
129
|
+
const c = t?.constructor?.name;
|
|
130
|
+
return c && (o[Symbol.toStringTag] = c), new Proxy(o, {
|
|
131
|
+
get(a, r, n) {
|
|
132
|
+
return r === "prototype" ? Reflect.get(o, r, n) : Reflect.get(t, r, t);
|
|
133
|
+
},
|
|
134
|
+
set(a, r, n) {
|
|
135
|
+
return Reflect.set(t, r, n);
|
|
136
|
+
},
|
|
137
|
+
has(a, r) {
|
|
138
|
+
return Reflect.has(t, r);
|
|
139
|
+
},
|
|
140
|
+
deleteProperty(a, r) {
|
|
141
|
+
return Reflect.deleteProperty(t, r);
|
|
142
|
+
},
|
|
143
|
+
ownKeys() {
|
|
144
|
+
return Reflect.ownKeys(t);
|
|
145
|
+
},
|
|
146
|
+
getOwnPropertyDescriptor(a, r) {
|
|
147
|
+
return Object.getOwnPropertyDescriptor(t, r);
|
|
148
|
+
},
|
|
149
|
+
defineProperty(a, r, n) {
|
|
150
|
+
return Object.defineProperty(t, r, n);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
const A = () => {
|
|
155
|
+
}, re = (t = 0) => new Promise((e) => setTimeout(e, t));
|
|
156
|
+
var oe = Object.create, b = Object.defineProperty, ne = Object.getOwnPropertyDescriptor, B = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), T = (t) => {
|
|
122
157
|
throw TypeError(t);
|
|
123
|
-
},
|
|
124
|
-
for (var i = 0, a = t[e >> 1],
|
|
158
|
+
}, se = (t, e, o) => e in t ? b(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o, ce = (t, e) => b(t, "name", { value: e, configurable: !0 }), ae = (t) => [, , , oe(t?.[B("metadata")] ?? null)], le = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], j = (t) => t !== void 0 && typeof t != "function" ? T("Function expected") : t, de = (t, e, o, c, i) => ({ kind: le[t], name: e, metadata: c, addInitializer: (a) => o._ ? T("Already initialized") : i.push(j(a || null)) }), ue = (t, e) => se(e, B("metadata"), t[3]), he = (t, e, o, c) => {
|
|
159
|
+
for (var i = 0, a = t[e >> 1], r = a && a.length; i < r; i++) a[i].call(o);
|
|
125
160
|
return c;
|
|
126
|
-
},
|
|
127
|
-
var
|
|
128
|
-
|
|
129
|
-
for (var
|
|
130
|
-
l =
|
|
131
|
-
return
|
|
132
|
-
},
|
|
133
|
-
|
|
161
|
+
}, me = (t, e, o, c, i, a) => {
|
|
162
|
+
var r, n, l, u = e & 7, p = !1, v = 0, d = t[v] || (t[v] = []), h = u && (i = i.prototype, u < 5 && (u > 3 || !p) && ne(i, o));
|
|
163
|
+
ce(i, o);
|
|
164
|
+
for (var f = c.length - 1; f >= 0; f--)
|
|
165
|
+
l = de(u, o, n = {}, t[3], d), r = (0, c[f])(i, l), n._ = 1, j(r) && (i = r);
|
|
166
|
+
return ue(t, i), h && b(i, o, h), p ? u ^ 4 ? a : h : i;
|
|
167
|
+
}, R, y, F;
|
|
168
|
+
R = [C(["api", "wikiPage", "modal", "preferences"]), L(
|
|
134
169
|
m.object({
|
|
135
170
|
editSummary: m.string().description("Default edit summary for quick edits").default("[IPE-NEXT] Quick edit"),
|
|
136
171
|
editMinor: m.boolean().description("Whether to mark the edit as minor").default(!1),
|
|
137
172
|
outSideClose: m.boolean().description("Whether to close the modal outside").default(!0),
|
|
138
173
|
watchList: m.union([
|
|
139
|
-
m.const(
|
|
140
|
-
m.const(
|
|
141
|
-
m.const(
|
|
142
|
-
m.const(
|
|
143
|
-
]).description("Watchlist options").default(
|
|
144
|
-
}).description("Quick edit options").extra("category", "edit")
|
|
145
|
-
{
|
|
146
|
-
editSummary: "[IPE-NEXT] Quick edit",
|
|
147
|
-
editMinor: !1,
|
|
148
|
-
outSideClose: !0,
|
|
149
|
-
watchList: f.preferences
|
|
150
|
-
}
|
|
174
|
+
m.const(g.preferences).description("Follow my preferences"),
|
|
175
|
+
m.const(g.nochange).description("Keep the current watchlist status"),
|
|
176
|
+
m.const(g.watch).description("Add the page to watchlist"),
|
|
177
|
+
m.const(g.unwatch).description("Remove the page from watchlist")
|
|
178
|
+
]).description("Watchlist options").default(g.preferences)
|
|
179
|
+
}).description("Quick edit options").extra("category", "edit")
|
|
151
180
|
)];
|
|
152
|
-
class k extends (
|
|
181
|
+
class k extends (F = I) {
|
|
153
182
|
constructor(e) {
|
|
154
183
|
super(e, {}, "quick-edit"), this.ctx = e, this.DEFAULT_OPTIONS = {
|
|
155
184
|
title: "",
|
|
@@ -160,16 +189,16 @@ class k extends (U = A) {
|
|
|
160
189
|
editSummary: "",
|
|
161
190
|
createOnly: !1,
|
|
162
191
|
reloadAfterSave: !0
|
|
163
|
-
};
|
|
192
|
+
}, this.ctx.root.set("quickEdit", ie(this, "showModal"));
|
|
164
193
|
}
|
|
165
194
|
start() {
|
|
166
|
-
this.ctx.
|
|
195
|
+
this.ctx.inject(["toolbox"], (e) => {
|
|
167
196
|
this.injectToolbox(e), e.on("dispose", () => {
|
|
168
197
|
this.removeToolbox(e);
|
|
169
198
|
});
|
|
170
199
|
}), this.ctx.plugin(w);
|
|
171
200
|
}
|
|
172
|
-
async
|
|
201
|
+
async showModal(e) {
|
|
173
202
|
typeof e > "u" ? e = {} : typeof e == "string" && (e = {
|
|
174
203
|
title: e
|
|
175
204
|
}), e?.page && (e.title = e.page, delete e.page), !e.title && !e.pageId && !e.revision && (this.logger.warn("None of the title, pageId or revision provided. Using defaults."), e = {
|
|
@@ -178,28 +207,28 @@ class k extends (U = A) {
|
|
|
178
207
|
pageId: mw.config.get("wgArticleId"),
|
|
179
208
|
revision: mw.config.get("wgRevisionId")
|
|
180
209
|
});
|
|
181
|
-
const
|
|
210
|
+
const o = await this.ctx.preferences.get("outSideClose"), c = await this.ctx.preferences.get("watchList"), i = typeof e.editSummary == "string" ? e.editSummary : await this.ctx.preferences.get("editSummary"), a = typeof e.editMinor == "boolean" ? e.editMinor : await this.ctx.preferences.get("editMinor"), r = {
|
|
182
211
|
...this.DEFAULT_OPTIONS,
|
|
183
212
|
editSummary: i,
|
|
184
213
|
editMinor: a,
|
|
185
214
|
...e
|
|
186
215
|
};
|
|
187
|
-
|
|
216
|
+
r.editSummary || (r.editSummary = await this.ctx.preferences.get("editSummary") || ""), r || this.ctx.emit("quick-edit/init-options", { ctx: this.ctx, options: r });
|
|
188
217
|
const n = this.ctx.modal.createObject({
|
|
189
218
|
className: "ipe-quickEdit",
|
|
190
219
|
sizeClass: "large",
|
|
191
220
|
// backdrop: false,
|
|
192
221
|
// draggable: true,
|
|
193
222
|
center: !1,
|
|
194
|
-
outSideClose:
|
|
223
|
+
outSideClose: o
|
|
195
224
|
}).init();
|
|
196
225
|
n.setTitle(
|
|
197
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ s(S, { children: [
|
|
198
227
|
"Loading: ",
|
|
199
|
-
/* @__PURE__ */
|
|
228
|
+
/* @__PURE__ */ s("u", { children: r.title })
|
|
200
229
|
] })
|
|
201
230
|
), n.setContent(
|
|
202
|
-
/* @__PURE__ */
|
|
231
|
+
/* @__PURE__ */ s(
|
|
203
232
|
"section",
|
|
204
233
|
{
|
|
205
234
|
className: "ipe-quickEdit-loading",
|
|
@@ -210,7 +239,7 @@ class k extends (U = A) {
|
|
|
210
239
|
justifyContent: "center",
|
|
211
240
|
alignItems: "center"
|
|
212
241
|
},
|
|
213
|
-
children: /* @__PURE__ */
|
|
242
|
+
children: /* @__PURE__ */ s(D, {})
|
|
214
243
|
}
|
|
215
244
|
)
|
|
216
245
|
), n.addButton({
|
|
@@ -221,42 +250,42 @@ class k extends (U = A) {
|
|
|
221
250
|
method() {
|
|
222
251
|
n.close();
|
|
223
252
|
}
|
|
224
|
-
}), n.show(), this.ctx.emit("quick-edit/show-modal", { ctx: this.ctx, modal: n, options:
|
|
253
|
+
}), n.show(), this.ctx.emit("quick-edit/show-modal", { ctx: this.ctx, modal: n, options: r });
|
|
225
254
|
let l;
|
|
226
255
|
try {
|
|
227
|
-
l = await this.getWikiPageFromPayload(
|
|
256
|
+
if (l = await this.getWikiPageFromPayload(r), l.pageInfo.special)
|
|
257
|
+
throw new Error("Special page is not editable");
|
|
228
258
|
} catch (d) {
|
|
229
|
-
n.close(), this.ctx.modal.notify("error", {
|
|
230
|
-
title: "Error",
|
|
259
|
+
n.off(n.Event.Close), n.close(), this.ctx.modal.notify("error", {
|
|
231
260
|
content: d instanceof Error ? d.message : String(d)
|
|
232
261
|
});
|
|
233
262
|
return;
|
|
234
263
|
}
|
|
235
264
|
n.setTitle(
|
|
236
|
-
/* @__PURE__ */
|
|
265
|
+
/* @__PURE__ */ s(S, { children: [
|
|
237
266
|
"Quick ",
|
|
238
267
|
l.pageInfo.pageid === 0 ? "Create" : "Edit",
|
|
239
268
|
":",
|
|
240
269
|
" ",
|
|
241
|
-
/* @__PURE__ */
|
|
270
|
+
/* @__PURE__ */ s("u", { children: l.pageInfo.title })
|
|
242
271
|
] })
|
|
243
272
|
);
|
|
244
273
|
const u = [];
|
|
245
274
|
l.pageInfo.pageid === 0 && u.push(
|
|
246
|
-
/* @__PURE__ */
|
|
275
|
+
/* @__PURE__ */ s(E, { title: "Attention", type: "important", children: /* @__PURE__ */ s("p", { children: "This page does not exist." }) })
|
|
247
276
|
), l.pageInfo.pageid && l.pageInfo.lastrevid !== l.revisions[0]?.revid && u.push(
|
|
248
|
-
/* @__PURE__ */
|
|
277
|
+
/* @__PURE__ */ s(E, { title: "Attention", type: "warning", children: /* @__PURE__ */ s("p", { children: "You are editing a revision that is not the latest." }) })
|
|
249
278
|
), this.ctx.emit("quick-edit/edit-notice", {
|
|
250
279
|
ctx: this.ctx,
|
|
251
|
-
options:
|
|
280
|
+
options: r,
|
|
252
281
|
modal: n,
|
|
253
282
|
wikiPage: l,
|
|
254
283
|
editNotices: u
|
|
255
284
|
});
|
|
256
|
-
const p = /* @__PURE__ */
|
|
257
|
-
/* @__PURE__ */
|
|
258
|
-
/* @__PURE__ */
|
|
259
|
-
/* @__PURE__ */
|
|
285
|
+
const p = /* @__PURE__ */ s("form", { className: "ipe-quickEdit__form", children: [
|
|
286
|
+
/* @__PURE__ */ s("div", { className: "ipe-quickEdit__notices", children: u }),
|
|
287
|
+
/* @__PURE__ */ s("div", { className: "ipe-quickEdit__content", children: /* @__PURE__ */ s("textarea", { className: "ipe-quickEdit__textarea", name: "text", id: "wpTextbox1", children: l.revisions[0]?.content || "" }) }),
|
|
288
|
+
/* @__PURE__ */ s(
|
|
260
289
|
"div",
|
|
261
290
|
{
|
|
262
291
|
class: "ipe-quickEdit__options",
|
|
@@ -267,16 +296,16 @@ class k extends (U = A) {
|
|
|
267
296
|
marginTop: "1rem"
|
|
268
297
|
},
|
|
269
298
|
children: [
|
|
270
|
-
/* @__PURE__ */
|
|
271
|
-
/* @__PURE__ */
|
|
272
|
-
/* @__PURE__ */
|
|
273
|
-
/* @__PURE__ */
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
].map((d) => /* @__PURE__ */
|
|
279
|
-
|
|
299
|
+
/* @__PURE__ */ s(z, { label: "Summary", id: "summary", name: "summary", value: r.editSummary }),
|
|
300
|
+
/* @__PURE__ */ s("div", { className: "ipe-input-box", children: [
|
|
301
|
+
/* @__PURE__ */ s("label", { htmlFor: "watchlist", style: { display: "block" }, children: "Watchlist" }),
|
|
302
|
+
/* @__PURE__ */ s("div", { style: { display: "flex", gap: "1rem" }, children: [
|
|
303
|
+
g.preferences,
|
|
304
|
+
g.nochange,
|
|
305
|
+
g.watch,
|
|
306
|
+
g.unwatch
|
|
307
|
+
].map((d) => /* @__PURE__ */ s(
|
|
308
|
+
U,
|
|
280
309
|
{
|
|
281
310
|
name: "watchlist",
|
|
282
311
|
value: d,
|
|
@@ -286,9 +315,9 @@ class k extends (U = A) {
|
|
|
286
315
|
d
|
|
287
316
|
)) })
|
|
288
317
|
] }),
|
|
289
|
-
/* @__PURE__ */
|
|
290
|
-
/* @__PURE__ */
|
|
291
|
-
/* @__PURE__ */
|
|
318
|
+
/* @__PURE__ */ s("div", { style: { display: "flex", gap: "1rem" }, children: [
|
|
319
|
+
/* @__PURE__ */ s(P, { name: "minor", id: "minor", checked: r.editMinor, children: "Minor edit" }),
|
|
320
|
+
/* @__PURE__ */ s(P, { name: "reloadAfterSave", id: "reloadAfterSave", checked: r.reloadAfterSave, children: "Reload after save" })
|
|
292
321
|
] })
|
|
293
322
|
]
|
|
294
323
|
}
|
|
@@ -302,20 +331,21 @@ class k extends (U = A) {
|
|
|
302
331
|
label: "Submit",
|
|
303
332
|
method: () => {
|
|
304
333
|
const d = new FormData(p);
|
|
305
|
-
n.setLoadingState(!0), this.handleSubmit(
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
334
|
+
n.setLoadingState(!0), this.handleSubmit({
|
|
335
|
+
wikiPage: l,
|
|
336
|
+
text: d.get("text"),
|
|
337
|
+
summary: d.get("summary"),
|
|
338
|
+
minor: d.get("minor") === "on",
|
|
339
|
+
section: r.section,
|
|
340
|
+
createonly: l.pageid === 0,
|
|
341
|
+
watchlist: c
|
|
342
|
+
}).then(async () => {
|
|
313
343
|
n.setOptions({
|
|
314
|
-
beforeClose:
|
|
344
|
+
beforeClose: A
|
|
315
345
|
}), n.close(), this.ctx.modal.notify("success", {
|
|
316
346
|
title: "Submission Successful",
|
|
317
347
|
content: "Your changes have been saved."
|
|
318
|
-
}), d.get("reloadAfterSave") && (await
|
|
348
|
+
}), d.get("reloadAfterSave") && (await re(500), location.reload());
|
|
319
349
|
}).catch((h) => {
|
|
320
350
|
this.ctx.modal.notify("error", {
|
|
321
351
|
title: "Submission Error",
|
|
@@ -339,18 +369,18 @@ class k extends (U = A) {
|
|
|
339
369
|
className: "is-danger is-ghost"
|
|
340
370
|
},
|
|
341
371
|
cancelBtn: {
|
|
342
|
-
label: "Continue",
|
|
372
|
+
label: "Continue Editing",
|
|
343
373
|
className: "is-primary is-ghost"
|
|
344
374
|
}
|
|
345
375
|
},
|
|
346
|
-
(
|
|
347
|
-
beforeClose:
|
|
376
|
+
(f) => (f && (n.setOptions({
|
|
377
|
+
beforeClose: A
|
|
348
378
|
}), n.close()), !0)
|
|
349
379
|
), !1);
|
|
350
380
|
}
|
|
351
381
|
}), this.ctx.emit("quick-edit/wiki-page", {
|
|
352
382
|
ctx: this.ctx,
|
|
353
|
-
options:
|
|
383
|
+
options: r,
|
|
354
384
|
modal: n,
|
|
355
385
|
wikiPage: l
|
|
356
386
|
});
|
|
@@ -359,9 +389,9 @@ class k extends (U = A) {
|
|
|
359
389
|
window.removeEventListener("beforeunload", v);
|
|
360
390
|
});
|
|
361
391
|
}
|
|
362
|
-
handleSubmit(e
|
|
363
|
-
const c =
|
|
364
|
-
return
|
|
392
|
+
async handleSubmit(e) {
|
|
393
|
+
const o = e.wikiPage, c = e.summary || "", i = e.text || "", a = e.minor, r = e.createonly, n = e.watchlist, l = e.section;
|
|
394
|
+
return o.edit(
|
|
365
395
|
{
|
|
366
396
|
summary: c,
|
|
367
397
|
text: i,
|
|
@@ -370,16 +400,25 @@ class k extends (U = A) {
|
|
|
370
400
|
},
|
|
371
401
|
{
|
|
372
402
|
minor: a,
|
|
373
|
-
createonly:
|
|
403
|
+
createonly: r
|
|
374
404
|
}
|
|
375
405
|
);
|
|
376
406
|
}
|
|
407
|
+
async getWikiPageFromPayload(e) {
|
|
408
|
+
if (e.revision)
|
|
409
|
+
return this.ctx.wikiPage.newFromRevision(e.revision, e.section);
|
|
410
|
+
if (e.pageId)
|
|
411
|
+
return this.ctx.wikiPage.newFromPageId(e.pageId, e.section);
|
|
412
|
+
if (e.title)
|
|
413
|
+
return this.ctx.wikiPage.newFromTitle(e.title, !1, e.section);
|
|
414
|
+
throw new Error("Invalid payload");
|
|
415
|
+
}
|
|
377
416
|
injectToolbox(e) {
|
|
378
417
|
e.toolbox.addButton({
|
|
379
418
|
id: "quick-edit",
|
|
380
419
|
group: "group1",
|
|
381
420
|
index: 0,
|
|
382
|
-
icon: /* @__PURE__ */
|
|
421
|
+
icon: /* @__PURE__ */ s(
|
|
383
422
|
"svg",
|
|
384
423
|
{
|
|
385
424
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -393,36 +432,27 @@ class k extends (U = A) {
|
|
|
393
432
|
"stroke-linejoin": "round",
|
|
394
433
|
class: "icon icon-tabler icons-tabler-outline icon-tabler-edit",
|
|
395
434
|
children: [
|
|
396
|
-
/* @__PURE__ */
|
|
397
|
-
/* @__PURE__ */
|
|
398
|
-
/* @__PURE__ */
|
|
399
|
-
/* @__PURE__ */
|
|
435
|
+
/* @__PURE__ */ s("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
436
|
+
/* @__PURE__ */ s("path", { d: "M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1" }),
|
|
437
|
+
/* @__PURE__ */ s("path", { d: "M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z" }),
|
|
438
|
+
/* @__PURE__ */ s("path", { d: "M16 5l3 3" })
|
|
400
439
|
]
|
|
401
440
|
}
|
|
402
441
|
),
|
|
403
442
|
tooltip: "Edit this page quickly",
|
|
404
|
-
onClick: () => this.
|
|
443
|
+
onClick: () => this.showModal({
|
|
405
444
|
revision: mw.config.get("wgRevisionId")
|
|
406
445
|
})
|
|
407
446
|
});
|
|
408
447
|
}
|
|
409
|
-
async getWikiPageFromPayload(e) {
|
|
410
|
-
if (e.revision)
|
|
411
|
-
return this.ctx.wikiPage.newFromRevision(e.revision, e.section);
|
|
412
|
-
if (e.pageId)
|
|
413
|
-
return this.ctx.wikiPage.newFromPageId(e.pageId, e.section);
|
|
414
|
-
if (e.title)
|
|
415
|
-
return this.ctx.wikiPage.newFromTitle(e.title, !1, e.section);
|
|
416
|
-
throw new Error("Invalid payload");
|
|
417
|
-
}
|
|
418
448
|
removeToolbox(e) {
|
|
419
449
|
e.toolbox.removeButton("quick-edit");
|
|
420
450
|
}
|
|
421
451
|
}
|
|
422
|
-
|
|
423
|
-
k =
|
|
424
|
-
|
|
452
|
+
y = ae(F);
|
|
453
|
+
k = me(y, 0, "PluginQuickEdit", R, k);
|
|
454
|
+
he(y, 1, k);
|
|
425
455
|
export {
|
|
426
456
|
k as PluginQuickEdit
|
|
427
457
|
};
|
|
428
|
-
//# sourceMappingURL=index-
|
|
458
|
+
//# sourceMappingURL=index-Cm67r8TX.js.map
|