artalk 2.3.3 → 2.3.4

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.
@@ -42,11 +42,13 @@ var __async = (__this, __arguments, generator) => {
42
42
  });
43
43
  };
44
44
  import { marked as marked$1 } from "marked";
45
- var main = "";
45
+ var main = /* @__PURE__ */ (() => `.artalk,.atk-layer-wrap{--at-color-font: #2a2e2e;--at-color-deep: #2a2e2e;--at-color-sub: #757575;--at-color-grey: #747474;--at-color-meta: #697182;--at-color-border: #eceff2;--at-color-light: #4285f4;--at-color-bg: #FFF;--at-color-bg-transl: rgba(255, 255, 255, .94);--at-color-bg-grey: #F4F4F4;--at-color-bg-grey-transl: rgba(244, 244, 244, .75);--at-color-bg-light: rgba(29, 161, 242, .1);--at-color-main: #0083ff;--at-color-red: #ff5652;--at-color-pink: #fa5a57;--at-color-yellow: #ff7c37;--at-color-green: #4caf50;--at-color-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255))}.artalk.atk-dark-mode,.atk-layer-wrap.atk-dark-mode{--at-color-font: #fff;--at-color-deep: #e7e7e7;--at-color-sub: #e7e7e7;--at-color-grey: #fff;--at-color-meta: #fff;--at-color-border: #2d3235;--at-color-light: #687a86;--at-color-bg: #1e2224;--at-color-bg-transl: rgba(30, 34, 36, .95);--at-color-bg-grey: #46494e;--at-color-bg-grey-transl: rgba(8, 8, 8, .95);--at-color-bg-light: rgba(29, 161, 242, .1);--at-color-main: #0083ff;--at-color-red: #ff5652;--at-color-pink: #fa5a57;--at-color-yellow: #ff7c37;--at-color-green: #4caf50;--at-color-gradient: linear-gradient(180deg, rgba(30, 34, 36, 0), #1e2224)}.artalk{position:relative;width:100%;min-height:200px}.artalk,.atk-layer-wrap{color:var(--at-color-font);word-wrap:break-word;word-break:break-all}.artalk *,.atk-layer-wrap *{box-sizing:border-box}.artalk input,.atk-layer-wrap input,.artalk textarea,.atk-layer-wrap textarea,.artalk button,.atk-layer-wrap button,.artalk optgroup,.atk-layer-wrap optgroup,.artalk select,.atk-layer-wrap select{font-family:inherit;color:inherit;font-size:inherit}.artalk code,.atk-layer-wrap code{font-family:source code pro,Consolas,Monaco,Menlo,sans-serif;margin:0 .3em;padding:0 .5em;display:inline-block;font-size:.9em;background-color:var(--at-color-bg-grey);color:var(--at-color-font);border-radius:6px}.artalk pre,.atk-layer-wrap pre{margin:10px 0 0;padding:0;line-height:0}.artalk pre code,.atk-layer-wrap pre code{line-height:1.6em;display:block;padding:10px 15px;white-space:pre-wrap;background-color:var(--at-color-bg-grey);color:var(--at-color-font);margin:0}.artalk pre code *,.atk-layer-wrap pre code *{font-family:source code pro,Consolas,Monaco,Menlo,sans-serif}.artalk a,.atk-layer-wrap a{color:var(--at-color-main);text-decoration:none}.artalk blockquote,.atk-layer-wrap blockquote{position:static;margin:10px 0;padding:10px 20px;background:var(--at-color-bg-grey);border-left:4px solid #687a86;color:var(--at-color-font)}.artalk p:first-child,.atk-layer-wrap p:first-child{margin-top:0}.artalk p:last-child,.atk-layer-wrap p:last-child{margin-bottom:0}.artalk img,.atk-layer-wrap img{max-width:100%}.artalk table,.atk-layer-wrap table{width:100%;border-collapse:collapse;border-spacing:0;margin-bottom:1.5em;font-size:.96em}.artalk td,.atk-layer-wrap td,.artalk th,.atk-layer-wrap th{text-align:left;padding:4px 8px 4px 10px;border:1px solid var(--at-color-border)}.artalk td,.atk-layer-wrap td{vertical-align:top}.artalk tr:nth-child(even),.atk-layer-wrap tr:nth-child(even){background-color:var(--at-color-bg-grey)}.atk-hide{display:none!important}.atk-full-layer,.atk-loading,.atk-error-layer,.atk-layer-dialog-wrap{width:100%;height:100%;position:absolute;top:0;left:0;background:var(--at-color-bg);z-index:10;align-items:center;justify-content:center;flex-flow:column;display:flex}.atk-loading{z-index:11}.atk-loading-spinner{position:relative;width:50px;height:50px}.atk-loading-spinner svg{-webkit-animation:atkRotate 2s linear infinite;animation:atkRotate 2s linear infinite;transform-origin:center center;width:100%;height:100%;position:absolute;top:0;left:0}.atk-loading-spinner svg circle{stroke-dasharray:1,200;stroke-dashoffset:0;-webkit-animation:atkDash 1.5s ease-in-out infinite,atkColor 6s ease-in-out infinite;animation:atkDash 1.5s ease-in-out infinite,atkColor 6s ease-in-out infinite;stroke-linecap:round}@-webkit-keyframes atkRotate{to{transform:rotate(360deg)}}@keyframes atkRotate{to{transform:rotate(360deg)}}@-webkit-keyframes atkDash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}to{stroke-dasharray:89,200;stroke-dashoffset:-124px}}@keyframes atkDash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}to{stroke-dasharray:89,200;stroke-dashoffset:-124px}}@-webkit-keyframes atkColor{0%,to{stroke:#ff5652}40%{stroke:#2196f3}66%{stroke:#32c787}80%,90%{stroke:#ffc107}}@keyframes atkColor{0%,to{stroke:#ff5652}40%{stroke:#2196f3}66%{stroke:#32c787}80%,90%{stroke:#ffc107}}@-webkit-keyframes atkLoadingIconRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes atkLoadingIconRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.atk-loading-icon{width:18px;height:18px;box-sizing:border-box;border:solid 1px transparent;border-top-color:#29d;border-left-color:#29d;border-radius:50%;-webkit-animation:atkLoadingIconRotate .4s linear infinite;animation:atkLoadingIconRotate .4s linear infinite}.atk-fade-in{-webkit-animation:atkFadeIn both .3s;animation:atkFadeIn both .3s}.atk-fade-out{-webkit-animation:atkFadeOut both .2s;animation:atkFadeOut both .2s}.atk-rotate{-webkit-animation:atkRotate 2s linear infinite;animation:atkRotate 2s linear infinite}@-webkit-keyframes atkFadeIn{0%{opacity:0}to{opacity:1}}@keyframes atkFadeIn{0%{opacity:0}to{opacity:1}}@-webkit-keyframes atkFadeOut{to{opacity:0}}@keyframes atkFadeOut{to{opacity:0}}@keyframes atkRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}i.atk-icon{width:20px;height:20px;background-color:var(--at-color-deep);background-size:contain;background-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:contain;mask-size:contain}.atk-icon-sync{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-del{background-color:var(--at-color-red)!important;-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-edit{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E")}.atk-icon-no,.atk-icon-close{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E")}.atk-icon-yes{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E")}.atk-icon-plus{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E")}.atk-error-layer{background-color:var(--at-color-bg-transl)}.atk-error-layer .atk-error-title{color:var(--at-color-red)}.atk-error-layer .atk-warn-title{color:var(--at-color-yellow)}.atk-error-layer .atk-error-title,.atk-error-layer .atk-warn-title{display:inline-block;padding:0 15px;margin-bottom:20px;font-size:20px;letter-spacing:-.5px}.atk-error-layer .atk-error-text{text-align:center;padding:0 20px}.atk-error-layer .atk-error-text *{color:var(--at-color-deep)}.atk-error-layer .atk-error-text a{color:var(--at-color-meta)}.atk-layer-dialog-wrap{background-color:var(--at-color-bg-transl)}.atk-layer-dialog-wrap>.atk-layer-dialog{width:25%}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-content .atk-captcha-img{cursor:pointer;width:170px;height:auto;margin-right:10px;padding-right:10px;border-right:1px solid var(--at-color-border);vertical-align:bottom}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-content input{width:100%;line-height:34px;background-color:var(--at-color-bg);border:1px solid var(--at-color-border);border-radius:3px;outline:none;padding:0 6px;display:block;margin-top:10px;margin-bottom:5px;text-align:center}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions{display:flex;flex-direction:row}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button{flex:1;display:block;cursor:pointer;border:1px solid var(--at-color-main);background:transparent;color:var(--at-color-main);border-radius:3px;padding:0 15px;line-height:30px;outline:none}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button:active{color:#fff;background:var(--at-color-main)}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button:not(:last-child){margin-right:5px}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button.error{color:#fff;background:#ff5652;border-color:#ff5652}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap{position:fixed;z-index:999998;left:0;top:0;height:100vh;width:100vw}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap>iframe{width:100%;height:100%;border:0}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap .atk-close-btn{z-index:999999;position:fixed;top:20px;right:20px;display:flex;flex-direction:column;width:50px;height:50px;align-items:center;place-content:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:10px}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap .atk-close-btn:hover .atk-icon-close{background-color:#e81123e6}@media only screen and (max-width: 768px){.atk-layer-dialog-wrap>.atk-layer-dialog{width:90%!important}}.atk-notify{display:block;overflow:hidden;background-color:#2c2c2c;color:#fff;border-radius:3px;cursor:pointer;font-size:14px;padding:5px 15px}.atk-notify:not(:last-child){margin-bottom:3px}.atk-notify .atk-notify-content{color:#fff}.atk-layer-wrap .atk-layer-mask{position:fixed;top:0;left:0;width:100%;height:100%;z-index:99998;background:rgba(0,0,0,.3)}.atk-layer-wrap .atk-layer-item{position:fixed;z-index:99999;top:0;right:0;width:100%;height:100%}.atk-common-action-btn.atk-btn-confirm,.atk-common-action-btn.atk-btn-warn{color:var(--at-color-yellow)!important}.atk-common-action-btn.atk-btn-error{color:var(--at-color-red)!important}.atk-common-action-btn.atk-btn-success{color:var(--at-color-green)!important}img[atk-emoticon]{max-height:60px}
46
+ `)();
46
47
  var en = {
47
48
  placeholder: "Leave a comment",
48
49
  noComment: "No Comment",
49
50
  send: "Send",
51
+ save: "Save",
50
52
  nick: "Nickname",
51
53
  email: "Email",
52
54
  link: "Website",
@@ -82,6 +84,8 @@ var en = {
82
84
  approved: "Approved",
83
85
  pending: "Pending",
84
86
  pendingMsg: "Pending, visible only to commenter.",
87
+ edit: "Edit",
88
+ editCancel: "Cancel Edit",
85
89
  delete: "Delete",
86
90
  deleteConfirm: "Confirm",
87
91
  pin: "Pin",
@@ -112,6 +116,7 @@ const zhCN = {
112
116
  placeholder: "\u952E\u5165\u5185\u5BB9...",
113
117
  noComment: "\u300C\u6B64\u65F6\u65E0\u58F0\u80DC\u6709\u58F0\u300D",
114
118
  send: "\u53D1\u9001\u8BC4\u8BBA",
119
+ save: "\u4FDD\u5B58\u8BC4\u8BBA",
115
120
  nick: "\u6635\u79F0",
116
121
  email: "\u90AE\u7BB1",
117
122
  link: "\u7F51\u5740",
@@ -143,10 +148,12 @@ const zhCN = {
143
148
  collapse: "\u6298\u53E0",
144
149
  collapsed: "\u5DF2\u6298\u53E0",
145
150
  collapsedMsg: "\u8BE5\u8BC4\u8BBA\u5DF2\u88AB\u7CFB\u7EDF\u6216\u7BA1\u7406\u5458\u6298\u53E0",
146
- expand: "\u53D6\u6D88\u6298\u53E0",
151
+ expand: "\u5C55\u5F00",
147
152
  approved: "\u5DF2\u5BA1",
148
153
  pending: "\u5F85\u5BA1",
149
154
  pendingMsg: "\u5BA1\u6838\u4E2D\uFF0C\u4EC5\u672C\u4EBA\u53EF\u89C1\u3002",
155
+ edit: "\u7F16\u8F91",
156
+ editCancel: "\u53D6\u6D88\u7F16\u8F91",
150
157
  delete: "\u5220\u9664",
151
158
  deleteConfirm: "\u786E\u8BA4\u5220\u9664",
152
159
  pin: "\u7F6E\u9876",
@@ -1035,7 +1042,7 @@ function showNotify(wrapElem, msg, type) {
1035
1042
  window.clearTimeout(timeoutFn);
1036
1043
  });
1037
1044
  }
1038
- function playFadeAnim(elem, after, type) {
1045
+ function playFadeAnim(elem, after, type = "in") {
1039
1046
  elem.classList.add(`atk-fade-${type}`);
1040
1047
  const onAnimEnded = () => {
1041
1048
  elem.classList.remove(`atk-fade-${type}`);
@@ -1264,8 +1271,8 @@ function POST(ctx, url, data) {
1264
1271
  const init = {
1265
1272
  method: "POST"
1266
1273
  };
1267
- if (data)
1268
- init.body = ToFormData(data);
1274
+ data = __spreadValues({ site_name: ctx.conf.site || "" }, data || {});
1275
+ init.body = ToFormData(data);
1269
1276
  const json = yield Fetch(ctx, url, init);
1270
1277
  return json.data || {};
1271
1278
  });
@@ -1762,6 +1769,11 @@ class Api {
1762
1769
  return data || { is_login: false, is_admin: false };
1763
1770
  });
1764
1771
  }
1772
+ logout() {
1773
+ return __async(this, null, function* () {
1774
+ return POST(this.ctx, `${this.baseURL}/logout`);
1775
+ });
1776
+ }
1765
1777
  pageGet(siteName, offset, limit) {
1766
1778
  return __async(this, null, function* () {
1767
1779
  const params = {
@@ -2034,18 +2046,30 @@ class Context {
2034
2046
  insertComment(commentData) {
2035
2047
  this.list.insertComment(commentData);
2036
2048
  }
2049
+ updateComment(commentData) {
2050
+ this.list.updateComment(commentData);
2051
+ }
2037
2052
  replyComment(commentData, $comment, scroll) {
2038
2053
  this.editor.setReply(commentData, $comment, scroll);
2039
2054
  }
2040
2055
  cancelReplyComment() {
2041
2056
  this.editor.cancelReply();
2042
2057
  }
2058
+ editComment(commentData, $comment) {
2059
+ this.editor.setEditComment(commentData, $comment);
2060
+ }
2061
+ cancelEditComment() {
2062
+ this.editor.cancelEditComment();
2063
+ }
2043
2064
  updateNotifies(notifies) {
2044
2065
  this.list.updateUnread(notifies);
2045
2066
  }
2046
2067
  listReload() {
2047
2068
  this.list.reload();
2048
2069
  }
2070
+ reload() {
2071
+ this.listReload();
2072
+ }
2049
2073
  listRefreshUI() {
2050
2074
  this.list.refreshUI();
2051
2075
  }
@@ -2120,6 +2144,24 @@ class Context {
2120
2144
  str = str.replace(/\{\s*(\w+?)\s*\}/g, (_, token) => args[token] || "");
2121
2145
  return str;
2122
2146
  }
2147
+ setDarkMode(darkMode) {
2148
+ const darkModeClassName = "atk-dark-mode";
2149
+ this.conf.darkMode = darkMode;
2150
+ this.trigger("conf-updated");
2151
+ if (this.conf.darkMode) {
2152
+ this.$root.classList.add(darkModeClassName);
2153
+ } else {
2154
+ this.$root.classList.remove(darkModeClassName);
2155
+ }
2156
+ const { $wrap: $layerWrap } = GetLayerWrap(this);
2157
+ if ($layerWrap) {
2158
+ if (this.conf.darkMode) {
2159
+ $layerWrap.classList.add(darkModeClassName);
2160
+ } else {
2161
+ $layerWrap.classList.remove(darkModeClassName);
2162
+ }
2163
+ }
2164
+ }
2123
2165
  }
2124
2166
  const defaults = {
2125
2167
  el: "",
@@ -2402,9 +2444,9 @@ class CheckerLauncher {
2402
2444
  this.launched = this.launched.filter((c) => c !== checker);
2403
2445
  }
2404
2446
  }
2405
- var editor = "";
2447
+ var editor = /* @__PURE__ */ (() => ".atk-main-editor{z-index:5;position:relative;overflow:hidden;background:var(--at-color-bg);border:1px solid var(--at-color-border);border-radius:6px;margin-bottom:10px}@media only screen and (max-width: 768px){.atk-main-editor{margin-bottom:7px}}.atk-main-editor>.atk-header{display:flex;flex-direction:row;padding:10px 14px 0}.atk-main-editor>.atk-header input{flex:1;width:100%;font-size:14px;background:transparent;border:2px solid transparent;border-radius:3px;padding:6px 5px;resize:none;outline:none}.atk-main-editor>.atk-header input:not(:last-child){margin-right:2px}.atk-main-editor>.atk-textarea-wrap{position:relative}.atk-main-editor>.atk-textarea-wrap>.atk-textarea{display:block;overflow:hidden;color:var(--at-color-font);font-size:15px;background-color:var(--at-color-bg);border:2px solid transparent;border-radius:3px;width:100%;min-height:120px;margin-top:2px;padding:10px 20px;resize:none;word-wrap:break-word;outline:none}.atk-main-editor>.atk-textarea-wrap>.atk-comment-closed{pointer-events:none;color:var(--at-color-meta);font-size:12px;background-color:var(--at-color-bg);border-top:1px solid var(--at-color-border);padding:5px 15px;margin-top:10px}.atk-main-editor>.atk-textarea-wrap>.atk-send-reply{z-index:2;position:absolute;right:7px;bottom:2px;max-width:80%;height:30px;line-height:30px;font-size:14px;background:var(--at-color-bg-grey-transl);padding:0 30px 0 10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;border-radius:3px}.atk-main-editor>.atk-textarea-wrap>.atk-send-reply .atk-cancel{position:absolute;right:0;bottom:0;height:30px;text-align:center;width:30px;line-height:30px;font-weight:700}.atk-main-editor>.atk-textarea-wrap>.atk-send-reply .atk-cancel:hover{color:var(--at-color-deep)}.atk-main-editor>.atk-plug-panel-wrap{position:relative;height:180px;width:100%;overflow:hidden;border-top:1px solid var(--at-color-border);-webkit-animation:.3s both atkFadeIn;animation:.3s both atkFadeIn;transition:.2s height ease-in-out}.atk-main-editor>.atk-bottom{display:flex;flex-direction:row;justify-content:space-between;padding:5px 5px 5px 10px}.atk-main-editor>.atk-bottom>.atk-item{display:flex;flex-direction:row;align-items:center}.atk-main-editor>.atk-bottom .atk-plug-btn{padding:0 8px;line-height:24px;cursor:pointer;color:var(--at-color-grey);font-size:14px;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:3px}.atk-main-editor>.atk-bottom .atk-plug-btn:not(:last-child){margin-right:2px}.atk-main-editor>.atk-bottom .atk-plug-btn:hover{background:var(--at-color-bg-grey)}.atk-main-editor>.atk-bottom .atk-plug-btn.active{color:var(--at-color-main)}.atk-main-editor>.atk-bottom .atk-plug-btn.active svg.markdown path{fill:var(--at-color-main)}.atk-main-editor>.atk-bottom .atk-plug-btn i{color:var(--at-color-grey);display:inline-flex;vertical-align:sub;margin-left:4px}.atk-main-editor>.atk-bottom .atk-plug-btn i svg.markdown path{fill:var(--at-color-grey)}.atk-main-editor>.atk-bottom .atk-send-btn{background:var(--at-color-main);color:#fff;font-size:14px;border:none;padding:0 30px;margin:0;height:30px;cursor:pointer;transition:opacity .3s ease-in-out;outline:none;border-radius:3px}.atk-main-editor>.atk-bottom .atk-send-btn:active{opacity:.9}.atk-main-editor>.atk-notify-wrap{z-index:9;position:absolute;right:-2px;bottom:40px;width:225px;opacity:.83}\n")();
2406
2448
  var EditorHTML = '<div class="atk-main-editor">\n <div class="atk-header">\n <input name="nick" class="atk-nick" type="text" required="required">\n <input name="email" class="atk-email" type="email" required="required">\n <input name="link" class="atk-link" type="url">\n </div>\n <div class="atk-textarea-wrap">\n <textarea class="atk-textarea"></textarea>\n </div>\n <div class="atk-plug-panel-wrap" style="display: none;"></div>\n <div class="atk-bottom">\n <div class="atk-item atk-plug-btn-wrap"></div>\n <div class="atk-item">\n <button type="button" class="atk-send-btn"></button>\n </div>\n </div>\n <div class="atk-notify-wrap"></div>\n</div>\n';
2407
- var emoticonsPlug = "";
2449
+ var emoticonsPlug = /* @__PURE__ */ (() => ".atk-editor-plug-emoticons{height:100%;width:100%}.atk-editor-plug-emoticons>.atk-grp-wrap{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%}.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar{width:4px;height:4px;background:transparent}.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:window-inactive{background:rgba(86,86,86,.3)}.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:vertical:hover{background:rgba(65,74,82,.77)}.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:vertical:active{background:rgba(41,47,53,.77)}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp{display:flex;flex-wrap:wrap;flex-direction:row;padding:5px 10px 35px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp[data-type=image]>.atk-item{height:63px;width:63px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item{display:flex;align-items:center;justify-content:center;padding:5px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:3px;font-size:16px;min-width:35px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item>img{max-height:100%;width:auto}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item:hover{background:var(--at-color-bg-grey)}.atk-editor-plug-emoticons>.atk-grp-switcher{position:absolute;bottom:0;left:0;width:100%;background:var(--at-color-bg-transl);height:30px;border-top:1px solid var(--at-color-border);border-bottom:1px solid var(--at-color-border)}.atk-editor-plug-emoticons>.atk-grp-switcher>span{-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:0 10px;line-height:30px;float:left;display:block;cursor:pointer;font-size:14px}.atk-editor-plug-emoticons>.atk-grp-switcher>span:hover,.atk-editor-plug-emoticons>.atk-grp-switcher>span.active{background:var(--at-color-bg-grey)}\n")();
2408
2450
  class EditorPlug {
2409
2451
  constructor(editor2) {
2410
2452
  __publicField(this, "editor");
@@ -2767,7 +2809,7 @@ class UploadPlug extends EditorPlug {
2767
2809
  }
2768
2810
  }
2769
2811
  __publicField(UploadPlug, "Name", "upload");
2770
- var previewPlug = "";
2812
+ var previewPlug = /* @__PURE__ */ (() => ".atk-editor-plug-preview{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%;padding:10px 15px}\n")();
2771
2813
  class PreviewPlug extends EditorPlug {
2772
2814
  constructor(editor2) {
2773
2815
  super(editor2);
@@ -2865,9 +2907,11 @@ class Editor extends Component {
2865
2907
  __publicField(this, "$bottom");
2866
2908
  __publicField(this, "$submitBtn");
2867
2909
  __publicField(this, "$notifyWrap");
2910
+ __publicField(this, "isTraveling", false);
2868
2911
  __publicField(this, "replyComment", null);
2869
2912
  __publicField(this, "$sendReply", null);
2870
- __publicField(this, "isTraveling", false);
2913
+ __publicField(this, "editComment", null);
2914
+ __publicField(this, "$editCancelBtn", null);
2871
2915
  __publicField(this, "ENABLED_PLUGS", [EmoticonsPlug, UploadPlug, PreviewPlug, HeaderInputPlug]);
2872
2916
  __publicField(this, "plugList", {});
2873
2917
  __publicField(this, "openedPlugName", null);
@@ -2899,6 +2943,12 @@ class Editor extends Component {
2899
2943
  get $inputs() {
2900
2944
  return { nick: this.$nick, email: this.$email, link: this.$link };
2901
2945
  }
2946
+ get isReplyMode() {
2947
+ return this.replyComment !== null;
2948
+ }
2949
+ get isEditMode() {
2950
+ return this.editComment !== null;
2951
+ }
2902
2952
  initLocalStorage() {
2903
2953
  const localContent = window.localStorage.getItem("ArtalkContent") || "";
2904
2954
  if (localContent.trim() !== "") {
@@ -2918,6 +2968,8 @@ class Editor extends Component {
2918
2968
  });
2919
2969
  }
2920
2970
  onHeaderInput(key, $input) {
2971
+ if (this.isEditMode)
2972
+ return;
2921
2973
  this.user.update({
2922
2974
  [key]: $input.value.trim()
2923
2975
  });
@@ -2939,8 +2991,14 @@ class Editor extends Component {
2939
2991
  this.adjustTextareaHeight();
2940
2992
  });
2941
2993
  }
2994
+ refreshSendBtnText() {
2995
+ if (this.isEditMode)
2996
+ this.$submitBtn.innerText = this.$t("save");
2997
+ else
2998
+ this.$submitBtn.innerText = this.ctx.conf.sendBtn || this.$t("send");
2999
+ }
2942
3000
  initSubmitBtn() {
2943
- this.$submitBtn.innerText = this.ctx.conf.sendBtn || this.$t("send");
3001
+ this.refreshSendBtnText();
2944
3002
  this.$submitBtn.addEventListener("click", () => this.submit());
2945
3003
  }
2946
3004
  getFinalContent() {
@@ -2985,19 +3043,16 @@ class Editor extends Component {
2985
3043
  this.$textarea.value += val;
2986
3044
  }
2987
3045
  }
2988
- clearEditor() {
2989
- this.setContent("");
2990
- this.cancelReply();
2991
- }
2992
3046
  adjustTextareaHeight() {
2993
3047
  const diff = this.$textarea.offsetHeight - this.$textarea.clientHeight;
2994
3048
  this.$textarea.style.height = "0px";
2995
3049
  this.$textarea.style.height = `${this.$textarea.scrollHeight + diff}px`;
2996
3050
  }
2997
3051
  setReply(commentData, $comment, scroll = true) {
2998
- if (this.replyComment !== null) {
3052
+ if (this.isEditMode)
3053
+ this.cancelEditComment();
3054
+ if (this.isReplyMode)
2999
3055
  this.cancelReply();
3000
- }
3001
3056
  if (this.$sendReply === null) {
3002
3057
  this.$sendReply = createElement(`<div class="atk-send-reply">${this.$t("reply")} <span class="atk-text"></span><span class="atk-cancel">\xD7</span></div>`);
3003
3058
  this.$sendReply.querySelector(".atk-text").innerText = `@${commentData.nick}`;
@@ -3024,6 +3079,42 @@ class Editor extends Component {
3024
3079
  this.travelBack();
3025
3080
  }
3026
3081
  }
3082
+ setEditComment(commentData, $comment) {
3083
+ if (this.isEditMode)
3084
+ this.cancelEditComment();
3085
+ if (this.isReplyMode)
3086
+ this.cancelReply();
3087
+ if (this.$editCancelBtn === null) {
3088
+ this.$editCancelBtn = createElement(`<div class="atk-send-reply">${this.$t("editCancel")}<span class="atk-cancel">\xD7</span></div>`);
3089
+ this.$editCancelBtn.onclick = () => {
3090
+ this.cancelEditComment();
3091
+ };
3092
+ this.$textareaWrap.append(this.$editCancelBtn);
3093
+ }
3094
+ this.editComment = commentData;
3095
+ this.$header.style.display = "none";
3096
+ this.travel($comment);
3097
+ this.$nick.value = commentData.nick;
3098
+ this.$email.value = commentData.email || "";
3099
+ this.$link.value = commentData.link;
3100
+ this.setContent(commentData.content);
3101
+ this.$textarea.focus();
3102
+ this.refreshSendBtnText();
3103
+ }
3104
+ cancelEditComment() {
3105
+ if (this.$editCancelBtn !== null) {
3106
+ this.$editCancelBtn.remove();
3107
+ this.$editCancelBtn = null;
3108
+ }
3109
+ this.editComment = null;
3110
+ this.travelBack();
3111
+ this.$nick.value = this.user.data.nick;
3112
+ this.$email.value = this.user.data.email;
3113
+ this.$link.value = this.user.data.link;
3114
+ this.setContent("");
3115
+ this.refreshSendBtnText();
3116
+ this.$header.style.display = "";
3117
+ }
3027
3118
  showNotify(msg, type) {
3028
3119
  showNotify(this.$notifyWrap, msg, type);
3029
3120
  }
@@ -3041,6 +3132,16 @@ class Editor extends Component {
3041
3132
  }
3042
3133
  this.ctx.trigger("editor-submit");
3043
3134
  this.showLoading();
3135
+ if (!this.isEditMode) {
3136
+ yield this.submitAdd();
3137
+ } else {
3138
+ yield this.submitEdit();
3139
+ }
3140
+ this.hideLoading();
3141
+ });
3142
+ }
3143
+ submitAdd() {
3144
+ return __async(this, null, function* () {
3044
3145
  try {
3045
3146
  const nComment = yield this.ctx.getApi().add({
3046
3147
  content: this.getFinalContent(),
@@ -3056,14 +3157,32 @@ class Editor extends Component {
3056
3157
  window.open(`${this.replyComment.page_url}#atk-comment-${nComment.id}`);
3057
3158
  }
3058
3159
  this.ctx.insertComment(nComment);
3059
- this.clearEditor();
3160
+ this.setContent("");
3161
+ this.cancelReply();
3162
+ this.ctx.trigger("editor-submitted");
3163
+ } catch (err) {
3164
+ console.error(err);
3165
+ this.showNotify(`${this.$t("commentFail")}\uFF0C${err.msg || String(err)}`, "e");
3166
+ }
3167
+ });
3168
+ }
3169
+ submitEdit() {
3170
+ return __async(this, null, function* () {
3171
+ try {
3172
+ const saveData = {
3173
+ content: this.getFinalContent(),
3174
+ nick: this.$nick.value,
3175
+ email: this.$email.value,
3176
+ link: this.$link.value
3177
+ };
3178
+ const nComment = yield this.ctx.getApi().commentEdit(__spreadValues(__spreadValues({}, this.editComment), saveData));
3179
+ this.ctx.updateComment(nComment);
3180
+ this.setContent("");
3181
+ this.cancelEditComment();
3060
3182
  this.ctx.trigger("editor-submitted");
3061
3183
  } catch (err) {
3062
3184
  console.error(err);
3063
3185
  this.showNotify(`${this.$t("commentFail")}\uFF0C${err.msg || String(err)}`, "e");
3064
- return;
3065
- } finally {
3066
- this.hideLoading();
3067
3186
  }
3068
3187
  });
3069
3188
  }
@@ -3172,7 +3291,7 @@ class Editor extends Component {
3172
3291
  this.openedPlugName = null;
3173
3292
  }
3174
3293
  }
3175
- var list = "";
3294
+ var list = /* @__PURE__ */ (() => ".artalk>.atk-list{position:relative}.artalk>.atk-list>.atk-list-header{display:flex;flex-direction:row;padding:10px 17px}.artalk>.atk-list>.atk-list-header .atk-text{display:inline-block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap{position:relative;cursor:pointer}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-arrow-down-icon{cursor:pointer;vertical-align:middle;border-top:5px solid var(--at-color-grey);border-left:3px solid transparent;border-right:3px solid transparent;margin-top:-1px;margin-left:.8rem;display:inline-block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap:hover .atk-dropdown{display:block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown{z-index:888;display:none;height:auto!important;max-height:calc(100vh - 2.7rem);overflow-y:auto;position:absolute;top:100%;right:0;width:100%;background-color:var(--at-color-bg);padding:.6rem 0;border:1px solid var(--at-color-border);text-align:center;border-radius:6px;white-space:nowrap;margin:0;list-style:none}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item span,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a{display:block;line-height:2rem;position:relative;border-bottom:none;font-weight:400;padding:0 1.5rem}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item span:hover,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a:hover{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item.active span,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-comment-count{font-size:15px}.artalk>.atk-list>.atk-list-header .atk-comment-count .atk-comment-count-num{font-size:22px;margin-right:4px}.artalk>.atk-list>.atk-list-header .atk-right-action{display:flex;flex:1;flex-direction:row;align-items:center;justify-content:flex-end}.artalk>.atk-list>.atk-list-header .atk-right-action>span{font-size:14px;color:var(--at-color-meta);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;position:relative}.artalk>.atk-list>.atk-list-header .atk-right-action>span.atk-on,.artalk>.atk-list>.atk-list-header .atk-right-action>span.atk-on *{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-right-action>span:not(:last-child):not(.atk-hide){margin-right:10px;padding-right:10px}.artalk>.atk-list>.atk-list-header .atk-right-action>span .atk-unread-badge{position:absolute;top:-5px;left:-6px;color:#fff;background:var(--at-color-pink);text-align:center;min-width:16px;height:16px;padding:0 3px;border-radius:8px;line-height:16px;font-size:12px}.artalk>.atk-list>.atk-list-body{min-height:150px}.artalk>.atk-list>.atk-list-footer{z-index:1;position:absolute;bottom:5px;right:0}@media only screen and (max-width: 768px){.artalk>.atk-list>.atk-list-footer{position:relative;margin-top:10px;text-align:center}}.artalk>.atk-list>.atk-list-footer .atk-copyright{display:block;font-size:12px;color:var(--at-color-meta);padding-right:15px;margin-top:5px}.artalk>.atk-list>.atk-list-footer .atk-copyright a{color:var(--at-color-main);text-decoration:none}.atk-list-no-comment{text-align:center;height:150px;line-height:150px;display:block;font-size:19px}.atk-list-read-more{border-top:1px dashed var(--at-color-border);margin-top:28px;padding-bottom:25px}@media only screen and (max-width: 768px){.atk-list-read-more{padding-bottom:10px}}.atk-list-read-more .atk-list-read-more-inner{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:0 15px;font-size:14px;border-radius:6px;border:1px solid transparent;display:flex;height:30px;flex-direction:row;place-content:center;align-items:center;width:120px;margin:-15px auto 0;background:var(--at-color-bg);border-color:var(--at-color-border)}.atk-list-read-more .atk-list-read-more-inner.atk-err>.atk-text{color:var(--at-color-red)!important}.atk-list-read-more .atk-list-read-more-inner>.atk-loading-icon{height:15px;width:15px}.atk-list-read-more .atk-list-read-more-inner>.atk-text{color:var(--at-color-meta)}.atk-list-read-more .atk-list-read-more-inner:hover{background:var(--at-color-bg-grey)}\n")();
3176
3295
  var ListHTML = '<div class="atk-list">\n <div class="atk-list-header">\n <div class="atk-comment-count">\n <div class="atk-text"></div>\n </div>\n <div class="atk-right-action">\n <span data-action="admin-close-comment" class="atk-hide" atk-only-admin-show></span>\n <span data-action="open-sidebar" class="atk-hide atk-on">\n <span class="atk-unread-badge" style="display: none;"></span>\n <div class="atk-text"></div>\n </span>\n </div>\n </div>\n <div class="atk-list-body"></div>\n <div class="atk-list-footer">\n <div class="atk-copyright"></div>\n </div>\n</div>\n';
3177
3296
  const win = window || {};
3178
3297
  const nav = navigator || {};
@@ -3364,7 +3483,7 @@ function Detect(userAgent) {
3364
3483
  }
3365
3484
  return dest;
3366
3485
  }
3367
- var comment = "";
3486
+ var comment = /* @__PURE__ */ (() => '.atk-comment-wrap{overflow:hidden;position:relative;border-bottom:1px solid transparent}.atk-comment-wrap.atk-flash-once{-webkit-animation:atkFlashOnce 1s ease-in-out 0s;animation:atkFlashOnce 1s ease-in-out 0s}@-webkit-keyframes atkFlashOnce{0%{background:rgba(0,131,255,.2)}to{background:transparent}}@keyframes atkFlashOnce{0%{background:rgba(0,131,255,.2)}to{background:transparent}}.atk-comment-wrap.atk-unread:before{content:" ";position:absolute;left:0;top:10%;width:3px;height:80%;background:var(--at-color-main)}.atk-comment-wrap.atk-openable{cursor:pointer}.atk-comment-wrap.atk-openable:hover{background:var(--at-color-bg-grey)}.atk-comment-wrap.atk-openable .atk-height-limit:after{background:transparent!important}.atk-comment-wrap:last-child{border-bottom:none}.atk-comment{display:block;padding:12px 10px}.atk-comment>.atk-avatar{display:block;padding:2px 0;float:left}.atk-comment>.atk-avatar img{width:50px;height:50px;border-radius:3px}.atk-comment>.atk-main{display:block;margin-left:63px}.atk-comment>.atk-main>.atk-header{line-height:1;font-size:13px;margin-bottom:.5em;overflow:hidden;position:relative;display:flex;flex-wrap:wrap;align-items:center}.atk-comment>.atk-main>.atk-header .atk-item{display:flex;align-items:center;margin-top:2px;margin-bottom:2px;color:var(--at-color-meta)}.atk-comment>.atk-main>.atk-header .atk-item:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-item.atk-nick,.atk-comment>.atk-main>.atk-header .atk-item.atk-nick a{font-size:14px;color:var(--at-color-main);text-decoration:none}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at{margin-left:2px}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at>.atk-arrow:before{content:"";vertical-align:middle;transform:rotate(90deg);border-bottom:4px solid var(--at-color-grey);border-left:3px solid transparent;border-right:3px solid transparent;display:inline-block;margin-top:-1px}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at>.atk-nick{color:var(--at-color-main);cursor:pointer;margin-left:6px}.atk-comment>.atk-main>.atk-header .atk-badge-wrap>*:last-child{margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-badge{display:inline-block;color:var(--at-color-meta);background:var(--at-color-bg-grey);padding:0 6px;line-height:17px;border-radius:3px;color:#fff}.atk-comment>.atk-main>.atk-header .atk-badge:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-pinned-badge{display:inline-block;color:var(--at-color-meta);background:var(--at-color-bg-grey);padding:0 6px;line-height:17px;border-radius:3px;color:#fff;background:#f44336}.atk-comment>.atk-main>.atk-header .atk-pinned-badge:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-ua{display:inline-block;color:var(--at-color-meta);background:var(--at-color-bg-grey);padding:0 6px;line-height:17px;border-radius:3px}.atk-comment>.atk-main>.atk-header .atk-ua:not(:last-child){margin-right:6px}@media only screen and (max-width: 768px){.atk-comment>.atk-main>.atk-header .atk-ua-wrap{display:block;margin-top:5px}}.atk-comment>.atk-main>.atk-body{display:block;overflow:hidden;position:relative}.atk-comment>.atk-main>.atk-body img{max-width:100%}.atk-comment>.atk-main>.atk-body>.atk-content{word-break:break-all}.atk-comment>.atk-main>.atk-body>.atk-content.atk-type-collapsed{border:3px solid var(--at-color-bg-grey);border-bottom:0;padding:5px 10px;border-radius:6px 6px 0 0;margin-bottom:-5px}.atk-comment>.atk-main>.atk-body>.atk-content>*:first-child{margin-top:0}.atk-comment>.atk-main>.atk-body>.atk-content>*:last-child{margin-bottom:0}.atk-comment>.atk-main>.atk-body>.atk-content .atk-height-limit-btn{bottom:5px}.atk-comment>.atk-main>.atk-body>.atk-pending{color:var(--at-color-meta);margin:3px 0;font-size:13px;padding:10px 18px;display:block;background:var(--at-color-bg-grey);border-left:4px solid #f44336}.atk-comment>.atk-main>.atk-body>.atk-reply-to{padding:5px 15px;border-left:3px solid #eee;margin-bottom:10px;position:relative;margin-top:10px}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-meta{font-size:15px}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-meta .atk-nick{color:var(--at-color-main)}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-content{margin-top:5px}.atk-comment>.atk-main>.atk-body>.atk-collapsed{margin:3px 0;font-size:13px;padding:10px 18px;display:block;background:var(--at-color-bg-grey);border-radius:6px}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-text{color:var(--at-color-meta)}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-show-btn{color:var(--at-color-main);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:3px}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-show-btn:hover{color:var(--at-color-main)}.atk-comment>.atk-main>.atk-footer{margin-top:12px}.atk-comment>.atk-main>.atk-footer .atk-actions{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;margin-bottom:-15px}.atk-comment>.atk-main>.atk-footer .atk-actions>span{color:var(--at-color-meta);font-size:13px;line-height:15px;display:inline-flex;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-bottom:15px}.atk-comment>.atk-main>.atk-footer .atk-actions>span.atk-error,.atk-comment>.atk-main>.atk-footer .atk-actions>span.atk-error:hover{color:var(--at-color-red)}.atk-comment>.atk-main>.atk-footer .atk-actions>span:not(:last-child):not(.atk-hide){margin-right:16px}.atk-comment>.atk-main>.atk-footer .atk-actions>span:hover{color:var(--at-color-deep)}.atk-comment .atk-height-limit:after{position:absolute;z-index:1;display:block;overflow:hidden;width:100%;content:" ";bottom:0;height:80px;background:var(--at-color-gradient)}.atk-comment .atk-height-limit-btn{z-index:10;position:absolute;left:50%;bottom:10px;transform:translate(-50%);cursor:pointer;border:1px solid var(--at-color-border);border-radius:6px;background:var(--at-color-bg);padding:1px 20px;font-size:15px;color:var(--at-color-meta);-webkit-user-select:none;-moz-user-select:none;user-select:none}.atk-comment .atk-height-limit-btn:hover{background:var(--at-color-bg-grey)}.atk-comment .atk-height-limit .atk-height-limit .atk-height-limit-btn{display:none}.atk-comment-children>.atk-comment-wrap{margin-top:10px;border-left:1px dashed transparent;border-bottom-color:transparent}.atk-comment-children>.atk-comment-wrap:not(:last-child){margin-bottom:5px}.atk-comment-children>.atk-comment-wrap>.atk-comment{padding:4px 0}.atk-comment-children>.atk-comment-wrap>.atk-comment>.atk-avatar img{width:36px;height:36px}.atk-comment-children>.atk-comment-wrap>.atk-comment>.atk-main{margin-left:47px}\n')();
3368
3487
  class ActionBtn {
3369
3488
  constructor(ctx, conf) {
3370
3489
  __publicField(this, "ctx");
@@ -3692,6 +3811,22 @@ class CommentRender {
3692
3811
  pendingBtn.setClick(() => {
3693
3812
  this.comment.getActions().adminEdit("pending", pendingBtn);
3694
3813
  });
3814
+ const pinnedBtn = new ActionBtn(this.ctx, {
3815
+ text: () => this.data.is_pinned ? this.ctx.$t("unpin") : this.ctx.$t("pin"),
3816
+ adminOnly: true
3817
+ });
3818
+ pinnedBtn.appendTo(this.$actions);
3819
+ pinnedBtn.setClick(() => {
3820
+ this.comment.getActions().adminEdit("pinned", pendingBtn);
3821
+ });
3822
+ const editBtn = new ActionBtn(this.ctx, {
3823
+ text: this.ctx.$t("edit"),
3824
+ adminOnly: true
3825
+ });
3826
+ editBtn.appendTo(this.$actions);
3827
+ editBtn.setClick(() => {
3828
+ this.ctx.editComment(this.data, this.$el);
3829
+ });
3695
3830
  const delBtn = new ActionBtn(this.ctx, {
3696
3831
  text: this.ctx.$t("delete"),
3697
3832
  confirm: true,
@@ -3702,14 +3837,6 @@ class CommentRender {
3702
3837
  delBtn.setClick(() => {
3703
3838
  this.comment.getActions().adminDelete(delBtn);
3704
3839
  });
3705
- const pinnedBtn = new ActionBtn(this.ctx, {
3706
- text: () => this.data.is_pinned ? this.ctx.$t("unpin") : this.ctx.$t("pin"),
3707
- adminOnly: true
3708
- });
3709
- pinnedBtn.appendTo(this.$actions);
3710
- pinnedBtn.setClick(() => {
3711
- this.comment.getActions().adminEdit("pinned", pendingBtn);
3712
- });
3713
3840
  }
3714
3841
  checkHeightLimit() {
3715
3842
  this.checkHeightLimitArea("content");
@@ -4019,7 +4146,7 @@ class Comment extends Component {
4019
4146
  return this.cConf;
4020
4147
  }
4021
4148
  }
4022
- var pagination = "";
4149
+ var pagination = /* @__PURE__ */ (() => ".atk-pagination{display:flex;flex-direction:row;justify-content:center;padding:10px 0;position:relative}.atk-pagination>.atk-btn,.atk-pagination>.atk-input{font-size:15px;height:30px;border:1px solid var(--at-color-border);border-radius:3px;padding:0 5px;text-align:center;background:var(--at-color-bg)}.atk-pagination>.atk-btn{-webkit-user-select:none;-moz-user-select:none;user-select:none;width:70px;cursor:pointer;display:flex;justify-content:center;align-items:center}.atk-pagination>.atk-btn:hover{background:var(--at-color-bg-grey)}.atk-pagination>.atk-btn.atk-disabled{color:var(--at-color-sub)}.atk-pagination>.atk-btn.atk-disabled:hover{cursor:default;background:initial}.atk-pagination>.atk-input{background:transparent;color:var(--at-color-font);font-size:18px;width:60px;outline:none}.atk-pagination>.atk-input:focus{border-color:var(--at-color-main)}.atk-pagination>*:not(:last-child){margin-right:10px}\n")();
4023
4150
  class Pagination {
4024
4151
  constructor(total, conf) {
4025
4152
  __publicField(this, "conf");
@@ -4267,7 +4394,7 @@ function makeNestCommentNodeList(srcData, sortBy = "DATE_DESC", nestMax = 2) {
4267
4394
  })(nodeList);
4268
4395
  return nodeList;
4269
4396
  }
4270
- const backendMinVersion = "2.1.7";
4397
+ const backendMinVersion = "2.1.10";
4271
4398
  class ListLite extends Component {
4272
4399
  constructor(ctx) {
4273
4400
  super(ctx);
@@ -4365,7 +4492,7 @@ class ListLite extends Component {
4365
4492
  }
4366
4493
  this.data = data;
4367
4494
  const feMinVersion = ((_a = data.api_version) == null ? void 0 : _a.fe_min_version) || "0.0.0";
4368
- if (this.ctx.conf.versionCheck && this.versionCheck("frontend", feMinVersion, "2.3.3"))
4495
+ if (this.ctx.conf.versionCheck && this.versionCheck("frontend", feMinVersion, "2.3.4"))
4369
4496
  return;
4370
4497
  if (this.ctx.conf.versionCheck && this.versionCheck("backend", backendMinVersion, (_b = data.api_version) == null ? void 0 : _b.version))
4371
4498
  return;
@@ -4579,6 +4706,12 @@ class ListLite extends Component {
4579
4706
  this.ctx.trigger("list-loaded");
4580
4707
  this.ctx.trigger("list-inserted", commentData);
4581
4708
  }
4709
+ updateComment(commentData) {
4710
+ const comment2 = this.ctx.findComment(commentData.id);
4711
+ if (comment2) {
4712
+ comment2.setData(commentData);
4713
+ }
4714
+ }
4582
4715
  updateUnread(notifies) {
4583
4716
  this.unread = notifies;
4584
4717
  if (this.unreadHighlight === true) {
@@ -4648,7 +4781,7 @@ class List extends ListLite {
4648
4781
  if (this.ctx.conf.listSort) {
4649
4782
  this.initDropdown();
4650
4783
  }
4651
- this.$el.querySelector(".atk-copyright").innerHTML = `Powered By <a href="https://artalk.js.org" target="_blank" title="Artalk v${"2.3.3"}">Artalk</a>`;
4784
+ this.$el.querySelector(".atk-copyright").innerHTML = `Powered By <a href="https://artalk.js.org" target="_blank" title="Artalk v${"2.3.4"}">Artalk</a>`;
4652
4785
  }
4653
4786
  initListActionBtn() {
4654
4787
  this.$openSidebarBtn = this.$el.querySelector('[data-action="open-sidebar"]');
@@ -4820,7 +4953,7 @@ class List extends ListLite {
4820
4953
  this.showUnreadBadge((notifies == null ? void 0 : notifies.length) || 0);
4821
4954
  }
4822
4955
  }
4823
- var sidebarLayer = "";
4956
+ var sidebarLayer = /* @__PURE__ */ (() => ".atk-sidebar-layer{position:fixed;z-index:99999;top:0;right:0;width:430px;height:100%;background:var(--at-color-bg);transition:transform .45s cubic-bezier(.23,1,.32,1) 0ms;transform:translate(430px)}@media only screen and (max-width: 430px){.atk-sidebar-layer{width:100%}}.atk-sidebar-layer .atk-sidebar-inner{position:relative;height:100%}.atk-sidebar-layer .atk-sidebar-header{position:absolute;top:0;right:0;display:flex;flex-direction:row;align-items:center;z-index:99999}.atk-sidebar-layer .atk-sidebar-header .atk-sidebar-close{display:flex;flex-direction:column;width:60px;height:60px;align-items:center;place-content:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:10px}.atk-sidebar-layer .atk-sidebar-header .atk-sidebar-close:hover .atk-icon-close{background-color:#e81123e6}.atk-sidebar-layer .atk-sidebar-iframe-wrap{height:100%;position:relative}.atk-sidebar-layer .atk-sidebar-iframe-wrap iframe{border:0;width:100%;height:100%}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert{z-index:9999;top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;background:var(--at-color-bg);padding:40px 30px;width:80%;text-align:center;border-radius:4px}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-title{font-size:1.4em;margin-bottom:20px;color:var(--at-color-font)}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-text{color:var(--at-color-font)}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-text span{cursor:pointer;color:var(--at-color-main)}\n")();
4824
4957
  var SidebarHTML = '<div class="atk-sidebar-layer">\n <div class="atk-sidebar-inner">\n <div class="atk-sidebar-header">\n <div class="atk-sidebar-close"><i class="atk-icon atk-icon-close"></i></div>\n </div>\n <div class="atk-sidebar-iframe-wrap"></div>\n </div>\n</div>\n';
4825
4958
  class SidebarLayer extends Component {
4826
4959
  constructor(ctx) {
@@ -4966,6 +5099,7 @@ const _Artalk = class {
4966
5099
  __publicField(this, "editor");
4967
5100
  __publicField(this, "list");
4968
5101
  __publicField(this, "sidebarLayer");
5102
+ __publicField(this, "instancePlugins", []);
4969
5103
  this.conf = _Artalk.HandelBaseConf(customConf);
4970
5104
  if (this.conf.el instanceof HTMLElement)
4971
5105
  this.$root = this.conf.el;
@@ -5076,24 +5210,6 @@ const _Artalk = class {
5076
5210
  this.setDarkMode(this.conf.darkMode || false);
5077
5211
  }
5078
5212
  }
5079
- setDarkMode(darkMode) {
5080
- const darkModeClassName = "atk-dark-mode";
5081
- this.ctx.conf.darkMode = darkMode;
5082
- this.ctx.trigger("conf-updated");
5083
- if (this.conf.darkMode) {
5084
- this.$root.classList.add(darkModeClassName);
5085
- } else {
5086
- this.$root.classList.remove(darkModeClassName);
5087
- }
5088
- const { $wrap: $layerWrap } = GetLayerWrap(this.ctx);
5089
- if ($layerWrap) {
5090
- if (this.conf.darkMode) {
5091
- $layerWrap.classList.add(darkModeClassName);
5092
- } else {
5093
- $layerWrap.classList.remove(darkModeClassName);
5094
- }
5095
- }
5096
- }
5097
5213
  on(name, handler) {
5098
5214
  this.ctx.on(name, handler, "external");
5099
5215
  }
@@ -5106,9 +5222,21 @@ const _Artalk = class {
5106
5222
  reload() {
5107
5223
  this.ctx.listReload();
5108
5224
  }
5109
- static Use(plugin) {
5225
+ setDarkMode(darkMode) {
5226
+ this.ctx.setDarkMode(darkMode);
5227
+ }
5228
+ use(plugin) {
5229
+ this.instancePlugins.push(plugin);
5230
+ if (typeof plugin === "function")
5231
+ plugin(this.ctx);
5232
+ }
5233
+ static use(plugin) {
5110
5234
  this.Plugins.push(plugin);
5111
5235
  }
5236
+ static Use(plugin) {
5237
+ this.use(plugin);
5238
+ console.warn("`Use(...)` is deprecated, replace it with lowercase `use(...)`.");
5239
+ }
5112
5240
  static LoadCountWidget(customConf) {
5113
5241
  const conf = this.HandelBaseConf(customConf);
5114
5242
  const ctx = new Context(conf);
@@ -5117,7 +5245,5 @@ const _Artalk = class {
5117
5245
  };
5118
5246
  let Artalk = _Artalk;
5119
5247
  __publicField(Artalk, "defaults", defaults);
5120
- __publicField(Artalk, "Plugins", [
5121
- PvCountWidget
5122
- ]);
5248
+ __publicField(Artalk, "Plugins", [PvCountWidget]);
5123
5249
  export { Artalk as default };