@inpageedit/core 0.5.0 → 0.5.2

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.
Files changed (34) hide show
  1. package/dist/{index-K73DMVec.js → index-3FdvKxaN.js} +5 -5
  2. package/dist/{index-K73DMVec.js.map → index-3FdvKxaN.js.map} +1 -1
  3. package/dist/{index-Bo1hNwWJ.js → index-6bp2nmez.js} +17 -17
  4. package/dist/index-6bp2nmez.js.map +1 -0
  5. package/dist/{index-z5MR2HJ2.js → index-B0QzYk-q.js} +301 -295
  6. package/dist/index-B0QzYk-q.js.map +1 -0
  7. package/dist/{index-jKU6cYcH.js → index-BwVAO_o4.js} +5 -5
  8. package/dist/{index-jKU6cYcH.js.map → index-BwVAO_o4.js.map} +1 -1
  9. package/dist/index-CIzmjtBz.js +5170 -0
  10. package/dist/index-CIzmjtBz.js.map +1 -0
  11. package/dist/{index-D3yG7jFv.js → index-D1plOuGc.js} +32 -32
  12. package/dist/{index-D3yG7jFv.js.map → index-D1plOuGc.js.map} +1 -1
  13. package/dist/{index-mMAGhnbR.js → index-DXvJqlhL.js} +2 -2
  14. package/dist/{index-mMAGhnbR.js.map → index-DXvJqlhL.js.map} +1 -1
  15. package/dist/{index-BxR7MsNM.js → index-DlE7PWxs.js} +145 -130
  16. package/dist/index-DlE7PWxs.js.map +1 -0
  17. package/dist/{index-CUXLgVhg.js → index-DnpXoEP3.js} +4 -4
  18. package/dist/{index-CUXLgVhg.js.map → index-DnpXoEP3.js.map} +1 -1
  19. package/dist/index.js +9 -5139
  20. package/dist/index.js.map +1 -1
  21. package/dist/models/WikiPage/index.d.ts +5 -4
  22. package/dist/plugins/BasePlugin.d.ts +12 -4
  23. package/dist/plugins/in-article-links/index.d.ts +31 -0
  24. package/dist/plugins/quick-edit/index.d.ts +7 -3
  25. package/dist/plugins/quick-preview/index.d.ts +2 -2
  26. package/dist/plugins/toolbox/index.d.ts +2 -2
  27. package/dist/style.css +1 -1
  28. package/lib/index.umd.js +32 -32
  29. package/lib/index.umd.js.map +1 -1
  30. package/lib/style.css +1 -1
  31. package/package.json +20 -19
  32. package/dist/index-Bo1hNwWJ.js.map +0 -1
  33. package/dist/index-BxR7MsNM.js.map +0 -1
  34. package/dist/index-z5MR2HJ2.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { j as e, P as l } from "./index-CvhkVj_L.js";
2
- import { BasePlugin as d } from "./index.js";
2
+ import { B as d } from "./index-CIzmjtBz.js";
3
3
  import { T as m } from "./index-Bh70Udzi.js";
4
4
  import { I as u, C as h } from "./InputBox-FIzJ-rPN.js";
5
5
  class v extends d {
@@ -155,4 +155,4 @@ class v extends d {
155
155
  export {
156
156
  v as PluginQuickRedirect
157
157
  };
158
- //# sourceMappingURL=index-mMAGhnbR.js.map
158
+ //# sourceMappingURL=index-DXvJqlhL.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-mMAGhnbR.js","sources":["../src/plugins/quick-redirect/index.tsx"],"sourcesContent":["import { InPageEdit } from '@/InPageEdit'\n\ndeclare module '@/InPageEdit' {\n interface InPageEdit {\n quickRedirect: PluginQuickRedirect['quickRedirect']\n redirectPage: PluginQuickRedirect['redirectPage']\n }\n}\n\nexport interface RedirectPageOptions {\n from: string\n to: string\n reason?: string\n overwrite?: boolean\n}\nexport interface QuickRedirectOptions extends Partial<RedirectPageOptions> {}\n\nexport class PluginQuickRedirect extends BasePlugin {\n static readonly inject = ['api', 'wikiPage', 'modal']\n\n constructor(public ctx: InPageEdit) {\n super(ctx, {}, 'quick-redirect')\n }\n\n protected start(): Promise<void> | void {\n this.ctx.set('quickRedirect', this.quickRedirect.bind(this))\n this.ctx.set('redirectPage', this.redirectPage.bind(this))\n\n const curPageName = window.mw?.config.get('wgPageName') || ''\n const canEdit = window.mw?.config.get('wgIsProbablyEditable')\n this.ctx.inject(['toolbox'], (ctx) => {\n this.ctx = ctx\n ctx.toolbox.addButton({\n id: 'quick-redirect',\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-file-symlink\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M4 21v-4a3 3 0 0 1 3 -3h5\" />\n <path d=\"M9 17l3 -3l-3 -3\" />\n <path d=\"M14 3v4a1 1 0 0 0 1 1h4\" />\n <path d=\"M5 11v-6a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-9.5\" />\n </svg>\n ) as HTMLElement,\n tooltip: 'Quick Redirect',\n group: 'group1',\n onClick: () => {\n this.quickRedirect(\n canEdit\n ? {\n to: curPageName,\n }\n : {}\n )\n },\n })\n this.addDisposeHandler((ctx) => {\n ctx.toolbox.removeButton('quick-redirect')\n })\n })\n }\n\n protected stop(): Promise<void> | void {}\n\n quickRedirect(options?: Partial<QuickRedirectOptions>) {\n const modal = this.ctx.modal\n .createObject({\n title: 'Quick Redirect',\n content: (<ProgressBar />) as HTMLElement,\n className: 'quick-redirect compact-buttons',\n sizeClass: 'medium',\n center: true,\n })\n .init()\n\n let formRef: HTMLFormElement | null = null\n modal.setContent(\n (\n <form\n ref={(el) => (formRef = el)}\n style={{\n display: 'flex',\n flexDirection: 'column',\n gap: '1rem',\n }}\n onSubmit={(e) => {\n e.preventDefault()\n formRef?.checkValidity()\n if (!formRef?.reportValidity()) {\n return\n }\n const formData = new FormData(formRef!)\n const options = {\n from: formData.get('from')?.toString().trim()!,\n to: formData.get('to')?.toString().trim()!,\n reason: (formData.get('reason') as string) || '',\n overwrite: formData.get('overwrite') === 'on',\n }\n if (!options.from || !options.to) {\n this.ctx.modal.notify('error', {\n title: 'Failed to redirect',\n content: 'From and to are required.',\n })\n return\n }\n modal.setLoadingState(true)\n this.redirectPage(options)\n .then((res) => {\n modal.close()\n this.ctx.modal.notify('success', {\n title: 'Redirect successful',\n content: 'The redirect has been created.',\n })\n })\n .catch((error) => {\n modal.setLoadingState(false)\n this.ctx.modal.notify('error', {\n title: 'Failed to redirect',\n content: error instanceof Error ? error.message : String(error),\n })\n })\n }}\n >\n <TwinSwapInput\n inputs={[\n {\n label: 'From',\n name: 'from',\n value: options?.from,\n required: true,\n },\n {\n label: 'To',\n name: 'to',\n value: options?.to,\n required: true,\n },\n ]}\n />\n <InputBox label=\"Reason\" id=\"reason\" name=\"reason\" value={options?.reason} />\n <div>\n <CheckBox name=\"overwrite\" id=\"overwrite\" checked={options?.overwrite}>\n Force create redirect even if the from page already exists\n </CheckBox>\n </div>\n </form>\n ) as HTMLFormElement\n )\n modal.setButtons([\n {\n label: 'Create Redirect',\n className: 'is-primary is-ghost',\n method: () => {\n formRef?.dispatchEvent(new Event('submit'))\n },\n },\n ])\n\n return modal.show()\n }\n\n async redirectPage(options: RedirectPageOptions) {\n const { from, to, reason = '', overwrite = false } = options\n const wikiPage = await this.ctx.wikiPage.newBlankPage({\n title: from,\n })\n const content = `#REDIRECT [[:${to}]]`\n const res = await wikiPage.edit(\n {\n text: content,\n summary: reason,\n },\n {\n createonly: !overwrite,\n }\n )\n if (res.data?.errors) {\n throw new Error(res.data.errors[0].text, { cause: res })\n }\n return res\n }\n}\n"],"names":["PluginQuickRedirect","BasePlugin","ctx","curPageName","canEdit","jsxs","jsx","options","modal","ProgressBar","formRef","el","e","formData","res","error","TwinSwapInput","InputBox","CheckBox","from","to","reason","overwrite","wikiPage","content"],"mappings":";;;;AAiBO,MAAMA,UAA4BC,EAAW;AAAA,EAGlD,YAAmBC,GAAiB;AAClC,UAAMA,GAAK,CAAA,GAAI,gBAAgB,GADd,KAAA,MAAAA;AAAA,EAEnB;AAAA,EAJA,OAAA;AAAA,SAAgB,SAAS,CAAC,OAAO,YAAY,OAAO;AAAA,EAAA;AAAA,EAM1C,QAA8B;AACtC,SAAK,IAAI,IAA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,EAAS;AAAA,MACzB;AAAA,QACE,MAAMC;AAAA,QACN,SAASH;AAAA,MAAA;AAAA,MAEX;AAAA,QACE,YAAY,CAACC;AAAA,MAAA;AAAA,IACf;AAEF,QAAIR,EAAI,MAAM;AACZ,YAAM,IAAI,MAAMA,EAAI,KAAK,OAAO,CAAC,EAAE,MAAM,EAAE,OAAOA,GAAK;AAEzD,WAAOA;AAAA,EACT;AACF;"}
1
+ {"version":3,"file":"index-DXvJqlhL.js","sources":["../src/plugins/quick-redirect/index.tsx"],"sourcesContent":["import { InPageEdit } from '@/InPageEdit'\n\ndeclare module '@/InPageEdit' {\n interface InPageEdit {\n quickRedirect: PluginQuickRedirect['quickRedirect']\n redirectPage: PluginQuickRedirect['redirectPage']\n }\n}\n\nexport interface RedirectPageOptions {\n from: string\n to: string\n reason?: string\n overwrite?: boolean\n}\nexport interface QuickRedirectOptions extends Partial<RedirectPageOptions> {}\n\nexport class PluginQuickRedirect extends BasePlugin {\n static readonly inject = ['api', 'wikiPage', 'modal']\n\n constructor(public ctx: InPageEdit) {\n super(ctx, {}, 'quick-redirect')\n }\n\n protected start(): Promise<void> | void {\n this.ctx.set('quickRedirect', this.quickRedirect.bind(this))\n this.ctx.set('redirectPage', this.redirectPage.bind(this))\n\n const curPageName = window.mw?.config.get('wgPageName') || ''\n const canEdit = window.mw?.config.get('wgIsProbablyEditable')\n this.ctx.inject(['toolbox'], (ctx) => {\n this.ctx = ctx\n ctx.toolbox.addButton({\n id: 'quick-redirect',\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-file-symlink\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M4 21v-4a3 3 0 0 1 3 -3h5\" />\n <path d=\"M9 17l3 -3l-3 -3\" />\n <path d=\"M14 3v4a1 1 0 0 0 1 1h4\" />\n <path d=\"M5 11v-6a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-9.5\" />\n </svg>\n ) as HTMLElement,\n tooltip: 'Quick Redirect',\n group: 'group1',\n onClick: () => {\n this.quickRedirect(\n canEdit\n ? {\n to: curPageName,\n }\n : {}\n )\n },\n })\n this.addDisposeHandler((ctx) => {\n ctx.toolbox.removeButton('quick-redirect')\n })\n })\n }\n\n protected stop(): Promise<void> | void {}\n\n quickRedirect(options?: Partial<QuickRedirectOptions>) {\n const modal = this.ctx.modal\n .createObject({\n title: 'Quick Redirect',\n content: (<ProgressBar />) as HTMLElement,\n className: 'quick-redirect compact-buttons',\n sizeClass: 'medium',\n center: true,\n })\n .init()\n\n let formRef: HTMLFormElement | null = null\n modal.setContent(\n (\n <form\n ref={(el) => (formRef = el)}\n style={{\n display: 'flex',\n flexDirection: 'column',\n gap: '1rem',\n }}\n onSubmit={(e) => {\n e.preventDefault()\n formRef?.checkValidity()\n if (!formRef?.reportValidity()) {\n return\n }\n const formData = new FormData(formRef!)\n const options = {\n from: formData.get('from')?.toString().trim()!,\n to: formData.get('to')?.toString().trim()!,\n reason: (formData.get('reason') as string) || '',\n overwrite: formData.get('overwrite') === 'on',\n }\n if (!options.from || !options.to) {\n this.ctx.modal.notify('error', {\n title: 'Failed to redirect',\n content: 'From and to are required.',\n })\n return\n }\n modal.setLoadingState(true)\n this.redirectPage(options)\n .then((res) => {\n modal.close()\n this.ctx.modal.notify('success', {\n title: 'Redirect successful',\n content: 'The redirect has been created.',\n })\n })\n .catch((error) => {\n modal.setLoadingState(false)\n this.ctx.modal.notify('error', {\n title: 'Failed to redirect',\n content: error instanceof Error ? error.message : String(error),\n })\n })\n }}\n >\n <TwinSwapInput\n inputs={[\n {\n label: 'From',\n name: 'from',\n value: options?.from,\n required: true,\n },\n {\n label: 'To',\n name: 'to',\n value: options?.to,\n required: true,\n },\n ]}\n />\n <InputBox label=\"Reason\" id=\"reason\" name=\"reason\" value={options?.reason} />\n <div>\n <CheckBox name=\"overwrite\" id=\"overwrite\" checked={options?.overwrite}>\n Force create redirect even if the from page already exists\n </CheckBox>\n </div>\n </form>\n ) as HTMLFormElement\n )\n modal.setButtons([\n {\n label: 'Create Redirect',\n className: 'is-primary is-ghost',\n method: () => {\n formRef?.dispatchEvent(new Event('submit'))\n },\n },\n ])\n\n return modal.show()\n }\n\n async redirectPage(options: RedirectPageOptions) {\n const { from, to, reason = '', overwrite = false } = options\n const wikiPage = await this.ctx.wikiPage.newBlankPage({\n title: from,\n })\n const content = `#REDIRECT [[:${to}]]`\n const res = await wikiPage.edit(\n {\n text: content,\n summary: reason,\n },\n {\n createonly: !overwrite,\n }\n )\n if (res.data?.errors) {\n throw new Error(res.data.errors[0].text, { cause: res })\n }\n return res\n }\n}\n"],"names":["PluginQuickRedirect","BasePlugin","ctx","curPageName","canEdit","jsxs","jsx","options","modal","ProgressBar","formRef","el","e","formData","res","error","TwinSwapInput","InputBox","CheckBox","from","to","reason","overwrite","wikiPage","content"],"mappings":";;;;AAiBO,MAAMA,UAA4BC,EAAW;AAAA,EAGlD,YAAmBC,GAAiB;AAClC,UAAMA,GAAK,CAAA,GAAI,gBAAgB,GADd,KAAA,MAAAA;AAAA,EAEnB;AAAA,EAJA,OAAA;AAAA,SAAgB,SAAS,CAAC,OAAO,YAAY,OAAO;AAAA,EAAA;AAAA,EAM1C,QAA8B;AACtC,SAAK,IAAI,IAAI,iBAAiB,KAAK,cAAc,KAAK,IAAI,CAAC,GAC3D,KAAK,IAAI,IAAI,gBAAgB,KAAK,aAAa,KAAK,IAAI,CAAC;AAEzD,UAAMC,IAAc,OAAO,IAAI,OAAO,IAAI,YAAY,KAAK,IACrDC,IAAU,OAAO,IAAI,OAAO,IAAI,sBAAsB;AAC5D,SAAK,IAAI,OAAO,CAAC,SAAS,GAAG,CAACF,MAAQ;AACpC,WAAK,MAAMA,G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
- import { j as s, F as E, P as U } from "./index-CvhkVj_L.js";
2
- import { BasePlugin as I, Inject as A, Schema as m } from "./index.js";
1
+ import { j as o, F as E, P as D } from "./index-CvhkVj_L.js";
2
+ import { B as A, a as q, S as m, W as f } from "./index-CIzmjtBz.js";
3
3
  import { R as C } from "./Preferences-Bg3J5Ur9.js";
4
- import { M as D, R as Q } from "./RadioBox-CaA8VgLu.js";
5
- import { I as z, C as y } from "./InputBox-FIzJ-rPN.js";
4
+ import { R as Q, M as y } from "./RadioBox-CaA8VgLu.js";
5
+ import { I as z, C as P } from "./InputBox-FIzJ-rPN.js";
6
6
  import { s as R } from "./sleep-DpyIipK-.js";
7
- var h = /* @__PURE__ */ ((t) => (t.preferences = "preferences", t.watch = "watch", t.unwatch = "unwatch", t.nochange = "nochange", t))(h || {}), W = Object.create, x = Object.defineProperty, H = Object.getOwnPropertyDescriptor, q = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), $ = (t) => {
7
+ var W = Object.create, _ = Object.defineProperty, H = Object.getOwnPropertyDescriptor, N = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), $ = (t) => {
8
8
  throw TypeError(t);
9
- }, X = (t, e, r) => e in t ? x(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Y = (t, e) => x(t, "name", { value: e, configurable: !0 }), G = (t) => [, , , W(t?.[q("metadata")] ?? null)], K = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], L = (t) => t !== void 0 && typeof t != "function" ? $("Function expected") : t, J = (t, e, r, a, i) => ({ kind: K[t], name: e, metadata: a, addInitializer: (c) => r._ ? $("Already initialized") : i.push(L(c || null)) }), V = (t, e) => X(e, q("metadata"), t[3]), Z = (t, e, r, a) => {
10
- for (var i = 0, c = t[e >> 1], o = c && c.length; i < o; i++) c[i].call(r);
11
- return a;
12
- }, ee = (t, e, r, a, i, c) => {
13
- var o, n, u, d = e & 7, p = !1, l = 0, g = t[l] || (t[l] = []), f = d && (i = i.prototype, d < 5 && (d > 3 || !p) && H(i, r));
14
- Y(i, r);
15
- for (var v = a.length - 1; v >= 0; v--)
16
- u = J(d, r, n = {}, t[3], g), o = (0, a[v])(i, u), n._ = 1, L(o) && (i = o);
17
- return V(t, i), f && x(i, r, f), p ? d ^ 4 ? c : f : i;
18
- }, M, _, N;
19
- M = [A(["sitemeta", "quickEdit"]), C(
9
+ }, Y = (t, e, r) => e in t ? _(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, X = (t, e) => _(t, "name", { value: e, configurable: !0 }), G = (t) => [, , , W(t?.[N("metadata")] ?? null)], K = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], L = (t) => t !== void 0 && typeof t != "function" ? $("Function expected") : t, J = (t, e, r, c, i) => ({ kind: K[t], name: e, metadata: c, addInitializer: (a) => r._ ? $("Already initialized") : i.push(L(a || null)) }), V = (t, e) => Y(e, N("metadata"), t[3]), Z = (t, e, r, c) => {
10
+ for (var i = 0, a = t[e >> 1], s = a && a.length; i < s; i++) a[i].call(r);
11
+ return c;
12
+ }, ee = (t, e, r, c, i, a) => {
13
+ var s, n, l, u = e & 7, p = !1, v = 0, d = t[v] || (t[v] = []), h = u && (i = i.prototype, u < 5 && (u > 3 || !p) && H(i, r));
14
+ X(i, r);
15
+ for (var g = c.length - 1; g >= 0; g--)
16
+ l = J(u, r, n = {}, t[3], d), s = (0, c[g])(i, l), n._ = 1, L(s) && (i = s);
17
+ return V(t, i), h && _(i, r, h), p ? u ^ 4 ? a : h : i;
18
+ }, M, x, B;
19
+ M = [q(["sitemeta", "quickEdit"]), C(
20
20
  m.object({
21
21
  redLinkEdit: m.boolean().description("Show quick edit entry after red links").default(!0)
22
22
  }).description("In-article quick edit links"),
@@ -24,15 +24,15 @@ M = [A(["sitemeta", "quickEdit"]), C(
24
24
  redLinkEdit: !0
25
25
  }
26
26
  )];
27
- class w extends (N = I) {
27
+ class w extends (B = A) {
28
28
  constructor(e) {
29
- const r = e.sitemeta.mwConfig, a = r.wgArticlePath.replace("$1", ""), i = `${location.protocol}//${r.wgServer.split("//")[1]}`;
29
+ const r = e.sitemeta.mwConfig, c = r.wgArticlePath.replace("$1", ""), i = `${location.protocol}//${r.wgServer.split("//")[1]}`;
30
30
  super(
31
31
  e,
32
32
  {
33
33
  wikiBaseUrl: i,
34
- wikiArticlePath: a,
35
- wikiArticleBaseUrl: `${i}${a}`,
34
+ wikiArticlePath: c,
35
+ wikiArticleBaseUrl: `${i}${c}`,
36
36
  wikiScriptBaseUrl: `${i}${r.wgScriptPath}`,
37
37
  linkClassName: "ipe-quickEdit__in-article-link"
38
38
  },
@@ -42,23 +42,23 @@ class w extends (N = I) {
42
42
  async start() {
43
43
  mw.hook("wikipage.content").add(() => {
44
44
  document.querySelectorAll("#mw-content-text a[href]").forEach((r) => {
45
- const a = this.checkEditAnchor(r);
46
- if (!a || r.dataset.ipeQuickEditLink)
45
+ const c = this.checkEditAnchor(r);
46
+ if (!c || r.dataset.ipeQuickEditLink)
47
47
  return;
48
- const i = /* @__PURE__ */ s(
48
+ const i = /* @__PURE__ */ o(
49
49
  "a",
50
50
  {
51
- href: `#/IPE/quickEdit/${a.title}`,
51
+ href: `#/IPE/quickEdit/${c.title}`,
52
52
  className: this.config.linkClassName,
53
53
  style: {
54
54
  userSelect: "none",
55
55
  marginLeft: "0.2em",
56
56
  verticalAlign: "middle"
57
57
  },
58
- onClick: (c) => {
59
- c.preventDefault(), this.ctx.quickEdit(a);
58
+ onClick: (a) => {
59
+ a.preventDefault(), this.ctx.quickEdit(c);
60
60
  },
61
- children: /* @__PURE__ */ s(
61
+ children: /* @__PURE__ */ o(
62
62
  "svg",
63
63
  {
64
64
  style: "width: 1em; height: 1em",
@@ -73,10 +73,10 @@ class w extends (N = I) {
73
73
  "stroke-linejoin": "round",
74
74
  class: "icon icon-tabler icons-tabler-outline icon-tabler-pencil-bolt",
75
75
  children: [
76
- /* @__PURE__ */ s("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
77
- /* @__PURE__ */ s("path", { d: "M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4" }),
78
- /* @__PURE__ */ s("path", { d: "M13.5 6.5l4 4" }),
79
- /* @__PURE__ */ s("path", { d: "M19 16l-2 3h4l-2 3" })
76
+ /* @__PURE__ */ o("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
77
+ /* @__PURE__ */ o("path", { d: "M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4" }),
78
+ /* @__PURE__ */ o("path", { d: "M13.5 6.5l4 4" }),
79
+ /* @__PURE__ */ o("path", { d: "M19 16l-2 3h4l-2 3" })
80
80
  ]
81
81
  }
82
82
  )
@@ -95,61 +95,61 @@ class w extends (N = I) {
95
95
  const r = e.href || "";
96
96
  if (!r.startsWith(this.config.wikiArticleBaseUrl) && !r.startsWith(this.config.wikiScriptBaseUrl))
97
97
  return null;
98
- const a = new URL(r), i = a.searchParams, c = i.get("action") || "view", o = i.get("title") || decodeURI(a.pathname.substring(this.config.wikiArticlePath.length)) || "", n = i.get("section")?.replace(/^T-/, "") || void 0, u = i.get("oldid");
98
+ const c = new URL(r), i = c.searchParams, a = i.get("action") || "view", s = i.get("title") || decodeURI(c.pathname.substring(this.config.wikiArticlePath.length)) || "", n = i.get("section")?.replace(/^T-/, "") || void 0, l = i.get("oldid");
99
99
  if (
100
100
  // 不合法的 title
101
- !o || o.endsWith(".php") || // 不是 edit 相关操作
102
- !["edit", "editsource", "editredlink", "submit"].includes(c) || // 暂时未兼容 undo
101
+ !s || s.endsWith(".php") || // 不是 edit 相关操作
102
+ !["edit", "editsource", "editredlink", "submit"].includes(a) || // 暂时未兼容 undo
103
103
  i.get("undo") || // 暂时未兼容 preload
104
104
  i.get("preload")
105
105
  )
106
106
  return null;
107
- let d;
108
- return n === "new" ? d = "new" : n && /^\d+$/.test(n) && (d = parseInt(n, 10)), {
109
- title: o,
110
- section: d,
111
- revision: parseInt("" + u, 10) || 0,
107
+ let u;
108
+ return n === "new" ? u = "new" : n && /^\d+$/.test(n) && (u = parseInt(n, 10)), {
109
+ title: s,
110
+ section: u,
111
+ revision: parseInt("" + l, 10) || 0,
112
112
  createOnly: !!i.get("redlink")
113
113
  };
114
114
  }
115
115
  }
116
- _ = G(N);
117
- w = ee(_, 0, "PluginQuickEditInArticleLinks", M, w);
118
- Z(_, 1, w);
119
- const P = () => {
116
+ x = G(B);
117
+ w = ee(x, 0, "PluginQuickEditInArticleLinks", M, w);
118
+ Z(x, 1, w);
119
+ const I = () => {
120
120
  };
121
121
  var te = Object.create, b = Object.defineProperty, ie = Object.getOwnPropertyDescriptor, O = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), T = (t) => {
122
122
  throw TypeError(t);
123
- }, re = (t, e, r) => e in t ? b(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ne = (t, e) => b(t, "name", { value: e, configurable: !0 }), oe = (t) => [, , , te(t?.[O("metadata")] ?? null)], se = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], B = (t) => t !== void 0 && typeof t != "function" ? T("Function expected") : t, ae = (t, e, r, a, i) => ({ kind: se[t], name: e, metadata: a, addInitializer: (c) => r._ ? T("Already initialized") : i.push(B(c || null)) }), ce = (t, e) => re(e, O("metadata"), t[3]), le = (t, e, r, a) => {
124
- for (var i = 0, c = t[e >> 1], o = c && c.length; i < o; i++) c[i].call(r);
125
- return a;
126
- }, de = (t, e, r, a, i, c) => {
127
- var o, n, u, d = e & 7, p = !1, l = 0, g = t[l] || (t[l] = []), f = d && (i = i.prototype, d < 5 && (d > 3 || !p) && ie(i, r));
123
+ }, re = (t, e, r) => e in t ? b(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ne = (t, e) => b(t, "name", { value: e, configurable: !0 }), oe = (t) => [, , , te(t?.[O("metadata")] ?? null)], se = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], j = (t) => t !== void 0 && typeof t != "function" ? T("Function expected") : t, ce = (t, e, r, c, i) => ({ kind: se[t], name: e, metadata: c, addInitializer: (a) => r._ ? T("Already initialized") : i.push(j(a || null)) }), ae = (t, e) => re(e, O("metadata"), t[3]), le = (t, e, r, c) => {
124
+ for (var i = 0, a = t[e >> 1], s = a && a.length; i < s; i++) a[i].call(r);
125
+ return c;
126
+ }, de = (t, e, r, c, i, a) => {
127
+ var s, n, l, u = e & 7, p = !1, v = 0, d = t[v] || (t[v] = []), h = u && (i = i.prototype, u < 5 && (u > 3 || !p) && ie(i, r));
128
128
  ne(i, r);
129
- for (var v = a.length - 1; v >= 0; v--)
130
- u = ae(d, r, n = {}, t[3], g), o = (0, a[v])(i, u), n._ = 1, B(o) && (i = o);
131
- return ce(t, i), f && b(i, r, f), p ? d ^ 4 ? c : f : i;
132
- }, j, S, F;
133
- j = [A(["api", "wikiPage", "modal", "preferences"]), C(
129
+ for (var g = c.length - 1; g >= 0; g--)
130
+ l = ce(u, r, n = {}, t[3], d), s = (0, c[g])(i, l), n._ = 1, j(s) && (i = s);
131
+ return ae(t, i), h && b(i, r, h), p ? u ^ 4 ? a : h : i;
132
+ }, F, S, U;
133
+ F = [q(["api", "wikiPage", "modal", "preferences"]), C(
134
134
  m.object({
135
135
  editSummary: m.string().description("Default edit summary for quick edits").default("[IPE-NEXT] Quick edit"),
136
136
  editMinor: m.boolean().description("Whether to mark the edit as minor").default(!1),
137
137
  outSideClose: m.boolean().description("Whether to close the modal outside").default(!0),
138
138
  watchList: m.union([
139
- m.const(h.preferences).description("Follow my preferences"),
140
- m.const(h.nochange).description("Keep the current watchlist status"),
141
- m.const(h.watch).description("Add the page to watchlist"),
142
- m.const(h.unwatch).description("Remove the page from watchlist")
143
- ]).description("Watchlist options").default(h.preferences)
139
+ m.const(f.preferences).description("Follow my preferences"),
140
+ m.const(f.nochange).description("Keep the current watchlist status"),
141
+ m.const(f.watch).description("Add the page to watchlist"),
142
+ m.const(f.unwatch).description("Remove the page from watchlist")
143
+ ]).description("Watchlist options").default(f.preferences)
144
144
  }).description("Quick edit options").extra("category", "edit"),
145
145
  {
146
146
  editSummary: "[IPE-NEXT] Quick edit",
147
147
  editMinor: !1,
148
148
  outSideClose: !0,
149
- watchList: h.preferences
149
+ watchList: f.preferences
150
150
  }
151
151
  )];
152
- class k extends (F = I) {
152
+ class k extends (U = A) {
153
153
  constructor(e) {
154
154
  super(e, {}, "quick-edit"), this.ctx = e, this.DEFAULT_OPTIONS = {
155
155
  title: "",
@@ -178,13 +178,13 @@ class k extends (F = I) {
178
178
  pageId: mw.config.get("wgArticleId"),
179
179
  revision: mw.config.get("wgRevisionId")
180
180
  });
181
- const r = await this.ctx.preferences.get("outSideClose"), a = await this.ctx.preferences.get("watchList"), i = typeof e.editSummary == "string" ? e.editSummary : await this.ctx.preferences.get("editSummary"), c = typeof e.editMinor == "boolean" ? e.editMinor : await this.ctx.preferences.get("editMinor"), o = {
181
+ const r = 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"), s = {
182
182
  ...this.DEFAULT_OPTIONS,
183
183
  editSummary: i,
184
- editMinor: c,
184
+ editMinor: a,
185
185
  ...e
186
186
  };
187
- o.editSummary || (o.editSummary = await this.ctx.preferences.get("editSummary") || ""), o || this.ctx.emit("quickEdit/initOptions", { ctx: this.ctx, options: o });
187
+ s.editSummary || (s.editSummary = await this.ctx.preferences.get("editSummary") || ""), s || this.ctx.emit("quick-edit/init-options", { ctx: this.ctx, options: s });
188
188
  const n = this.ctx.modal.createObject({
189
189
  className: "ipe-quickEdit",
190
190
  sizeClass: "large",
@@ -194,12 +194,12 @@ class k extends (F = I) {
194
194
  outSideClose: r
195
195
  }).init();
196
196
  n.setTitle(
197
- /* @__PURE__ */ s(E, { children: [
197
+ /* @__PURE__ */ o(E, { children: [
198
198
  "Loading: ",
199
- /* @__PURE__ */ s("u", { children: o.title })
199
+ /* @__PURE__ */ o("u", { children: s.title })
200
200
  ] })
201
201
  ), n.setContent(
202
- /* @__PURE__ */ s(
202
+ /* @__PURE__ */ o(
203
203
  "section",
204
204
  {
205
205
  className: "ipe-quickEdit-loading",
@@ -210,7 +210,7 @@ class k extends (F = I) {
210
210
  justifyContent: "center",
211
211
  alignItems: "center"
212
212
  },
213
- children: /* @__PURE__ */ s(U, {})
213
+ children: /* @__PURE__ */ o(D, {})
214
214
  }
215
215
  )
216
216
  ), n.addButton({
@@ -221,33 +221,45 @@ class k extends (F = I) {
221
221
  method() {
222
222
  n.close();
223
223
  }
224
- }), n.show(), this.ctx.emit("quickEdit/showModal", { ctx: this.ctx, modal: n, options: o });
225
- let u;
224
+ }), n.show(), this.ctx.emit("quick-edit/show-modal", { ctx: this.ctx, modal: n, options: s });
225
+ let l;
226
226
  try {
227
- u = await this.getWikiPageFromPayload(o);
228
- } catch (l) {
227
+ l = await this.getWikiPageFromPayload(s);
228
+ } catch (d) {
229
229
  n.close(), this.ctx.modal.notify("error", {
230
230
  title: "Error",
231
- content: l instanceof Error ? l.message : String(l)
231
+ content: d instanceof Error ? d.message : String(d)
232
232
  });
233
233
  return;
234
234
  }
235
235
  n.setTitle(
236
- /* @__PURE__ */ s(E, { children: [
236
+ /* @__PURE__ */ o(E, { children: [
237
237
  "Quick ",
238
- u.pageInfo.pageid === 0 ? "Create" : "Edit",
238
+ l.pageInfo.pageid === 0 ? "Create" : "Edit",
239
239
  ":",
240
240
  " ",
241
- /* @__PURE__ */ s("u", { children: u.pageInfo.title })
241
+ /* @__PURE__ */ o("u", { children: l.pageInfo.title })
242
242
  ] })
243
243
  );
244
- const d = /* @__PURE__ */ s("form", { className: "ipe-quickEdit-form", children: [
245
- u.pageInfo.pageid === 0 && /* @__PURE__ */ s(D, { title: "Attention", type: "important", children: /* @__PURE__ */ s("p", { children: "This page does not exist." }) }),
246
- /* @__PURE__ */ s("textarea", { className: "editArea", name: "text", id: "wpTextbox1", children: u.revisions[0]?.content || "" }),
247
- /* @__PURE__ */ s(
244
+ const u = [];
245
+ l.pageInfo.pageid === 0 && u.push(
246
+ /* @__PURE__ */ o(y, { title: "Attention", type: "important", children: /* @__PURE__ */ o("p", { children: "This page does not exist." }) })
247
+ ), l.pageInfo.pageid && l.pageInfo.lastrevid !== l.revisions[0]?.revid && u.push(
248
+ /* @__PURE__ */ o(y, { title: "Attention", type: "warning", children: /* @__PURE__ */ o("p", { children: "You are editing a revision that is not the latest." }) })
249
+ ), this.ctx.emit("quick-edit/edit-notice", {
250
+ ctx: this.ctx,
251
+ options: s,
252
+ modal: n,
253
+ wikiPage: l,
254
+ editNotices: u
255
+ });
256
+ const p = /* @__PURE__ */ o("form", { className: "ipe-quickEdit__form", children: [
257
+ /* @__PURE__ */ o("div", { className: "ipe-quickEdit__notices", children: u }),
258
+ /* @__PURE__ */ o("div", { className: "ipe-quickEdit__content", children: /* @__PURE__ */ o("textarea", { className: "ipe-quickEdit__textarea", name: "text", id: "wpTextbox1", children: l.revisions[0]?.content || "" }) }),
259
+ /* @__PURE__ */ o(
248
260
  "div",
249
261
  {
250
- class: "ipe-quickEdit-options",
262
+ class: "ipe-quickEdit__options",
251
263
  style: {
252
264
  display: "flex",
253
265
  flexDirection: "column",
@@ -255,59 +267,59 @@ class k extends (F = I) {
255
267
  marginTop: "1rem"
256
268
  },
257
269
  children: [
258
- /* @__PURE__ */ s(z, { label: "Summary", id: "summary", name: "summary", value: o.editSummary }),
259
- /* @__PURE__ */ s("div", { className: "ipe-input-box", children: [
260
- /* @__PURE__ */ s("label", { htmlFor: "watchlist", style: { display: "block" }, children: "Watchlist" }),
261
- /* @__PURE__ */ s("div", { style: { display: "flex", gap: "1rem" }, children: [
262
- h.preferences,
263
- h.nochange,
264
- h.watch,
265
- h.unwatch
266
- ].map((l) => /* @__PURE__ */ s(
270
+ /* @__PURE__ */ o(z, { label: "Summary", id: "summary", name: "summary", value: s.editSummary }),
271
+ /* @__PURE__ */ o("div", { className: "ipe-input-box", children: [
272
+ /* @__PURE__ */ o("label", { htmlFor: "watchlist", style: { display: "block" }, children: "Watchlist" }),
273
+ /* @__PURE__ */ o("div", { style: { display: "flex", gap: "1rem" }, children: [
274
+ f.preferences,
275
+ f.nochange,
276
+ f.watch,
277
+ f.unwatch
278
+ ].map((d) => /* @__PURE__ */ o(
267
279
  Q,
268
280
  {
269
281
  name: "watchlist",
270
- value: l,
271
- inputProps: { checked: a === l },
272
- children: l
282
+ value: d,
283
+ inputProps: { checked: c === d },
284
+ children: d
273
285
  },
274
- l
286
+ d
275
287
  )) })
276
288
  ] }),
277
- /* @__PURE__ */ s("div", { style: { display: "flex", gap: "1rem" }, children: [
278
- /* @__PURE__ */ s(y, { name: "minor", id: "minor", checked: o.editMinor, children: "Minor edit" }),
279
- /* @__PURE__ */ s(y, { name: "reloadAfterSave", id: "reloadAfterSave", checked: o.reloadAfterSave, children: "Reload after save" })
289
+ /* @__PURE__ */ o("div", { style: { display: "flex", gap: "1rem" }, children: [
290
+ /* @__PURE__ */ o(P, { name: "minor", id: "minor", checked: s.editMinor, children: "Minor edit" }),
291
+ /* @__PURE__ */ o(P, { name: "reloadAfterSave", id: "reloadAfterSave", checked: s.reloadAfterSave, children: "Reload after save" })
280
292
  ] })
281
293
  ]
282
294
  }
283
295
  ),
284
296
  !1
285
297
  ] });
286
- n.setContent(d), n.addButton(
298
+ n.setContent(p), n.addButton(
287
299
  {
288
300
  side: "left",
289
301
  className: "is-primary submit-btn",
290
302
  label: "Submit",
291
303
  method: () => {
292
- const l = new FormData(d);
304
+ const d = new FormData(p);
293
305
  n.setLoadingState(!0), this.handleSubmit(
294
- { ctx: this.ctx, modal: n, wikiPage: u, options: o },
306
+ { ctx: this.ctx, modal: n, wikiPage: l, options: s },
295
307
  {
296
- text: l.get("text"),
297
- summary: l.get("summary"),
298
- minor: l.get("minor") === "on"
308
+ text: d.get("text"),
309
+ summary: d.get("summary"),
310
+ minor: d.get("minor") === "on"
299
311
  }
300
312
  ).then(async () => {
301
313
  n.setOptions({
302
- beforeClose: P
314
+ beforeClose: I
303
315
  }), n.close(), this.ctx.modal.notify("success", {
304
316
  title: "Submission Successful",
305
317
  content: "Your changes have been saved."
306
- }), l.get("reloadAfterSave") && (await R(500), location.reload());
307
- }).catch((g) => {
318
+ }), d.get("reloadAfterSave") && (await R(500), location.reload());
319
+ }).catch((h) => {
308
320
  this.ctx.modal.notify("error", {
309
321
  title: "Submission Error",
310
- content: g instanceof Error ? g.message : String(g)
322
+ content: h instanceof Error ? h.message : String(h)
311
323
  }), n.setLoadingState(!1);
312
324
  });
313
325
  }
@@ -315,8 +327,8 @@ class k extends (F = I) {
315
327
  0
316
328
  ), n.setOptions({
317
329
  beforeClose: () => {
318
- const l = u.revisions[0]?.content || "";
319
- return (d.querySelector("textarea")?.value || "") === l ? !0 : (this.ctx.modal.confirm(
330
+ const d = l.revisions[0]?.content || "";
331
+ return (p.querySelector("textarea")?.value || "") === d ? !0 : (this.ctx.modal.confirm(
320
332
  {
321
333
  className: "is-primary",
322
334
  title: "Unsaved Changes",
@@ -331,33 +343,34 @@ class k extends (F = I) {
331
343
  className: "is-primary is-ghost"
332
344
  }
333
345
  },
334
- (f) => (f && (n.setOptions({
335
- beforeClose: P
346
+ (g) => (g && (n.setOptions({
347
+ beforeClose: I
336
348
  }), n.close()), !0)
337
349
  ), !1);
338
350
  }
339
- }), this.ctx.emit("quickEdit/wikiPage", {
351
+ }), this.ctx.emit("quick-edit/wiki-page", {
340
352
  ctx: this.ctx,
341
- options: o,
353
+ options: s,
342
354
  modal: n,
343
- wikiPage: u
355
+ wikiPage: l
344
356
  });
345
- const p = (l) => d.querySelector("textarea")?.value === u.revisions[0]?.content ? !0 : (l.preventDefault(), "You have unsaved changes. Are you sure you want to leave?");
346
- window.addEventListener("beforeunload", p), n.on(n.Event.Close, () => {
347
- window.removeEventListener("beforeunload", p);
357
+ const v = (d) => p.querySelector("textarea")?.value === l.revisions[0]?.content ? !0 : (d.preventDefault(), "You have unsaved changes. Are you sure you want to leave?");
358
+ window.addEventListener("beforeunload", v), n.on(n.Event.Close, () => {
359
+ window.removeEventListener("beforeunload", v);
348
360
  });
349
361
  }
350
362
  handleSubmit(e, r) {
351
- const a = r.summary || "", i = r.text || "", c = r.minor || !1, o = r.createonly || !1, n = r.watchlist || h.nochange;
363
+ const c = r.summary || "", i = r.text || "", a = r.minor || !1, s = r.createonly || !1, n = r.watchlist || f.nochange, l = e.options.section;
352
364
  return e.wikiPage.edit(
353
365
  {
354
- summary: a,
366
+ summary: c,
355
367
  text: i,
356
- watchlist: n
368
+ watchlist: n,
369
+ section: l
357
370
  },
358
371
  {
359
- minor: c,
360
- createonly: o
372
+ minor: a,
373
+ createonly: s
361
374
  }
362
375
  );
363
376
  }
@@ -366,7 +379,7 @@ class k extends (F = I) {
366
379
  id: "quick-edit",
367
380
  group: "group1",
368
381
  index: 0,
369
- icon: /* @__PURE__ */ s(
382
+ icon: /* @__PURE__ */ o(
370
383
  "svg",
371
384
  {
372
385
  xmlns: "http://www.w3.org/2000/svg",
@@ -380,15 +393,17 @@ class k extends (F = I) {
380
393
  "stroke-linejoin": "round",
381
394
  class: "icon icon-tabler icons-tabler-outline icon-tabler-edit",
382
395
  children: [
383
- /* @__PURE__ */ s("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
384
- /* @__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" }),
385
- /* @__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" }),
386
- /* @__PURE__ */ s("path", { d: "M16 5l3 3" })
396
+ /* @__PURE__ */ o("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
397
+ /* @__PURE__ */ o("path", { d: "M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1" }),
398
+ /* @__PURE__ */ o("path", { d: "M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z" }),
399
+ /* @__PURE__ */ o("path", { d: "M16 5l3 3" })
387
400
  ]
388
401
  }
389
402
  ),
390
403
  tooltip: "Edit this page quickly",
391
- onClick: () => this.quickEdit()
404
+ onClick: () => this.quickEdit({
405
+ revision: mw.config.get("wgRevisionId")
406
+ })
392
407
  });
393
408
  }
394
409
  async getWikiPageFromPayload(e) {
@@ -404,10 +419,10 @@ class k extends (F = I) {
404
419
  e.toolbox.removeButton("quick-edit");
405
420
  }
406
421
  }
407
- S = oe(F);
408
- k = de(S, 0, "PluginQuickEdit", j, k);
422
+ S = oe(U);
423
+ k = de(S, 0, "PluginQuickEdit", F, k);
409
424
  le(S, 1, k);
410
425
  export {
411
426
  k as PluginQuickEdit
412
427
  };
413
- //# sourceMappingURL=index-BxR7MsNM.js.map
428
+ //# sourceMappingURL=index-DlE7PWxs.js.map