artalk 2.1.3 → 2.1.6
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/CNAME +1 -0
- package/dist/Artalk.css +1 -1
- package/dist/Artalk.es.js +509 -1571
- package/dist/Artalk.iife.js +1 -1
- package/dist/Artalk.js +1 -1
- package/index.html +143 -0
- package/package.json +8 -32
- package/postcss.config.js +5 -0
- package/src/api/index.ts +16 -3
- package/src/api/request.ts +4 -2
- package/src/artalk.ts +30 -8
- package/src/components/action-btn.ts +1 -1
- package/src/components/comment.ts +88 -3
- package/src/components/editor-plugs/emoticons-plug.less +21 -11
- package/src/components/editor-plugs/emoticons-plug.ts +18 -18
- package/src/components/editor-plugs/preview-plug.less +1 -1
- package/src/components/editor.ts +15 -20
- package/src/components/html/comment.html +6 -13
- package/src/components/html/editor.html +8 -9
- package/src/components/html/list.html +1 -1
- package/src/components/html/sidebar-layer.html +8 -0
- package/src/components/list-lite.ts +203 -299
- package/src/components/list.ts +11 -9
- package/src/components/pagination.ts +2 -2
- package/src/components/read-more-btn.ts +27 -4
- package/src/components/sidebar-layer.ts +143 -0
- package/src/defaults.ts +2 -1
- package/src/lib/detect.js +3 -1
- package/src/lib/utils.ts +27 -1
- package/src/style/_color.less +19 -23
- package/src/style/_extend.less +0 -80
- package/src/style/_variables.less +0 -24
- package/src/style/comment.less +191 -197
- package/src/style/editor.less +69 -94
- package/src/style/list.less +13 -13
- package/src/style/main.less +32 -32
- package/src/style/pagination.less +6 -6
- package/src/style/sidebar-layer.less +92 -0
- package/types/artalk-config.d.ts +4 -1
- package/types/artalk-data.d.ts +2 -2
- package/vite-common.config.ts +15 -0
- package/vite-demo.config.ts +14 -0
- package/vite.config.ts +36 -0
- package/LICENSE +0 -674
- package/README.md +0 -84
- package/src/components/admin/page-list.ts +0 -194
- package/src/components/admin/site-list-floater.ts +0 -98
- package/src/components/admin/site-list.ts +0 -289
- package/src/components/html/sidebar.html +0 -22
- package/src/components/item-text-editor.ts +0 -136
- package/src/components/sidebar-view.ts +0 -26
- package/src/components/sidebar-views/comments-view.ts +0 -74
- package/src/components/sidebar-views/pages-view.ts +0 -61
- package/src/components/sidebar-views/setting-view.ts +0 -21
- package/src/components/sidebar-views/sites-view.ts +0 -36
- package/src/components/sidebar-views/transfer-view.ts +0 -218
- package/src/components/sidebar.ts +0 -293
- package/src/lib/md5.js +0 -6
- package/src/style/item-text-editor.less +0 -35
- package/src/style/page-list.less +0 -50
- package/src/style/sidebar.less +0 -420
- package/src/style/site-list.less +0 -208
package/src/components/editor.ts
CHANGED
|
@@ -18,12 +18,9 @@ export default class Editor extends Component {
|
|
|
18
18
|
public $header: HTMLElement
|
|
19
19
|
public $textareaWrap: HTMLElement
|
|
20
20
|
public $textarea: HTMLTextAreaElement
|
|
21
|
-
public $closeComment: HTMLTextAreaElement
|
|
22
21
|
public $plugWrap: HTMLElement
|
|
23
22
|
public $bottom: HTMLElement
|
|
24
|
-
public $
|
|
25
|
-
public $plugSwitcherWrap: HTMLElement
|
|
26
|
-
public $bottomPartRight: HTMLElement
|
|
23
|
+
public $plugBtnWrap: HTMLElement
|
|
27
24
|
public $submitBtn: HTMLButtonElement
|
|
28
25
|
public $notifyWrap: HTMLElement
|
|
29
26
|
|
|
@@ -41,17 +38,14 @@ export default class Editor extends Component {
|
|
|
41
38
|
|
|
42
39
|
this.$el = Utils.createElement(EditorHTML)
|
|
43
40
|
|
|
44
|
-
this.$header = this.$el.querySelector('.atk-
|
|
45
|
-
this.$textareaWrap = this.$el.querySelector('.atk-
|
|
46
|
-
this.$textarea = this.$el.querySelector('.atk-
|
|
47
|
-
this.$
|
|
48
|
-
this.$
|
|
49
|
-
this.$
|
|
50
|
-
this.$bottomPartLeft = this.$el.querySelector('.atk-editor-bottom-part.atk-left')!
|
|
51
|
-
this.$plugSwitcherWrap = this.$el.querySelector('.atk-editor-plug-switcher-wrap')!
|
|
52
|
-
this.$bottomPartRight = this.$el.querySelector('.atk-editor-bottom-part.atk-right')!
|
|
41
|
+
this.$header = this.$el.querySelector('.atk-header')!
|
|
42
|
+
this.$textareaWrap = this.$el.querySelector('.atk-textarea-wrap')!
|
|
43
|
+
this.$textarea = this.$el.querySelector('.atk-textarea')!
|
|
44
|
+
this.$plugWrap = this.$el.querySelector('.atk-plug-wrap')!
|
|
45
|
+
this.$bottom = this.$el.querySelector('.atk-bottom')!
|
|
46
|
+
this.$plugBtnWrap = this.$el.querySelector('.atk-plug-btn-wrap')!
|
|
53
47
|
this.$submitBtn = this.$el.querySelector('.atk-send-btn')!
|
|
54
|
-
this.$notifyWrap = this.$el.querySelector('.atk-
|
|
48
|
+
this.$notifyWrap = this.$el.querySelector('.atk-notify-wrap')!
|
|
55
49
|
|
|
56
50
|
this.initLocalStorage()
|
|
57
51
|
this.initHeader()
|
|
@@ -201,13 +195,13 @@ export default class Editor extends Component {
|
|
|
201
195
|
this.$plugWrap.innerHTML = ''
|
|
202
196
|
this.$plugWrap.style.display = 'none'
|
|
203
197
|
this.openedPlugName = null
|
|
204
|
-
this.$
|
|
198
|
+
this.$plugBtnWrap.innerHTML = ''
|
|
205
199
|
|
|
206
200
|
// 依次实例化 plug
|
|
207
201
|
this.LOADABLE_PLUG_LIST.forEach((PlugObj) => {
|
|
208
202
|
// 切换按钮
|
|
209
|
-
const btnElem = Utils.createElement(`<span class="atk-
|
|
210
|
-
this.$
|
|
203
|
+
const btnElem = Utils.createElement(`<span class="atk-plug-btn">${PlugObj.BtnHTML}</span>`)
|
|
204
|
+
this.$plugBtnWrap.appendChild(btnElem)
|
|
211
205
|
btnElem.addEventListener('click', () => {
|
|
212
206
|
let plug = this.plugList[PlugObj.Name]
|
|
213
207
|
if (!plug) {
|
|
@@ -215,7 +209,7 @@ export default class Editor extends Component {
|
|
|
215
209
|
this.plugList[PlugObj.Name] = plug
|
|
216
210
|
}
|
|
217
211
|
|
|
218
|
-
this.$
|
|
212
|
+
this.$plugBtnWrap.querySelectorAll('.active').forEach(item => item.classList.remove('active'))
|
|
219
213
|
|
|
220
214
|
// 若点击已打开的,则收起
|
|
221
215
|
if (PlugObj.Name === this.openedPlugName) {
|
|
@@ -413,7 +407,8 @@ export default class Editor extends Component {
|
|
|
413
407
|
|
|
414
408
|
/** 关闭评论 */
|
|
415
409
|
close () {
|
|
416
|
-
this.$
|
|
410
|
+
if (!this.$textareaWrap.querySelector('.atk-comment-closed'))
|
|
411
|
+
this.$textareaWrap.prepend(Utils.createElement('<div class="atk-comment-closed">仅管理员可评论</div>'))
|
|
417
412
|
|
|
418
413
|
if (!this.user.data.isAdmin) {
|
|
419
414
|
this.$textarea.style.display = 'none'
|
|
@@ -428,7 +423,7 @@ export default class Editor extends Component {
|
|
|
428
423
|
|
|
429
424
|
/** 打开评论 */
|
|
430
425
|
open () {
|
|
431
|
-
this.$
|
|
426
|
+
this.$textareaWrap.querySelector('.atk-comment-closed')?.remove()
|
|
432
427
|
this.$textarea.style.display = ''
|
|
433
428
|
this.$bottom.style.display = ''
|
|
434
429
|
}
|
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
<div class="atk-comment-wrap"
|
|
1
|
+
<div class="atk-comment-wrap">
|
|
2
2
|
<div class="atk-comment">
|
|
3
|
-
|
|
4
3
|
<div class="atk-avatar"></div>
|
|
5
|
-
|
|
6
|
-
<div class="atk-comment-main">
|
|
7
|
-
|
|
4
|
+
<div class="atk-main">
|
|
8
5
|
<div class="atk-header">
|
|
9
|
-
<span class="atk-nick"></span>
|
|
10
|
-
<span class="atk-badge"></span>
|
|
11
|
-
<span class="atk-date"></span>
|
|
6
|
+
<span class="atk-item atk-nick"></span>
|
|
7
|
+
<span class="atk-item atk-badge"></span>
|
|
8
|
+
<span class="atk-item atk-date"></span>
|
|
12
9
|
</div>
|
|
13
|
-
|
|
14
10
|
<div class="atk-body">
|
|
15
11
|
<div class="atk-content"></div>
|
|
16
12
|
</div>
|
|
17
|
-
|
|
18
13
|
<div class="atk-footer">
|
|
19
|
-
<div class="atk-
|
|
14
|
+
<div class="atk-actions"></div>
|
|
20
15
|
</div>
|
|
21
|
-
|
|
22
16
|
</div>
|
|
23
|
-
|
|
24
17
|
</div>
|
|
25
18
|
</div>
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
<div class="atk-main-editor">
|
|
2
|
-
<div class="atk-
|
|
2
|
+
<div class="atk-header">
|
|
3
3
|
<input name="nick" placeholder="昵称" class="atk-nick" type="text" required="required">
|
|
4
4
|
<input name="email" placeholder="邮箱" class="atk-email" type="email" required="required">
|
|
5
5
|
<input name="link" placeholder="网址 (https://)" class="atk-link" type="url">
|
|
6
6
|
</div>
|
|
7
|
-
<div class="atk-
|
|
8
|
-
<
|
|
9
|
-
<textarea id="atk-editor-textarea" class="atk-editor-textarea" placeholder=""></textarea>
|
|
7
|
+
<div class="atk-textarea-wrap">
|
|
8
|
+
<textarea class="atk-textarea" placeholder=""></textarea>
|
|
10
9
|
</div>
|
|
11
|
-
<div class="atk-
|
|
12
|
-
<div class="atk-
|
|
13
|
-
<div class="atk-
|
|
14
|
-
<div class="atk-
|
|
10
|
+
<div class="atk-plug-wrap" style="display: none;"></div>
|
|
11
|
+
<div class="atk-bottom">
|
|
12
|
+
<div class="atk-item atk-plug-btn-wrap"></div>
|
|
13
|
+
<div class="atk-item">
|
|
15
14
|
<button type="button" class="atk-send-btn"></button>
|
|
16
15
|
</div>
|
|
17
16
|
</div>
|
|
18
|
-
<div class="atk-
|
|
17
|
+
<div class="atk-notify-wrap"></div>
|
|
19
18
|
</div>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<span data-action="admin-close-comment" class="atk-hide" atk-only-admin-show>关闭评论</span>
|
|
9
9
|
<span data-action="open-sidebar" class="atk-hide atk-on">
|
|
10
10
|
<span class="atk-unread-badge" style="display: none;"></span>
|
|
11
|
-
|
|
11
|
+
<div class="atk-text">通知中心</div>
|
|
12
12
|
</span>
|
|
13
13
|
</div>
|
|
14
14
|
</div>
|