@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.
- package/dist/{IconQuickEdit-YVn1ANbm.js → IconQuickEdit-CAL1HXIb.js} +4 -4
- package/dist/IconQuickEdit-CAL1HXIb.js.map +1 -0
- package/dist/__test__/utils/constants.d.ts +2 -2
- package/dist/index-9M1QcjCN.js +354 -0
- package/dist/index-9M1QcjCN.js.map +1 -0
- package/dist/index-Ba7Wkale.js +127 -0
- package/dist/index-Ba7Wkale.js.map +1 -0
- package/dist/{index-1JtE4urY.js → index-C8dOYIIz.js} +63 -70
- package/dist/{index-1JtE4urY.js.map → index-C8dOYIIz.js.map} +1 -1
- package/dist/index-COlXHFRg.js +6326 -0
- package/dist/index-COlXHFRg.js.map +1 -0
- package/dist/{index-B3Bsg_nE.js → index-CeXR4lOu.js} +5 -5
- package/dist/{index-B3Bsg_nE.js.map → index-CeXR4lOu.js.map} +1 -1
- package/dist/index-DBV8FBjA.js +139 -0
- package/dist/index-DBV8FBjA.js.map +1 -0
- package/dist/{index-2AEdgbUL.js → index-DwyuBkCK.js} +3 -3
- package/dist/{index-2AEdgbUL.js.map → index-DwyuBkCK.js.map} +1 -1
- package/dist/{index-BCMwmSfQ.js → index-OBerV4GU.js} +76 -73
- package/dist/index-OBerV4GU.js.map +1 -0
- package/dist/{index-C0ci6Ll1.js → index-Tn22YSmW.js} +7 -7
- 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-CrWxZ0yl.js → index-mntCdHRr.js} +3 -3
- package/dist/{index-CrWxZ0yl.js.map → index-mntCdHRr.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/models/WikiPage/index.d.ts +42 -47
- package/dist/models/WikiTitle/index.d.ts +3 -2
- package/dist/plugins/in-article-links/index.d.ts +4 -34
- package/dist/plugins/quick-delete/index.d.ts +8 -6
- package/dist/plugins/quick-diff/PluginQuickDiffCore.d.ts +1 -1
- package/dist/plugins/quick-edit/index.d.ts +13 -11
- package/dist/plugins/quick-move/index.d.ts +3 -1
- package/dist/plugins/quick-preview/index.d.ts +13 -16
- package/dist/plugins/quick-redirect/index.d.ts +3 -1
- package/dist/plugins/toolbox/index.d.ts +7 -2
- package/dist/services/CurrentPageService.d.ts +27 -0
- package/dist/services/{ModalService/index.d.ts → ModalService.d.ts} +4 -4
- package/dist/services/{SiteMetadataService.d.ts → WikiMetadataService.d.ts} +36 -21
- package/dist/services/WikiPageService.d.ts +8 -7
- package/dist/services/WikiTitleService.d.ts +55 -3
- package/dist/style.css +1 -1
- package/dist/types/{SiteMetadata.d.ts → WikiMetadata.d.ts} +17 -17
- package/lib/index.umd.js +34 -35
- package/lib/index.umd.js.map +1 -1
- package/lib/style.css +1 -1
- package/package.json +8 -7
- package/dist/IconQuickEdit-YVn1ANbm.js.map +0 -1
- package/dist/index-2kN4SKmT.js +0 -116
- package/dist/index-2kN4SKmT.js.map +0 -1
- package/dist/index-BCMwmSfQ.js.map +0 -1
- package/dist/index-C0ci6Ll1.js.map +0 -1
- package/dist/index-CZnu6cRK.js +0 -319
- package/dist/index-CZnu6cRK.js.map +0 -1
- package/dist/index-CheNjwas.js +0 -128
- package/dist/index-CheNjwas.js.map +0 -1
- package/dist/index-DqfQ7hp6.js +0 -5626
- package/dist/index-DqfQ7hp6.js.map +0 -1
- package/dist/index-sfkutNHj.js +0 -201
- package/dist/index-sfkutNHj.js.map +0 -1
- package/dist/services/ModalService/IPEModal.d.ts +0 -235
package/dist/index.js
CHANGED
|
@@ -1,64 +1,59 @@
|
|
|
1
|
+
import { FexiosFinalContext } from 'fexios';
|
|
1
2
|
import { PageInfo } from './types/PageInfo';
|
|
2
3
|
import { PageParseData } from './types/PageParseData';
|
|
3
4
|
import { WatchlistAction } from './types/WatchlistAction';
|
|
4
|
-
import { MediaWikiApi, MwApiParams } from 'wiki-saikou/browser';
|
|
5
|
-
export
|
|
6
|
-
|
|
5
|
+
import { MediaWikiApi, MwApiParams, MwApiResponse } from 'wiki-saikou/browser';
|
|
6
|
+
export interface WikiPageEditPayload {
|
|
7
|
+
text?: string;
|
|
8
|
+
prependtext?: string;
|
|
9
|
+
appendtext?: string;
|
|
10
|
+
summary?: string;
|
|
11
|
+
watchlist?: WatchlistAction;
|
|
12
|
+
section?: number | 'new' | undefined;
|
|
13
|
+
}
|
|
14
|
+
export interface IWikiPage {
|
|
7
15
|
pageInfo: PageInfo;
|
|
8
|
-
|
|
9
|
-
constructor(pageInfo: Partial<PageInfo>, api?: MediaWikiApi);
|
|
10
|
-
fetchPageInfo(payload: MwApiParams): Promise<PageInfo>;
|
|
11
|
-
parse(params?: MwApiParams): Promise<import('fexios').FexiosFinalContext<import('wiki-saikou').MwApiResponse<{
|
|
16
|
+
parse(params?: MwApiParams): Promise<FexiosFinalContext<MwApiResponse<{
|
|
12
17
|
parse: PageParseData;
|
|
13
18
|
}>>>;
|
|
14
|
-
preview(text: string, params?: MwApiParams): Promise<
|
|
19
|
+
preview(text: string, params?: MwApiParams): Promise<FexiosFinalContext<MwApiResponse<{
|
|
15
20
|
parse: PageParseData;
|
|
16
21
|
}>>>;
|
|
17
|
-
edit(payload: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
appendtext?: string;
|
|
21
|
-
summary?: string;
|
|
22
|
-
watchlist?: WatchlistAction;
|
|
23
|
-
section?: number | 'new' | undefined;
|
|
24
|
-
}, params?: MwApiParams): Promise<import('fexios').FexiosFinalContext<any>>;
|
|
22
|
+
edit(payload: WikiPageEditPayload, params?: MwApiParams): Promise<FexiosFinalContext<MwApiResponse<{
|
|
23
|
+
success: boolean;
|
|
24
|
+
}>>>;
|
|
25
25
|
createOnly(payload: {
|
|
26
26
|
text: string;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
delete(reason?: string, params?: MwApiParams): Promise<
|
|
27
|
+
} & Pick<WikiPageEditPayload, 'summary' | 'watchlist'>, params?: MwApiParams): Promise<FexiosFinalContext<MwApiResponse<{
|
|
28
|
+
success: boolean;
|
|
29
|
+
}>>>;
|
|
30
|
+
delete(reason?: string, params?: MwApiParams): Promise<FexiosFinalContext<MwApiResponse<{
|
|
31
|
+
success: boolean;
|
|
32
|
+
}>>>;
|
|
31
33
|
moveTo(title: string, reason?: string, params?: Partial<MwApiParams & {
|
|
32
34
|
movetalk: boolean;
|
|
33
35
|
movesubpages: boolean;
|
|
34
|
-
}>): Promise<
|
|
36
|
+
}>): Promise<FexiosFinalContext<MwApiResponse<{
|
|
37
|
+
success: boolean;
|
|
38
|
+
}>>>;
|
|
35
39
|
userCan(action: keyof PageInfo['actions']): boolean;
|
|
36
40
|
userCanEdit(): boolean;
|
|
37
41
|
reloadSelfInfo(): Promise<this>;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
content: string;
|
|
55
|
-
}[];
|
|
56
|
-
get templates(): {
|
|
57
|
-
ns: number;
|
|
58
|
-
title: string;
|
|
59
|
-
}[];
|
|
60
|
-
get images(): {
|
|
61
|
-
ns: number;
|
|
62
|
-
title: string;
|
|
63
|
-
}[];
|
|
42
|
+
readonly pageid: PageInfo['pageid'];
|
|
43
|
+
readonly title: PageInfo['title'];
|
|
44
|
+
readonly ns: PageInfo['ns'];
|
|
45
|
+
readonly contentmodel: PageInfo['contentmodel'];
|
|
46
|
+
readonly fullurl: PageInfo['fullurl'];
|
|
47
|
+
readonly canonicalurl: PageInfo['canonicalurl'];
|
|
48
|
+
readonly editurl: PageInfo['editurl'];
|
|
49
|
+
readonly revisions: NonNullable<PageInfo['revisions']>;
|
|
50
|
+
readonly lastrevid: PageInfo['lastrevid'];
|
|
51
|
+
readonly templates: NonNullable<PageInfo['templates']>;
|
|
52
|
+
readonly images: NonNullable<PageInfo['images']>;
|
|
53
|
+
}
|
|
54
|
+
export interface WikiPageConstructor {
|
|
55
|
+
new (pageInfo: Partial<PageInfo>, loaded?: boolean): IWikiPage;
|
|
56
|
+
newFromApi(payload: MwApiParams): Promise<IWikiPage>;
|
|
57
|
+
newBlankPage(init?: Partial<PageInfo>): IWikiPage;
|
|
64
58
|
}
|
|
59
|
+
export declare function createWikiPageModel(api: MediaWikiApi): WikiPageConstructor;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WikiMetadata } from '../../types/WikiMetadata';
|
|
2
2
|
export interface IWikiTitle {
|
|
3
3
|
/**
|
|
4
4
|
* Get db key without namespace prefix
|
|
@@ -84,5 +84,6 @@ export interface IWikiTitle {
|
|
|
84
84
|
}
|
|
85
85
|
export interface WikiTitleConstructor {
|
|
86
86
|
new (title: string, namespace?: number): IWikiTitle;
|
|
87
|
+
create(title: string, namespace?: number): IWikiTitle;
|
|
87
88
|
}
|
|
88
|
-
export declare function createWikiTitleModel(metadata:
|
|
89
|
+
export declare function createWikiTitleModel(metadata: WikiMetadata): WikiTitleConstructor;
|
|
@@ -1,55 +1,25 @@
|
|
|
1
1
|
import { InPageEdit } from '../../InPageEdit';
|
|
2
|
-
import {
|
|
2
|
+
import { WikiLinkMetadata } from '../../services/WikiTitleService.js';
|
|
3
3
|
declare module '../../InPageEdit' {
|
|
4
4
|
interface InPageEdit {
|
|
5
5
|
inArticleLinks: PluginInArticleLinks;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
export interface
|
|
9
|
-
title: IWikiTitle;
|
|
10
|
-
url: URL;
|
|
11
|
-
params: URLSearchParams;
|
|
12
|
-
hash: string;
|
|
13
|
-
action: 'view' | 'edit' | 'create' | 'diff' | string;
|
|
14
|
-
}
|
|
15
|
-
export interface InArticleWikiAnchorInfo extends InArticleWikiLinkInfo {
|
|
8
|
+
export interface InArticleWikiAnchorMetadata extends WikiLinkMetadata {
|
|
16
9
|
$el: HTMLAnchorElement;
|
|
17
10
|
kind: 'normal' | 'mw:File';
|
|
18
11
|
external: boolean;
|
|
19
12
|
redlink: boolean;
|
|
20
13
|
}
|
|
21
14
|
export declare class PluginInArticleLinks extends BasePlugin<{
|
|
22
|
-
/**
|
|
23
|
-
* @example "https://example.com"
|
|
24
|
-
*/
|
|
25
|
-
wikiBaseUrl: string;
|
|
26
|
-
/**
|
|
27
|
-
* Article path, with trailing slash
|
|
28
|
-
* @example "/wiki/" (if wgArticlePath is "/wiki/$1")
|
|
29
|
-
*/
|
|
30
|
-
wikiArticlePath: string;
|
|
31
|
-
/**
|
|
32
|
-
* Article base URL, with trailing slash
|
|
33
|
-
* @example "https://example.com/wiki/" (if wgArticlePath is "/wiki/$1")
|
|
34
|
-
*/
|
|
35
|
-
wikiArticleBaseUrl: string;
|
|
36
|
-
/**
|
|
37
|
-
* Script base URL, **without** trailing slash
|
|
38
|
-
* @example "https://example.com/w" (if wgScriptPath is "/w")
|
|
39
|
-
*/
|
|
40
|
-
wikiScriptBaseUrl: string;
|
|
41
15
|
linkClassName: string;
|
|
42
16
|
}> {
|
|
43
17
|
constructor(ctx: InPageEdit);
|
|
44
18
|
protected start(): Promise<void>;
|
|
45
19
|
protected stop(): Promise<void>;
|
|
46
|
-
isWikiLink(url: string): boolean;
|
|
47
|
-
static readonly REG_SKIPPED_HREF: RegExp;
|
|
48
|
-
private validateHrefAttr;
|
|
49
20
|
private _cachedAnchorInfo;
|
|
50
|
-
parseAnchor(anchor: HTMLAnchorElement):
|
|
51
|
-
|
|
52
|
-
scanAnchors(parent: HTMLElement): InArticleWikiAnchorInfo[];
|
|
21
|
+
parseAnchor(anchor: HTMLAnchorElement): InArticleWikiAnchorMetadata | null;
|
|
22
|
+
scanAnchors(parent: HTMLElement, filter?: (info: InArticleWikiAnchorMetadata) => boolean): InArticleWikiAnchorMetadata[];
|
|
53
23
|
handleQuickEdit(): Promise<void>;
|
|
54
24
|
handleQuickDiff(): void;
|
|
55
25
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InPageEdit } from '../../InPageEdit';
|
|
2
|
-
import {
|
|
3
|
-
import { IPEModal } from '
|
|
2
|
+
import { IWikiPage } from '../../models/WikiPage';
|
|
3
|
+
import { IPEModal } from '@inpageedit/modal';
|
|
4
4
|
import { ReactNode } from 'jsx-dom';
|
|
5
5
|
declare module '../../InPageEdit' {
|
|
6
6
|
interface InPageEdit {
|
|
@@ -28,10 +28,10 @@ export interface QuickDeleteInitPayload {
|
|
|
28
28
|
ctx: InPageEdit;
|
|
29
29
|
options: QuickDeleteOptions;
|
|
30
30
|
modal: IPEModal;
|
|
31
|
-
wikiPage:
|
|
31
|
+
wikiPage: IWikiPage;
|
|
32
32
|
}
|
|
33
33
|
export interface QuickDeleteSubmitPayload {
|
|
34
|
-
wikiPage:
|
|
34
|
+
wikiPage: IWikiPage;
|
|
35
35
|
reason?: string;
|
|
36
36
|
}
|
|
37
37
|
export declare class PluginQuickDelete extends BasePlugin {
|
|
@@ -40,8 +40,10 @@ export declare class PluginQuickDelete extends BasePlugin {
|
|
|
40
40
|
constructor(ctx: InPageEdit);
|
|
41
41
|
protected start(): Promise<void> | void;
|
|
42
42
|
showModal(payload?: string | Partial<QuickDeleteOptions>): Promise<void>;
|
|
43
|
-
handleSubmit(payload: QuickDeleteSubmitPayload): Promise<import('fexios').FexiosFinalContext<
|
|
44
|
-
|
|
43
|
+
handleSubmit(payload: QuickDeleteSubmitPayload): Promise<import('fexios').FexiosFinalContext<import('wiki-saikou').MwApiResponse<{
|
|
44
|
+
success: boolean;
|
|
45
|
+
}>>>;
|
|
46
|
+
getWikiPageFromPayload(payload: Partial<QuickDeleteOptions>): Promise<IWikiPage>;
|
|
45
47
|
private injectToolbox;
|
|
46
48
|
protected removeToolbox(ctx: InPageEdit): void;
|
|
47
49
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InPageEdit } from '../../InPageEdit';
|
|
2
2
|
import { JsDiffDiffType } from './JsDiffService';
|
|
3
|
-
import { IPEModal, IPEModalOptions } from '
|
|
3
|
+
import { IPEModal, IPEModalOptions } from '@inpageedit/modal';
|
|
4
4
|
declare module '../../InPageEdit' {
|
|
5
5
|
interface InPageEdit {
|
|
6
6
|
quickDiff: PluginQuickDiffCore;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InPageEdit } from '../../InPageEdit';
|
|
2
|
-
import {
|
|
2
|
+
import { IWikiPage } from '../../models/WikiPage';
|
|
3
3
|
import { WatchlistAction } from '../../models/WikiPage/types/WatchlistAction';
|
|
4
|
-
import { IPEModal } from '
|
|
4
|
+
import { IPEModal } from '@inpageedit/modal';
|
|
5
5
|
import { ReactNode } from 'jsx-dom';
|
|
6
6
|
declare module '../../InPageEdit' {
|
|
7
7
|
interface InPageEdit {
|
|
@@ -10,10 +10,10 @@ declare module '../../InPageEdit' {
|
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
interface Events {
|
|
13
|
-
'quick-edit/init-options'(payload: Omit<
|
|
14
|
-
'quick-edit/show-modal'(payload: Omit<
|
|
15
|
-
'quick-edit/wiki-page'(payload:
|
|
16
|
-
'quick-edit/edit-notice'(payload:
|
|
13
|
+
'quick-edit/init-options'(payload: Omit<QuickEditEventPayload, 'modal' | 'wikiPage'>): void;
|
|
14
|
+
'quick-edit/show-modal'(payload: Omit<QuickEditEventPayload, 'wikiPage'>): void;
|
|
15
|
+
'quick-edit/wiki-page'(payload: QuickEditEventPayload): void;
|
|
16
|
+
'quick-edit/edit-notice'(payload: QuickEditEventPayload & {
|
|
17
17
|
editNotices: ReactNode[];
|
|
18
18
|
}): void;
|
|
19
19
|
}
|
|
@@ -33,14 +33,14 @@ export interface QuickEditOptions {
|
|
|
33
33
|
createOnly: boolean;
|
|
34
34
|
reloadAfterSave: boolean;
|
|
35
35
|
}
|
|
36
|
-
export interface
|
|
36
|
+
export interface QuickEditEventPayload {
|
|
37
37
|
ctx: InPageEdit;
|
|
38
38
|
options: QuickEditOptions;
|
|
39
39
|
modal: IPEModal;
|
|
40
|
-
wikiPage:
|
|
40
|
+
wikiPage: IWikiPage;
|
|
41
41
|
}
|
|
42
42
|
export interface QuickEditSubmitPayload {
|
|
43
|
-
wikiPage:
|
|
43
|
+
wikiPage: IWikiPage;
|
|
44
44
|
text?: string;
|
|
45
45
|
summary?: string;
|
|
46
46
|
section?: number | 'new' | undefined;
|
|
@@ -54,8 +54,10 @@ export declare class PluginQuickEdit extends BasePlugin {
|
|
|
54
54
|
constructor(ctx: InPageEdit);
|
|
55
55
|
protected start(): Promise<void> | void;
|
|
56
56
|
showModal(payload?: string | Partial<QuickEditOptions>): Promise<void>;
|
|
57
|
-
handleSubmit(payload: QuickEditSubmitPayload): Promise<import('fexios').FexiosFinalContext<
|
|
58
|
-
|
|
57
|
+
handleSubmit(payload: QuickEditSubmitPayload): Promise<import('fexios').FexiosFinalContext<import('wiki-saikou').MwApiResponse<{
|
|
58
|
+
success: boolean;
|
|
59
|
+
}>>>;
|
|
60
|
+
getWikiPageFromPayload(payload: Partial<QuickEditOptions>): Promise<IWikiPage>;
|
|
59
61
|
private injectToolbox;
|
|
60
62
|
protected removeToolbox(ctx: InPageEdit): void;
|
|
61
63
|
}
|
|
@@ -23,5 +23,7 @@ export declare class PluginQuickMove extends BasePlugin {
|
|
|
23
23
|
protected start(): Promise<void> | void;
|
|
24
24
|
private injectToolbox;
|
|
25
25
|
quickMove(options?: Partial<QuickMoveOptions>): import('../../services/ModalService').CustomIPEModal;
|
|
26
|
-
movePage(options: MovePageOptions): Promise<import('fexios').FexiosFinalContext<
|
|
26
|
+
movePage(options: MovePageOptions): Promise<import('fexios').FexiosFinalContext<import('wiki-saikou').MwApiResponse<{
|
|
27
|
+
success: boolean;
|
|
28
|
+
}>>>;
|
|
27
29
|
}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { InPageEdit } from '../../InPageEdit';
|
|
2
|
-
import {
|
|
2
|
+
import { IWikiPage } from '../../models/WikiPage';
|
|
3
3
|
import { MwApiParams } from 'wiki-saikou';
|
|
4
4
|
import { PageParseData } from '../../models/WikiPage/types/PageParseData';
|
|
5
|
-
import { IPEModal, IPEModalOptions } from '
|
|
5
|
+
import { IPEModal, IPEModalOptions } from '@inpageedit/modal';
|
|
6
|
+
interface QuickPreviewEventPayload {
|
|
7
|
+
ctx: InPageEdit;
|
|
8
|
+
modal: IPEModal;
|
|
9
|
+
wikiPage: IWikiPage;
|
|
10
|
+
text: string;
|
|
11
|
+
parseData: PageParseData;
|
|
12
|
+
}
|
|
6
13
|
declare module '../../InPageEdit' {
|
|
7
14
|
interface InPageEdit {
|
|
8
15
|
quickPreview: PluginQuickPreview & {
|
|
@@ -10,19 +17,8 @@ declare module '../../InPageEdit' {
|
|
|
10
17
|
};
|
|
11
18
|
}
|
|
12
19
|
interface Events {
|
|
13
|
-
'quick-preview/show-modal'(payload:
|
|
14
|
-
|
|
15
|
-
text: string;
|
|
16
|
-
modal: IPEModal;
|
|
17
|
-
wikiPage: WikiPage;
|
|
18
|
-
}): void;
|
|
19
|
-
'quick-preview/loaded'(payload: {
|
|
20
|
-
ctx: InPageEdit;
|
|
21
|
-
modal: IPEModal;
|
|
22
|
-
wikiPage: WikiPage;
|
|
23
|
-
text: string;
|
|
24
|
-
parseData: PageParseData;
|
|
25
|
-
}): void;
|
|
20
|
+
'quick-preview/show-modal'(payload: Omit<QuickPreviewEventPayload, 'parseData'>): void;
|
|
21
|
+
'quick-preview/loaded'(payload: QuickPreviewEventPayload): void;
|
|
26
22
|
}
|
|
27
23
|
}
|
|
28
24
|
export declare class PluginQuickPreview extends BasePlugin {
|
|
@@ -30,7 +26,8 @@ export declare class PluginQuickPreview extends BasePlugin {
|
|
|
30
26
|
constructor(ctx: InPageEdit);
|
|
31
27
|
protected start(): Promise<void> | void;
|
|
32
28
|
protected stop(): Promise<void> | void;
|
|
33
|
-
previewWikitext(text: string, params?: MwApiParams, wikiPage?:
|
|
29
|
+
previewWikitext(text: string, params?: MwApiParams, wikiPage?: IWikiPage, modal?: IPEModal, modalOptions?: Partial<IPEModalOptions>): IPEModal;
|
|
34
30
|
private injectQuickEdit;
|
|
35
31
|
private injectQuickDelete;
|
|
36
32
|
}
|
|
33
|
+
export {};
|
|
@@ -20,5 +20,7 @@ export declare class PluginQuickRedirect extends BasePlugin {
|
|
|
20
20
|
protected start(): Promise<void> | void;
|
|
21
21
|
protected stop(): Promise<void> | void;
|
|
22
22
|
quickRedirect(options?: Partial<QuickRedirectOptions>): import('../../services/ModalService').CustomIPEModal;
|
|
23
|
-
redirectPage(options: RedirectPageOptions): Promise<import('fexios').FexiosFinalContext<
|
|
23
|
+
redirectPage(options: RedirectPageOptions): Promise<import('fexios').FexiosFinalContext<import('wiki-saikou').MwApiResponse<{
|
|
24
|
+
success: boolean;
|
|
25
|
+
}>>>;
|
|
24
26
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InPageEdit, Service } from '../../InPageEdit';
|
|
2
|
-
import { ReactElement } from 'jsx-dom';
|
|
2
|
+
import { JSX, ReactElement } from 'jsx-dom';
|
|
3
3
|
declare module '../../InPageEdit' {
|
|
4
4
|
interface InPageEdit {
|
|
5
5
|
toolbox: PluginToolbox;
|
|
@@ -21,6 +21,7 @@ export declare class PluginToolbox extends Service {
|
|
|
21
21
|
constructor(ctx: InPageEdit);
|
|
22
22
|
protected start(): Promise<void>;
|
|
23
23
|
protected stop(): void | Promise<void>;
|
|
24
|
+
private get isPersistent();
|
|
24
25
|
private setupHoverLogic;
|
|
25
26
|
/**
|
|
26
27
|
* 计算按钮动画延迟
|
|
@@ -40,9 +41,13 @@ export declare class PluginToolbox extends Service {
|
|
|
40
41
|
group?: 'auto' | 'group1' | 'group2';
|
|
41
42
|
icon: string | HTMLElement | SVGElement | ReactElement;
|
|
42
43
|
tooltip?: string | HTMLElement;
|
|
43
|
-
|
|
44
|
+
itemProps?: JSX.IntrinsicElements['li'];
|
|
45
|
+
buttonProps?: JSX.IntrinsicElements['button'];
|
|
44
46
|
onClick?: (event: MouseEvent) => void;
|
|
45
47
|
index?: number;
|
|
46
48
|
}): HTMLElement;
|
|
47
49
|
removeButton(id: string): void;
|
|
50
|
+
getContainer(): HTMLElement;
|
|
51
|
+
get isOpened(): boolean;
|
|
52
|
+
toggle(force?: boolean): void;
|
|
48
53
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { InPageEdit, Service } from '../InPageEdit.js';
|
|
2
|
+
import { IWikiTitle } from '../models/WikiTitle';
|
|
3
|
+
declare module '../InPageEdit.js' {
|
|
4
|
+
interface InPageEdit {
|
|
5
|
+
/**
|
|
6
|
+
* Basic information of the current web page
|
|
7
|
+
*/
|
|
8
|
+
currentPage: CurrentPageService;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export declare class CurrentPageService extends Service {
|
|
12
|
+
#private;
|
|
13
|
+
readonly ctx: InPageEdit;
|
|
14
|
+
constructor(ctx: InPageEdit);
|
|
15
|
+
private readonly logger;
|
|
16
|
+
protected start(): Promise<void>;
|
|
17
|
+
protected stop(): void | Promise<void>;
|
|
18
|
+
url: URL;
|
|
19
|
+
get params(): URLSearchParams;
|
|
20
|
+
readonly isMainPage: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Get the title of the current page by location URL
|
|
23
|
+
* @returns IWikiTitle or null if cannot be determined
|
|
24
|
+
*/
|
|
25
|
+
wikiTitle: IWikiTitle | null;
|
|
26
|
+
readonly wikiAction: string;
|
|
27
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { InPageEdit } from '
|
|
2
|
-
import { IPEModal, IPEModalEvent, IPEModalOptions } from '
|
|
3
|
-
export * from '
|
|
4
|
-
declare module '
|
|
1
|
+
import { InPageEdit } from '../InPageEdit';
|
|
2
|
+
import { IPEModal, IPEModalEvent, IPEModalOptions } from '@inpageedit/modal';
|
|
3
|
+
export * from '@inpageedit/modal';
|
|
4
|
+
declare module '../InPageEdit' {
|
|
5
5
|
interface InPageEdit {
|
|
6
6
|
modal: ModalService;
|
|
7
7
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { InPageEdit, Service } from '../InPageEdit';
|
|
2
|
-
import {
|
|
2
|
+
import { WikiMetadata, WikiUserBlockInfo } from '../types/WikiMetadata';
|
|
3
3
|
declare module '../InPageEdit' {
|
|
4
4
|
interface InPageEdit {
|
|
5
|
-
|
|
6
|
-
getUrl:
|
|
7
|
-
getSciprtUrl:
|
|
8
|
-
getMainpageUrl:
|
|
5
|
+
wiki: WikiMetadataService;
|
|
6
|
+
getUrl: WikiMetadataService['getUrl'];
|
|
7
|
+
getSciprtUrl: WikiMetadataService['getSciprtUrl'];
|
|
8
|
+
getMainpageUrl: WikiMetadataService['getMainpageUrl'];
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
export declare class
|
|
11
|
+
export declare class WikiMetadataService extends Service {
|
|
12
12
|
ctx: InPageEdit;
|
|
13
13
|
private _data;
|
|
14
14
|
private readonly CACHE_TTL;
|
|
@@ -26,37 +26,52 @@ export declare class SiteMetadataService extends Service {
|
|
|
26
26
|
protected start(): Promise<void>;
|
|
27
27
|
computeSiteIdentity(): string;
|
|
28
28
|
fetchFromApi(): Promise<any>;
|
|
29
|
-
fetchFromCache(): Promise<
|
|
30
|
-
saveToCache(data:
|
|
29
|
+
fetchFromCache(): Promise<WikiMetadata | null>;
|
|
30
|
+
saveToCache(data: WikiMetadata): Promise<import('./StorageService').IPEStorageItem<WikiMetadata>>;
|
|
31
31
|
invalidateCache(): Promise<void>;
|
|
32
|
-
get _raw():
|
|
33
|
-
get general(): import('../types/
|
|
34
|
-
get specialPageAliases(): import('../types/
|
|
35
|
-
get namespaceAliases(): import('../types/
|
|
36
|
-
get namespaces(): Record<string, import('../types/
|
|
32
|
+
get _raw(): WikiMetadata;
|
|
33
|
+
get general(): import('../types/WikiMetadata').WikiSiteInfo;
|
|
34
|
+
get specialPageAliases(): import('../types/WikiMetadata').WikiSpecialPageAlias[];
|
|
35
|
+
get namespaceAliases(): import('../types/WikiMetadata').WikiNameSpaceAlias[];
|
|
36
|
+
get namespaces(): Record<string, import('../types/WikiMetadata').WikiNamespace>;
|
|
37
37
|
get namespaceMap(): {
|
|
38
38
|
id: number;
|
|
39
39
|
canonical: string | undefined;
|
|
40
40
|
aliases: string[];
|
|
41
41
|
}[];
|
|
42
|
-
get magicWords(): import('../types/
|
|
42
|
+
get magicWords(): import('../types/WikiMetadata').WikiMagicWord[];
|
|
43
43
|
get userInfo(): {
|
|
44
44
|
id: number;
|
|
45
45
|
name: string;
|
|
46
46
|
groups: string[];
|
|
47
47
|
rights: string[];
|
|
48
|
-
} & Partial<
|
|
49
|
-
options: import('../types/
|
|
48
|
+
} & Partial<WikiUserBlockInfo> & {
|
|
49
|
+
options: import('../types/WikiMetadata').WikiUserOptions;
|
|
50
50
|
};
|
|
51
|
-
get userOptions(): import('../types/
|
|
51
|
+
get userOptions(): import('../types/WikiMetadata').WikiUserOptions;
|
|
52
52
|
get isUserBlocked(): boolean | "" | undefined;
|
|
53
53
|
get userGroups(): string[];
|
|
54
54
|
get userRights(): string[];
|
|
55
55
|
/**
|
|
56
56
|
* Base URL, without trailing slash
|
|
57
|
-
* @example "https://
|
|
57
|
+
* @example "https://mediawiki.org"
|
|
58
58
|
*/
|
|
59
59
|
get baseUrl(): string;
|
|
60
|
+
/**
|
|
61
|
+
* Home page URL of this wiki
|
|
62
|
+
* @description Generally same as the Mainpage URL,
|
|
63
|
+
* but after MediaWiki 1.34,
|
|
64
|
+
* it can be set to the website root directory.
|
|
65
|
+
* @example "https://mediawiki.org/wiki/Main_Page" (In most cases)
|
|
66
|
+
* @example "https://mediawiki.org/" ($wgMainPageIsDomainRoot = true)
|
|
67
|
+
*/
|
|
68
|
+
get landingPageUrl(): string;
|
|
69
|
+
get mainPageName(): string;
|
|
70
|
+
/**
|
|
71
|
+
* Exact Mainpage URL of this wiki
|
|
72
|
+
* @example "https://mediawiki.org/wiki/Main_Page"
|
|
73
|
+
*/
|
|
74
|
+
get mainPageUrl(): string;
|
|
60
75
|
/**
|
|
61
76
|
* Article path, with the $1 placeholder
|
|
62
77
|
* @example "/wiki/$1"
|
|
@@ -69,12 +84,12 @@ export declare class SiteMetadataService extends Service {
|
|
|
69
84
|
get scriptPath(): string;
|
|
70
85
|
/**
|
|
71
86
|
* Article base URL, with the $1 placeholder
|
|
72
|
-
* @example "https://
|
|
87
|
+
* @example "https://mediawiki.org/wiki/$1"
|
|
73
88
|
*/
|
|
74
89
|
get articleBaseUrl(): string;
|
|
75
90
|
/**
|
|
76
91
|
* Script base URL, without trailing slash
|
|
77
|
-
* @example "https://
|
|
92
|
+
* @example "https://mediawiki.org/w"
|
|
78
93
|
*/
|
|
79
94
|
get scriptBaseUrl(): string;
|
|
80
95
|
getSciprtUrl(name?: string): string;
|
|
@@ -89,5 +104,5 @@ export declare class SiteMetadataService extends Service {
|
|
|
89
104
|
hasEveryRights(...rights: string[]): boolean;
|
|
90
105
|
inGroup(name: string): boolean;
|
|
91
106
|
inAnyGroup(...names: string[]): boolean;
|
|
92
|
-
getBlockInfo():
|
|
107
|
+
getBlockInfo(): WikiUserBlockInfo | null;
|
|
93
108
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Inject, InPageEdit, Service } from '../InPageEdit';
|
|
2
|
-
import {
|
|
2
|
+
import { IWikiPage, WikiPageConstructor } from '../models/WikiPage';
|
|
3
3
|
import { PageInfo } from '../models/WikiPage/types/PageInfo';
|
|
4
4
|
declare module '../InPageEdit' {
|
|
5
5
|
interface InPageEdit {
|
|
@@ -9,11 +9,12 @@ declare module '../InPageEdit' {
|
|
|
9
9
|
export declare class WikiPageService extends Service {
|
|
10
10
|
ctx: InPageEdit;
|
|
11
11
|
static readonly inject: Inject;
|
|
12
|
+
WikiPage: WikiPageConstructor;
|
|
12
13
|
constructor(ctx: InPageEdit);
|
|
13
|
-
|
|
14
|
-
createInstance(payload: Record<string, any
|
|
15
|
-
newFromTitle(title: string, converttitles?: boolean, rvsection?: number | string): Promise<
|
|
16
|
-
newFromPageId(pageid: number, rvsection?: number | string): Promise<
|
|
17
|
-
newFromRevision(revid: number, rvsection?: number | string): Promise<
|
|
18
|
-
newBlankPage(init?: Partial<PageInfo>):
|
|
14
|
+
readonly logger: import('@inpageedit/logger').Logger;
|
|
15
|
+
createInstance(payload: Record<string, any>, noCache?: boolean): Promise<IWikiPage>;
|
|
16
|
+
newFromTitle(title: string, converttitles?: boolean, rvsection?: number | string, noCache?: boolean): Promise<IWikiPage>;
|
|
17
|
+
newFromPageId(pageid: number, rvsection?: number | string, noCache?: boolean): Promise<IWikiPage>;
|
|
18
|
+
newFromRevision(revid: number, rvsection?: number | string, noCache?: boolean): Promise<IWikiPage>;
|
|
19
|
+
newBlankPage(init?: Partial<PageInfo>): IWikiPage;
|
|
19
20
|
}
|
|
@@ -1,14 +1,66 @@
|
|
|
1
1
|
import { Inject, InPageEdit, Service } from '../InPageEdit';
|
|
2
|
-
import { WikiTitleConstructor } from '../models/WikiTitle/index.js';
|
|
2
|
+
import { IWikiTitle, WikiTitleConstructor } from '../models/WikiTitle/index.js';
|
|
3
3
|
declare module '../InPageEdit' {
|
|
4
4
|
interface InPageEdit {
|
|
5
5
|
wikiTitle: WikiTitleService;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
+
export interface WikiLinkMetadata {
|
|
9
|
+
title: IWikiTitle | null;
|
|
10
|
+
pageId: number | null;
|
|
11
|
+
url: URL;
|
|
12
|
+
params: URLSearchParams;
|
|
13
|
+
hash: string;
|
|
14
|
+
action: 'view' | 'edit' | 'create' | 'diff' | string;
|
|
15
|
+
}
|
|
8
16
|
export declare class WikiTitleService extends Service {
|
|
9
17
|
ctx: InPageEdit;
|
|
10
18
|
static readonly inject: Inject;
|
|
11
|
-
readonly
|
|
19
|
+
readonly Title: WikiTitleConstructor;
|
|
12
20
|
constructor(ctx: InPageEdit);
|
|
13
|
-
|
|
21
|
+
private readonly logger;
|
|
22
|
+
newTitle(title: string, namespace?: number): IWikiTitle;
|
|
23
|
+
newTitleFromUrl(url: string | URL): Promise<IWikiTitle | null>;
|
|
24
|
+
private _titleByPageId;
|
|
25
|
+
newTitleFromPageId(pageId: number): Promise<IWikiTitle | null>;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve **special** special pages to it's real target
|
|
28
|
+
*
|
|
29
|
+
* If target is self or cannot be resolved, return null
|
|
30
|
+
* @example
|
|
31
|
+
* ```
|
|
32
|
+
* Special:MyPage -> User:<username>
|
|
33
|
+
* Special:Edit/Page_Title -> Page_Title
|
|
34
|
+
* Special:NewSection/Page_Title -> Page_Title (section=new)
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
resolveSpecialPageTarget(input: IWikiTitle | string): {
|
|
38
|
+
title: IWikiTitle;
|
|
39
|
+
action?: string | undefined;
|
|
40
|
+
section?: number | 'new' | undefined;
|
|
41
|
+
} | null;
|
|
42
|
+
private readonly wiki;
|
|
43
|
+
/**
|
|
44
|
+
* @example "https://example.com"
|
|
45
|
+
*/
|
|
46
|
+
private readonly wikiBaseUrl;
|
|
47
|
+
/**
|
|
48
|
+
* Article path, with trailing slash
|
|
49
|
+
* @example "/wiki/" (if wgArticlePath is "/wiki/$1")
|
|
50
|
+
*/
|
|
51
|
+
private readonly wikiArticlePath;
|
|
52
|
+
/**
|
|
53
|
+
* Article base URL, with trailing slash
|
|
54
|
+
* @example "https://example.com/wiki/" (if wgArticlePath is "/wiki/$1")
|
|
55
|
+
*/
|
|
56
|
+
private readonly wikiArticleBaseUrl;
|
|
57
|
+
/**
|
|
58
|
+
* Script base URL, **without** trailing slash
|
|
59
|
+
* @example "https://example.com/w" (if wgScriptPath is "/w")
|
|
60
|
+
*/
|
|
61
|
+
private readonly wikiIndexPhpUrl;
|
|
62
|
+
isWikiLink(url: string): boolean;
|
|
63
|
+
static readonly REG_SKIPPED_HREF: RegExp;
|
|
64
|
+
validateHrefAttr(href: string | null): boolean;
|
|
65
|
+
parseWikiLink(link: string | URL): WikiLinkMetadata | null;
|
|
14
66
|
}
|