artalk 2.3.3 → 2.4.0
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/Artalk.css +1 -1
- package/dist/Artalk.es.js +3184 -2888
- package/dist/Artalk.iife.js +1 -1
- package/dist/Artalk.js +1 -1
- package/dist/ArtalkLite.css +1 -1
- package/dist/ArtalkLite.es.js +3157 -2887
- package/dist/ArtalkLite.iife.js +1 -1
- package/dist/ArtalkLite.js +1 -1
- package/dist/src/api/admin.d.ts +10 -0
- package/dist/src/api/api-base.d.ts +14 -0
- package/dist/src/api/captcha.d.ts +14 -0
- package/dist/src/api/comment.d.ts +29 -0
- package/dist/src/api/index.d.ts +31 -0
- package/dist/src/api/page.d.ts +22 -0
- package/dist/src/api/request.d.ts +12 -0
- package/dist/src/api/site.d.ts +17 -0
- package/dist/src/api/system.d.ts +13 -0
- package/dist/src/api/upload.d.ts +11 -0
- package/dist/src/api/user.d.ts +28 -0
- package/dist/src/artalk.d.ts +56 -0
- package/dist/src/comment/actions.d.ts +17 -0
- package/dist/src/comment/comment.d.ts +67 -0
- package/dist/src/comment/index.d.ts +2 -0
- package/dist/src/comment/render.d.ts +76 -0
- package/dist/src/components/action-btn.d.ts +52 -0
- package/dist/src/components/dialog.d.ts +18 -0
- package/dist/src/components/pagination.d.ts +30 -0
- package/dist/src/components/read-more-btn.d.ts +33 -0
- package/dist/src/context.d.ts +72 -0
- package/dist/src/defaults.d.ts +3 -0
- package/dist/src/editor/editor.d.ts +84 -0
- package/dist/src/editor/index.d.ts +2 -0
- package/dist/src/editor/plugs/editor-plug.d.ts +26 -0
- package/dist/src/editor/plugs/emoticons-plug.d.ts +36 -0
- package/dist/src/editor/plugs/header-input-plug.d.ts +13 -0
- package/dist/src/editor/plugs/preview-plug.d.ts +10 -0
- package/dist/src/editor/plugs/upload-plug.d.ts +10 -0
- package/dist/src/i18n/en.d.ts +69 -0
- package/dist/src/i18n/index.d.ts +294 -0
- package/dist/src/i18n/zh-CN.d.ts +3 -0
- package/dist/src/layer/index.d.ts +3 -0
- package/dist/src/layer/layer.d.ts +32 -0
- package/dist/src/layer/sidebar-layer.d.ts +20 -0
- package/dist/src/lib/checker/admin-checker.d.ts +3 -0
- package/dist/src/lib/checker/captcha-checker.d.ts +3 -0
- package/dist/src/lib/checker/index.d.ts +42 -0
- package/dist/src/lib/component.d.ts +12 -0
- package/dist/src/lib/detect.d.ts +10 -0
- package/dist/src/lib/stat.d.ts +15 -0
- package/dist/src/lib/ui.d.ts +23 -0
- package/dist/src/lib/user.d.ts +13 -0
- package/dist/src/lib/utils.d.ts +39 -0
- package/dist/src/list/index.d.ts +2 -0
- package/dist/src/list/list-lite.d.ts +63 -0
- package/dist/src/list/list-nest.d.ts +10 -0
- package/dist/src/list/list.d.ts +26 -0
- package/dist/src/main.d.ts +4 -0
- package/dist/types/artalk-config.d.ts +132 -0
- package/dist/types/artalk-data.d.ts +204 -0
- package/dist/types/context.d.ts +146 -0
- package/dist/types/event.d.ts +28 -0
- package/dist/types/global.d.ts +0 -0
- package/dist/types/plug.d.ts +4 -0
- package/index.html +3 -3
- package/package.json +5 -5
- package/src/api/admin.ts +18 -0
- package/src/api/api-base.ts +27 -0
- package/src/api/captcha.ts +24 -0
- package/src/api/comment.ts +84 -0
- package/src/api/index.ts +25 -361
- package/src/api/page.ts +85 -0
- package/src/api/request.ts +12 -8
- package/src/api/site.ts +51 -0
- package/src/api/system.ts +39 -0
- package/src/api/upload.ts +29 -0
- package/src/api/user.ts +75 -0
- package/src/artalk.ts +75 -76
- package/src/comment/actions.ts +3 -3
- package/src/comment/comment.ts +6 -9
- package/src/comment/render.ts +93 -47
- package/src/components/pagination.ts +0 -1
- package/src/context.ts +57 -18
- package/src/editor/editor.ts +111 -18
- package/src/editor/plugs/header-input-plug.ts +1 -1
- package/src/editor/plugs/upload-plug.ts +1 -1
- package/src/i18n/en.ts +3 -0
- package/src/i18n/index.ts +117 -2
- package/src/i18n/zh-CN.ts +4 -1
- package/src/layer/sidebar-layer.ts +1 -3
- package/src/lib/checker/admin-checker.ts +1 -1
- package/src/lib/checker/captcha-checker.ts +3 -3
- package/src/lib/stat.ts +2 -2
- package/src/lib/ui.ts +6 -0
- package/src/list/list-lite.ts +33 -25
- package/src/list/list.ts +3 -4
- package/src/main.ts +3 -0
- package/src/style/comment.less +2 -3
- package/src/style/main.less +6 -0
- package/test/CSRF.html +26 -0
- package/types/artalk-data.d.ts +3 -0
- package/types/context.d.ts +19 -1
- package/types/global.d.ts +0 -2
- package/vite-base.config.ts +9 -5
- package/vite.config.ts +5 -1
- package/types/index.d.ts +0 -3
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { CommentData } from '../../types/artalk-data';
|
|
2
|
+
import Context from '../../types/context';
|
|
3
|
+
import Component from '../lib/component';
|
|
4
|
+
import EditorPlug from './plugs/editor-plug';
|
|
5
|
+
export default class Editor extends Component {
|
|
6
|
+
private get user();
|
|
7
|
+
$header: HTMLElement;
|
|
8
|
+
$nick: HTMLInputElement;
|
|
9
|
+
$email: HTMLInputElement;
|
|
10
|
+
$link: HTMLInputElement;
|
|
11
|
+
get $inputs(): {
|
|
12
|
+
nick: HTMLInputElement;
|
|
13
|
+
email: HTMLInputElement;
|
|
14
|
+
link: HTMLInputElement;
|
|
15
|
+
};
|
|
16
|
+
$textareaWrap: HTMLElement;
|
|
17
|
+
$textarea: HTMLTextAreaElement;
|
|
18
|
+
$bottom: HTMLElement;
|
|
19
|
+
$submitBtn: HTMLButtonElement;
|
|
20
|
+
$notifyWrap: HTMLElement;
|
|
21
|
+
private isTraveling;
|
|
22
|
+
/** 回复评论 */
|
|
23
|
+
private replyComment;
|
|
24
|
+
private $sendReply;
|
|
25
|
+
get isReplyMode(): boolean;
|
|
26
|
+
/** 编辑评论 */
|
|
27
|
+
private editComment;
|
|
28
|
+
private $editCancelBtn;
|
|
29
|
+
get isEditMode(): boolean;
|
|
30
|
+
/** 启用的插件 */
|
|
31
|
+
private readonly ENABLED_PLUGS;
|
|
32
|
+
plugList: {
|
|
33
|
+
[name: string]: EditorPlug;
|
|
34
|
+
};
|
|
35
|
+
private openedPlugName;
|
|
36
|
+
$plugPanelWrap: HTMLElement;
|
|
37
|
+
$plugBtnWrap: HTMLElement;
|
|
38
|
+
constructor(ctx: Context);
|
|
39
|
+
private initLocalStorage;
|
|
40
|
+
private saveToLocalStorage;
|
|
41
|
+
private initHeader;
|
|
42
|
+
private onHeaderInput;
|
|
43
|
+
private initTextarea;
|
|
44
|
+
private refreshSendBtnText;
|
|
45
|
+
private initSubmitBtn;
|
|
46
|
+
/** 最终用于 submit 的数据 */
|
|
47
|
+
getFinalContent(): string;
|
|
48
|
+
getContentOriginal(): string;
|
|
49
|
+
getContentMarked(): string;
|
|
50
|
+
setContent(val: string): void;
|
|
51
|
+
insertContent(val: string): void;
|
|
52
|
+
private adjustTextareaHeight;
|
|
53
|
+
/** 设置回复评论 */
|
|
54
|
+
setReply(commentData: CommentData, $comment: HTMLElement, scroll?: boolean): void;
|
|
55
|
+
/** 取消回复评论 */
|
|
56
|
+
cancelReply(): void;
|
|
57
|
+
/** 设置编辑评论 */
|
|
58
|
+
setEditComment(commentData: CommentData, $comment: HTMLElement): void;
|
|
59
|
+
/** 取消编辑评论 */
|
|
60
|
+
cancelEditComment(): void;
|
|
61
|
+
showNotify(msg: string, type: "i" | "s" | "w" | "e"): void;
|
|
62
|
+
showLoading(): void;
|
|
63
|
+
hideLoading(): void;
|
|
64
|
+
/** 点击评论提交按钮事件 */
|
|
65
|
+
submit(): Promise<void>;
|
|
66
|
+
/** 创建评论 */
|
|
67
|
+
submitAdd(): Promise<void>;
|
|
68
|
+
/** 修改评论 */
|
|
69
|
+
submitEdit(): Promise<void>;
|
|
70
|
+
/** 关闭评论 */
|
|
71
|
+
close(): void;
|
|
72
|
+
/** 打开评论 */
|
|
73
|
+
open(): void;
|
|
74
|
+
/** 移动评论框到置顶元素之后 */
|
|
75
|
+
travel($afterEl: HTMLElement): void;
|
|
76
|
+
/** 评论框归位 */
|
|
77
|
+
travelBack(): void;
|
|
78
|
+
/** 插件初始化 */
|
|
79
|
+
private initPlugs;
|
|
80
|
+
/** 展开插件面板 */
|
|
81
|
+
openPlugPanel(plugName: string): void;
|
|
82
|
+
/** 收起插件面板 */
|
|
83
|
+
closePlugPanel(): void;
|
|
84
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Editor from '../editor';
|
|
2
|
+
/**
|
|
3
|
+
* Editor 插件
|
|
4
|
+
*
|
|
5
|
+
* @desc 使用 Interface x Abstract 合并声明
|
|
6
|
+
* @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#merging-interfaces
|
|
7
|
+
*/
|
|
8
|
+
interface EditorPlug {
|
|
9
|
+
onPanelShow?(): void;
|
|
10
|
+
onPanelHide?(): void;
|
|
11
|
+
}
|
|
12
|
+
declare abstract class EditorPlug {
|
|
13
|
+
protected editor: Editor;
|
|
14
|
+
protected get ctx(): import("../../../types/context").default;
|
|
15
|
+
protected $panel?: HTMLElement;
|
|
16
|
+
protected $btn?: HTMLElement;
|
|
17
|
+
onHeaderInput?: (key: string, $input: HTMLElement) => void;
|
|
18
|
+
constructor(editor: Editor);
|
|
19
|
+
static Name: string;
|
|
20
|
+
protected registerPanel(html?: string): HTMLElement;
|
|
21
|
+
protected registerBtn(html: string): HTMLElement;
|
|
22
|
+
protected registerHeaderInputEvt(action: (key: string, $input: HTMLElement) => void): void;
|
|
23
|
+
getPanel(): HTMLElement | undefined;
|
|
24
|
+
getBtn(): HTMLElement | undefined;
|
|
25
|
+
}
|
|
26
|
+
export default EditorPlug;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { EmoticonListData } from '../../../types/artalk-data';
|
|
2
|
+
import EditorPlug from './editor-plug';
|
|
3
|
+
import Editor from '../editor';
|
|
4
|
+
export default class EmoticonsPlug extends EditorPlug {
|
|
5
|
+
editor: Editor;
|
|
6
|
+
static Name: string;
|
|
7
|
+
protected $panel: HTMLElement;
|
|
8
|
+
emoticons: EmoticonListData;
|
|
9
|
+
loadingTask: Promise<void> | null;
|
|
10
|
+
$grpWrap: HTMLElement;
|
|
11
|
+
$grpSwitcher: HTMLElement;
|
|
12
|
+
constructor(editor: Editor);
|
|
13
|
+
onPanelShow(): void;
|
|
14
|
+
onPanelHide(): void;
|
|
15
|
+
isListLoaded: boolean;
|
|
16
|
+
isImgLoaded: boolean;
|
|
17
|
+
loadEmoticonsData(): Promise<void>;
|
|
18
|
+
private handleData;
|
|
19
|
+
/** 远程加载 */
|
|
20
|
+
private remoteLoad;
|
|
21
|
+
/** 避免表情 item.key 为 null 的情况 */
|
|
22
|
+
private solveNullKey;
|
|
23
|
+
/** 避免相同 item.key */
|
|
24
|
+
private solveSameKey;
|
|
25
|
+
/** 判断是否为 OwO 格式 */
|
|
26
|
+
private isOwOFormat;
|
|
27
|
+
/** 转换 OwO 格式数据 */
|
|
28
|
+
private convertOwO;
|
|
29
|
+
/** 初始化表情列表界面 */
|
|
30
|
+
private initEmoticonsList;
|
|
31
|
+
/** 打开一个表情组 */
|
|
32
|
+
openGrp(index: number): void;
|
|
33
|
+
private changeListHeight;
|
|
34
|
+
/** 处理评论 content 中的表情内容 */
|
|
35
|
+
transEmoticonImageText(text: string): string;
|
|
36
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Editor from '../editor';
|
|
2
|
+
import EditorPlug from './editor-plug';
|
|
3
|
+
export default class HeaderInputPlug extends EditorPlug {
|
|
4
|
+
static Name: string;
|
|
5
|
+
constructor(editor: Editor);
|
|
6
|
+
queryUserInfo: {
|
|
7
|
+
timeout: number | null;
|
|
8
|
+
abortFunc: (() => void) | null;
|
|
9
|
+
};
|
|
10
|
+
/** 远程获取用户数据 */
|
|
11
|
+
fetchUserInfo(): void;
|
|
12
|
+
showLoginDialog(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Editor from '../editor';
|
|
2
|
+
import EditorPlug from './editor-plug';
|
|
3
|
+
export default class PreviewPlug extends EditorPlug {
|
|
4
|
+
static Name: string;
|
|
5
|
+
protected $panel: HTMLElement;
|
|
6
|
+
private isBind;
|
|
7
|
+
constructor(editor: Editor);
|
|
8
|
+
onPanelShow(): void;
|
|
9
|
+
updateContent(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Editor from '../editor';
|
|
2
|
+
import EditorPlug from './editor-plug';
|
|
3
|
+
export default class UploadPlug extends EditorPlug {
|
|
4
|
+
static Name: string;
|
|
5
|
+
$imgUploadInput?: HTMLInputElement;
|
|
6
|
+
/** 允许的图片格式 */
|
|
7
|
+
allowImgExts: string[];
|
|
8
|
+
constructor(editor: Editor);
|
|
9
|
+
uploadImg(file: File): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
placeholder: string;
|
|
3
|
+
noComment: string;
|
|
4
|
+
send: string;
|
|
5
|
+
save: string;
|
|
6
|
+
nick: string;
|
|
7
|
+
email: string;
|
|
8
|
+
link: string;
|
|
9
|
+
emoticon: string;
|
|
10
|
+
preview: string;
|
|
11
|
+
image: string;
|
|
12
|
+
uploadFail: string;
|
|
13
|
+
commentFail: string;
|
|
14
|
+
restoredMsg: string;
|
|
15
|
+
onlyAdminCanReply: string;
|
|
16
|
+
uploadLoginMsg: string;
|
|
17
|
+
counter: string;
|
|
18
|
+
sortLatest: string;
|
|
19
|
+
sortOldest: string;
|
|
20
|
+
sortBest: string;
|
|
21
|
+
sortAuthor: string;
|
|
22
|
+
openComment: string;
|
|
23
|
+
closeComment: string;
|
|
24
|
+
listLoadFailMsg: string;
|
|
25
|
+
listRetry: string;
|
|
26
|
+
loadMore: string;
|
|
27
|
+
admin: string;
|
|
28
|
+
reply: string;
|
|
29
|
+
voteUp: string;
|
|
30
|
+
voteDown: string;
|
|
31
|
+
voteFail: string;
|
|
32
|
+
readMore: string;
|
|
33
|
+
actionConfirm: string;
|
|
34
|
+
collapse: string;
|
|
35
|
+
collapsed: string;
|
|
36
|
+
collapsedMsg: string;
|
|
37
|
+
expand: string;
|
|
38
|
+
approved: string;
|
|
39
|
+
pending: string;
|
|
40
|
+
pendingMsg: string;
|
|
41
|
+
edit: string;
|
|
42
|
+
editCancel: string;
|
|
43
|
+
delete: string;
|
|
44
|
+
deleteConfirm: string;
|
|
45
|
+
pin: string;
|
|
46
|
+
unpin: string;
|
|
47
|
+
seconds: string;
|
|
48
|
+
minutes: string;
|
|
49
|
+
hours: string;
|
|
50
|
+
days: string;
|
|
51
|
+
now: string;
|
|
52
|
+
adminCheck: string;
|
|
53
|
+
captchaCheck: string;
|
|
54
|
+
confirm: string;
|
|
55
|
+
cancel: string;
|
|
56
|
+
msgCenter: string;
|
|
57
|
+
ctrlCenter: string;
|
|
58
|
+
frontend: string;
|
|
59
|
+
backend: string;
|
|
60
|
+
loading: string;
|
|
61
|
+
loadFail: string;
|
|
62
|
+
editing: string;
|
|
63
|
+
editFail: string;
|
|
64
|
+
deleting: string;
|
|
65
|
+
deleteFail: string;
|
|
66
|
+
reqGot: string;
|
|
67
|
+
reqAborted: string;
|
|
68
|
+
};
|
|
69
|
+
export default _default;
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import en from './en';
|
|
2
|
+
export declare type I18n = typeof en;
|
|
3
|
+
export declare const internal: {
|
|
4
|
+
en: {
|
|
5
|
+
placeholder: string;
|
|
6
|
+
noComment: string;
|
|
7
|
+
send: string;
|
|
8
|
+
save: string;
|
|
9
|
+
nick: string;
|
|
10
|
+
email: string;
|
|
11
|
+
link: string;
|
|
12
|
+
emoticon: string;
|
|
13
|
+
preview: string;
|
|
14
|
+
image: string;
|
|
15
|
+
uploadFail: string;
|
|
16
|
+
commentFail: string;
|
|
17
|
+
restoredMsg: string;
|
|
18
|
+
onlyAdminCanReply: string;
|
|
19
|
+
uploadLoginMsg: string;
|
|
20
|
+
counter: string;
|
|
21
|
+
sortLatest: string;
|
|
22
|
+
sortOldest: string;
|
|
23
|
+
sortBest: string;
|
|
24
|
+
sortAuthor: string;
|
|
25
|
+
openComment: string;
|
|
26
|
+
closeComment: string;
|
|
27
|
+
listLoadFailMsg: string;
|
|
28
|
+
listRetry: string;
|
|
29
|
+
loadMore: string;
|
|
30
|
+
admin: string;
|
|
31
|
+
reply: string;
|
|
32
|
+
voteUp: string;
|
|
33
|
+
voteDown: string;
|
|
34
|
+
voteFail: string;
|
|
35
|
+
readMore: string;
|
|
36
|
+
actionConfirm: string;
|
|
37
|
+
collapse: string;
|
|
38
|
+
collapsed: string;
|
|
39
|
+
collapsedMsg: string;
|
|
40
|
+
expand: string;
|
|
41
|
+
approved: string;
|
|
42
|
+
pending: string;
|
|
43
|
+
pendingMsg: string;
|
|
44
|
+
edit: string;
|
|
45
|
+
editCancel: string;
|
|
46
|
+
delete: string;
|
|
47
|
+
deleteConfirm: string;
|
|
48
|
+
pin: string;
|
|
49
|
+
unpin: string;
|
|
50
|
+
seconds: string;
|
|
51
|
+
minutes: string;
|
|
52
|
+
hours: string;
|
|
53
|
+
days: string;
|
|
54
|
+
now: string;
|
|
55
|
+
adminCheck: string;
|
|
56
|
+
captchaCheck: string;
|
|
57
|
+
confirm: string;
|
|
58
|
+
cancel: string;
|
|
59
|
+
msgCenter: string;
|
|
60
|
+
ctrlCenter: string;
|
|
61
|
+
frontend: string;
|
|
62
|
+
backend: string;
|
|
63
|
+
loading: string;
|
|
64
|
+
loadFail: string;
|
|
65
|
+
editing: string;
|
|
66
|
+
editFail: string;
|
|
67
|
+
deleting: string;
|
|
68
|
+
deleteFail: string;
|
|
69
|
+
reqGot: string;
|
|
70
|
+
reqAborted: string;
|
|
71
|
+
};
|
|
72
|
+
'en-US': {
|
|
73
|
+
placeholder: string;
|
|
74
|
+
noComment: string;
|
|
75
|
+
send: string;
|
|
76
|
+
save: string;
|
|
77
|
+
nick: string;
|
|
78
|
+
email: string;
|
|
79
|
+
link: string;
|
|
80
|
+
emoticon: string;
|
|
81
|
+
preview: string;
|
|
82
|
+
image: string;
|
|
83
|
+
uploadFail: string;
|
|
84
|
+
commentFail: string;
|
|
85
|
+
restoredMsg: string;
|
|
86
|
+
onlyAdminCanReply: string;
|
|
87
|
+
uploadLoginMsg: string;
|
|
88
|
+
counter: string;
|
|
89
|
+
sortLatest: string;
|
|
90
|
+
sortOldest: string;
|
|
91
|
+
sortBest: string;
|
|
92
|
+
sortAuthor: string;
|
|
93
|
+
openComment: string;
|
|
94
|
+
closeComment: string;
|
|
95
|
+
listLoadFailMsg: string;
|
|
96
|
+
listRetry: string;
|
|
97
|
+
loadMore: string;
|
|
98
|
+
admin: string;
|
|
99
|
+
reply: string;
|
|
100
|
+
voteUp: string;
|
|
101
|
+
voteDown: string;
|
|
102
|
+
voteFail: string;
|
|
103
|
+
readMore: string;
|
|
104
|
+
actionConfirm: string;
|
|
105
|
+
collapse: string;
|
|
106
|
+
collapsed: string;
|
|
107
|
+
collapsedMsg: string;
|
|
108
|
+
expand: string;
|
|
109
|
+
approved: string;
|
|
110
|
+
pending: string;
|
|
111
|
+
pendingMsg: string;
|
|
112
|
+
edit: string;
|
|
113
|
+
editCancel: string;
|
|
114
|
+
delete: string;
|
|
115
|
+
deleteConfirm: string;
|
|
116
|
+
pin: string;
|
|
117
|
+
unpin: string;
|
|
118
|
+
seconds: string;
|
|
119
|
+
minutes: string;
|
|
120
|
+
hours: string;
|
|
121
|
+
days: string;
|
|
122
|
+
now: string;
|
|
123
|
+
adminCheck: string;
|
|
124
|
+
captchaCheck: string;
|
|
125
|
+
confirm: string;
|
|
126
|
+
cancel: string;
|
|
127
|
+
msgCenter: string;
|
|
128
|
+
ctrlCenter: string;
|
|
129
|
+
frontend: string;
|
|
130
|
+
backend: string;
|
|
131
|
+
loading: string;
|
|
132
|
+
loadFail: string;
|
|
133
|
+
editing: string;
|
|
134
|
+
editFail: string;
|
|
135
|
+
deleting: string;
|
|
136
|
+
deleteFail: string;
|
|
137
|
+
reqGot: string;
|
|
138
|
+
reqAborted: string;
|
|
139
|
+
};
|
|
140
|
+
'zh-CN': {
|
|
141
|
+
placeholder: string;
|
|
142
|
+
noComment: string;
|
|
143
|
+
send: string;
|
|
144
|
+
save: string;
|
|
145
|
+
nick: string;
|
|
146
|
+
email: string;
|
|
147
|
+
link: string;
|
|
148
|
+
emoticon: string;
|
|
149
|
+
preview: string;
|
|
150
|
+
image: string;
|
|
151
|
+
uploadFail: string;
|
|
152
|
+
commentFail: string;
|
|
153
|
+
restoredMsg: string;
|
|
154
|
+
onlyAdminCanReply: string;
|
|
155
|
+
uploadLoginMsg: string;
|
|
156
|
+
counter: string;
|
|
157
|
+
sortLatest: string;
|
|
158
|
+
sortOldest: string;
|
|
159
|
+
sortBest: string;
|
|
160
|
+
sortAuthor: string;
|
|
161
|
+
openComment: string;
|
|
162
|
+
closeComment: string;
|
|
163
|
+
listLoadFailMsg: string;
|
|
164
|
+
listRetry: string;
|
|
165
|
+
loadMore: string;
|
|
166
|
+
admin: string;
|
|
167
|
+
reply: string;
|
|
168
|
+
voteUp: string;
|
|
169
|
+
voteDown: string;
|
|
170
|
+
voteFail: string;
|
|
171
|
+
readMore: string;
|
|
172
|
+
actionConfirm: string;
|
|
173
|
+
collapse: string;
|
|
174
|
+
collapsed: string;
|
|
175
|
+
collapsedMsg: string;
|
|
176
|
+
expand: string;
|
|
177
|
+
approved: string;
|
|
178
|
+
pending: string;
|
|
179
|
+
pendingMsg: string;
|
|
180
|
+
edit: string;
|
|
181
|
+
editCancel: string;
|
|
182
|
+
delete: string;
|
|
183
|
+
deleteConfirm: string;
|
|
184
|
+
pin: string;
|
|
185
|
+
unpin: string;
|
|
186
|
+
seconds: string;
|
|
187
|
+
minutes: string;
|
|
188
|
+
hours: string;
|
|
189
|
+
days: string;
|
|
190
|
+
now: string;
|
|
191
|
+
adminCheck: string;
|
|
192
|
+
captchaCheck: string;
|
|
193
|
+
confirm: string;
|
|
194
|
+
cancel: string;
|
|
195
|
+
msgCenter: string;
|
|
196
|
+
ctrlCenter: string;
|
|
197
|
+
frontend: string;
|
|
198
|
+
backend: string;
|
|
199
|
+
loading: string;
|
|
200
|
+
loadFail: string;
|
|
201
|
+
editing: string;
|
|
202
|
+
editFail: string;
|
|
203
|
+
deleting: string;
|
|
204
|
+
deleteFail: string;
|
|
205
|
+
reqGot: string;
|
|
206
|
+
reqAborted: string;
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
export declare const external: {
|
|
210
|
+
'jp-JP': {};
|
|
211
|
+
'zh-TW': {
|
|
212
|
+
placeholder: string;
|
|
213
|
+
noComment: string;
|
|
214
|
+
send: string;
|
|
215
|
+
save: string;
|
|
216
|
+
nick: string;
|
|
217
|
+
email: string;
|
|
218
|
+
link: string;
|
|
219
|
+
emoticon: string;
|
|
220
|
+
preview: string;
|
|
221
|
+
image: string;
|
|
222
|
+
uploadFail: string;
|
|
223
|
+
commentFail: string;
|
|
224
|
+
restoredMsg: string;
|
|
225
|
+
onlyAdminCanReply: string;
|
|
226
|
+
uploadLoginMsg: string;
|
|
227
|
+
counter: string;
|
|
228
|
+
sortLatest: string;
|
|
229
|
+
sortOldest: string;
|
|
230
|
+
sortBest: string;
|
|
231
|
+
sortAuthor: string;
|
|
232
|
+
openComment: string;
|
|
233
|
+
closeComment: string;
|
|
234
|
+
listLoadFailMsg: string;
|
|
235
|
+
listRetry: string;
|
|
236
|
+
loadMore: string;
|
|
237
|
+
admin: string;
|
|
238
|
+
reply: string;
|
|
239
|
+
voteUp: string;
|
|
240
|
+
voteDown: string;
|
|
241
|
+
voteFail: string;
|
|
242
|
+
readMore: string;
|
|
243
|
+
actionConfirm: string;
|
|
244
|
+
collapse: string;
|
|
245
|
+
collapsed: string;
|
|
246
|
+
collapsedMsg: string;
|
|
247
|
+
expand: string;
|
|
248
|
+
approved: string;
|
|
249
|
+
pending: string;
|
|
250
|
+
pendingMsg: string;
|
|
251
|
+
edit: string;
|
|
252
|
+
editCancel: string;
|
|
253
|
+
delete: string;
|
|
254
|
+
deleteConfirm: string;
|
|
255
|
+
pin: string;
|
|
256
|
+
unpin: string;
|
|
257
|
+
seconds: string;
|
|
258
|
+
minutes: string;
|
|
259
|
+
hours: string;
|
|
260
|
+
days: string;
|
|
261
|
+
now: string;
|
|
262
|
+
adminCheck: string;
|
|
263
|
+
captchaCheck: string;
|
|
264
|
+
confirm: string;
|
|
265
|
+
cancel: string;
|
|
266
|
+
msgCenter: string;
|
|
267
|
+
ctrlCenter: string;
|
|
268
|
+
frontend: string;
|
|
269
|
+
backend: string;
|
|
270
|
+
loading: string;
|
|
271
|
+
loadFail: string;
|
|
272
|
+
editing: string;
|
|
273
|
+
editFail: string;
|
|
274
|
+
deleting: string;
|
|
275
|
+
deleteFail: string;
|
|
276
|
+
reqGot: string;
|
|
277
|
+
reqAborted: string;
|
|
278
|
+
};
|
|
279
|
+
'fr-FR': {};
|
|
280
|
+
'de-DE': {};
|
|
281
|
+
'bn-IN': {};
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* get a locale object by language name
|
|
285
|
+
*/
|
|
286
|
+
declare function getLocaleSet(lang: string): I18n;
|
|
287
|
+
/**
|
|
288
|
+
* get a i18n message by key
|
|
289
|
+
*/
|
|
290
|
+
declare function getI18n(locale: I18n | string, key: keyof I18n, args?: {
|
|
291
|
+
[key: string]: string;
|
|
292
|
+
}): string;
|
|
293
|
+
export { getLocaleSet, getI18n };
|
|
294
|
+
export default getI18n;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import Context from '../../types/context';
|
|
2
|
+
import Component from '../lib/component';
|
|
3
|
+
export default class Layer extends Component {
|
|
4
|
+
private name;
|
|
5
|
+
private $wrap;
|
|
6
|
+
private $mask;
|
|
7
|
+
private maskClickHideEnable;
|
|
8
|
+
static BodyOrgOverflow: string;
|
|
9
|
+
static BodyOrgPaddingRight: string;
|
|
10
|
+
afterHide?: Function;
|
|
11
|
+
constructor(ctx: Context, name: string, el?: HTMLElement);
|
|
12
|
+
getName(): string;
|
|
13
|
+
getWrapEl(): HTMLElement;
|
|
14
|
+
getEl(): HTMLElement;
|
|
15
|
+
show(): void;
|
|
16
|
+
hide(): void;
|
|
17
|
+
setMaskClickHide(enable: boolean): void;
|
|
18
|
+
pageBodyScrollBarHide(): void;
|
|
19
|
+
pageBodyScrollBarShow(): void;
|
|
20
|
+
private static actionTimers;
|
|
21
|
+
private newActionTimer;
|
|
22
|
+
private fireAllActionTimer;
|
|
23
|
+
/** 销毁 - 无动画 */
|
|
24
|
+
disposeNow(): void;
|
|
25
|
+
/** 销毁 */
|
|
26
|
+
dispose(): void;
|
|
27
|
+
checkCleanLayer(): void;
|
|
28
|
+
}
|
|
29
|
+
export declare function GetLayerWrap(ctx: Context): {
|
|
30
|
+
$wrap: HTMLElement;
|
|
31
|
+
$mask: HTMLElement;
|
|
32
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Context from '../../types/context';
|
|
2
|
+
import Component from '../lib/component';
|
|
3
|
+
import Layer from './layer';
|
|
4
|
+
export interface SidebarShowPayload {
|
|
5
|
+
view?: 'comments' | 'sites' | 'pages' | 'transfer';
|
|
6
|
+
}
|
|
7
|
+
export default class SidebarLayer extends Component {
|
|
8
|
+
layer?: Layer;
|
|
9
|
+
$header: HTMLElement;
|
|
10
|
+
$closeBtn: HTMLElement;
|
|
11
|
+
$iframeWrap: HTMLElement;
|
|
12
|
+
$iframe?: HTMLIFrameElement;
|
|
13
|
+
constructor(ctx: Context);
|
|
14
|
+
private firstShow;
|
|
15
|
+
/** 显示 */
|
|
16
|
+
show(conf?: SidebarShowPayload): Promise<void>;
|
|
17
|
+
/** 隐藏 */
|
|
18
|
+
hide(): void;
|
|
19
|
+
private iframeLoad;
|
|
20
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import Context from '../../../types/context';
|
|
2
|
+
import Layer from '../../layer';
|
|
3
|
+
export interface CheckerCaptchaPayload extends CheckerPayload {
|
|
4
|
+
imgData?: string;
|
|
5
|
+
iframe?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CheckerPayload {
|
|
8
|
+
onSuccess?: (inputVal: string, dialogEl?: HTMLElement) => void;
|
|
9
|
+
onMount?: (dialogEl: HTMLElement) => void;
|
|
10
|
+
onCancel?: () => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Checker 发射台
|
|
14
|
+
*/
|
|
15
|
+
export default class CheckerLauncher {
|
|
16
|
+
ctx: Context;
|
|
17
|
+
launched: Checker[];
|
|
18
|
+
captchaConf: {
|
|
19
|
+
val?: string;
|
|
20
|
+
imgData?: string;
|
|
21
|
+
iframe?: string;
|
|
22
|
+
};
|
|
23
|
+
constructor(ctx: Context);
|
|
24
|
+
checkCaptcha(payload: CheckerCaptchaPayload): void;
|
|
25
|
+
checkAdmin(payload: CheckerPayload): void;
|
|
26
|
+
fire(checker: Checker, payload: CheckerPayload): void;
|
|
27
|
+
private close;
|
|
28
|
+
}
|
|
29
|
+
export interface Checker {
|
|
30
|
+
el?: HTMLElement;
|
|
31
|
+
inputType?: 'password' | 'text';
|
|
32
|
+
body: (launcher: CheckerLauncher, ctx: CheckerCtx) => HTMLElement;
|
|
33
|
+
request: (launcher: CheckerLauncher, ctx: CheckerCtx, inputVal: string) => Promise<string>;
|
|
34
|
+
onSuccess?: (launcher: CheckerLauncher, ctx: CheckerCtx, data: string, inputVal: string, formEl: HTMLElement) => void;
|
|
35
|
+
onError?: (launcher: CheckerLauncher, ctx: CheckerCtx, err: any, inputVal: string, formEl: HTMLElement) => void;
|
|
36
|
+
}
|
|
37
|
+
export interface CheckerCtx {
|
|
38
|
+
getLayer(): Layer;
|
|
39
|
+
hideInteractInput(): void;
|
|
40
|
+
triggerSuccess(): void;
|
|
41
|
+
cancel(): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import ArtalkConfig from '../../types/artalk-config';
|
|
2
|
+
import Context from '../../types/context';
|
|
3
|
+
import { I18n } from '../i18n';
|
|
4
|
+
export default abstract class Component {
|
|
5
|
+
$el: HTMLElement;
|
|
6
|
+
ctx: Context;
|
|
7
|
+
readonly conf: ArtalkConfig;
|
|
8
|
+
constructor(ctx: Context);
|
|
9
|
+
$t(key: keyof I18n, args?: {
|
|
10
|
+
[key: string]: string;
|
|
11
|
+
}): string;
|
|
12
|
+
}
|