@inpageedit/core 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/{IconQuickEdit-YVn1ANbm.js → IconQuickEdit-CAL1HXIb.js} +4 -4
  2. package/dist/IconQuickEdit-CAL1HXIb.js.map +1 -0
  3. package/dist/__test__/utils/constants.d.ts +2 -2
  4. package/dist/index-9M1QcjCN.js +354 -0
  5. package/dist/index-9M1QcjCN.js.map +1 -0
  6. package/dist/index-Ba7Wkale.js +127 -0
  7. package/dist/index-Ba7Wkale.js.map +1 -0
  8. package/dist/{index-1JtE4urY.js → index-C8dOYIIz.js} +63 -70
  9. package/dist/{index-1JtE4urY.js.map → index-C8dOYIIz.js.map} +1 -1
  10. package/dist/index-COlXHFRg.js +6326 -0
  11. package/dist/index-COlXHFRg.js.map +1 -0
  12. package/dist/{index-B3Bsg_nE.js → index-CeXR4lOu.js} +5 -5
  13. package/dist/{index-B3Bsg_nE.js.map → index-CeXR4lOu.js.map} +1 -1
  14. package/dist/index-DBV8FBjA.js +139 -0
  15. package/dist/index-DBV8FBjA.js.map +1 -0
  16. package/dist/{index-2AEdgbUL.js → index-DwyuBkCK.js} +3 -3
  17. package/dist/{index-2AEdgbUL.js.map → index-DwyuBkCK.js.map} +1 -1
  18. package/dist/{index-BCMwmSfQ.js → index-OBerV4GU.js} +76 -73
  19. package/dist/index-OBerV4GU.js.map +1 -0
  20. package/dist/{index-C0ci6Ll1.js → index-Tn22YSmW.js} +7 -7
  21. package/dist/index-Tn22YSmW.js.map +1 -0
  22. package/dist/index-kRdAN8h3.js +193 -0
  23. package/dist/index-kRdAN8h3.js.map +1 -0
  24. package/dist/{index-CrWxZ0yl.js → index-mntCdHRr.js} +3 -3
  25. package/dist/{index-CrWxZ0yl.js.map → index-mntCdHRr.js.map} +1 -1
  26. package/dist/index.js +1 -1
  27. package/dist/models/WikiPage/index.d.ts +42 -47
  28. package/dist/models/WikiTitle/index.d.ts +3 -2
  29. package/dist/plugins/in-article-links/index.d.ts +4 -34
  30. package/dist/plugins/quick-delete/index.d.ts +8 -6
  31. package/dist/plugins/quick-diff/PluginQuickDiffCore.d.ts +1 -1
  32. package/dist/plugins/quick-edit/index.d.ts +13 -11
  33. package/dist/plugins/quick-move/index.d.ts +3 -1
  34. package/dist/plugins/quick-preview/index.d.ts +13 -16
  35. package/dist/plugins/quick-redirect/index.d.ts +3 -1
  36. package/dist/plugins/toolbox/index.d.ts +7 -2
  37. package/dist/services/CurrentPageService.d.ts +27 -0
  38. package/dist/services/{ModalService/index.d.ts → ModalService.d.ts} +4 -4
  39. package/dist/services/{SiteMetadataService.d.ts → WikiMetadataService.d.ts} +36 -21
  40. package/dist/services/WikiPageService.d.ts +8 -7
  41. package/dist/services/WikiTitleService.d.ts +55 -3
  42. package/dist/style.css +1 -1
  43. package/dist/types/{SiteMetadata.d.ts → WikiMetadata.d.ts} +17 -17
  44. package/lib/index.umd.js +34 -35
  45. package/lib/index.umd.js.map +1 -1
  46. package/lib/style.css +1 -1
  47. package/package.json +8 -7
  48. package/dist/IconQuickEdit-YVn1ANbm.js.map +0 -1
  49. package/dist/index-2kN4SKmT.js +0 -116
  50. package/dist/index-2kN4SKmT.js.map +0 -1
  51. package/dist/index-BCMwmSfQ.js.map +0 -1
  52. package/dist/index-C0ci6Ll1.js.map +0 -1
  53. package/dist/index-CZnu6cRK.js +0 -319
  54. package/dist/index-CZnu6cRK.js.map +0 -1
  55. package/dist/index-CheNjwas.js +0 -128
  56. package/dist/index-CheNjwas.js.map +0 -1
  57. package/dist/index-DqfQ7hp6.js +0 -5626
  58. package/dist/index-DqfQ7hp6.js.map +0 -1
  59. package/dist/index-sfkutNHj.js +0 -201
  60. package/dist/index-sfkutNHj.js.map +0 -1
  61. package/dist/services/ModalService/IPEModal.d.ts +0 -235
@@ -1,201 +0,0 @@
1
- import { j as A } from "./index-CvhkVj_L.js";
2
- import { B as q, m as B, I as T, S as g } from "./index-DqfQ7hp6.js";
3
- import { R } from "./Preferences-Bg3J5Ur9.js";
4
- import { I as j } from "./IconQuickEdit-YVn1ANbm.js";
5
- var W = Object.create, v = Object.defineProperty, M = Object.getOwnPropertyDescriptor, I = (i, e) => (e = Symbol[i]) ? e : Symbol.for("Symbol." + i), P = (i) => {
6
- throw TypeError(i);
7
- }, U = (i, e, t) => e in i ? v(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, K = (i, e) => v(i, "name", { value: e, configurable: !0 }), C = (i) => [, , , W(i?.[I("metadata")] ?? null)], H = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], y = (i) => i !== void 0 && typeof i != "function" ? P("Function expected") : i, N = (i, e, t, n, s) => ({ kind: H[i], name: e, metadata: n, addInitializer: (l) => t._ ? P("Already initialized") : s.push(y(l || null)) }), O = (i, e) => U(e, I("metadata"), i[3]), F = (i, e, t, n) => {
8
- for (var s = 0, l = i[e >> 1], r = l && l.length; s < r; s++) l[s].call(t);
9
- return n;
10
- }, Q = (i, e, t, n, s, l) => {
11
- var r, a, o, d = e & 7, c = !1, f = 0, p = i[f] || (i[f] = []), k = d && (s = s.prototype, d < 5 && (d > 3 || !c) && M(s, t));
12
- K(s, t);
13
- for (var h = n.length - 1; h >= 0; h--)
14
- o = N(d, t, a = {}, i[3], p), r = (0, n[h])(s, o), a._ = 1, y(r) && (s = r);
15
- return O(i, s), k && v(s, t, k), c ? d ^ 4 ? l : k : s;
16
- }, x, w, L;
17
- x = [T(["sitemeta", "wikiTitle", "preferences"]), R(
18
- g.object({
19
- "inArticleLinks.enable": g.boolean().description("Whether to enable in-article links").default(!0),
20
- "inArticleLinks.quickDiff.enable": g.boolean().description("Whether to enable in-article links for quick diff").default(!0),
21
- "inArticleLinks.quickEdit.enable": g.boolean().description("Whether to enable in-article links for quick edit").default(!0),
22
- "inArticleLinks.quickEdit.redlinks": g.boolean().description("Whether to show quick edit button for redlinks").default(!0)
23
- }).description("In-article links preferences").extra("category", "in-article-links")
24
- )];
25
- let _ = class E extends (L = q) {
26
- constructor(e) {
27
- super(
28
- e,
29
- {
30
- wikiBaseUrl: e.sitemeta.baseUrl,
31
- wikiArticlePath: e.sitemeta.articlePath.replace("$1", ""),
32
- wikiArticleBaseUrl: e.sitemeta.articleBaseUrl.replace("$1", ""),
33
- wikiScriptBaseUrl: e.sitemeta.scriptBaseUrl,
34
- linkClassName: "ipe__in-article-link"
35
- },
36
- "InArticleLinks"
37
- ), this._cachedAnchorInfo = /* @__PURE__ */ new WeakMap(), this.ctx.set("inArticleLinks", this), this.ctx.preferences.defineCategory({
38
- label: "In Article Links",
39
- name: "in-article-links",
40
- description: "In-article links preferences",
41
- index: 9
42
- });
43
- }
44
- async start() {
45
- await this.ctx.preferences.get("inArticleLinks.quickEdit.enable") && this.handleQuickEdit(), await this.ctx.preferences.get("inArticleLinks.quickDiff.enable") && this.handleQuickDiff();
46
- }
47
- async stop() {
48
- }
49
- isWikiLink(e) {
50
- return e.startsWith(this.config.wikiArticleBaseUrl) || e.startsWith(this.config.wikiScriptBaseUrl + "/index.php");
51
- }
52
- static {
53
- this.REG_SKIPPED_HREF = /^(#|javascript:|vbscript:|file:)/i;
54
- }
55
- validateHrefAttr(e) {
56
- return typeof e != "string" ? !1 : !E.REG_SKIPPED_HREF.test(e);
57
- }
58
- parseAnchor(e) {
59
- if (!(e instanceof HTMLAnchorElement))
60
- return null;
61
- const t = this._cachedAnchorInfo.get(e);
62
- if (t)
63
- return t;
64
- const n = e.getAttribute("href") || "";
65
- if (!this.validateHrefAttr(n))
66
- return null;
67
- const s = e.href || "", l = this.parseLink(s);
68
- if (!l)
69
- return null;
70
- const r = {
71
- $el: e,
72
- kind: e.closest('[typeof^="mw:File"]') ? "mw:File" : "normal",
73
- external: e.classList.contains("external") || !!n.startsWith("http"),
74
- redlink: e.classList.contains("new") || l.params.has("redlink"),
75
- ...l
76
- };
77
- return this._cachedAnchorInfo.set(e, r), r;
78
- }
79
- parseLink(e) {
80
- if (!e || typeof e == "string" && !this.validateHrefAttr(e))
81
- return null;
82
- const t = B(e);
83
- if (!this.isWikiLink(t.toString()))
84
- return null;
85
- const n = t.searchParams, s = t.hash.replace("#", ""), l = n.get("action") || "view", r = t.pathname.endsWith(".php") ? n.get("title") : (() => {
86
- try {
87
- return decodeURI(t.pathname.substring(this.config.wikiArticlePath.length));
88
- } catch (a) {
89
- return this.logger.error("parseLink", t, a), null;
90
- }
91
- })();
92
- return r ? {
93
- url: t,
94
- params: n,
95
- hash: s,
96
- action: l,
97
- title: this.ctx.wikiTitle.create(r)
98
- } : null;
99
- }
100
- scanAnchors(e) {
101
- const t = e.querySelectorAll("a[href]");
102
- return Array.from(t).map((n) => this.parseAnchor(n)).filter((n) => n !== null);
103
- }
104
- async handleQuickEdit() {
105
- let e = !1;
106
- const t = await this.ctx.preferences.get(
107
- "inArticleLinks.quickEdit.redlinks"
108
- );
109
- this.ctx.inject(["quickEdit"], (n) => {
110
- e = !0, n.on("dispose", () => {
111
- e = !1;
112
- }), window?.mw?.hook?.("wikipage.content").add((s) => {
113
- if (!e)
114
- return;
115
- this.scanAnchors(s.get(0)).filter(({ action: r, title: a, redlink: o }) => (["edit", "create"].includes(r) || a.isSpecial("edit")) && // 添加对showButtonOnRedlinks的判断
116
- (t || !o)).forEach(({ $el: r, title: a, params: o }) => {
117
- if (r.dataset.ipeEditMounted)
118
- return;
119
- if (r.dataset.ipeEditMounted = "1", o.has("preload") || o.has("redo"))
120
- return this.ctx.logger.debug(r, "Not compatible with quick edit");
121
- let c;
122
- if (a.getNamespaceId() === -1) {
123
- const u = a.getMainDBKey().split("/").slice(1).join("/") || "";
124
- if (a.isSpecial("edit"))
125
- c = u;
126
- else if (a.isSpecial("talkpage")) {
127
- const m = a.newTitle(u).getTalkPage();
128
- if (!m)
129
- return this.ctx.logger.debug(r, "Talk page not found.");
130
- c = m.getPrefixedDBKey();
131
- } else if (a.isSpecial("mypage"))
132
- c = a.newTitle(this.ctx.sitemeta.userInfo.name, 2).getPrefixedDBKey() + (u ? `/${u}` : "");
133
- else if (a.isSpecial("mytalk"))
134
- c = a.newTitle(this.ctx.sitemeta.userInfo.name, 3).getPrefixedDBKey() + (u ? `/${u}` : "");
135
- else
136
- return this.ctx.logger.debug(r, "Special page cannot be edited");
137
- } else
138
- c = a.getPrefixedDBKey();
139
- const f = o.get("section")?.replace(/^T-/, "") || void 0, p = o.get("oldid"), k = o.has("redlink");
140
- let h;
141
- f === "new" ? h = "new" : f && /^\d+$/.test(f) && (h = parseInt(f, 10));
142
- const S = p ? parseInt(p, 10) : void 0, b = {
143
- title: c,
144
- section: h,
145
- revision: S,
146
- createOnly: k
147
- }, D = /* @__PURE__ */ A(
148
- "a",
149
- {
150
- href: "#ipe://quick-edit/",
151
- dataset: b,
152
- className: `${this.config.linkClassName} ipe-quick-edit ${k ? "ipe-quick-edit--create-only" : ""}`,
153
- style: {
154
- userSelect: "none",
155
- marginLeft: "0.2em",
156
- verticalAlign: "middle"
157
- },
158
- onClick: (u) => {
159
- u.preventDefault(), n.quickEdit.showModal(b);
160
- },
161
- children: /* @__PURE__ */ A(j, { style: "width: 1em; height: 1em" })
162
- }
163
- );
164
- r.insertAdjacentElement("afterend", D);
165
- });
166
- });
167
- });
168
- }
169
- handleQuickDiff() {
170
- let e = !1;
171
- const t = (n) => ["prev", "next", "cur"].includes(n);
172
- this.ctx.inject(["quickDiff"], (n) => {
173
- e = !0, n.on("dispose", () => {
174
- e = !1;
175
- }), window?.mw?.hook?.("wikipage.content").add((s) => {
176
- if (!e)
177
- return;
178
- this.scanAnchors(s.get(0)).filter(({ params: r, title: a }) => r.has("diff") || a.isSpecial("diff")).forEach(({ $el: r, title: a, params: o }) => {
179
- if (r.dataset.ipeDiffMounted)
180
- return;
181
- r.dataset.ipeDiffMounted = "1";
182
- let d, c;
183
- if (a.getNamespaceId() === -1 ? [, d, c] = a.getMainDBKey().split("/") : (d = o.get("diff"), c = o.get("oldid")), !d || !c)
184
- return;
185
- const f = {};
186
- t(d) ? (f.fromrev = parseInt(c), f.torelative = d) : (f.fromrev = parseInt(c), f.torev = parseInt(d)), r.addEventListener("click", (p) => {
187
- p.preventDefault(), n.quickDiff.comparePages(f);
188
- });
189
- });
190
- });
191
- });
192
- }
193
- };
194
- w = C(L);
195
- _ = Q(w, 0, "PluginInArticleLinks", x, _);
196
- F(w, 1, _);
197
- let V = _;
198
- export {
199
- V as PluginInArticleLinks
200
- };
201
- //# sourceMappingURL=index-sfkutNHj.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-sfkutNHj.js","sources":["../src/plugins/in-article-links/index.tsx"],"sourcesContent":["import { Inject, InPageEdit, Schema } from '@/InPageEdit'\nimport { IWikiTitle } from '@/models/WikiTitle/index.js'\nimport { CompareApiRequestOptions } from '../quick-diff/PluginQuickDiffCore.js'\nimport { QuickEditOptions } from '../quick-edit/index.js'\n\ndeclare module '@/InPageEdit' {\n interface InPageEdit {\n inArticleLinks: PluginInArticleLinks\n }\n}\n\nexport interface InArticleWikiLinkInfo {\n title: IWikiTitle\n url: URL\n params: URLSearchParams\n hash: string\n action: 'view' | 'edit' | 'create' | 'diff' | string\n}\n\nexport interface InArticleWikiAnchorInfo extends InArticleWikiLinkInfo {\n $el: HTMLAnchorElement\n kind: 'normal' | 'mw:File'\n external: boolean\n redlink: boolean\n}\n\n@Inject(['sitemeta', 'wikiTitle', 'preferences'])\n@RegisterPreferences(\n Schema.object({\n 'inArticleLinks.enable': Schema.boolean()\n .description('Whether to enable in-article links')\n .default(true),\n 'inArticleLinks.quickDiff.enable': Schema.boolean()\n .description('Whether to enable in-article links for quick diff')\n .default(true),\n 'inArticleLinks.quickEdit.enable': Schema.boolean()\n .description('Whether to enable in-article links for quick edit')\n .default(true),\n 'inArticleLinks.quickEdit.redlinks': Schema.boolean()\n .description('Whether to show quick edit button for redlinks')\n .default(true),\n })\n .description('In-article links preferences')\n .extra('category', 'in-article-links')\n)\nexport class PluginInArticleLinks extends BasePlugin<{\n /**\n * @example \"https://example.com\"\n */\n wikiBaseUrl: string\n /**\n * Article path, with trailing slash\n * @example \"/wiki/\" (if wgArticlePath is \"/wiki/$1\")\n */\n wikiArticlePath: string\n /**\n * Article base URL, with trailing slash\n * @example \"https://example.com/wiki/\" (if wgArticlePath is \"/wiki/$1\")\n */\n wikiArticleBaseUrl: string\n /**\n * Script base URL, **without** trailing slash\n * @example \"https://example.com/w\" (if wgScriptPath is \"/w\")\n */\n wikiScriptBaseUrl: string\n linkClassName: string\n}> {\n constructor(ctx: InPageEdit) {\n super(\n ctx,\n {\n wikiBaseUrl: ctx.sitemeta.baseUrl,\n wikiArticlePath: ctx.sitemeta.articlePath.replace('$1', ''),\n wikiArticleBaseUrl: ctx.sitemeta.articleBaseUrl.replace('$1', ''),\n wikiScriptBaseUrl: ctx.sitemeta.scriptBaseUrl,\n linkClassName: 'ipe__in-article-link',\n },\n 'InArticleLinks'\n )\n this.ctx.set('inArticleLinks', this)\n\n this.ctx.preferences.defineCategory({\n label: 'In Article Links',\n name: 'in-article-links',\n description: 'In-article links preferences',\n index: 9,\n })\n }\n\n protected async start() {\n // TODO: 这些都不应该硬编码,暂时先这样\n if (await this.ctx.preferences.get<boolean>('inArticleLinks.quickEdit.enable')) {\n this.handleQuickEdit()\n }\n if (await this.ctx.preferences.get<boolean>('inArticleLinks.quickDiff.enable')) {\n this.handleQuickDiff()\n }\n }\n\n protected async stop() {}\n\n isWikiLink(url: string): boolean {\n return (\n url.startsWith(this.config.wikiArticleBaseUrl) ||\n url.startsWith(this.config.wikiScriptBaseUrl + '/index.php')\n )\n }\n\n static readonly REG_SKIPPED_HREF = /^(#|javascript:|vbscript:|file:)/i\n private validateHrefAttr(href: string | null): boolean {\n if (typeof href !== 'string') {\n return false\n }\n return !PluginInArticleLinks.REG_SKIPPED_HREF.test(href)\n }\n\n private _cachedAnchorInfo = new WeakMap<HTMLAnchorElement, InArticleWikiAnchorInfo>()\n parseAnchor(anchor: HTMLAnchorElement): InArticleWikiAnchorInfo | null {\n // 不是链接元素\n if (!(anchor instanceof HTMLAnchorElement)) {\n return null\n }\n\n const cached = this._cachedAnchorInfo.get(anchor)\n if (cached) {\n return cached\n }\n\n const attrHref = anchor.getAttribute('href') || ''\n if (!this.validateHrefAttr(attrHref)) {\n return null\n }\n const href = anchor.href || ''\n const linkInfo = this.parseLink(href)\n if (!linkInfo) {\n return null\n }\n\n const info: InArticleWikiAnchorInfo = {\n $el: anchor,\n kind: anchor.closest('[typeof^=\"mw:File\"]') ? 'mw:File' : 'normal',\n external: anchor.classList.contains('external') || !!attrHref.startsWith('http'),\n redlink: anchor.classList.contains('new') || linkInfo.params.has('redlink'),\n ...linkInfo,\n }\n this._cachedAnchorInfo.set(anchor, info)\n return info\n }\n\n parseLink(link: string | URL): InArticleWikiLinkInfo | null {\n if (!link) {\n return null\n }\n\n if (typeof link === 'string' && !this.validateHrefAttr(link)) {\n return null\n }\n\n const url = makeURL(link)\n if (!this.isWikiLink(url.toString())) {\n return null\n }\n\n const params = url.searchParams\n const hash = url.hash.replace('#', '')\n const action = params.get('action') || 'view'\n const titleText = url.pathname.endsWith('.php')\n ? params.get('title')\n : (() => {\n try {\n return decodeURI(url.pathname.substring(this.config.wikiArticlePath.length))\n } catch (e) {\n this.logger.error('parseLink', url, e)\n return null\n }\n })()\n\n if (!titleText) {\n return null\n }\n\n return {\n url,\n params,\n hash,\n action,\n title: this.ctx.wikiTitle.create(titleText),\n }\n }\n\n scanAnchors(parent: HTMLElement): InArticleWikiAnchorInfo[] {\n const anchors = parent.querySelectorAll<HTMLAnchorElement>('a[href]')\n return Array.from(anchors)\n .map((anchor) => this.parseAnchor(anchor))\n .filter((anchor) => anchor !== null)\n }\n\n async handleQuickEdit() {\n let enable = false\n const showButtonOnRedlinks = await this.ctx.preferences.get<boolean>(\n 'inArticleLinks.quickEdit.redlinks'\n )\n\n this.ctx.inject(['quickEdit'], (ctx) => {\n enable = true\n ctx.on('dispose', () => {\n enable = false\n })\n\n window?.mw?.hook?.('wikipage.content').add(($content) => {\n if (!enable) {\n return\n }\n const anchors = this.scanAnchors($content.get(0)!).filter(({ action, title, redlink }) => {\n return (\n (['edit', 'create'].includes(action) || title.isSpecial('edit')) &&\n // 添加对showButtonOnRedlinks的判断\n (showButtonOnRedlinks || !redlink)\n )\n })\n anchors.forEach(({ $el, title, params }) => {\n if ($el.dataset.ipeEditMounted) {\n return\n }\n $el.dataset.ipeEditMounted = '1'\n\n const notCompatible = params.has('preload') || params.has('redo')\n if (notCompatible) {\n return this.ctx.logger.debug($el, `Not compatible with quick edit`)\n }\n\n let titleText: string\n if (title.getNamespaceId() === -1) {\n const sub = title.getMainDBKey().split('/').slice(1).join('/') || ''\n if (title.isSpecial('edit')) {\n titleText = sub\n } else if (title.isSpecial('talkpage')) {\n const talkPage = title.newTitle(sub).getTalkPage()\n if (!talkPage) {\n return this.ctx.logger.debug($el, `Talk page not found.`)\n }\n titleText = talkPage.getPrefixedDBKey()\n } else if (title.isSpecial('mypage')) {\n const userPage = title.newTitle(this.ctx.sitemeta.userInfo.name, 2)\n titleText = userPage.getPrefixedDBKey() + (sub ? `/${sub}` : '')\n } else if (title.isSpecial('mytalk')) {\n const userTalkPage = title.newTitle(this.ctx.sitemeta.userInfo.name, 3)\n titleText = userTalkPage.getPrefixedDBKey() + (sub ? `/${sub}` : '')\n } else {\n return this.ctx.logger.debug($el, `Special page cannot be edited`)\n }\n } else {\n titleText = title.getPrefixedDBKey()\n }\n\n const sectionRaw = params.get('section')?.replace(/^T-/, '') || undefined\n const revisionRaw = params.get('oldid')\n const createOnly = params.has('redlink')\n\n let section: 'new' | number | undefined = undefined\n if (sectionRaw === 'new') {\n section = 'new'\n } else if (sectionRaw && /^\\d+$/.test(sectionRaw)) {\n section = parseInt(sectionRaw, 10)\n }\n\n const revision = revisionRaw ? parseInt(revisionRaw, 10) : undefined\n\n const payload: Partial<QuickEditOptions> = {\n title: titleText,\n section,\n revision,\n createOnly,\n }\n\n const link = (\n <a\n href={`#ipe://quick-edit/`}\n dataset={payload as any}\n className={`${this.config.linkClassName} ipe-quick-edit ${createOnly ? 'ipe-quick-edit--create-only' : ''}`}\n style={{\n userSelect: 'none',\n marginLeft: '0.2em',\n verticalAlign: 'middle',\n }}\n onClick={(e) => {\n e.preventDefault()\n ctx.quickEdit.showModal(payload)\n }}\n >\n <IconQuickEdit style=\"width: 1em; height: 1em\" />\n </a>\n )\n\n $el.insertAdjacentElement('afterend', link)\n })\n })\n })\n }\n\n handleQuickDiff() {\n let enable = false\n const isRelative = (str: string): str is 'prev' | 'next' | 'cur' =>\n ['prev', 'next', 'cur'].includes(str)\n\n this.ctx.inject(['quickDiff'], (ctx) => {\n enable = true\n ctx.on('dispose', () => {\n enable = false\n })\n\n window?.mw?.hook?.('wikipage.content').add(($content) => {\n if (!enable) {\n return\n }\n const anchors = this.scanAnchors($content.get(0)!).filter(({ params, title }) => {\n return params.has('diff') || title.isSpecial('diff')\n })\n anchors.forEach(({ $el, title, params }) => {\n if ($el.dataset.ipeDiffMounted) {\n return\n }\n $el.dataset.ipeDiffMounted = '1'\n\n let diff: string | null\n let oldid: string | null\n if (title.getNamespaceId() === -1) {\n // prettier-ignore\n ;[/** special page name */, diff, oldid] = title.getMainDBKey().split('/')\n } else {\n diff = params.get('diff')\n oldid = params.get('oldid')\n }\n if (!diff || !oldid) {\n return\n }\n\n const compare: Partial<CompareApiRequestOptions> = {}\n if (isRelative(diff)) {\n compare.fromrev = parseInt(oldid)\n compare.torelative = diff\n } else {\n compare.fromrev = parseInt(oldid)\n compare.torev = parseInt(diff)\n }\n\n $el.addEventListener('click', (e) => {\n e.preventDefault()\n ctx.quickDiff.comparePages(compare)\n })\n })\n })\n })\n }\n}\n"],"names":["_PluginInArticleLinks_decorators","_init","_a","Inject","RegisterPreferences","Schema","_PluginInArticleLinks","BasePlugin","ctx","url","href","anchor","cached","attrHref","linkInfo","info","link","makeURL","params","hash","action","titleText","e","parent","anchors","enable","showButtonOnRedlinks","$content","title","redlink","$el","sub","talkPage","sectionRaw","revisionRaw","createOnly","section","revision","payload","jsx","IconQuickEdit","isRelative","str","diff","oldid","compare","__decoratorStart","__decorateElement","__runInitializers","PluginInArticleLinks"],"mappings":";;;;;;;;;;;;;;;GAAAA,GAAAC,GAAAC;AA0BAF,IAAA,CAACG,EAAO,CAAC,YAAY,aAAa,aAAa,CAAC,GAC/CC;AAAA,EACCC,EAAO,OAAO;AAAA,IACZ,yBAAyBA,EAAO,QAAA,EAC7B,YAAY,oCAAoC,EAChD,QAAQ,EAAI;AAAA,IACf,mCAAmCA,EAAO,QAAA,EACvC,YAAY,mDAAmD,EAC/D,QAAQ,EAAI;AAAA,IACf,mCAAmCA,EAAO,QAAA,EACvC,YAAY,mDAAmD,EAC/D,QAAQ,EAAI;AAAA,IACf,qCAAqCA,EAAO,QAAA,EACzC,YAAY,gDAAgD,EAC5D,QAAQ,EAAI;AAAA,EAAA,CAChB,EACE,YAAY,8BAA8B,EAC1C,MAAM,YAAY,kBAAkB;AACzC,CAAA;AACO,IAAMC,IAAN,MAAMA,WAA6BJ,IAAAK,GAqBvC;AAAA,EACD,YAAYC,GAAiB;AAC3B;AAAA,MACEA;AAAA,MACA;AAAA,QACE,aAAaA,EAAI,SAAS;AAAA,QAC1B,iBAAiBA,EAAI,SAAS,YAAY,QAAQ,MAAM,EAAE;AAAA,QAC1D,oBAAoBA,EAAI,SAAS,eAAe,QAAQ,MAAM,EAAE;AAAA,QAChE,mBAAmBA,EAAI,SAAS;AAAA,QAChC,eAAe;AAAA,MAAA;AAAA,MAEjB;AAAA,IAAA,GAuCJ,KAAQ,wCAAwB,QAAA,GArC9B,KAAK,IAAI,IAAI,kBAAkB,IAAI,GAEnC,KAAK,IAAI,YAAY,eAAe;AAAA,MAClC,OAAO;AAAA,MACP,MAAM;AAAA,MACN,aAAa;AAAA,MACb,OAAO;AAAA,IAAA,CACR;AAAA,EACH;AAAA,EAEA,MAAgB,QAAQ;AAEtB,IAAI,MAAM,KAAK,IAAI,YAAY,IAAa,iCAAiC,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HgB,KAAK,YAAYE,EAAS,IAAI,CAAC,CAAE,EAAE,OAAO,CAAC,EAAE,QAAAT,GAAQ,OAAAU,QAC5DV,EAAO,IAAI,MAAM,KAAKU,EAAM,UAAU,MAAM,CACpD,EACO,QAAQ,CAAC,EAAE,KAAAE,GAAK,OAAAF,GAAO,QAAAV,QAAa;AAC1C,cAAIY,EAAI,QAAQ;AACd;AAEF,UAAAA,EAAI,QAAQ,iBAAiB;AAE7B,cAAIa,GACAC;AAQJ,cAPIhB,EAAM,eAAA,MAAqB,KAE5B,CAAA,EAA2Be,GAAMC,CAAK,IAAIhB,EAAM,aAAA,EAAe,MAAM,GAAG,KAEzEe,IAAOzB,EAAO,IAAI,MAAM,GACxB0B,IAAQ1B,EAAO,IAAI,OAAO,IAExB,CAACyB,KAAQ,CAACC;AACZ;AAGF,gBAAMC,IAA6C,CAAA;AACnD,UAAIJ,EAAWE,CAAI,KACjBE,EAAQ,UAAU,SAASD,CAAK,GAChCC,EAAQ,aAAaF,MAErBE,EAAQ,UAAU,SAASD,CAAK,GAChCC,EAAQ,QAAQ,SAASF,CAAI,IAG/Bb,EAAI,iBAAiB,SAAS,CAACR,MAAM;AACnC,YAAAA,EAAE,eAAA,GACFd,EAAI,UAAU,aAAaqC,CAAO;AAAA,UACpC,CAAC;AAAA,QACH,CAAC;AAAA,MACH,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACF;AArTO5C,IAAA6C,EAAA5C,CAAA;AAAMI,IAANyC,gCAnBP/C,GAmBaM,CAAA;AAAN0C,EAAA/C,GAAA,GAAMK,CAAA;AAAN,IAAM2C,IAAN3C;"}
@@ -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
- }