artalk 2.8.0 → 2.8.2
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.cjs +2 -2
- package/dist/Artalk.cjs.map +1 -1
- package/dist/Artalk.css +1 -1
- package/dist/Artalk.iife.js +2 -2
- package/dist/Artalk.iife.js.map +1 -1
- package/dist/Artalk.js +2 -2
- package/dist/Artalk.js.map +1 -1
- package/dist/Artalk.mjs +311 -269
- package/dist/Artalk.mjs.map +1 -1
- package/dist/ArtalkLite.cjs +2 -2
- package/dist/ArtalkLite.cjs.map +1 -1
- package/dist/ArtalkLite.css +1 -1
- package/dist/ArtalkLite.iife.js +2 -2
- package/dist/ArtalkLite.iife.js.map +1 -1
- package/dist/ArtalkLite.js +2 -2
- package/dist/ArtalkLite.js.map +1 -1
- package/dist/ArtalkLite.mjs +311 -269
- package/dist/ArtalkLite.mjs.map +1 -1
- package/dist/i18n/jp.cjs +1 -1
- package/dist/i18n/jp.js +1 -1
- package/dist/i18n/jp.mjs +1 -1
- package/dist/i18n/zh-TW.cjs +1 -1
- package/dist/i18n/zh-TW.js +1 -1
- package/dist/i18n/zh-TW.mjs +3 -3
- package/dist/main.d.cts +109 -50
- package/dist/main.d.ts +109 -50
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -237,6 +237,26 @@ declare class Api_2<SecurityDataType extends unknown> extends HttpClient<Securit
|
|
|
237
237
|
createComment: (comment: HandlerParamsCommentCreate, params?: RequestParams) => Promise<HttpResponse<HandlerResponseCommentCreate, HandlerMap & {
|
|
238
238
|
msg?: string | undefined;
|
|
239
239
|
}>>;
|
|
240
|
+
/**
|
|
241
|
+
* @description Get the detail of a comment by comment id
|
|
242
|
+
*
|
|
243
|
+
* @tags Comment
|
|
244
|
+
* @name GetComment
|
|
245
|
+
* @summary Get a comment
|
|
246
|
+
* @request GET:/comments/{id}
|
|
247
|
+
* @response `200` `HandlerResponseCommentGet` OK
|
|
248
|
+
* @response `404` `(HandlerMap & {
|
|
249
|
+
msg?: string,
|
|
250
|
+
|
|
251
|
+
})` Not Found
|
|
252
|
+
* @response `500` `(HandlerMap & {
|
|
253
|
+
msg?: string,
|
|
254
|
+
|
|
255
|
+
})` Internal Server Error
|
|
256
|
+
*/
|
|
257
|
+
getComment: (id: number, params?: RequestParams) => Promise<HttpResponse<HandlerResponseCommentGet, HandlerMap & {
|
|
258
|
+
msg?: string | undefined;
|
|
259
|
+
}>>;
|
|
240
260
|
/**
|
|
241
261
|
* @description Update a specific comment
|
|
242
262
|
*
|
|
@@ -1227,6 +1247,8 @@ declare namespace ArtalkType {
|
|
|
1227
1247
|
ContextApi,
|
|
1228
1248
|
EditorState,
|
|
1229
1249
|
EditorApi,
|
|
1250
|
+
ListErrorData,
|
|
1251
|
+
ListFetchedArgs,
|
|
1230
1252
|
EventPayloadMap,
|
|
1231
1253
|
ArtalkPlugin,
|
|
1232
1254
|
SidebarShowPayload
|
|
@@ -1293,9 +1315,9 @@ declare interface CheckerStore {
|
|
|
1293
1315
|
|
|
1294
1316
|
declare class CommentActions {
|
|
1295
1317
|
private comment;
|
|
1296
|
-
private get ctx();
|
|
1297
1318
|
private get data();
|
|
1298
|
-
private get
|
|
1319
|
+
private get opts();
|
|
1320
|
+
private getApi;
|
|
1299
1321
|
constructor(comment: CommentNode);
|
|
1300
1322
|
/** 投票操作 */
|
|
1301
1323
|
vote(type: 'up' | 'down'): void;
|
|
@@ -1307,17 +1329,6 @@ declare class CommentActions {
|
|
|
1307
1329
|
goToReplyComment(): void;
|
|
1308
1330
|
}
|
|
1309
1331
|
|
|
1310
|
-
declare interface CommentConf {
|
|
1311
|
-
isUnread?: boolean;
|
|
1312
|
-
openURL?: string;
|
|
1313
|
-
isFlatMode: boolean;
|
|
1314
|
-
replyTo?: CommentData;
|
|
1315
|
-
afterRender?: () => void;
|
|
1316
|
-
openEvt?: () => void;
|
|
1317
|
-
onReplyBtnClick?: Function;
|
|
1318
|
-
onDelete?: Function;
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
1332
|
export declare interface CommentData {
|
|
1322
1333
|
/** 评论 ID */
|
|
1323
1334
|
id: number;
|
|
@@ -1347,7 +1358,7 @@ export declare interface CommentData {
|
|
|
1347
1358
|
badge_name?: string;
|
|
1348
1359
|
/** 徽章颜色 */
|
|
1349
1360
|
badge_color?: string;
|
|
1350
|
-
/** IP
|
|
1361
|
+
/** IP 属地 */
|
|
1351
1362
|
ip_region?: string;
|
|
1352
1363
|
/** 是否允许回复 */
|
|
1353
1364
|
is_allow_reply: boolean;
|
|
@@ -1365,16 +1376,16 @@ export declare interface CommentData {
|
|
|
1365
1376
|
vote_down: number;
|
|
1366
1377
|
}
|
|
1367
1378
|
|
|
1368
|
-
declare class CommentNode
|
|
1379
|
+
declare class CommentNode {
|
|
1380
|
+
$el?: HTMLElement;
|
|
1369
1381
|
private renderInstance;
|
|
1370
1382
|
private actionInstance;
|
|
1371
1383
|
private data;
|
|
1372
|
-
private
|
|
1384
|
+
private opts;
|
|
1373
1385
|
private parent;
|
|
1374
1386
|
private children;
|
|
1375
1387
|
private nestCurt;
|
|
1376
|
-
|
|
1377
|
-
constructor(ctx: ContextApi, data: CommentData, conf: CommentConf);
|
|
1388
|
+
constructor(data: CommentData, opts: CommentOptions);
|
|
1378
1389
|
/** 渲染 UI */
|
|
1379
1390
|
render(): void;
|
|
1380
1391
|
/** 获取评论操作实例对象 */
|
|
@@ -1396,13 +1407,29 @@ declare class CommentNode extends Component {
|
|
|
1396
1407
|
/** 获取评论 ID */
|
|
1397
1408
|
getID(): number;
|
|
1398
1409
|
/** 置入子评论 */
|
|
1399
|
-
putChild(
|
|
1410
|
+
putChild(childNode: CommentNode, insertMode?: 'append' | 'prepend'): void;
|
|
1400
1411
|
/** 获取存放子评论的元素对象 */
|
|
1401
|
-
|
|
1412
|
+
getChildrenWrapEl(): HTMLElement;
|
|
1402
1413
|
/** 获取所有父评论 */
|
|
1403
1414
|
getParents(): CommentNode[];
|
|
1404
|
-
/**
|
|
1415
|
+
/**
|
|
1416
|
+
* Get the element of the comment
|
|
1417
|
+
*
|
|
1418
|
+
* The `getEl()` will always return the latest $el after calling `render()`.
|
|
1419
|
+
* Please be aware of the memory leak if you use the $el reference directly.
|
|
1420
|
+
*/
|
|
1405
1421
|
getEl(): HTMLElement;
|
|
1422
|
+
/**
|
|
1423
|
+
* Focus on the comment
|
|
1424
|
+
*
|
|
1425
|
+
* Scroll to the comment and perform flash animation
|
|
1426
|
+
*/
|
|
1427
|
+
focus(): void;
|
|
1428
|
+
scrollIntoView(): void;
|
|
1429
|
+
/**
|
|
1430
|
+
* Remove the comment node
|
|
1431
|
+
*/
|
|
1432
|
+
remove(): void;
|
|
1406
1433
|
/** 获取 Gravatar 头像 URL */
|
|
1407
1434
|
getGravatarURL(): string;
|
|
1408
1435
|
/** 获取评论 markdown 解析后的内容 */
|
|
@@ -1415,7 +1442,7 @@ declare class CommentNode extends Component {
|
|
|
1415
1442
|
os: string;
|
|
1416
1443
|
};
|
|
1417
1444
|
/** 获取配置 */
|
|
1418
|
-
|
|
1445
|
+
getOpts(): CommentOptions;
|
|
1419
1446
|
}
|
|
1420
1447
|
|
|
1421
1448
|
declare type CommentNode_2 = {
|
|
@@ -1426,6 +1453,25 @@ declare type CommentNode_2 = {
|
|
|
1426
1453
|
level: number;
|
|
1427
1454
|
};
|
|
1428
1455
|
|
|
1456
|
+
declare interface CommentOptions {
|
|
1457
|
+
onAfterRender?: () => void;
|
|
1458
|
+
onDelete?: Function;
|
|
1459
|
+
/** The comment being replied to (linked comment) */
|
|
1460
|
+
replyTo?: CommentData;
|
|
1461
|
+
flatMode: boolean;
|
|
1462
|
+
vote: boolean;
|
|
1463
|
+
voteDown: boolean;
|
|
1464
|
+
uaBadge: boolean;
|
|
1465
|
+
nestMax: number;
|
|
1466
|
+
gravatar: ArtalkConfig['gravatar'];
|
|
1467
|
+
heightLimit: ArtalkConfig['heightLimit'];
|
|
1468
|
+
avatarURLBuilder: ArtalkConfig['avatarURLBuilder'];
|
|
1469
|
+
scrollRelativeTo: ArtalkConfig['scrollRelativeTo'];
|
|
1470
|
+
getApi: () => Api;
|
|
1471
|
+
replyComment: ContextApi['replyComment'];
|
|
1472
|
+
editComment: ContextApi['editComment'];
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1429
1475
|
declare interface CommonApiVersionData {
|
|
1430
1476
|
app: string;
|
|
1431
1477
|
commit_hash: string;
|
|
@@ -1451,6 +1497,7 @@ declare abstract class Component {
|
|
|
1451
1497
|
$el: HTMLElement;
|
|
1452
1498
|
get conf(): ArtalkConfig;
|
|
1453
1499
|
constructor(ctx: ContextApi);
|
|
1500
|
+
getEl(): HTMLElement;
|
|
1454
1501
|
}
|
|
1455
1502
|
|
|
1456
1503
|
declare enum ContentType {
|
|
@@ -1644,7 +1691,7 @@ export declare interface EditorApi extends Component {
|
|
|
1644
1691
|
*/
|
|
1645
1692
|
hideLoading(): void;
|
|
1646
1693
|
/**
|
|
1647
|
-
* Start
|
|
1694
|
+
* Start replying a comment
|
|
1648
1695
|
*/
|
|
1649
1696
|
setReply(commentData: CommentData, $comment: HTMLElement, scroll?: boolean): void;
|
|
1650
1697
|
/**
|
|
@@ -1709,7 +1756,7 @@ declare interface EditorUI extends Record<keyof typeof Sel, HTMLElement> {
|
|
|
1709
1756
|
$link: HTMLInputElement;
|
|
1710
1757
|
$textarea: HTMLTextAreaElement;
|
|
1711
1758
|
$submitBtn: HTMLButtonElement;
|
|
1712
|
-
$
|
|
1759
|
+
$sendReplyBtn?: HTMLElement;
|
|
1713
1760
|
$editCancelBtn?: HTMLElement;
|
|
1714
1761
|
}
|
|
1715
1762
|
|
|
@@ -1734,7 +1781,7 @@ declare const en: {
|
|
|
1734
1781
|
link: string;
|
|
1735
1782
|
emoticon: string;
|
|
1736
1783
|
preview: string;
|
|
1737
|
-
|
|
1784
|
+
uploadImage: string;
|
|
1738
1785
|
uploadFail: string;
|
|
1739
1786
|
commentFail: string;
|
|
1740
1787
|
restoredMsg: string;
|
|
@@ -1879,11 +1926,6 @@ declare interface EntityCookedUserForAdmin {
|
|
|
1879
1926
|
receive_email: boolean;
|
|
1880
1927
|
}
|
|
1881
1928
|
|
|
1882
|
-
declare interface ErrorData {
|
|
1883
|
-
msg: string;
|
|
1884
|
-
data?: any;
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
1929
|
declare type EventHandler<T> = (payload: T) => void;
|
|
1888
1930
|
|
|
1889
1931
|
declare class EventManager<PayloadMap> implements EventManagerFuncs<PayloadMap> {
|
|
@@ -1923,7 +1965,7 @@ export declare interface EventPayloadMap {
|
|
|
1923
1965
|
'list-fetched': ListFetchedArgs;
|
|
1924
1966
|
'list-load': CommentData[];
|
|
1925
1967
|
'list-loaded': CommentData[];
|
|
1926
|
-
'list-failed':
|
|
1968
|
+
'list-failed': ListErrorData;
|
|
1927
1969
|
'list-goto-first': undefined;
|
|
1928
1970
|
'list-reach-bottom': undefined;
|
|
1929
1971
|
'comment-inserted': CommentData;
|
|
@@ -2188,6 +2230,13 @@ declare interface HandlerResponseCommentCreate {
|
|
|
2188
2230
|
vote_up: number;
|
|
2189
2231
|
}
|
|
2190
2232
|
|
|
2233
|
+
declare interface HandlerResponseCommentGet {
|
|
2234
|
+
/** The comment detail */
|
|
2235
|
+
comment: EntityCookedComment;
|
|
2236
|
+
/** The reply comment if exists (like reply) */
|
|
2237
|
+
reply_comment: EntityCookedComment;
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2191
2240
|
declare interface HandlerResponseCommentList {
|
|
2192
2241
|
comments: EntityCookedComment[];
|
|
2193
2242
|
count: number;
|
|
@@ -2427,13 +2476,13 @@ declare interface LayerOptions {
|
|
|
2427
2476
|
}
|
|
2428
2477
|
|
|
2429
2478
|
declare interface LayoutOptions {
|
|
2479
|
+
/** The comments wrap of list */
|
|
2430
2480
|
$commentsWrap: HTMLElement;
|
|
2431
2481
|
nestSortBy: ListNest.SortByType;
|
|
2432
2482
|
nestMax: number;
|
|
2433
2483
|
flatMode: boolean;
|
|
2434
|
-
createCommentNode(comment: CommentData,
|
|
2484
|
+
createCommentNode(comment: CommentData, replyComment?: CommentData): CommentNode;
|
|
2435
2485
|
findCommentNode(id: number): CommentNode | undefined;
|
|
2436
|
-
getCommentDataList(): CommentData[];
|
|
2437
2486
|
}
|
|
2438
2487
|
|
|
2439
2488
|
declare class List extends Component {
|
|
@@ -2443,7 +2492,9 @@ declare class List extends Component {
|
|
|
2443
2492
|
protected commentNodes: CommentNode[];
|
|
2444
2493
|
getCommentNodes(): CommentNode[];
|
|
2445
2494
|
constructor(ctx: ContextApi);
|
|
2446
|
-
getListLayout(
|
|
2495
|
+
getListLayout({ forceFlatMode }?: {
|
|
2496
|
+
forceFlatMode?: boolean;
|
|
2497
|
+
}): ListLayout;
|
|
2447
2498
|
private initCrudEvents;
|
|
2448
2499
|
}
|
|
2449
2500
|
|
|
@@ -2458,10 +2509,15 @@ export declare interface ListData {
|
|
|
2458
2509
|
page: PageData;
|
|
2459
2510
|
}
|
|
2460
2511
|
|
|
2461
|
-
declare interface
|
|
2512
|
+
export declare interface ListErrorData {
|
|
2513
|
+
msg: string;
|
|
2514
|
+
data?: any;
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2517
|
+
export declare interface ListFetchedArgs {
|
|
2462
2518
|
params: Partial<ListFetchParams>;
|
|
2463
2519
|
data?: ListData;
|
|
2464
|
-
error?:
|
|
2520
|
+
error?: ListErrorData;
|
|
2465
2521
|
}
|
|
2466
2522
|
|
|
2467
2523
|
export declare interface ListFetchParams {
|
|
@@ -2481,13 +2537,9 @@ export declare interface ListLastFetchData {
|
|
|
2481
2537
|
declare class ListLayout {
|
|
2482
2538
|
private options;
|
|
2483
2539
|
constructor(options: LayoutOptions);
|
|
2540
|
+
private getStrategy;
|
|
2484
2541
|
import(comments: CommentData[]): void;
|
|
2485
|
-
insert(comment: CommentData): void;
|
|
2486
|
-
private importCommentsNestMode;
|
|
2487
|
-
/** 导入评论 · 平铺模式 */
|
|
2488
|
-
private putCommentFlatMode;
|
|
2489
|
-
private insertCommentNest;
|
|
2490
|
-
private insertCommentFlatMode;
|
|
2542
|
+
insert(comment: CommentData, replyComment?: CommentData): void;
|
|
2491
2543
|
}
|
|
2492
2544
|
|
|
2493
2545
|
declare namespace ListNest {
|
|
@@ -2612,10 +2664,8 @@ declare type QueryParamsType = Record<string | number, any>;
|
|
|
2612
2664
|
|
|
2613
2665
|
declare class Render {
|
|
2614
2666
|
comment: CommentNode;
|
|
2615
|
-
get ctx(): ContextApi;
|
|
2616
2667
|
get data(): CommentData;
|
|
2617
|
-
get
|
|
2618
|
-
get cConf(): CommentConf;
|
|
2668
|
+
get opts(): CommentOptions;
|
|
2619
2669
|
$el: HTMLElement;
|
|
2620
2670
|
$main: HTMLElement;
|
|
2621
2671
|
$header: HTMLElement;
|
|
@@ -2630,6 +2680,15 @@ declare class Render {
|
|
|
2630
2680
|
$replyTo?: HTMLElement;
|
|
2631
2681
|
$replyAt?: HTMLElement;
|
|
2632
2682
|
constructor(comment: CommentNode);
|
|
2683
|
+
/**
|
|
2684
|
+
* Render the comment ui
|
|
2685
|
+
*
|
|
2686
|
+
* If comment data is updated, call this method to re-render the comment ui.
|
|
2687
|
+
* The method will be called multiple times, so it should be idempotent.
|
|
2688
|
+
*
|
|
2689
|
+
* Renders may add event listeners to the comment ui, so it should be called only once or override the original.
|
|
2690
|
+
* Please be aware of the memory leak caused by the event listener.
|
|
2691
|
+
*/
|
|
2633
2692
|
render(): HTMLElement;
|
|
2634
2693
|
/** 内容限高检测 */
|
|
2635
2694
|
checkHeightLimit(): void;
|
|
@@ -2639,12 +2698,10 @@ declare class Render {
|
|
|
2639
2698
|
playFadeAnim(): void;
|
|
2640
2699
|
/** 渐出动画 · 评论内容区域 */
|
|
2641
2700
|
playFadeAnimForBody(): void;
|
|
2701
|
+
/** Perform the flash animation */
|
|
2702
|
+
playFlashAnim(): void;
|
|
2642
2703
|
/** 获取子评论 Wrap */
|
|
2643
|
-
getChildrenWrap(): HTMLElement
|
|
2644
|
-
/** 初始化子评论区域 Wrap */
|
|
2645
|
-
renderChildrenWrap(): HTMLElement;
|
|
2646
|
-
/** 恢复原有的子评论区域 Wrap */
|
|
2647
|
-
recoveryChildrenWrap(): void;
|
|
2704
|
+
getChildrenWrap(): HTMLElement;
|
|
2648
2705
|
/** 设置已读 */
|
|
2649
2706
|
setUnread(val: boolean): void;
|
|
2650
2707
|
/** 设置为可点击的评论 */
|
|
@@ -2669,6 +2726,8 @@ declare const Sel: {
|
|
|
2669
2726
|
$bottom: string;
|
|
2670
2727
|
$submitBtn: string;
|
|
2671
2728
|
$notifyWrap: string;
|
|
2729
|
+
$bottomLeft: string;
|
|
2730
|
+
$stateWrap: string;
|
|
2672
2731
|
$plugBtnWrap: string;
|
|
2673
2732
|
$plugPanelWrap: string;
|
|
2674
2733
|
};
|