@inpageedit/core 0.8.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.
- package/LICENSE +20 -20
- package/README.md +55 -55
- package/dist/ActionButton-BgbTKTg7.js.map +1 -1
- package/dist/CheckBox-D3rHnX7I.js.map +1 -1
- package/dist/{IconQuickEdit-YVn1ANbm.js → IconQuickEdit-CAL1HXIb.js} +4 -4
- package/dist/IconQuickEdit-CAL1HXIb.js.map +1 -0
- package/dist/InputBox-BV4m05Xs.js.map +1 -1
- package/dist/Preferences-Bg3J5Ur9.js.map +1 -1
- package/dist/RadioBox-nJqWsxW2.js.map +1 -1
- package/dist/__test__/utils/constants.d.ts +2 -2
- package/dist/components/index.js.map +1 -1
- package/dist/index-9M1QcjCN.js +354 -0
- package/dist/index-9M1QcjCN.js.map +1 -0
- package/dist/{index-C0V2s48o.js → index-Ba7Wkale.js} +38 -33
- package/dist/index-Ba7Wkale.js.map +1 -0
- package/dist/index-Bh70Udzi.js.map +1 -1
- package/dist/{index--xn9BebC.js → index-C8dOYIIz.js} +61 -69
- package/dist/{index--xn9BebC.js.map → index-C8dOYIIz.js.map} +1 -1
- package/dist/{index-DpLwTw4C.js → index-COlXHFRg.js} +2599 -2080
- package/dist/index-COlXHFRg.js.map +1 -0
- package/dist/{index-DTA86mHU.js → index-CeXR4lOu.js} +5 -5
- package/dist/index-CeXR4lOu.js.map +1 -0
- package/dist/index-CvhkVj_L.js.map +1 -1
- package/dist/{index-VzP81S7B.js → index-DBV8FBjA.js} +2 -2
- package/dist/index-DBV8FBjA.js.map +1 -0
- package/dist/{index-DlgTb4XY.js → index-DwyuBkCK.js} +3 -3
- package/dist/index-DwyuBkCK.js.map +1 -0
- package/dist/{index-DDWds9Jg.js → index-OBerV4GU.js} +28 -28
- package/dist/index-OBerV4GU.js.map +1 -0
- package/dist/{index-TzKe6Ebm.js → index-Tn22YSmW.js} +2 -2
- package/dist/index-Tn22YSmW.js.map +1 -0
- package/dist/index-kRdAN8h3.js +193 -0
- package/dist/index-kRdAN8h3.js.map +1 -0
- package/dist/index-lZkYoUca.js.map +1 -1
- package/dist/{index-BT1mN_St.js → index-mntCdHRr.js} +3 -3
- package/dist/{index-BT1mN_St.js.map → index-mntCdHRr.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/makeCallable-LDU0xZMJ.js.map +1 -1
- package/dist/models/WikiTitle/index.d.ts +1 -0
- package/dist/noop-ClDc6zv4.js.map +1 -1
- package/dist/plugins/in-article-links/index.d.ts +1 -1
- package/dist/plugins/quick-delete/index.d.ts +1 -1
- package/dist/plugins/quick-diff/PluginQuickDiffCore.d.ts +1 -1
- package/dist/plugins/quick-edit/index.d.ts +1 -1
- package/dist/plugins/quick-preview/index.d.ts +1 -1
- package/dist/services/CurrentPageService.d.ts +27 -0
- package/dist/services/{ModalService/index.d.ts → ModalService.d.ts} +4 -4
- package/dist/services/WikiTitleService.d.ts +19 -7
- package/dist/style.css +1 -1
- package/lib/index.umd.js +34 -35
- package/lib/index.umd.js.map +1 -1
- package/lib/style.css +1 -1
- package/package.json +7 -6
- package/dist/IconQuickEdit-YVn1ANbm.js.map +0 -1
- package/dist/index-C0V2s48o.js.map +0 -1
- package/dist/index-DDWds9Jg.js.map +0 -1
- package/dist/index-DDef1ojx.js +0 -166
- package/dist/index-DDef1ojx.js.map +0 -1
- package/dist/index-DTA86mHU.js.map +0 -1
- package/dist/index-DlgTb4XY.js.map +0 -1
- package/dist/index-DpLwTw4C.js.map +0 -1
- package/dist/index-TzKe6Ebm.js.map +0 -1
- package/dist/index-VzP81S7B.js.map +0 -1
- package/dist/index-loWqosf7.js +0 -331
- package/dist/index-loWqosf7.js.map +0 -1
- package/dist/services/ModalService/IPEModal.d.ts +0 -235
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 dragon-fish
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 dragon-fish
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
[<img src="/docs/.vitepress/public/images/logo/ipe-next-uwu.png" width="280" alt="InPageEdit Logo">](https://www.ipe.wiki)
|
|
4
|
-
|
|
5
|
-
# InPageEdit NEXT
|
|
6
|
-
|
|
7
|
-
🚀 MediaWiki 的模块化、可扩展超级增强插件
|
|
8
|
-
|
|
9
|
-
**InPageEdit NEXT**是由机智的小鱼君开发的一款 MediaWiki 多功能插件。主要功能旨在使许多 MediaWiki 的功能在不打开新标签页的情况下完成(包括但不限于编辑),极大加快维护 wiki 的速度。模块化设计、类型定义清晰完整,插件可自由热插拔。
|
|
10
|
-
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
## 快速上手 / Quick Start
|
|
14
|
-
|
|
15
|
-
[](https://www.jsdelivr.com/package/npm/@inpageedit/core)
|
|
16
|
-
|
|
17
|
-
在*个人 JS 页*添加以下代码:
|
|
18
|
-
|
|
19
|
-
<!-- prettier-ignore -->
|
|
20
|
-
```javascript
|
|
21
|
-
// InPageEdit NEXT
|
|
22
|
-
$('<script src="https://unpkg.com/@inpageedit/core" type="module"></script>').appendTo('body')
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## 特色功能 / Features
|
|
26
|
-
|
|
27
|
-
**编辑者视角 / For wiki editors**
|
|
28
|
-
|
|
29
|
-
- 快速编辑 / Quick Edit
|
|
30
|
-
- 快速移动 / Quick Move
|
|
31
|
-
- 快速重定向 / Quick Redirect
|
|
32
|
-
- 快速差异 / Quick Diff
|
|
33
|
-
- 快速预览 / Quick Preview
|
|
34
|
-
|
|
35
|
-
**开发者视角 / For developers**
|
|
36
|
-
|
|
37
|
-
- 可热插拔的模块化设计
|
|
38
|
-
- 完全使用 TypeScript 编写
|
|
39
|
-
- 超简单的扩展能力,示例插件:[hello-world](./docs/.templates/examples/plugins/hello-world.js)
|
|
40
|
-
|
|
41
|
-
## Supported languages
|
|
42
|
-
|
|
43
|
-
> [!NOTE]
|
|
44
|
-
>
|
|
45
|
-
> Currently only English is supported. We're working on i18n support.
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
🚀 Modular, Extensible Supercharged Plugin for MediaWiki.
|
|
50
|
-
|
|
51
|
-
> [MIT License](https://opensource.org/licenses/MIT)
|
|
52
|
-
>
|
|
53
|
-
> InPageEdit-NEXT Copyright © 2025-present dragon-fish
|
|
54
|
-
|
|
55
|
-
See more: [GitHub](https://github.com/inpageedit/inpageedit-next) | [Change Logs](https://www.ipe.wiki/changelogs/) | [File Issues](https://github.com/inpageedit/inpageedit-next/issues)
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
[<img src="/docs/.vitepress/public/images/logo/ipe-next-uwu.png" width="280" alt="InPageEdit Logo">](https://www.ipe.wiki)
|
|
4
|
+
|
|
5
|
+
# InPageEdit NEXT
|
|
6
|
+
|
|
7
|
+
🚀 MediaWiki 的模块化、可扩展超级增强插件
|
|
8
|
+
|
|
9
|
+
**InPageEdit NEXT**是由机智的小鱼君开发的一款 MediaWiki 多功能插件。主要功能旨在使许多 MediaWiki 的功能在不打开新标签页的情况下完成(包括但不限于编辑),极大加快维护 wiki 的速度。模块化设计、类型定义清晰完整,插件可自由热插拔。
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
## 快速上手 / Quick Start
|
|
14
|
+
|
|
15
|
+
[](https://www.jsdelivr.com/package/npm/@inpageedit/core)
|
|
16
|
+
|
|
17
|
+
在*个人 JS 页*添加以下代码:
|
|
18
|
+
|
|
19
|
+
<!-- prettier-ignore -->
|
|
20
|
+
```javascript
|
|
21
|
+
// InPageEdit NEXT
|
|
22
|
+
$('<script src="https://unpkg.com/@inpageedit/core" type="module"></script>').appendTo('body')
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 特色功能 / Features
|
|
26
|
+
|
|
27
|
+
**编辑者视角 / For wiki editors**
|
|
28
|
+
|
|
29
|
+
- 快速编辑 / Quick Edit
|
|
30
|
+
- 快速移动 / Quick Move
|
|
31
|
+
- 快速重定向 / Quick Redirect
|
|
32
|
+
- 快速差异 / Quick Diff
|
|
33
|
+
- 快速预览 / Quick Preview
|
|
34
|
+
|
|
35
|
+
**开发者视角 / For developers**
|
|
36
|
+
|
|
37
|
+
- 可热插拔的模块化设计
|
|
38
|
+
- 完全使用 TypeScript 编写
|
|
39
|
+
- 超简单的扩展能力,示例插件:[hello-world](./docs/.templates/examples/plugins/hello-world.js)
|
|
40
|
+
|
|
41
|
+
## Supported languages
|
|
42
|
+
|
|
43
|
+
> [!NOTE]
|
|
44
|
+
>
|
|
45
|
+
> Currently only English is supported. We're working on i18n support.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
🚀 Modular, Extensible Supercharged Plugin for MediaWiki.
|
|
50
|
+
|
|
51
|
+
> [MIT License](https://opensource.org/licenses/MIT)
|
|
52
|
+
>
|
|
53
|
+
> InPageEdit-NEXT Copyright © 2025-present dragon-fish
|
|
54
|
+
|
|
55
|
+
See more: [GitHub](https://github.com/inpageedit/inpageedit-next) | [Change Logs](https://www.ipe.wiki/changelogs/) | [File Issues](https://github.com/inpageedit/inpageedit-next/issues)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionButton-BgbTKTg7.js","sources":["../src/components/ActionButton.tsx"],"sourcesContent":["import { h, JSX, ReactNode } from 'jsx-dom'\
|
|
1
|
+
{"version":3,"file":"ActionButton-BgbTKTg7.js","sources":["../src/components/ActionButton.tsx"],"sourcesContent":["import { h, JSX, ReactNode } from 'jsx-dom'\n\nexport interface ActionButtonProps {\n type?: 'primary' | 'secondary' | 'danger' | 'default'\n tag?: 'a' | 'button' | 'div'\n}\n\nconst origin = window?.location?.origin\n\nexport const ActionButton = ({\n type,\n tag,\n href,\n target,\n children,\n ...rest\n}: ActionButtonProps &\n Omit<JSX.IntrinsicElements['button'], 'type'> &\n JSX.IntrinsicElements['a']) => {\n tag = tag || (href ? 'a' : 'button')\n if (\n typeof target === 'undefined' &&\n href &&\n href.startsWith('http') &&\n !href.startsWith(origin)\n ) {\n target = '_blank'\n }\n return h(\n tag,\n {\n className: `theme-ipe ipe-action-button ipe-modal-btn is-${type || 'default'}`,\n // @ts-ignore\n href: tag === 'a' ? href : undefined,\n target: tag === 'a' ? target : undefined,\n 'data-href': tag !== 'a' ? href : undefined,\n ...rest,\n },\n children\n )\n}\n"],"names":["origin","ActionButton","type","tag","href","target","children","rest","h"],"mappings":";AAOA,MAAMA,IAAS,QAAQ,UAAU,QAEpBC,IAAe,CAAC;AAAA,EAC3B,MAAAC;AAAA,EACA,KAAAC;AAAA,EACA,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,OAGEJ,IAAMA,MAAQC,IAAO,MAAM,WAEzB,OAAOC,IAAW,OAClBD,KACAA,EAAK,WAAW,MAAM,KACtB,CAACA,EAAK,WAAWJ,CAAM,MAEvBK,IAAS,WAEJG;AAAAA,EACLL;AAAA,EACA;AAAA,IACE,WAAW,gDAAgDD,KAAQ,SAAS;AAAA;AAAA,IAE5E,MAAMC,MAAQ,MAAMC,IAAO;AAAA,IAC3B,QAAQD,MAAQ,MAAME,IAAS;AAAA,IAC/B,aAAaF,MAAQ,MAAMC,IAAO;AAAA,IAClC,GAAGG;AAAA,EAAA;AAAA,EAELD;AAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckBox-D3rHnX7I.js","sources":["../src/components/CheckBox.tsx"],"sourcesContent":["import { JSX, ReactNode } from 'jsx-dom'\
|
|
1
|
+
{"version":3,"file":"CheckBox-D3rHnX7I.js","sources":["../src/components/CheckBox.tsx"],"sourcesContent":["import { JSX, ReactNode } from 'jsx-dom'\n\nexport type CheckBoxProps = {\n id?: string\n name: string\n label?: string | HTMLElement\n checked?: boolean\n inputProps?: JSX.IntrinsicElements['input']\n labelProps?: JSX.IntrinsicElements['span']\n} & JSX.IntrinsicElements['label']\n\nexport const CheckBox = (props: CheckBoxProps) => {\n const { id, name, label, checked, inputProps, labelProps, children, ...rest } = props\n return (\n <label className=\"theme-ipe ipe-checkbox\" {...rest}>\n <input type=\"checkbox\" id={id} name={name} checked={checked} {...inputProps} />\n <span className=\"ipe-checkbox-box\"></span>\n <span {...labelProps}>{label || children}</span>\n </label>\n )\n}\n"],"names":["CheckBox","props","id","name","label","checked","inputProps","labelProps","children","rest","jsxs","jsx"],"mappings":";AAWO,MAAMA,IAAW,CAACC,MAAyB;AAChD,QAAM,EAAE,IAAAC,GAAI,MAAAC,GAAM,OAAAC,GAAO,SAAAC,GAAS,YAAAC,GAAY,YAAAC,GAAY,UAAAC,GAAU,GAAGC,EAAA,IAASR;AAChF,SACES,gBAAAA,EAAC,SAAA,EAAM,WAAU,0BAA0B,GAAGD,GAC5C,UAAA;AAAA,IAAA,gBAAAE,EAAC,WAAM,MAAK,YAAW,IAAAT,GAAQ,MAAAC,GAAY,SAAAE,GAAmB,GAAGC,GAAY;AAAA,IAC7E,gBAAAK,EAAC,QAAA,EAAK,WAAU,mBAAA,CAAmB;AAAA,IACnC,gBAAAA,EAAC,QAAA,EAAM,GAAGJ,GAAa,eAASC,EAAA,CAAS;AAAA,EAAA,GAC3C;AAEJ;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as o } from "./index-CvhkVj_L.js";
|
|
2
|
-
const
|
|
2
|
+
const n = (t) => /* @__PURE__ */ o(
|
|
3
3
|
"svg",
|
|
4
4
|
{
|
|
5
5
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -11,8 +11,8 @@ const l = (t) => /* @__PURE__ */ o(
|
|
|
11
11
|
"stroke-width": "2",
|
|
12
12
|
"stroke-linecap": "round",
|
|
13
13
|
"stroke-linejoin": "round",
|
|
14
|
-
class: "icon icon-tabler icons-tabler-outline icon-tabler-pencil-bolt",
|
|
15
14
|
...t,
|
|
15
|
+
class: `icon icon-tabler icons-tabler-outline icon-tabler-pencil-bolt ${t.className || ""}`,
|
|
16
16
|
children: [
|
|
17
17
|
/* @__PURE__ */ o("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
18
18
|
/* @__PURE__ */ o("path", { d: "M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4" }),
|
|
@@ -22,6 +22,6 @@ const l = (t) => /* @__PURE__ */ o(
|
|
|
22
22
|
}
|
|
23
23
|
);
|
|
24
24
|
export {
|
|
25
|
-
|
|
25
|
+
n as I
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=IconQuickEdit-
|
|
27
|
+
//# sourceMappingURL=IconQuickEdit-CAL1HXIb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconQuickEdit-CAL1HXIb.js","sources":["../src/components/Icon/IconQuickEdit.tsx"],"sourcesContent":["import { SVGProps } from 'jsx-dom'\n\nexport const IconQuickEdit = (props: SVGProps<SVGSVGElement>) => (\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 {...props}\n class={`icon icon-tabler icons-tabler-outline icon-tabler-pencil-bolt ${props.className || ''}`}\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4\" />\n <path d=\"M13.5 6.5l4 4\" />\n <path d=\"M19 16l-2 3h4l-2 3\" />\n </svg>\n)\n"],"names":["IconQuickEdit","props","jsxs","jsx"],"mappings":";AAEO,MAAMA,IAAgB,CAACC,MAC5BC,gBAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,QAAO;AAAA,IACP,gBAAa;AAAA,IACb,kBAAe;AAAA,IACf,mBAAgB;AAAA,IACf,GAAGD;AAAA,IACJ,OAAO,iEAAiEA,EAAM,aAAa,EAAE;AAAA,IAE7F,UAAA;AAAA,MAAA,gBAAAE,EAAC,UAAK,QAAO,QAAO,GAAE,iBAAgB,MAAK,QAAO;AAAA,MAClD,gBAAAA,EAAC,QAAA,EAAK,GAAE,0DAAA,CAA0D;AAAA,MAClE,gBAAAA,EAAC,QAAA,EAAK,GAAE,gBAAA,CAAgB;AAAA,MACxB,gBAAAA,EAAC,QAAA,EAAK,GAAE,qBAAA,CAAqB;AAAA,IAAA;AAAA,EAAA;AAC/B;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputBox-BV4m05Xs.js","sources":["../src/components/InputBox.tsx"],"sourcesContent":["import { JSX } from 'jsx-dom'\
|
|
1
|
+
{"version":3,"file":"InputBox-BV4m05Xs.js","sources":["../src/components/InputBox.tsx"],"sourcesContent":["import { JSX } from 'jsx-dom'\n\nexport type InputBoxProps = {\n label: string\n id?: string\n name: string\n value?: string\n disabled?: boolean\n labelProps?: JSX.IntrinsicElements['label']\n inputProps?: JSX.IntrinsicElements['input']\n} & JSX.IntrinsicElements['div']\n\nexport const InputBox = (props: InputBoxProps) => {\n const { label, id, name, value, disabled, labelProps, inputProps, ...rest } = props\n return (\n <div className=\"theme-ipe ipe-input-box\" {...rest}>\n <label htmlFor={id} style={{ display: 'block' }} {...labelProps}>\n {label}\n </label>\n <input\n id={id}\n name={name}\n value={value}\n disabled={disabled}\n style={{ width: '100%' }}\n {...inputProps}\n />\n </div>\n )\n}\n"],"names":["InputBox","props","label","id","name","value","disabled","labelProps","inputProps","rest","jsxs","jsx"],"mappings":";AAYO,MAAMA,IAAW,CAACC,MAAyB;AAChD,QAAM,EAAE,OAAAC,GAAO,IAAAC,GAAI,MAAAC,GAAM,OAAAC,GAAO,UAAAC,GAAU,YAAAC,GAAY,YAAAC,GAAY,GAAGC,EAAA,IAASR;AAC9E,SACES,gBAAAA,EAAC,OAAA,EAAI,WAAU,2BAA2B,GAAGD,GAC3C,UAAA;AAAA,IAAA,gBAAAE,EAAC,SAAA,EAAM,SAASR,GAAI,OAAO,EAAE,SAAS,QAAA,GAAY,GAAGI,GAClD,UAAAL,EAAA,CACH;AAAA,IACA,gBAAAS;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAAR;AAAA,QACA,MAAAC;AAAA,QACA,OAAAC;AAAA,QACA,UAAAC;AAAA,QACA,OAAO,EAAE,OAAO,OAAA;AAAA,QACf,GAAGE;AAAA,MAAA;AAAA,IAAA;AAAA,EACN,GACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Preferences-Bg3J5Ur9.js","sources":["../src/decorators/Preferences.ts"],"sourcesContent":["import type Schema from 'schemastery'\
|
|
1
|
+
{"version":3,"file":"Preferences-Bg3J5Ur9.js","sources":["../src/decorators/Preferences.ts"],"sourcesContent":["import type Schema from 'schemastery'\n\ntype AnyConstructor<T = any> = new (...args: any[]) => T\n\nexport type PreferenceAugmented<C extends AnyConstructor, D extends Record<string, any>> = C & {\n PreferencesSchema: Schema<D>\n PreferencesDefaults: D\n}\n\n/**\n * Decorator for registering preferences\n *\n * ```ts\n * @RegisterPreferences(\n * Schema.object({\n * foo: Schema.string().description('Foo description'),\n * }),\n * {\n * foo: 'default foo value',\n * }\n * )\n * class Foo {}\n * ```\n *\n * same as:\n *\n * ```ts\n * class Foo {\n * static ConfigSchema = Schema.object({\n * foo: Schema.string().description('Foo description')\n * })\n * static ConfigDefaults = {\n * foo: 'default foo value'\n * }\n * }\n * ```\n */\nexport function RegisterPreferences<D extends Record<string, any>>(\n schema: Schema<D>,\n defaults?: D\n) {\n return function <T extends AnyConstructor>(target: T): PreferenceAugmented<T, D> {\n ;(target as any).PreferencesSchema = schema\n ;(target as any).PreferencesDefaults = defaults\n return target as PreferenceAugmented<T, D>\n }\n}\n"],"names":["RegisterPreferences","schema","defaults","target"],"mappings":"AAqCO,SAASA,EACdC,GACAC,GACA;AACA,SAAO,SAAoCC,GAAsC;AAC7E,WAAAA,EAAe,oBAAoBF,GACnCE,EAAe,sBAAsBD,GAChCC;AAAA,EACT;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioBox-nJqWsxW2.js","sources":["../src/components/RadioBox.tsx"],"sourcesContent":["import { JSX, ReactNode } from 'jsx-dom'\
|
|
1
|
+
{"version":3,"file":"RadioBox-nJqWsxW2.js","sources":["../src/components/RadioBox.tsx"],"sourcesContent":["import { JSX, ReactNode } from 'jsx-dom'\n\nexport type RadioBoxProps = {\n id?: string\n name: string\n value: string\n label?: string | HTMLElement\n inputProps?: JSX.IntrinsicElements['input']\n labelProps?: JSX.IntrinsicElements['span']\n} & JSX.IntrinsicElements['label']\n\nexport const RadioBox = (props: RadioBoxProps) => {\n const { id, name, value, label, inputProps, labelProps, children, ...rest } = props\n return (\n <label className=\"theme-ipe ipe-radio-box\" {...rest}>\n <input type=\"radio\" id={id} name={name} value={value} {...inputProps} />\n <span className=\"ipe-checkbox-box\"></span>\n <span {...labelProps}>{label || children}</span>\n </label>\n )\n}\n"],"names":["RadioBox","props","id","name","value","label","inputProps","labelProps","children","rest","jsxs","jsx"],"mappings":";AAWO,MAAMA,IAAW,CAACC,MAAyB;AAChD,QAAM,EAAE,IAAAC,GAAI,MAAAC,GAAM,OAAAC,GAAO,OAAAC,GAAO,YAAAC,GAAY,YAAAC,GAAY,UAAAC,GAAU,GAAGC,EAAA,IAASR;AAC9E,SACES,gBAAAA,EAAC,SAAA,EAAM,WAAU,2BAA2B,GAAGD,GAC7C,UAAA;AAAA,IAAA,gBAAAE,EAAC,WAAM,MAAK,SAAQ,IAAAT,GAAQ,MAAAC,GAAY,OAAAC,GAAe,GAAGE,GAAY;AAAA,IACtE,gBAAAK,EAAC,QAAA,EAAK,WAAU,mBAAA,CAAmB;AAAA,IACnC,gBAAAA,EAAC,QAAA,EAAM,GAAGJ,GAAa,eAASC,EAAA,CAAS;AAAA,EAAA,GAC3C;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const MOCK_SITE_METADATA:
|
|
1
|
+
import { WikiMetadata } from '../../types/WikiMetadata.js';
|
|
2
|
+
export declare const MOCK_SITE_METADATA: WikiMetadata;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/components/TabView/index.tsx"],"sourcesContent":["import { ReactNode } from 'jsx-dom'\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/components/TabView/index.tsx"],"sourcesContent":["import { ReactNode } from 'jsx-dom'\nimport styles from './styles.module.sass'\n\nexport interface TabViewLabelOptions {\n name: string\n children: ReactNode\n}\n\nconsole.log(styles)\n\nexport function TabView({\n tabs = [],\n defaultActiveIndex = 0,\n}: {\n tabs: (TabViewLabelOptions & { content: ReactNode })[]\n defaultActiveIndex?: number\n}) {\n const el = (\n <div className={`ipe-tabView ${styles.tabview}`}>\n <ul className={`ipe-tabView__labels-container ${styles.labels_container}`}>\n {tabs.map((tab) => (\n <TabLabel key={tab.name} name={tab.name}>\n {tab.children}\n </TabLabel>\n ))}\n </ul>\n <div className={`ipe-tabView__contents ${styles.contents_container}`}>\n {tabs.map((tab) => (\n <TabContent key={tab.name} name={tab.name}>\n {tab.content}\n </TabContent>\n ))}\n </div>\n </div>\n )\n\n const defaultActiveLabel = el.querySelector<HTMLAnchorElement>(\n `.ipe-tabView__labels-container > .ipe-tabView__label:nth-child(${defaultActiveIndex + 1})`\n )\n if (defaultActiveLabel) {\n defaultActiveLabel.click()\n }\n\n return el\n}\n\nexport function TabLabel({ name, children }: { name: string; children: ReactNode }) {\n return (\n <li\n data-tab-name={name}\n className={`ipe-tabView__label ${styles.label}`}\n onClick={function (e) {\n e.preventDefault()\n const container = this.closest('.ipe-tabView')\n if (!container) return\n const labels = Array.from(container.children).find((el) =>\n el.classList.contains('ipe-tabView__labels')\n )?.children\n if (labels) {\n Array.from(labels).forEach((label) => {\n label.classList.remove(styles.active)\n })\n }\n this.classList.add(styles.active)\n const contents = Array.from(container.children).find((el) =>\n el.classList.contains('ipe-tabView__contents')\n )?.children\n if (contents) {\n Array.from(contents).forEach((content) => {\n if (content instanceof HTMLElement) {\n if (content.dataset.tabName === name) {\n content.style.display = ''\n content.classList.add(styles.active)\n } else {\n content.style.display = 'none'\n content.classList.remove(styles.active)\n }\n }\n })\n }\n }}\n >\n <a>{children || name}</a>\n </li>\n )\n}\n\nexport function TabContent({ name, children }: { name: string; children: ReactNode }) {\n return (\n <div\n data-tab-name={name}\n className=\"ipe-tabView__content-body\"\n style={{\n display: 'none',\n }}\n >\n {children}\n </div>\n )\n}\n"],"names":["TabView","tabs","defaultActiveIndex","el","jsxs","styles","jsx","tab","TabLabel","TabContent","defaultActiveLabel","name","children","e","container","labels","label","contents","content"],"mappings":";;;;;;;;;;;;;;;AAUO,SAASA,EAAQ;AAAA,EACtB,MAAAC,IAAO,CAAA;AAAA,EACP,oBAAAC,IAAqB;AACvB,GAGG;AACD,QAAMC,IACJC,gBAAAA,EAAC,OAAA,EAAI,WAAW,eAAeC,EAAO,OAAO,IAC3C,UAAA;AAAA,IAAA,gBAAAC,EAAC,MAAA,EAAG,WAAW,iCAAiCD,EAAO,gBAAgB,IACpE,UAAAJ,EAAK,IAAI,CAACM,wBACRC,GAAA,EAAwB,MAAMD,EAAI,MAChC,UAAAA,EAAI,YADQA,EAAI,IAEnB,CACD,EAAA,CACH;AAAA,IACA,gBAAAD,EAAC,SAAI,WAAW,yBAAyBD,EAAO,kBAAkB,IAC/D,YAAK,IAAI,CAACE,MACT,gBAAAD,EAACG,GAAA,EAA0B,MAAMF,EAAI,MAClC,YAAI,QAAA,GADUA,EAAI,IAErB,CACD,EAAA,CACH;AAAA,EAAA,GACF,GAGIG,IAAqBP,EAAG;AAAA,IAC5B,kEAAkED,IAAqB,CAAC;AAAA,EAAA;AAE1F,SAAIQ,KACFA,EAAmB,MAAA,GAGdP;AACT;AAEO,SAASK,EAAS,EAAE,MAAAG,GAAM,UAAAC,KAAmD;AAClF,SACE,gBAAAN;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,iBAAeK;AAAA,MACf,WAAW,sBAAsBN,EAAO,KAAK;AAAA,MAC7C,SAAS,SAAUQ,GAAG;AACpB,QAAAA,EAAE,eAAA;AACF,cAAMC,IAAY,KAAK,QAAQ,cAAc;AAC7C,YAAI,CAACA,EAAW;AAChB,cAAMC,IAAS,MAAM,KAAKD,EAAU,QAAQ,EAAE;AAAA,UAAK,CAACX,MAClDA,EAAG,UAAU,SAAS,qBAAqB;AAAA,QAAA,GAC1C;AACH,QAAIY,KACF,MAAM,KAAKA,CAAM,EAAE,QAAQ,CAACC,MAAU;AACpC,UAAAA,EAAM,UAAU,OAAOX,EAAO,MAAM;AAAA,QACtC,CAAC,GAEH,KAAK,UAAU,IAAIA,EAAO,MAAM;AAChC,cAAMY,IAAW,MAAM,KAAKH,EAAU,QAAQ,EAAE;AAAA,UAAK,CAACX,MACpDA,EAAG,UAAU,SAAS,uBAAuB;AAAA,QAAA,GAC5C;AACH,QAAIc,KACF,MAAM,KAAKA,CAAQ,EAAE,QAAQ,CAACC,MAAY;AACxC,UAAIA,aAAmB,gBACjBA,EAAQ,QAAQ,YAAYP,KAC9BO,EAAQ,MAAM,UAAU,IACxBA,EAAQ,UAAU,IAAIb,EAAO,MAAM,MAEnCa,EAAQ,MAAM,UAAU,QACxBA,EAAQ,UAAU,OAAOb,EAAO,MAAM;AAAA,QAG5C,CAAC;AAAA,MAEL;AAAA,MAEA,UAAA,gBAAAC,EAAC,KAAA,EAAG,UAAAM,KAAYD,EAAA,CAAK;AAAA,IAAA;AAAA,EAAA;AAG3B;AAEO,SAASF,EAAW,EAAE,MAAAE,GAAM,UAAAC,KAAmD;AACpF,SACE,gBAAAN;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,iBAAeK;AAAA,MACf,WAAU;AAAA,MACV,OAAO;AAAA,QACL,SAAS;AAAA,MAAA;AAAA,MAGV,UAAAC;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { j as t, F as w, P as C } from "./index-CvhkVj_L.js";
|
|
2
|
+
import { B as M, W as f, I as B, S as m } from "./index-COlXHFRg.js";
|
|
3
|
+
import { m as A } from "./makeCallable-LDU0xZMJ.js";
|
|
4
|
+
import { R as F } from "./Preferences-Bg3J5Ur9.js";
|
|
5
|
+
import { M as S } from "./index-lZkYoUca.js";
|
|
6
|
+
import { I as _ } from "./InputBox-BV4m05Xs.js";
|
|
7
|
+
import { R as O } from "./RadioBox-nJqWsxW2.js";
|
|
8
|
+
import { C as E } from "./CheckBox-D3rHnX7I.js";
|
|
9
|
+
import { n as P } from "./noop-ClDc6zv4.js";
|
|
10
|
+
const D = (i = 0) => new Promise((e) => setTimeout(e, i));
|
|
11
|
+
var j = Object.create, k = Object.defineProperty, L = Object.getOwnPropertyDescriptor, y = (i, e) => (e = Symbol[i]) ? e : Symbol.for("Symbol." + i), q = (i) => {
|
|
12
|
+
throw TypeError(i);
|
|
13
|
+
}, R = (i, e, a) => e in i ? k(i, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : i[e] = a, U = (i, e) => k(i, "name", { value: e, configurable: !0 }), W = (i) => [, , , j(i?.[y("metadata")] ?? null)], z = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], I = (i) => i !== void 0 && typeof i != "function" ? q("Function expected") : i, Q = (i, e, a, l, n) => ({ kind: z[i], name: e, metadata: l, addInitializer: (d) => a._ ? q("Already initialized") : n.push(I(d || null)) }), K = (i, e) => R(e, y("metadata"), i[3]), Y = (i, e, a, l) => {
|
|
14
|
+
for (var n = 0, d = i[e >> 1], s = d && d.length; n < s; n++) d[n].call(a);
|
|
15
|
+
return l;
|
|
16
|
+
}, G = (i, e, a, l, n, d) => {
|
|
17
|
+
var s, o, c, u = e & 7, g = !1, p = 0, r = i[p] || (i[p] = []), h = u && (n = n.prototype, u < 5 && (u > 3 || !g) && L(n, a));
|
|
18
|
+
U(n, a);
|
|
19
|
+
for (var v = l.length - 1; v >= 0; v--)
|
|
20
|
+
c = Q(u, a, o = {}, i[3], r), s = (0, l[v])(n, c), o._ = 1, I(s) && (n = s);
|
|
21
|
+
return K(i, n), h && k(n, a, h), g ? u ^ 4 ? d : h : n;
|
|
22
|
+
}, T, b, N;
|
|
23
|
+
T = [B(["api", "wikiPage", "wikiTitle", "currentPage", "wiki", "modal", "preferences"]), F(
|
|
24
|
+
m.object({
|
|
25
|
+
"quickEdit.editSummary": m.string().description("Default edit summary for quick edits").default("[IPE-NEXT] Quick edit"),
|
|
26
|
+
"quickEdit.editMinor": m.boolean().description("Whether to mark the edit as minor").default(!1),
|
|
27
|
+
"quickEdit.outSideClose": m.boolean().description("Whether to close the modal outside").default(!0),
|
|
28
|
+
"quickEdit.watchList": m.union([
|
|
29
|
+
m.const(f.preferences).description("Follow my preferences"),
|
|
30
|
+
m.const(f.nochange).description("Keep the current watchlist status"),
|
|
31
|
+
m.const(f.watch).description("Add the page to watchlist"),
|
|
32
|
+
m.const(f.unwatch).description("Remove the page from watchlist")
|
|
33
|
+
]).description("Watchlist options").default(f.preferences),
|
|
34
|
+
"quickEdit.keyshortcut.save": m.string().default("ctrl-s").description("save button key shortcut (blank to disable)")
|
|
35
|
+
}).description("Quick edit options").extra("category", "edit")
|
|
36
|
+
)];
|
|
37
|
+
class x extends (N = M) {
|
|
38
|
+
constructor(e) {
|
|
39
|
+
super(e, {}, "quick-edit"), this.ctx = e, this.DEFAULT_OPTIONS = {
|
|
40
|
+
title: "",
|
|
41
|
+
pageId: 0,
|
|
42
|
+
revision: 0,
|
|
43
|
+
section: void 0,
|
|
44
|
+
editMinor: !1,
|
|
45
|
+
editSummary: "",
|
|
46
|
+
createOnly: !1,
|
|
47
|
+
reloadAfterSave: !0
|
|
48
|
+
}, this.ctx.root.set("quickEdit", A(this, "showModal"));
|
|
49
|
+
}
|
|
50
|
+
start() {
|
|
51
|
+
this.ctx.inject(["toolbox"], (e) => {
|
|
52
|
+
this.injectToolbox(e), e.on("dispose", () => {
|
|
53
|
+
this.removeToolbox(e);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async showModal(e) {
|
|
58
|
+
if (typeof e > "u" ? e = {} : typeof e == "string" && (e = {
|
|
59
|
+
title: e
|
|
60
|
+
}), e?.page && (e.title = e.page, delete e.page), !e.title && !e.pageId && !e.revision) {
|
|
61
|
+
this.logger.warn("None of the title, pageId or revision provided. Using defaults.");
|
|
62
|
+
const r = new URLSearchParams(window.location.search), h = this.ctx.currentPage.wikiTitle;
|
|
63
|
+
e = {
|
|
64
|
+
...e,
|
|
65
|
+
title: h?.getPrefixedDBKey(),
|
|
66
|
+
revision: r.has("oldid") ? Number(r.get("oldid")) : void 0,
|
|
67
|
+
pageId: r.has("curid") ? Number(r.get("curid")) : void 0
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (!e.revision && !e.pageId && e.title) {
|
|
71
|
+
const r = this.ctx.wikiTitle.resolveSpecialPageTarget(e.title);
|
|
72
|
+
r && r.title.getNamespaceId() >= 0 && (e.title = r.title.getPrefixedDBKey(), e.section ??= r.section);
|
|
73
|
+
}
|
|
74
|
+
const a = await this.ctx.preferences.get("quickEdit.outSideClose"), l = await this.ctx.preferences.get("quickEdit.watchList"), n = typeof e.editSummary == "string" ? e.editSummary : await this.ctx.preferences.get("quickEdit.editSummary"), d = typeof e.editMinor == "boolean" ? e.editMinor : await this.ctx.preferences.get("quickEdit.editMinor"), s = {
|
|
75
|
+
...this.DEFAULT_OPTIONS,
|
|
76
|
+
editSummary: n,
|
|
77
|
+
editMinor: d,
|
|
78
|
+
...e
|
|
79
|
+
};
|
|
80
|
+
s.editSummary || (s.editSummary = await this.ctx.preferences.get("quickEdit.editSummary") || ""), this.ctx.emit("quick-edit/init-options", { ctx: this.ctx, options: s });
|
|
81
|
+
const o = this.ctx.modal.createObject({
|
|
82
|
+
className: "ipe-quickEdit",
|
|
83
|
+
sizeClass: "large",
|
|
84
|
+
// backdrop: false,
|
|
85
|
+
// draggable: true,
|
|
86
|
+
center: !1,
|
|
87
|
+
outSideClose: a
|
|
88
|
+
}).init();
|
|
89
|
+
o.setTitle(
|
|
90
|
+
/* @__PURE__ */ t(w, { children: [
|
|
91
|
+
"Loading: ",
|
|
92
|
+
/* @__PURE__ */ t("u", { children: s.title })
|
|
93
|
+
] })
|
|
94
|
+
), o.setContent(
|
|
95
|
+
/* @__PURE__ */ t(
|
|
96
|
+
"section",
|
|
97
|
+
{
|
|
98
|
+
className: "ipe-quickEdit-loading",
|
|
99
|
+
style: {
|
|
100
|
+
height: "70vh",
|
|
101
|
+
display: "flex",
|
|
102
|
+
flexDirection: "column",
|
|
103
|
+
justifyContent: "center",
|
|
104
|
+
alignItems: "center"
|
|
105
|
+
},
|
|
106
|
+
children: /* @__PURE__ */ t(C, {})
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
), o.addButton({
|
|
110
|
+
side: "right",
|
|
111
|
+
type: "button",
|
|
112
|
+
className: "is-danger is-ghost",
|
|
113
|
+
label: "Cancel",
|
|
114
|
+
method() {
|
|
115
|
+
o.close();
|
|
116
|
+
}
|
|
117
|
+
}), o.show(), this.ctx.emit("quick-edit/show-modal", { ctx: this.ctx, modal: o, options: s });
|
|
118
|
+
let c;
|
|
119
|
+
try {
|
|
120
|
+
if (c = await this.getWikiPageFromPayload(s), c.pageInfo.special)
|
|
121
|
+
throw new Error("Special page is not editable");
|
|
122
|
+
} catch (r) {
|
|
123
|
+
o.off(o.Event.Close), o.close(), this.ctx.modal.notify("error", {
|
|
124
|
+
content: r instanceof Error ? r.message : String(r)
|
|
125
|
+
});
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
o.setTitle(
|
|
129
|
+
/* @__PURE__ */ t(w, { children: [
|
|
130
|
+
"Quick ",
|
|
131
|
+
c.pageInfo.pageid === 0 ? "Create" : "Edit",
|
|
132
|
+
":",
|
|
133
|
+
" ",
|
|
134
|
+
/* @__PURE__ */ t("u", { children: c.pageInfo.title })
|
|
135
|
+
] })
|
|
136
|
+
);
|
|
137
|
+
const u = [];
|
|
138
|
+
c.pageInfo.pageid === 0 && u.push(
|
|
139
|
+
/* @__PURE__ */ t(S, { title: "Attention", type: "important", children: /* @__PURE__ */ t("p", { children: "This page does not exist." }) })
|
|
140
|
+
), c.pageInfo.pageid && c.pageInfo.lastrevid !== c.revisions[0]?.revid && u.push(
|
|
141
|
+
/* @__PURE__ */ t(S, { title: "Attention", type: "warning", children: /* @__PURE__ */ t("p", { children: [
|
|
142
|
+
"You are editing a ",
|
|
143
|
+
/* @__PURE__ */ t("em", { children: "historical version" }),
|
|
144
|
+
"; the content is not the latest!"
|
|
145
|
+
] }) })
|
|
146
|
+
), this.ctx.emit("quick-edit/edit-notice", {
|
|
147
|
+
ctx: this.ctx,
|
|
148
|
+
options: s,
|
|
149
|
+
modal: o,
|
|
150
|
+
wikiPage: c,
|
|
151
|
+
editNotices: u
|
|
152
|
+
});
|
|
153
|
+
const g = /* @__PURE__ */ t("form", { className: "ipe-quickEdit__form", children: [
|
|
154
|
+
/* @__PURE__ */ t("div", { className: "ipe-quickEdit__notices", children: u }),
|
|
155
|
+
/* @__PURE__ */ t(
|
|
156
|
+
"div",
|
|
157
|
+
{
|
|
158
|
+
className: "ipe-quickEdit__content",
|
|
159
|
+
style: { display: "flex", flexDirection: "column", gap: "1rem" },
|
|
160
|
+
children: [
|
|
161
|
+
s.section === "new" && /* @__PURE__ */ t(w, { children: /* @__PURE__ */ t(
|
|
162
|
+
_,
|
|
163
|
+
{
|
|
164
|
+
label: "Section title",
|
|
165
|
+
id: "summary",
|
|
166
|
+
name: "summary",
|
|
167
|
+
value: "",
|
|
168
|
+
inputProps: { placeholder: "Topic for new section, this will be the h2 heading" }
|
|
169
|
+
}
|
|
170
|
+
) }),
|
|
171
|
+
/* @__PURE__ */ t("textarea", { className: "ipe-quickEdit__textarea", name: "text", id: "wpTextbox1", children: s.section === "new" ? "" : c.revisions[0]?.content || "" })
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
),
|
|
175
|
+
/* @__PURE__ */ t(
|
|
176
|
+
"div",
|
|
177
|
+
{
|
|
178
|
+
class: "ipe-quickEdit__options",
|
|
179
|
+
style: {
|
|
180
|
+
display: "flex",
|
|
181
|
+
flexDirection: "column",
|
|
182
|
+
gap: "1rem",
|
|
183
|
+
marginTop: "1rem"
|
|
184
|
+
},
|
|
185
|
+
children: [
|
|
186
|
+
s.section !== "new" && /* @__PURE__ */ t(_, { label: "Summary", id: "summary", name: "summary", value: s.editSummary }),
|
|
187
|
+
/* @__PURE__ */ t("div", { className: "ipe-input-box", children: [
|
|
188
|
+
/* @__PURE__ */ t("label", { htmlFor: "watchlist", style: { display: "block" }, children: "Watchlist" }),
|
|
189
|
+
/* @__PURE__ */ t("div", { style: { display: "flex", gap: "1rem" }, children: [
|
|
190
|
+
f.preferences,
|
|
191
|
+
f.nochange,
|
|
192
|
+
f.watch,
|
|
193
|
+
f.unwatch
|
|
194
|
+
].map((r) => /* @__PURE__ */ t(
|
|
195
|
+
O,
|
|
196
|
+
{
|
|
197
|
+
name: "watchlist",
|
|
198
|
+
value: r,
|
|
199
|
+
inputProps: { checked: l === r },
|
|
200
|
+
children: r
|
|
201
|
+
},
|
|
202
|
+
r
|
|
203
|
+
)) })
|
|
204
|
+
] }),
|
|
205
|
+
/* @__PURE__ */ t("div", { style: { display: "flex", gap: "1rem" }, children: [
|
|
206
|
+
/* @__PURE__ */ t(E, { name: "minor", id: "minor", checked: s.editMinor, children: "Minor edit" }),
|
|
207
|
+
/* @__PURE__ */ t(E, { name: "reloadAfterSave", id: "reloadAfterSave", checked: s.reloadAfterSave, children: "Reload after save" })
|
|
208
|
+
] })
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
!1
|
|
213
|
+
] });
|
|
214
|
+
o.setContent(g), o.addButton(
|
|
215
|
+
{
|
|
216
|
+
side: "left",
|
|
217
|
+
className: "is-primary submit-btn",
|
|
218
|
+
label: "Submit",
|
|
219
|
+
keyPress: await this.ctx.preferences.get("quickEdit.keyshortcut.save") || void 0,
|
|
220
|
+
method: () => {
|
|
221
|
+
const r = new FormData(g);
|
|
222
|
+
o.setLoadingState(!0), this.handleSubmit({
|
|
223
|
+
wikiPage: c,
|
|
224
|
+
text: r.get("text"),
|
|
225
|
+
summary: r.get("summary"),
|
|
226
|
+
minor: r.get("minor") === "on",
|
|
227
|
+
section: s.section,
|
|
228
|
+
createonly: c.pageid === 0,
|
|
229
|
+
watchlist: l
|
|
230
|
+
}).then(async () => {
|
|
231
|
+
o.setOptions({
|
|
232
|
+
beforeClose: P
|
|
233
|
+
}), o.close(), this.ctx.modal.notify("success", {
|
|
234
|
+
title: "Submission Successful",
|
|
235
|
+
content: "Your changes have been saved."
|
|
236
|
+
}), r.get("reloadAfterSave") && (await D(500), location.reload());
|
|
237
|
+
}).catch((h) => {
|
|
238
|
+
this.ctx.modal.notify("error", {
|
|
239
|
+
title: "Submission Error",
|
|
240
|
+
content: h instanceof Error ? h.message : String(h)
|
|
241
|
+
}), o.setLoadingState(!1);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
0
|
|
246
|
+
), o.setOptions({
|
|
247
|
+
beforeClose: () => {
|
|
248
|
+
const r = c.revisions[0]?.content || "";
|
|
249
|
+
return (g.querySelector("textarea")?.value || "") === r ? !0 : (this.ctx.modal.confirm(
|
|
250
|
+
{
|
|
251
|
+
className: "is-primary",
|
|
252
|
+
title: "Unsaved Changes",
|
|
253
|
+
content: "All edit contents will be lost after closing the modal. Are you sure you want to close?",
|
|
254
|
+
center: !0,
|
|
255
|
+
okBtn: {
|
|
256
|
+
label: "Give Up",
|
|
257
|
+
className: "is-danger is-ghost"
|
|
258
|
+
},
|
|
259
|
+
cancelBtn: {
|
|
260
|
+
label: "Continue Editing",
|
|
261
|
+
className: "is-primary is-ghost"
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
(v) => (v && (o.setOptions({
|
|
265
|
+
beforeClose: P
|
|
266
|
+
}), o.close()), !0)
|
|
267
|
+
), !1);
|
|
268
|
+
}
|
|
269
|
+
}), this.ctx.emit("quick-edit/wiki-page", {
|
|
270
|
+
ctx: this.ctx,
|
|
271
|
+
options: s,
|
|
272
|
+
modal: o,
|
|
273
|
+
wikiPage: c
|
|
274
|
+
});
|
|
275
|
+
const p = (r) => g.querySelector("textarea")?.value === c.revisions[0]?.content ? !0 : (r.preventDefault(), "You have unsaved changes. Are you sure you want to leave?");
|
|
276
|
+
window.addEventListener("beforeunload", p), o.on(o.Event.Close, () => {
|
|
277
|
+
window.removeEventListener("beforeunload", p);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
async handleSubmit(e) {
|
|
281
|
+
const a = e.wikiPage, l = e.summary || "", n = e.text || "", d = e.minor, s = e.createonly, o = e.watchlist, c = e.section;
|
|
282
|
+
return a.edit(
|
|
283
|
+
{
|
|
284
|
+
summary: l,
|
|
285
|
+
text: n,
|
|
286
|
+
watchlist: o,
|
|
287
|
+
section: c
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
minor: d,
|
|
291
|
+
createonly: s
|
|
292
|
+
}
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
async getWikiPageFromPayload(e) {
|
|
296
|
+
if (e.revision)
|
|
297
|
+
return this.ctx.wikiPage.newFromRevision(e.revision, e.section);
|
|
298
|
+
if (e.pageId)
|
|
299
|
+
return this.ctx.wikiPage.newFromPageId(e.pageId, e.section);
|
|
300
|
+
if (e.title)
|
|
301
|
+
return this.ctx.wikiPage.newFromTitle(e.title, !1, e.section);
|
|
302
|
+
throw new Error("Invalid payload");
|
|
303
|
+
}
|
|
304
|
+
async injectToolbox(e) {
|
|
305
|
+
const a = this.ctx.currentPage.wikiTitle, l = this.ctx.wiki.hasRight("edit") && a && a.getNamespaceId() >= 0;
|
|
306
|
+
e.toolbox.addButton({
|
|
307
|
+
id: "quick-edit",
|
|
308
|
+
group: "group1",
|
|
309
|
+
index: 0,
|
|
310
|
+
icon: /* @__PURE__ */ t(
|
|
311
|
+
"svg",
|
|
312
|
+
{
|
|
313
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
314
|
+
width: "24",
|
|
315
|
+
height: "24",
|
|
316
|
+
viewBox: "0 0 24 24",
|
|
317
|
+
fill: "none",
|
|
318
|
+
stroke: "currentColor",
|
|
319
|
+
"stroke-width": "2",
|
|
320
|
+
"stroke-linecap": "round",
|
|
321
|
+
"stroke-linejoin": "round",
|
|
322
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-edit",
|
|
323
|
+
children: [
|
|
324
|
+
/* @__PURE__ */ t("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
325
|
+
/* @__PURE__ */ t("path", { d: "M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1" }),
|
|
326
|
+
/* @__PURE__ */ t("path", { d: "M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z" }),
|
|
327
|
+
/* @__PURE__ */ t("path", { d: "M16 5l3 3" })
|
|
328
|
+
]
|
|
329
|
+
}
|
|
330
|
+
),
|
|
331
|
+
buttonProps: {
|
|
332
|
+
disabled: !l
|
|
333
|
+
},
|
|
334
|
+
tooltip: l ? "Quick Edit" : "Not editable",
|
|
335
|
+
onClick: () => {
|
|
336
|
+
const n = new URLSearchParams(window.location.search).get("oldid");
|
|
337
|
+
this.showModal({
|
|
338
|
+
title: a?.getPrefixedText(),
|
|
339
|
+
revision: n ? Number(n) : void 0
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
removeToolbox(e) {
|
|
345
|
+
e.toolbox.removeButton("quick-edit");
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
b = W(N);
|
|
349
|
+
x = G(b, 0, "PluginQuickEdit", T, x);
|
|
350
|
+
Y(b, 1, x);
|
|
351
|
+
export {
|
|
352
|
+
x as PluginQuickEdit
|
|
353
|
+
};
|
|
354
|
+
//# sourceMappingURL=index-9M1QcjCN.js.map
|