@inpageedit/core 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/Preferences-Bg3J5Ur9.js.map +1 -1
- package/dist/constants/endpoints.d.ts +2 -5
- package/dist/decorators/Preferences.d.ts +1 -1
- package/dist/{index-DXvJqlhL.js → index-BSjnoNn2.js} +3 -3
- package/dist/index-BSjnoNn2.js.map +1 -0
- package/dist/{index-BwVAO_o4.js → index-BedbUMp8.js} +6 -6
- package/dist/index-BedbUMp8.js.map +1 -0
- package/dist/{index-CIzmjtBz.js → index-DNQjqBV-.js} +1211 -1077
- package/dist/index-DNQjqBV-.js.map +1 -0
- package/dist/{index-B0QzYk-q.js → index-DtOC8Ck-.js} +1258 -1297
- package/dist/{index-B0QzYk-q.js.map → index-DtOC8Ck-.js.map} +1 -1
- package/dist/{index-3FdvKxaN.js → index-UyiZ7umI.js} +65 -42
- package/dist/index-UyiZ7umI.js.map +1 -0
- package/dist/{index-6bp2nmez.js → index-e7eyr1FL.js} +2 -2
- package/dist/{index-6bp2nmez.js.map → index-e7eyr1FL.js.map} +1 -1
- package/dist/{index-D1plOuGc.js → index-i-Uf0vuA.js} +63 -63
- package/dist/{index-D1plOuGc.js.map → index-i-Uf0vuA.js.map} +1 -1
- package/dist/{index-DlE7PWxs.js → index-rMDuLpcz.js} +170 -140
- package/dist/index-rMDuLpcz.js.map +1 -0
- package/dist/index-xJ2bdsOD.js +128 -0
- package/dist/index-xJ2bdsOD.js.map +1 -0
- 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 +8 -11
- 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,20 +1,24 @@
|
|
|
1
1
|
import { j as s } from "./index-CvhkVj_L.js";
|
|
2
|
-
import { B as I, S as b, I as v, a as S } from "./index-
|
|
3
|
-
import { A as
|
|
4
|
-
|
|
2
|
+
import { B as I, S as b, I as v, a as S } from "./index-DNQjqBV-.js";
|
|
3
|
+
import { A as w } from "./ActionButton-BgbTKTg7.js";
|
|
4
|
+
const O = (r) => typeof r == "function";
|
|
5
|
+
async function j(r) {
|
|
6
|
+
return O(r) ? await r() : r;
|
|
7
|
+
}
|
|
8
|
+
var A = Object.create, h = Object.defineProperty, R = Object.getOwnPropertyDescriptor, P = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), y = (r) => {
|
|
5
9
|
throw TypeError(r);
|
|
6
|
-
},
|
|
7
|
-
for (var
|
|
8
|
-
return
|
|
9
|
-
},
|
|
10
|
-
var o, g, p, l = e & 7,
|
|
11
|
-
|
|
12
|
-
for (var
|
|
13
|
-
p =
|
|
14
|
-
return
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
class u extends (
|
|
10
|
+
}, U = (r, e, t) => e in r ? h(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, G = (r, e) => h(r, "name", { value: e, configurable: !0 }), V = (r) => [, , , A(r?.[P("metadata")] ?? null)], H = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], x = (r) => r !== void 0 && typeof r != "function" ? y("Function expected") : r, L = (r, e, t, i, n) => ({ kind: H[r], name: e, metadata: i, addInitializer: (a) => t._ ? y("Already initialized") : n.push(x(a || null)) }), T = (r, e) => U(e, P("metadata"), r[3]), k = (r, e, t, i) => {
|
|
11
|
+
for (var n = 0, a = r[e >> 1], o = a && a.length; n < o; n++) a[n].call(t);
|
|
12
|
+
return i;
|
|
13
|
+
}, z = (r, e, t, i, n, a) => {
|
|
14
|
+
var o, g, p, l = e & 7, _ = !1, m = 0, C = r[m] || (r[m] = []), c = l && (n = n.prototype, l < 5 && (l > 3 || !_) && R(n, t));
|
|
15
|
+
G(n, t);
|
|
16
|
+
for (var d = i.length - 1; d >= 0; d--)
|
|
17
|
+
p = L(l, t, g = {}, r[3], C), o = (0, i[d])(n, p), g._ = 1, x(o) && (n = o);
|
|
18
|
+
return T(r, n), c && h(n, t, c), _ ? l ^ 4 ? a : c : n;
|
|
19
|
+
}, E, f, D;
|
|
20
|
+
E = [S(["sitemeta", "storage"])];
|
|
21
|
+
class u extends (D = I) {
|
|
18
22
|
constructor(e) {
|
|
19
23
|
super(e, {}, "preferences"), this.ctx = e, this.db = void 0, this.customRegistries = [], this.categoryDefinitions = [], this._defaultPreferences = {}, this.db = e.storage.createDatabse("preferences", 1 / 0), this.ctx.set("preferences", this);
|
|
20
24
|
}
|
|
@@ -42,13 +46,21 @@ class u extends (w = I) {
|
|
|
42
46
|
"v",
|
|
43
47
|
this.ctx.version
|
|
44
48
|
] }),
|
|
45
|
-
/* @__PURE__ */ s("h2", { children: "
|
|
49
|
+
/* @__PURE__ */ s("h2", { children: "Portals" }),
|
|
46
50
|
/* @__PURE__ */ s("div", { style: "display: flex; flex-direction: column; gap: 1rem", children: [
|
|
47
|
-
/* @__PURE__ */ s(P, { href: "https://www.ipe.wiki", style: { display: "block", width: "100%" }, children: "Official Website & Help Center" }),
|
|
48
51
|
/* @__PURE__ */ s(
|
|
49
|
-
|
|
52
|
+
"a",
|
|
53
|
+
{
|
|
54
|
+
href: this.ctx.Endpoints.HOME_URL,
|
|
55
|
+
target: "_blank",
|
|
56
|
+
style: { display: "block", width: "100%" },
|
|
57
|
+
children: "Official Website & Help Center"
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ s(
|
|
61
|
+
w,
|
|
50
62
|
{
|
|
51
|
-
href:
|
|
63
|
+
href: `${this.ctx.Endpoints.UPDATE_LOGS_URL}#${this.ctx.version}`,
|
|
52
64
|
style: { display: "block", width: "100%" },
|
|
53
65
|
children: "Update Logs"
|
|
54
66
|
}
|
|
@@ -60,7 +72,7 @@ class u extends (w = I) {
|
|
|
60
72
|
/* @__PURE__ */ s("strong", { children: "GitHub" }),
|
|
61
73
|
":",
|
|
62
74
|
" ",
|
|
63
|
-
/* @__PURE__ */ s("a", { href:
|
|
75
|
+
/* @__PURE__ */ s("a", { href: this.ctx.Endpoints.GITHUB_URL, target: "_blank", children: "inpageedit/inpageedit-next" })
|
|
64
76
|
] }),
|
|
65
77
|
/* @__PURE__ */ s("li", { children: [
|
|
66
78
|
/* @__PURE__ */ s("strong", { children: "QQ Group" }),
|
|
@@ -75,51 +87,62 @@ class u extends (w = I) {
|
|
|
75
87
|
}).description(""),
|
|
76
88
|
"about",
|
|
77
89
|
{}
|
|
78
|
-
), import("./index-
|
|
90
|
+
), import("./index-DtOC8Ck-.js").then((e) => {
|
|
79
91
|
const t = this.ctx.plugin(e.PluginPreferencesUI);
|
|
80
92
|
this.addDisposeHandler(() => {
|
|
81
93
|
t.dispose();
|
|
82
94
|
});
|
|
83
95
|
});
|
|
84
96
|
}
|
|
85
|
-
get(e, t) {
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
return this.logger.
|
|
89
|
-
}
|
|
97
|
+
async get(e, t) {
|
|
98
|
+
t ??= () => {
|
|
99
|
+
const n = this.getDefaultValue(e);
|
|
100
|
+
return this.logger.debug(e, `(fallback value: ${n})`), n;
|
|
101
|
+
};
|
|
102
|
+
const i = await this.db.get(e, void 0);
|
|
103
|
+
return i !== null ? i : await j(t);
|
|
90
104
|
}
|
|
91
105
|
getDefaultValue(e) {
|
|
92
106
|
return this._defaultPreferences[e] ??= this.loadDefaultConfigs()[e];
|
|
93
107
|
}
|
|
94
108
|
set(e, t) {
|
|
95
|
-
const
|
|
96
|
-
return t ===
|
|
109
|
+
const i = this.getDefaultValue(e);
|
|
110
|
+
return t === i ? this.db.delete(e) : this.db.set(e, t);
|
|
97
111
|
}
|
|
98
112
|
async getAll() {
|
|
99
113
|
const e = this.loadDefaultConfigs();
|
|
100
|
-
return await this.db.iterate((t,
|
|
101
|
-
e[
|
|
114
|
+
return await this.db.iterate((t, i) => {
|
|
115
|
+
e[i] = t;
|
|
102
116
|
}), e;
|
|
103
117
|
}
|
|
104
118
|
loadDefaultConfigs() {
|
|
105
119
|
const e = {};
|
|
106
120
|
return this.getConfigRegistries().forEach((t) => {
|
|
107
|
-
|
|
108
|
-
|
|
121
|
+
try {
|
|
122
|
+
const i = t.schema({});
|
|
123
|
+
Object.entries(i).forEach(([n, a]) => {
|
|
124
|
+
e[n] = a;
|
|
125
|
+
});
|
|
126
|
+
} catch {
|
|
127
|
+
}
|
|
128
|
+
t.defaults && Object.entries(t.defaults).forEach(([i, n]) => {
|
|
129
|
+
e[i] = n;
|
|
109
130
|
});
|
|
131
|
+
}), Object.entries(e).forEach(([t, i]) => {
|
|
132
|
+
this._defaultPreferences[t] = i;
|
|
110
133
|
}), e;
|
|
111
134
|
}
|
|
112
|
-
registerCustomConfig(e, t,
|
|
135
|
+
registerCustomConfig(e, t, i, n) {
|
|
113
136
|
return this.customRegistries.push({
|
|
114
137
|
name: e,
|
|
115
138
|
schema: t,
|
|
116
|
-
category:
|
|
117
|
-
defaults:
|
|
139
|
+
category: i,
|
|
140
|
+
defaults: n
|
|
118
141
|
}), this;
|
|
119
142
|
}
|
|
120
143
|
getConfigRegistries(e) {
|
|
121
|
-
return Array.from(this.ctx.registry.entries()).map(([t,
|
|
122
|
-
name: "root",
|
|
144
|
+
return Array.from(this.ctx.registry.entries()).map(([t, i]) => t === null ? {
|
|
145
|
+
name: "@root",
|
|
123
146
|
schema: v?.PreferencesSchema || null,
|
|
124
147
|
defaults: v?.PreferencesDefaults || {}
|
|
125
148
|
} : {
|
|
@@ -132,17 +155,17 @@ class u extends (w = I) {
|
|
|
132
155
|
})).concat(this.customRegistries).filter((t) => !e || t.category === e);
|
|
133
156
|
}
|
|
134
157
|
defineCategory(e) {
|
|
135
|
-
const t = this.categoryDefinitions.findIndex((
|
|
136
|
-
return t < 0 ? this.categoryDefinitions.push(e) : this.categoryDefinitions[t] = e, this.categoryDefinitions.sort((
|
|
158
|
+
const t = this.categoryDefinitions.findIndex((i) => i.name === e.name);
|
|
159
|
+
return t < 0 ? this.categoryDefinitions.push(e) : this.categoryDefinitions[t] = e, this.categoryDefinitions.sort((i, n) => (i.index ?? 0) - (n.index ?? 0)), this;
|
|
137
160
|
}
|
|
138
161
|
getConfigCategories() {
|
|
139
162
|
return this.categoryDefinitions;
|
|
140
163
|
}
|
|
141
164
|
}
|
|
142
|
-
f = V(
|
|
143
|
-
u =
|
|
165
|
+
f = V(D);
|
|
166
|
+
u = z(f, 0, "PluginPreferences", E, u);
|
|
144
167
|
k(f, 1, u);
|
|
145
168
|
export {
|
|
146
169
|
u as PluginPreferences
|
|
147
170
|
};
|
|
148
|
-
//# sourceMappingURL=index-
|
|
171
|
+
//# sourceMappingURL=index-UyiZ7umI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-UyiZ7umI.js","sources":["../src/utils/computeable.ts","../src/plugins/preferences/index.tsx"],"sourcesContent":["export type ComputeAble<T> = (() => T | Promise<T>) | T\nconst isFunction = (value: any): value is Function => typeof value === 'function'\nexport async function computeFallback<T>(value: ComputeAble<T>): Promise<T> {\n if (isFunction(value)) {\n return await value()\n } else {\n return value\n }\n}\n","import { Inject, InPageEdit, Schema } from '@/InPageEdit.js'\nimport { IPEStorageItem, IPEStorageManager } from '@/services/StorageService.js'\nimport { computeFallback, ComputeAble } from '@/utils/computeable.js'\n\ndeclare module '@/InPageEdit' {\n export interface InPageEdit {\n preferences: PluginPreferences\n }\n}\n\nexport interface InPageEditPreferenceUICategory {\n name: string\n label: string\n description?: string\n index?: number\n}\n\nexport interface InPageEditPreferenceUIRegistryItem {\n name: string\n schema: Schema\n defaults: Record<string, any>\n category: string\n}\n\n@Inject(['sitemeta', 'storage'])\nexport class PluginPreferences extends BasePlugin {\n private db: IPEStorageManager<any>\n public customRegistries: InPageEditPreferenceUIRegistryItem[] = []\n public categoryDefinitions: InPageEditPreferenceUICategory[] = []\n private _defaultPreferences: Record<string, any> = {}\n\n constructor(public ctx: InPageEdit) {\n super(ctx, {}, 'preferences')\n this.db = ctx.storage.createDatabse<any>('preferences', Infinity)\n this.ctx.set('preferences', this)\n }\n\n async start() {\n this.defineCategory({\n name: 'general',\n label: 'General',\n description: 'General settings',\n })\n this.defineCategory({\n name: 'edit',\n label: 'Editing',\n description: 'Settings related to editing content',\n })\n this.defineCategory({\n name: 'about',\n label: 'About',\n description: 'About InPageEdit',\n index: 99,\n })\n\n this.registerCustomConfig(\n 'about',\n Schema.object({\n about: Schema.const(\n <div className=\"prose\">\n <h2>✏️ InPageEdit NEXT</h2>\n <i>v{this.ctx.version}</i>\n <h2>Portals</h2>\n <div style=\"display: flex; flex-direction: column; gap: 1rem\">\n <a\n href={this.ctx.Endpoints.HOME_URL}\n target=\"_blank\"\n style={{ display: 'block', width: '100%' }}\n >\n Official Website & Help Center\n </a>\n <ActionButton\n href={`${this.ctx.Endpoints.UPDATE_LOGS_URL}#${this.ctx.version}`}\n style={{ display: 'block', width: '100%' }}\n >\n Update Logs\n </ActionButton>\n </div>\n <h2>Join us</h2>\n <ul>\n <li>\n <strong>GitHub</strong>:{' '}\n <a href={this.ctx.Endpoints.GITHUB_URL} target=\"_blank\">\n inpageedit/inpageedit-next\n </a>\n </li>\n <li>\n <strong>QQ Group</strong>: 1026023666\n </li>\n </ul>\n <hr />\n <p>🚀 Modular, Extensible Supercharged Plugin for MediaWiki.</p>\n <p>InPageEdit-NEXT Copyright © 2025-present dragon-fish</p>\n </div>\n ).role('raw-html'),\n }).description(''),\n 'about',\n {}\n )\n\n import('./ui/index').then((module) => {\n const fork = this.ctx.plugin(module.PluginPreferencesUI)\n this.addDisposeHandler(() => {\n fork.dispose()\n })\n })\n }\n\n async get<T = any>(key: string, fallback?: ComputeAble<T>): Promise<T | null> {\n fallback ??= () => {\n const defaultValue = this.getDefaultValue(key)\n this.logger.debug(key, `(fallback value: ${defaultValue})`)\n return defaultValue as T\n }\n const value = (await this.db.get(key, undefined)) as T | null\n return value !== null ? value : ((await computeFallback(fallback)) as T)\n }\n\n getDefaultValue(key: string): unknown {\n return (this._defaultPreferences[key] ??= this.loadDefaultConfigs()[key])\n }\n\n set<T = any>(key: string, value: T): Promise<IPEStorageItem<T> | void> {\n const defaultValue = this.getDefaultValue(key)\n if (value === defaultValue) {\n return this.db.delete(key)\n } else {\n return this.db.set(key, value)\n }\n }\n\n async getAll() {\n const data = this.loadDefaultConfigs()\n await this.db.iterate((value: IPEStorageItem, key: string) => {\n data[key] = value\n })\n return data\n }\n\n private loadDefaultConfigs() {\n const data = {} as Record<string, any>\n this.getConfigRegistries().forEach((item) => {\n // 首先读取 schema 上的默认值\n try {\n const defaultValues = item.schema({}) as any\n Object.entries(defaultValues).forEach(([key, val]) => {\n data[key] = val\n })\n } catch {}\n\n // 然后读取注册时定义的默认值\n item.defaults &&\n Object.entries(item.defaults).forEach(([key, val]) => {\n data[key] = val\n })\n })\n\n Object.entries(data).forEach(([key, val]) => {\n this._defaultPreferences[key] = val\n })\n\n return data\n }\n\n registerCustomConfig(\n name: string,\n schema: Schema,\n category: string,\n defaults: Record<string, any>\n ) {\n this.customRegistries.push({\n name,\n schema,\n category,\n defaults,\n })\n return this\n }\n\n getConfigRegistries(category?: string): InPageEditPreferenceUIRegistryItem[] {\n return Array.from(this.ctx.registry.entries())\n .map<{\n name: string\n schema: Schema\n defaults: Record<string, any>\n }>(([plugin, fork]) => {\n if (plugin === null) {\n return {\n name: '@root',\n schema: (InPageEdit as any)?.PreferencesSchema || null,\n defaults: (InPageEdit as any)?.PreferencesDefaults || {},\n }\n } else {\n return {\n name: plugin.name,\n schema: (plugin as any)?.PreferencesSchema || null,\n defaults: (plugin as any)?.PreferencesDefaults || {},\n }\n }\n })\n .filter((item) => item.schema !== null)\n .map((item) => {\n return {\n ...item,\n category: item.schema.meta.category || 'general',\n }\n })\n .concat(this.customRegistries)\n .filter((item) => !category || item.category === category)\n }\n\n defineCategory(category: InPageEditPreferenceUICategory) {\n const index = this.categoryDefinitions.findIndex((tab) => tab.name === category.name)\n if (index < 0) {\n this.categoryDefinitions.push(category)\n } else {\n this.categoryDefinitions[index] = category\n }\n this.categoryDefinitions.sort((a, b) => {\n return (a.index ?? 0) - (b.index ?? 0)\n })\n return this\n }\n\n getConfigCategories() {\n return this.categoryDefinitions\n }\n}\n"],"names":["isFunction","value","computeFallback","_PluginPreferences_decorators","_init","_a","Inject","PluginPreferences","BasePlugin","ctx","Schema","jsxs","jsx","ActionButton","module","fork","key","fallback","defaultValue","data","item","defaultValues","val","name","schema","category","defaults","plugin","InPageEdit","index","tab","a","b","__decoratorStart","__decorateElement","__runInitializers"],"mappings":";;;AACA,MAAMA,IAAa,CAACC,MAAkC,OAAOA,KAAU;AACvE,eAAsBC,EAAmBD,GAAmC;AAC1E,SAAID,EAAWC,CAAK,IACX,MAAMA,EAAA,IAENA;AAEX;;;;;;;;;;;;GCRAE,GAAAC,GAAAC;AAwBAF,IAAA,CAACG,EAAO,CAAC,YAAY,SAAS,CAAC,CAAA;AACxB,MAAMC,WAA0BF,IAAAG,GAAW;AAAA,EAMhD,YAAmBC,GAAiB;AAClC,UAAMA,GAAK,CAAA,GAAI,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2
|
-
import { B as y, a as S } from "./index-
|
|
2
|
+
import { B as y, a as S } from "./index-DNQjqBV-.js";
|
|
3
3
|
var E = Object.create, _ = Object.defineProperty, F = Object.getOwnPropertyDescriptor, k = (t, i) => (i = Symbol[t]) ? i : Symbol.for("Symbol." + t), x = (t) => {
|
|
4
4
|
throw TypeError(t);
|
|
5
5
|
}, O = (t, i, r) => i in t ? _(t, i, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[i] = r, Q = (t, i) => _(t, "name", { value: i, configurable: !0 }), T = (t) => [, , , E(t?.[k("metadata")] ?? null)], z = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], f = (t) => t !== void 0 && typeof t != "function" ? x("Function expected") : t, B = (t, i, r, a, e) => ({ kind: z[t], name: i, metadata: a, addInitializer: (c) => r._ ? x("Already initialized") : e.push(f(c || null)) }), C = (t, i) => O(i, k("metadata"), t[3]), I = (t, i, r, a) => {
|
|
@@ -93,4 +93,4 @@ I(h, 1, p);
|
|
|
93
93
|
export {
|
|
94
94
|
p as PluginQuickPreview
|
|
95
95
|
};
|
|
96
|
-
//# sourceMappingURL=index-
|
|
96
|
+
//# sourceMappingURL=index-e7eyr1FL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-e7eyr1FL.js","sources":["../src/plugins/quick-preview/index.tsx"],"sourcesContent":["import { Inject, InPageEdit } from '@/InPageEdit'\nimport { type QuickEditInitPayload } from '@/plugins/quick-edit'\nimport { WikiPage } from '@/models/WikiPage'\nimport { MwApiParams } from 'wiki-saikou'\nimport { PageParseData } from '@/models/WikiPage/types/PageParseData'\nimport { IPEModal } from '@/services/ModalService/IPEModal.js'\n\ndeclare module '@/InPageEdit' {\n interface InPageEdit {\n quickPreview: PluginQuickPreview['quickPreview']\n }\n interface Events {\n 'quick-preview/show-modal'(payload: {\n ctx: InPageEdit\n text: string\n modal: IPEModal\n wikiPage: WikiPage\n }): void\n 'quick-preview/loaded'(payload: {\n ctx: InPageEdit\n modal: IPEModal\n wikiPage: WikiPage\n text: string\n parseData: PageParseData\n }): void\n }\n}\n\n@Inject(['api', 'wikiPage', 'modal'])\nexport class PluginQuickPreview extends BasePlugin {\n constructor(public ctx: InPageEdit) {\n super(ctx, {}, 'quickPreview')\n }\n\n protected start(): Promise<void> | void {\n this.ctx.set('quickPreview', this.quickPreview.bind(this))\n this.ctx.on('quick-edit/wiki-page', this.injectQuickEdit.bind(this))\n }\n\n protected stop(): Promise<void> | void {\n this.ctx.off('quick-edit/wiki-page', this.injectQuickEdit.bind(this))\n }\n\n private injectQuickEdit({ ctx, modal, wikiPage }: QuickEditInitPayload) {\n let latestPreviewModal: IPEModal | undefined = undefined\n modal.addButton(\n {\n label: 'Preview',\n side: 'left',\n className: 'btn btn-secondary',\n method: () => {\n latestPreviewModal = this.quickPreview(\n (modal.get$content().querySelector<HTMLTextAreaElement>('textarea[name=\"text\"]')\n ?.value as string) || '',\n undefined,\n wikiPage,\n latestPreviewModal\n )\n },\n },\n 2\n )\n }\n\n quickPreview(text: string, params?: MwApiParams, wikiPage?: WikiPage, modal?: IPEModal) {\n wikiPage ||= this.ctx.wikiPage.newBlankPage({\n title: 'API',\n })\n\n if (!modal || modal.isDestroyed) {\n modal = this.ctx.modal\n .createObject({\n className: 'in-page-edit ipe-quickPreview',\n sizeClass: 'large',\n backdrop: false,\n draggable: true,\n })\n .init()\n }\n\n modal.show()\n modal.setTitle('Preview - Loading...')\n modal.setContent(<ProgressBar />)\n modal.bringToFront()\n this.ctx.emit('quick-preview/show-modal', {\n ctx: this.ctx,\n text,\n modal,\n wikiPage,\n })\n\n wikiPage\n .preview(text, params)\n .then((ret) => {\n const {\n data: { parse },\n } = ret\n modal.setTitle(`Preview - ${parse.title}`)\n let outputRef: HTMLElement | null = null\n modal.setContent(\n (\n <section>\n <div\n ref={(el) => (outputRef = el)}\n className=\"mw-parser-output\"\n innerHTML={parse.text}\n ></div>\n </section>\n ) as HTMLElement\n )\n window.mw?.hook('wikipage.content').fire($(outputRef!))\n this.ctx.emit('quick-preview/loaded', {\n ctx: this.ctx,\n modal,\n wikiPage,\n text,\n parseData: parse,\n })\n })\n .catch((error) => {\n modal.setTitle('Preview - Failed')\n modal.setContent(\n <>\n <p>Failed to preview</p>\n <p>{error instanceof Error ? error.message : String(error)}</p>\n </>\n )\n })\n\n return modal\n }\n}\n"],"names":["_PluginQuickPreview_decorators","_init","_a","Inject","PluginQuickPreview","BasePlugin","ctx","modal","wikiPage","latestPreviewModal","text","params","jsx","ProgressBar","ret","parse","outputRef","el","error","jsxs","Fragment","__decoratorStart","__decorateElement","__runInitializers"],"mappings":";;;;;;;;;;;;;GAAAA,GAAAC,GAAAC;AA4BAF,IAAA,CAACG,EAAO,CAAC,OAAO,YAAY,OAAO,CAAC,CAAA;AAC7B,MAAMC,WAA2BF,IAAAG,GAAW;AAAA,EACjD,YAAmBC,GAAiB;AAClC,UAAMA,GAAK,CAAA,GAAI,cAAc,GADZ,KAAA,MAAAA;AAAA,EAEnB;AAAA,EAEU,QAA8B;AACtC,SAAK,IAAI,IAAI,gBAAgB,KAAK,aAAa,KAAK,IAAI,CAAC,GACzD,KAAK,IAAI,GAAG,wBAAwB,KAAK,gBAAgB,KAAK,IAAI,CAAC;AAAA,EACrE;AAAA,EAEU,OAA6B;AACrC,SAAK,IAAI,IAAI,wBAAwB,KAAK,gBAAgB,KAAK,IAAI,CAAC;AAAA,EACtE;AAAA,EAEQ,gBAAgB,EAAE,KAAAA,GAAK,OAAAC,GAAO,UAAAC,KAAkC;AACtE,QAAIC;AACJ,IAAAF,EAAM;AAAA,MACJ;AAAA,QACE,OAAO;AAAA,QACP,MAAM;AAAA,QACN,WAAW;AAAA,QACX,QAAQ,MAAM;AACZ,UAAAE,IAAqB,KAAK;AAAA,YACvBF,EAAM,YAAA,EAAc,cAAmC,uBAAuB,GAC3E,SAAoB;AAAA,YACxB;AAAA,YACAC;AAAA,YACAC;AAAA,UAAA;AAAA,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,MAAM,CAACG,MAAU;AAChB,MAAAX,EAAM,SAAS,kBAAkB,GACjCA,EAAM;AAAA,QACJY,gBAAAA,EAAAC,GAAA,EACE,UAAA;AAAA,UAAA,gBAAAR,EAAC,OAAE,UAAA,oBAAA,CAAiB;AAAA,UACpB,gBAAAA,EAAC,OAAG,UAAAM,aAAiB,QAAQA,EAAM,UAAU,OAAOA,CAAK,EAAA,CAAE;AAAA,QAAA,EAAA,CAC7D;AAAA,MAAA;AAAA,IAEJ,CAAC,GAEIX;AAAA,EACT;AACF;AAtGON,IAAAoB,EAAAnB,CAAA;AAAME,IAANkB,8BADPtB,GACaI,CAAA;AAANmB,EAAAtB,GAAA,GAAMG,CAAA;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as m, F as be, P as Se } from "./index-CvhkVj_L.js";
|
|
2
|
-
import { B as G, a as Ne, S as E } from "./index-
|
|
2
|
+
import { B as G, a as Ne, S as E } from "./index-DNQjqBV-.js";
|
|
3
3
|
import { R as Pe } from "./Preferences-Bg3J5Ur9.js";
|
|
4
4
|
import { R as Ee, M as We } from "./RadioBox-CaA8VgLu.js";
|
|
5
5
|
class S {
|
|
@@ -11,14 +11,14 @@ class S {
|
|
|
11
11
|
}
|
|
12
12
|
diffWithOptionsObj(e, n, i, s) {
|
|
13
13
|
var r;
|
|
14
|
-
const l = (
|
|
15
|
-
if (
|
|
14
|
+
const l = (u) => {
|
|
15
|
+
if (u = this.postProcess(u, i), s) {
|
|
16
16
|
setTimeout(function() {
|
|
17
|
-
s(
|
|
17
|
+
s(u);
|
|
18
18
|
}, 0);
|
|
19
19
|
return;
|
|
20
20
|
} else
|
|
21
|
-
return
|
|
21
|
+
return u;
|
|
22
22
|
}, o = n.length, f = e.length;
|
|
23
23
|
let g = 1, a = o + f;
|
|
24
24
|
i.maxEditLength != null && (a = Math.min(a, i.maxEditLength));
|
|
@@ -28,39 +28,39 @@ class S {
|
|
|
28
28
|
return l(this.buildValues(v[0].lastComponent, n, e));
|
|
29
29
|
let p = -1 / 0, x = 1 / 0;
|
|
30
30
|
const C = () => {
|
|
31
|
-
for (let
|
|
32
|
-
let
|
|
33
|
-
const w = v[
|
|
34
|
-
w && (v[
|
|
31
|
+
for (let u = Math.max(p, -g); u <= Math.min(x, g); u += 2) {
|
|
32
|
+
let c;
|
|
33
|
+
const w = v[u - 1], k = v[u + 1];
|
|
34
|
+
w && (v[u - 1] = void 0);
|
|
35
35
|
let b = !1;
|
|
36
36
|
if (k) {
|
|
37
|
-
const N = k.oldPos -
|
|
37
|
+
const N = k.oldPos - u;
|
|
38
38
|
b = k && 0 <= N && N < o;
|
|
39
39
|
}
|
|
40
40
|
const D = w && w.oldPos + 1 < f;
|
|
41
41
|
if (!b && !D) {
|
|
42
|
-
v[
|
|
42
|
+
v[u] = void 0;
|
|
43
43
|
continue;
|
|
44
44
|
}
|
|
45
|
-
if (!D || b && w.oldPos < k.oldPos ?
|
|
46
|
-
return l(this.buildValues(
|
|
47
|
-
v[
|
|
45
|
+
if (!D || b && w.oldPos < k.oldPos ? c = this.addToPath(k, !0, !1, 0, i) : c = this.addToPath(w, !1, !0, 1, i), d = this.extractCommon(c, n, e, u, i), c.oldPos + 1 >= f && d + 1 >= o)
|
|
46
|
+
return l(this.buildValues(c.lastComponent, n, e)) || !0;
|
|
47
|
+
v[u] = c, c.oldPos + 1 >= f && (x = Math.min(x, u - 1)), d + 1 >= o && (p = Math.max(p, u + 1));
|
|
48
48
|
}
|
|
49
49
|
g++;
|
|
50
50
|
};
|
|
51
51
|
if (s)
|
|
52
|
-
(function
|
|
52
|
+
(function u() {
|
|
53
53
|
setTimeout(function() {
|
|
54
54
|
if (g > a || Date.now() > y)
|
|
55
55
|
return s(void 0);
|
|
56
|
-
C() ||
|
|
56
|
+
C() || u();
|
|
57
57
|
}, 0);
|
|
58
58
|
})();
|
|
59
59
|
else
|
|
60
60
|
for (; g <= a && Date.now() <= y; ) {
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
return
|
|
61
|
+
const u = C();
|
|
62
|
+
if (u)
|
|
63
|
+
return u;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
addToPath(e, n, i, s, r) {
|
|
@@ -384,9 +384,9 @@ class Me extends S {
|
|
|
384
384
|
return super.equals(e.replace(/,([\r\n])/g, "$1"), n.replace(/,([\r\n])/g, "$1"), i);
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
|
-
const
|
|
388
|
-
function
|
|
389
|
-
return
|
|
387
|
+
const ce = new Me();
|
|
388
|
+
function ue(t, e, n) {
|
|
389
|
+
return ce.diff(t, e, n);
|
|
390
390
|
}
|
|
391
391
|
function A(t, e, n, i, s) {
|
|
392
392
|
e = e || [], n = n || [], i && (t = i(s === void 0 ? "" : s, t));
|
|
@@ -553,7 +553,7 @@ function Ue(t, e, n = {}) {
|
|
|
553
553
|
else if (!l)
|
|
554
554
|
return !1;
|
|
555
555
|
}
|
|
556
|
-
function h(d, p, x, C = 0,
|
|
556
|
+
function h(d, p, x, C = 0, u = !0, c = [], w = 0) {
|
|
557
557
|
let k = 0, b = !1;
|
|
558
558
|
for (; C < d.length; C++) {
|
|
559
559
|
const D = d[C], N = D.length > 0 ? D[0] : " ", z = D.length > 0 ? D.substr(1) : D;
|
|
@@ -561,20 +561,20 @@ function Ue(t, e, n = {}) {
|
|
|
561
561
|
if (r(p + 1, i[p], N, z))
|
|
562
562
|
p++, k = 0;
|
|
563
563
|
else
|
|
564
|
-
return !x || i[p] == null ? null : (
|
|
564
|
+
return !x || i[p] == null ? null : (c[w] = i[p], h(d, p + 1, x - 1, C, !1, c, w + 1));
|
|
565
565
|
if (N === "+") {
|
|
566
|
-
if (!
|
|
566
|
+
if (!u)
|
|
567
567
|
return null;
|
|
568
|
-
|
|
568
|
+
c[w] = z, w++, k = 0, b = !0;
|
|
569
569
|
}
|
|
570
570
|
if (N === " ")
|
|
571
|
-
if (k++,
|
|
572
|
-
w++,
|
|
571
|
+
if (k++, c[w] = i[p], r(p + 1, i[p], N, z))
|
|
572
|
+
w++, u = !0, b = !1, p++;
|
|
573
573
|
else
|
|
574
|
-
return b || !x ? null : i[p] && (h(d, p + 1, x - 1, C + 1, !1,
|
|
574
|
+
return b || !x ? null : i[p] && (h(d, p + 1, x - 1, C + 1, !1, c, w + 1) || h(d, p + 1, x - 1, C, !1, c, w + 1)) || h(d, p, x - 1, C + 1, !1, c, w);
|
|
575
575
|
}
|
|
576
|
-
return w -= k, p -= k,
|
|
577
|
-
patchedLines:
|
|
576
|
+
return w -= k, p -= k, c.length = w, {
|
|
577
|
+
patchedLines: c,
|
|
578
578
|
oldLineLastI: p - 1
|
|
579
579
|
};
|
|
580
580
|
}
|
|
@@ -584,24 +584,24 @@ function Ue(t, e, n = {}) {
|
|
|
584
584
|
const p = s[d];
|
|
585
585
|
let x;
|
|
586
586
|
const C = i.length - p.oldLines + l;
|
|
587
|
-
let
|
|
588
|
-
for (let
|
|
589
|
-
|
|
590
|
-
const w = Qe(
|
|
591
|
-
for (;
|
|
587
|
+
let u;
|
|
588
|
+
for (let c = 0; c <= l; c++) {
|
|
589
|
+
u = p.oldStart + v - 1;
|
|
590
|
+
const w = Qe(u, o, C);
|
|
591
|
+
for (; u !== void 0 && (x = h(p.lines, u, c), !x); u = w())
|
|
592
592
|
;
|
|
593
593
|
if (x)
|
|
594
594
|
break;
|
|
595
595
|
}
|
|
596
596
|
if (!x)
|
|
597
597
|
return !1;
|
|
598
|
-
for (let
|
|
599
|
-
y.push(i[
|
|
600
|
-
for (let
|
|
601
|
-
const w = x.patchedLines[
|
|
598
|
+
for (let c = o; c < u; c++)
|
|
599
|
+
y.push(i[c]);
|
|
600
|
+
for (let c = 0; c < x.patchedLines.length; c++) {
|
|
601
|
+
const w = x.patchedLines[c];
|
|
602
602
|
y.push(w);
|
|
603
603
|
}
|
|
604
|
-
o = x.oldLineLastI + 1, v =
|
|
604
|
+
o = x.oldLineLastI + 1, v = u + 1 - p.oldStart;
|
|
605
605
|
}
|
|
606
606
|
for (let d = o; d < i.length; d++)
|
|
607
607
|
y.push(i[d]);
|
|
@@ -655,26 +655,26 @@ function q(t, e, n, i, s, r, l) {
|
|
|
655
655
|
if (!a)
|
|
656
656
|
return;
|
|
657
657
|
a.push({ value: "", lines: [] });
|
|
658
|
-
function h(
|
|
659
|
-
return
|
|
660
|
-
return " " +
|
|
658
|
+
function h(u) {
|
|
659
|
+
return u.map(function(c) {
|
|
660
|
+
return " " + c;
|
|
661
661
|
});
|
|
662
662
|
}
|
|
663
663
|
const y = [];
|
|
664
664
|
let v = 0, d = 0, p = [], x = 1, C = 1;
|
|
665
|
-
for (let
|
|
666
|
-
const
|
|
667
|
-
if (
|
|
665
|
+
for (let u = 0; u < a.length; u++) {
|
|
666
|
+
const c = a[u], w = c.lines || Xe(c.value);
|
|
667
|
+
if (c.lines = w, c.added || c.removed) {
|
|
668
668
|
if (!v) {
|
|
669
|
-
const k = a[
|
|
669
|
+
const k = a[u - 1];
|
|
670
670
|
v = x, d = C, k && (p = f > 0 ? h(k.lines.slice(-f)) : [], v -= p.length, d -= p.length);
|
|
671
671
|
}
|
|
672
672
|
for (const k of w)
|
|
673
|
-
p.push((
|
|
674
|
-
|
|
673
|
+
p.push((c.added ? "+" : "-") + k);
|
|
674
|
+
c.added ? C += w.length : x += w.length;
|
|
675
675
|
} else {
|
|
676
676
|
if (v)
|
|
677
|
-
if (w.length <= f * 2 &&
|
|
677
|
+
if (w.length <= f * 2 && u < a.length - 2)
|
|
678
678
|
for (const k of h(w))
|
|
679
679
|
p.push(k);
|
|
680
680
|
else {
|
|
@@ -693,10 +693,10 @@ function q(t, e, n, i, s, r, l) {
|
|
|
693
693
|
x += w.length, C += w.length;
|
|
694
694
|
}
|
|
695
695
|
}
|
|
696
|
-
for (const
|
|
697
|
-
for (let
|
|
698
|
-
|
|
699
|
-
`) ?
|
|
696
|
+
for (const u of y)
|
|
697
|
+
for (let c = 0; c < u.lines.length; c++)
|
|
698
|
+
u.lines[c].endsWith(`
|
|
699
|
+
`) ? u.lines[c] = u.lines[c].slice(0, -1) : (u.lines.splice(c + 1, 0, "\"), c++);
|
|
700
700
|
return {
|
|
701
701
|
oldFileName: t,
|
|
702
702
|
newFileName: e,
|
|
@@ -778,14 +778,14 @@ const et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
778
778
|
diffArrays: me,
|
|
779
779
|
diffChars: ee,
|
|
780
780
|
diffCss: ae,
|
|
781
|
-
diffJson:
|
|
781
|
+
diffJson: ue,
|
|
782
782
|
diffLines: F,
|
|
783
783
|
diffSentences: oe,
|
|
784
784
|
diffTrimmedLines: re,
|
|
785
785
|
diffWords: ne,
|
|
786
786
|
diffWordsWithSpace: $,
|
|
787
787
|
formatPatch: L,
|
|
788
|
-
jsonDiff:
|
|
788
|
+
jsonDiff: ce,
|
|
789
789
|
lineDiff: M,
|
|
790
790
|
parsePatch: R,
|
|
791
791
|
reversePatch: we,
|
|
@@ -796,7 +796,7 @@ const et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
796
796
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
797
797
|
class tt {
|
|
798
798
|
constructor(e) {
|
|
799
|
-
this.ctx = e, this.JsDiff = et, this.diffChars = ee, this.diffWords = ne, this.diffWordsWithSpace = $, this.diffLines = F, this.diffTrimmedLines = re, this.diffSentences = oe, this.diffCss = ae, this.diffJson =
|
|
799
|
+
this.ctx = e, this.JsDiff = et, this.diffChars = ee, this.diffWords = ne, this.diffWordsWithSpace = $, this.diffLines = F, this.diffTrimmedLines = re, this.diffSentences = oe, this.diffCss = ae, this.diffJson = ue, this.diffArrays = me, this.createTwoFilesPatch = J, this.ctx.set("jsdiff", this);
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
802
|
const nt = {
|
|
@@ -912,12 +912,12 @@ const nt = {
|
|
|
912
912
|
}, lt = (t, e = document) => e.querySelector(t), ot = (t, e = document) => e.querySelectorAll(t);
|
|
913
913
|
var ft = Object.create, B = Object.defineProperty, at = Object.getOwnPropertyDescriptor, ve = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), ye = (t) => {
|
|
914
914
|
throw TypeError(t);
|
|
915
|
-
},
|
|
915
|
+
}, ct = (t, e, n) => e in t ? B(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, ut = (t, e) => B(t, "name", { value: e, configurable: !0 }), dt = (t) => [, , , ft(t?.[ve("metadata")] ?? null)], mt = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], xe = (t) => t !== void 0 && typeof t != "function" ? ye("Function expected") : t, ht = (t, e, n, i, s) => ({ kind: mt[t], name: e, metadata: i, addInitializer: (r) => n._ ? ye("Already initialized") : s.push(xe(r || null)) }), gt = (t, e) => ct(e, ve("metadata"), t[3]), pt = (t, e, n, i) => {
|
|
916
916
|
for (var s = 0, r = t[e >> 1], l = r && r.length; s < l; s++) r[s].call(n);
|
|
917
917
|
return i;
|
|
918
918
|
}, wt = (t, e, n, i, s, r) => {
|
|
919
919
|
var l, o, f, g = e & 7, a = !1, h = 0, y = t[h] || (t[h] = []), v = g && (s = s.prototype, g < 5 && (g > 3 || !a) && at(s, n));
|
|
920
|
-
|
|
920
|
+
ut(s, n);
|
|
921
921
|
for (var d = i.length - 1; d >= 0; d--)
|
|
922
922
|
f = ht(g, n, o = {}, t[3], y), l = (0, i[d])(s, f), o._ = 1, xe(l) && (s = l);
|
|
923
923
|
return gt(t, s), v && B(s, n, v), a ? g ^ 4 ? r : v : s;
|
|
@@ -999,7 +999,7 @@ class j extends (Ce = G) {
|
|
|
999
999
|
className: "btn btn-secondary",
|
|
1000
1000
|
method: () => {
|
|
1001
1001
|
const s = n.title, r = n.revisions?.[0]?.content || "", l = e.get$content().querySelector('textarea[name="text"]')?.value || "";
|
|
1002
|
-
return i = this.comparePages(
|
|
1002
|
+
return r === l ? this.ctx.modal.notify("info", { content: "No chages" }) : (i = this.comparePages(
|
|
1003
1003
|
{
|
|
1004
1004
|
fromtitle: s,
|
|
1005
1005
|
fromtext: r,
|
|
@@ -1007,7 +1007,7 @@ class j extends (Ce = G) {
|
|
|
1007
1007
|
totext: l
|
|
1008
1008
|
},
|
|
1009
1009
|
i
|
|
1010
|
-
), i;
|
|
1010
|
+
), i);
|
|
1011
1011
|
}
|
|
1012
1012
|
},
|
|
1013
1013
|
1
|
|
@@ -1137,4 +1137,4 @@ class Ct extends G {
|
|
|
1137
1137
|
export {
|
|
1138
1138
|
Ct as PluginQuickDiff
|
|
1139
1139
|
};
|
|
1140
|
-
//# sourceMappingURL=index-
|
|
1140
|
+
//# sourceMappingURL=index-i-Uf0vuA.js.map
|