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.
package/dist/Artalk.es.js CHANGED
@@ -41,11 +41,13 @@ var __async = (__this, __arguments, generator) => {
41
41
  step((generator = generator.apply(__this, __arguments)).next());
42
42
  });
43
43
  };
44
- var main = "";
44
+ 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}
45
+ `)();
45
46
  var en = {
46
47
  placeholder: "Leave a comment",
47
48
  noComment: "No Comment",
48
49
  send: "Send",
50
+ save: "Save",
49
51
  nick: "Nickname",
50
52
  email: "Email",
51
53
  link: "Website",
@@ -81,6 +83,8 @@ var en = {
81
83
  approved: "Approved",
82
84
  pending: "Pending",
83
85
  pendingMsg: "Pending, visible only to commenter.",
86
+ edit: "Edit",
87
+ editCancel: "Cancel Edit",
84
88
  delete: "Delete",
85
89
  deleteConfirm: "Confirm",
86
90
  pin: "Pin",
@@ -111,6 +115,7 @@ const zhCN = {
111
115
  placeholder: "\u952E\u5165\u5185\u5BB9...",
112
116
  noComment: "\u300C\u6B64\u65F6\u65E0\u58F0\u80DC\u6709\u58F0\u300D",
113
117
  send: "\u53D1\u9001\u8BC4\u8BBA",
118
+ save: "\u4FDD\u5B58\u8BC4\u8BBA",
114
119
  nick: "\u6635\u79F0",
115
120
  email: "\u90AE\u7BB1",
116
121
  link: "\u7F51\u5740",
@@ -142,10 +147,12 @@ const zhCN = {
142
147
  collapse: "\u6298\u53E0",
143
148
  collapsed: "\u5DF2\u6298\u53E0",
144
149
  collapsedMsg: "\u8BE5\u8BC4\u8BBA\u5DF2\u88AB\u7CFB\u7EDF\u6216\u7BA1\u7406\u5458\u6298\u53E0",
145
- expand: "\u53D6\u6D88\u6298\u53E0",
150
+ expand: "\u5C55\u5F00",
146
151
  approved: "\u5DF2\u5BA1",
147
152
  pending: "\u5F85\u5BA1",
148
153
  pendingMsg: "\u5BA1\u6838\u4E2D\uFF0C\u4EC5\u672C\u4EBA\u53EF\u89C1\u3002",
154
+ edit: "\u7F16\u8F91",
155
+ editCancel: "\u53D6\u6D88\u7F16\u8F91",
149
156
  delete: "\u5220\u9664",
150
157
  deleteConfirm: "\u786E\u8BA4\u5220\u9664",
151
158
  pin: "\u7F6E\u9876",
@@ -626,12 +633,19 @@ class Tokenizer {
626
633
  if (!endEarly) {
627
634
  const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?: [^\\n]*)?(?:\\n|$))`);
628
635
  const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
636
+ const fencesBeginRegex = new RegExp(`^( {0,${Math.min(3, indent - 1)}})(\`\`\`|~~~)`);
629
637
  while (src) {
630
638
  rawLine = src.split("\n", 1)[0];
631
639
  line = rawLine;
632
640
  if (this.options.pedantic) {
633
641
  line = line.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ");
634
642
  }
643
+ if (fencesBeginRegex.test(line)) {
644
+ break;
645
+ }
646
+ if (this.rules.block.heading.test(line)) {
647
+ break;
648
+ }
635
649
  if (nextBulletRegex.test(line)) {
636
650
  break;
637
651
  }
@@ -3008,7 +3022,7 @@ function showNotify(wrapElem, msg, type) {
3008
3022
  window.clearTimeout(timeoutFn);
3009
3023
  });
3010
3024
  }
3011
- function playFadeAnim(elem, after, type) {
3025
+ function playFadeAnim(elem, after, type = "in") {
3012
3026
  elem.classList.add(`atk-fade-${type}`);
3013
3027
  const onAnimEnded = () => {
3014
3028
  elem.classList.remove(`atk-fade-${type}`);
@@ -3237,8 +3251,8 @@ function POST(ctx, url, data) {
3237
3251
  const init = {
3238
3252
  method: "POST"
3239
3253
  };
3240
- if (data)
3241
- init.body = ToFormData(data);
3254
+ data = __spreadValues({ site_name: ctx.conf.site || "" }, data || {});
3255
+ init.body = ToFormData(data);
3242
3256
  const json = yield Fetch(ctx, url, init);
3243
3257
  return json.data || {};
3244
3258
  });
@@ -3735,6 +3749,11 @@ class Api {
3735
3749
  return data || { is_login: false, is_admin: false };
3736
3750
  });
3737
3751
  }
3752
+ logout() {
3753
+ return __async(this, null, function* () {
3754
+ return POST(this.ctx, `${this.baseURL}/logout`);
3755
+ });
3756
+ }
3738
3757
  pageGet(siteName, offset, limit) {
3739
3758
  return __async(this, null, function* () {
3740
3759
  const params = {
@@ -4007,18 +4026,30 @@ class Context {
4007
4026
  insertComment(commentData) {
4008
4027
  this.list.insertComment(commentData);
4009
4028
  }
4029
+ updateComment(commentData) {
4030
+ this.list.updateComment(commentData);
4031
+ }
4010
4032
  replyComment(commentData, $comment, scroll) {
4011
4033
  this.editor.setReply(commentData, $comment, scroll);
4012
4034
  }
4013
4035
  cancelReplyComment() {
4014
4036
  this.editor.cancelReply();
4015
4037
  }
4038
+ editComment(commentData, $comment) {
4039
+ this.editor.setEditComment(commentData, $comment);
4040
+ }
4041
+ cancelEditComment() {
4042
+ this.editor.cancelEditComment();
4043
+ }
4016
4044
  updateNotifies(notifies) {
4017
4045
  this.list.updateUnread(notifies);
4018
4046
  }
4019
4047
  listReload() {
4020
4048
  this.list.reload();
4021
4049
  }
4050
+ reload() {
4051
+ this.listReload();
4052
+ }
4022
4053
  listRefreshUI() {
4023
4054
  this.list.refreshUI();
4024
4055
  }
@@ -4093,6 +4124,24 @@ class Context {
4093
4124
  str = str.replace(/\{\s*(\w+?)\s*\}/g, (_, token) => args[token] || "");
4094
4125
  return str;
4095
4126
  }
4127
+ setDarkMode(darkMode) {
4128
+ const darkModeClassName = "atk-dark-mode";
4129
+ this.conf.darkMode = darkMode;
4130
+ this.trigger("conf-updated");
4131
+ if (this.conf.darkMode) {
4132
+ this.$root.classList.add(darkModeClassName);
4133
+ } else {
4134
+ this.$root.classList.remove(darkModeClassName);
4135
+ }
4136
+ const { $wrap: $layerWrap } = GetLayerWrap(this);
4137
+ if ($layerWrap) {
4138
+ if (this.conf.darkMode) {
4139
+ $layerWrap.classList.add(darkModeClassName);
4140
+ } else {
4141
+ $layerWrap.classList.remove(darkModeClassName);
4142
+ }
4143
+ }
4144
+ }
4096
4145
  }
4097
4146
  const defaults = {
4098
4147
  el: "",
@@ -4370,9 +4419,9 @@ class CheckerLauncher {
4370
4419
  this.launched = this.launched.filter((c) => c !== checker);
4371
4420
  }
4372
4421
  }
4373
- var editor = "";
4422
+ 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")();
4374
4423
  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';
4375
- var emoticonsPlug = "";
4424
+ 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")();
4376
4425
  class EditorPlug {
4377
4426
  constructor(editor2) {
4378
4427
  __publicField(this, "editor");
@@ -4735,7 +4784,7 @@ class UploadPlug extends EditorPlug {
4735
4784
  }
4736
4785
  }
4737
4786
  __publicField(UploadPlug, "Name", "upload");
4738
- var previewPlug = "";
4787
+ var previewPlug = /* @__PURE__ */ (() => ".atk-editor-plug-preview{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%;padding:10px 15px}\n")();
4739
4788
  class PreviewPlug extends EditorPlug {
4740
4789
  constructor(editor2) {
4741
4790
  super(editor2);
@@ -4833,9 +4882,11 @@ class Editor extends Component {
4833
4882
  __publicField(this, "$bottom");
4834
4883
  __publicField(this, "$submitBtn");
4835
4884
  __publicField(this, "$notifyWrap");
4885
+ __publicField(this, "isTraveling", false);
4836
4886
  __publicField(this, "replyComment", null);
4837
4887
  __publicField(this, "$sendReply", null);
4838
- __publicField(this, "isTraveling", false);
4888
+ __publicField(this, "editComment", null);
4889
+ __publicField(this, "$editCancelBtn", null);
4839
4890
  __publicField(this, "ENABLED_PLUGS", [EmoticonsPlug, UploadPlug, PreviewPlug, HeaderInputPlug]);
4840
4891
  __publicField(this, "plugList", {});
4841
4892
  __publicField(this, "openedPlugName", null);
@@ -4867,6 +4918,12 @@ class Editor extends Component {
4867
4918
  get $inputs() {
4868
4919
  return { nick: this.$nick, email: this.$email, link: this.$link };
4869
4920
  }
4921
+ get isReplyMode() {
4922
+ return this.replyComment !== null;
4923
+ }
4924
+ get isEditMode() {
4925
+ return this.editComment !== null;
4926
+ }
4870
4927
  initLocalStorage() {
4871
4928
  const localContent = window.localStorage.getItem("ArtalkContent") || "";
4872
4929
  if (localContent.trim() !== "") {
@@ -4886,6 +4943,8 @@ class Editor extends Component {
4886
4943
  });
4887
4944
  }
4888
4945
  onHeaderInput(key, $input) {
4946
+ if (this.isEditMode)
4947
+ return;
4889
4948
  this.user.update({
4890
4949
  [key]: $input.value.trim()
4891
4950
  });
@@ -4907,8 +4966,14 @@ class Editor extends Component {
4907
4966
  this.adjustTextareaHeight();
4908
4967
  });
4909
4968
  }
4969
+ refreshSendBtnText() {
4970
+ if (this.isEditMode)
4971
+ this.$submitBtn.innerText = this.$t("save");
4972
+ else
4973
+ this.$submitBtn.innerText = this.ctx.conf.sendBtn || this.$t("send");
4974
+ }
4910
4975
  initSubmitBtn() {
4911
- this.$submitBtn.innerText = this.ctx.conf.sendBtn || this.$t("send");
4976
+ this.refreshSendBtnText();
4912
4977
  this.$submitBtn.addEventListener("click", () => this.submit());
4913
4978
  }
4914
4979
  getFinalContent() {
@@ -4953,19 +5018,16 @@ class Editor extends Component {
4953
5018
  this.$textarea.value += val;
4954
5019
  }
4955
5020
  }
4956
- clearEditor() {
4957
- this.setContent("");
4958
- this.cancelReply();
4959
- }
4960
5021
  adjustTextareaHeight() {
4961
5022
  const diff = this.$textarea.offsetHeight - this.$textarea.clientHeight;
4962
5023
  this.$textarea.style.height = "0px";
4963
5024
  this.$textarea.style.height = `${this.$textarea.scrollHeight + diff}px`;
4964
5025
  }
4965
5026
  setReply(commentData, $comment, scroll = true) {
4966
- if (this.replyComment !== null) {
5027
+ if (this.isEditMode)
5028
+ this.cancelEditComment();
5029
+ if (this.isReplyMode)
4967
5030
  this.cancelReply();
4968
- }
4969
5031
  if (this.$sendReply === null) {
4970
5032
  this.$sendReply = createElement(`<div class="atk-send-reply">${this.$t("reply")} <span class="atk-text"></span><span class="atk-cancel">\xD7</span></div>`);
4971
5033
  this.$sendReply.querySelector(".atk-text").innerText = `@${commentData.nick}`;
@@ -4992,6 +5054,42 @@ class Editor extends Component {
4992
5054
  this.travelBack();
4993
5055
  }
4994
5056
  }
5057
+ setEditComment(commentData, $comment) {
5058
+ if (this.isEditMode)
5059
+ this.cancelEditComment();
5060
+ if (this.isReplyMode)
5061
+ this.cancelReply();
5062
+ if (this.$editCancelBtn === null) {
5063
+ this.$editCancelBtn = createElement(`<div class="atk-send-reply">${this.$t("editCancel")}<span class="atk-cancel">\xD7</span></div>`);
5064
+ this.$editCancelBtn.onclick = () => {
5065
+ this.cancelEditComment();
5066
+ };
5067
+ this.$textareaWrap.append(this.$editCancelBtn);
5068
+ }
5069
+ this.editComment = commentData;
5070
+ this.$header.style.display = "none";
5071
+ this.travel($comment);
5072
+ this.$nick.value = commentData.nick;
5073
+ this.$email.value = commentData.email || "";
5074
+ this.$link.value = commentData.link;
5075
+ this.setContent(commentData.content);
5076
+ this.$textarea.focus();
5077
+ this.refreshSendBtnText();
5078
+ }
5079
+ cancelEditComment() {
5080
+ if (this.$editCancelBtn !== null) {
5081
+ this.$editCancelBtn.remove();
5082
+ this.$editCancelBtn = null;
5083
+ }
5084
+ this.editComment = null;
5085
+ this.travelBack();
5086
+ this.$nick.value = this.user.data.nick;
5087
+ this.$email.value = this.user.data.email;
5088
+ this.$link.value = this.user.data.link;
5089
+ this.setContent("");
5090
+ this.refreshSendBtnText();
5091
+ this.$header.style.display = "";
5092
+ }
4995
5093
  showNotify(msg, type) {
4996
5094
  showNotify(this.$notifyWrap, msg, type);
4997
5095
  }
@@ -5009,6 +5107,16 @@ class Editor extends Component {
5009
5107
  }
5010
5108
  this.ctx.trigger("editor-submit");
5011
5109
  this.showLoading();
5110
+ if (!this.isEditMode) {
5111
+ yield this.submitAdd();
5112
+ } else {
5113
+ yield this.submitEdit();
5114
+ }
5115
+ this.hideLoading();
5116
+ });
5117
+ }
5118
+ submitAdd() {
5119
+ return __async(this, null, function* () {
5012
5120
  try {
5013
5121
  const nComment = yield this.ctx.getApi().add({
5014
5122
  content: this.getFinalContent(),
@@ -5024,14 +5132,32 @@ class Editor extends Component {
5024
5132
  window.open(`${this.replyComment.page_url}#atk-comment-${nComment.id}`);
5025
5133
  }
5026
5134
  this.ctx.insertComment(nComment);
5027
- this.clearEditor();
5135
+ this.setContent("");
5136
+ this.cancelReply();
5137
+ this.ctx.trigger("editor-submitted");
5138
+ } catch (err) {
5139
+ console.error(err);
5140
+ this.showNotify(`${this.$t("commentFail")}\uFF0C${err.msg || String(err)}`, "e");
5141
+ }
5142
+ });
5143
+ }
5144
+ submitEdit() {
5145
+ return __async(this, null, function* () {
5146
+ try {
5147
+ const saveData = {
5148
+ content: this.getFinalContent(),
5149
+ nick: this.$nick.value,
5150
+ email: this.$email.value,
5151
+ link: this.$link.value
5152
+ };
5153
+ const nComment = yield this.ctx.getApi().commentEdit(__spreadValues(__spreadValues({}, this.editComment), saveData));
5154
+ this.ctx.updateComment(nComment);
5155
+ this.setContent("");
5156
+ this.cancelEditComment();
5028
5157
  this.ctx.trigger("editor-submitted");
5029
5158
  } catch (err) {
5030
5159
  console.error(err);
5031
5160
  this.showNotify(`${this.$t("commentFail")}\uFF0C${err.msg || String(err)}`, "e");
5032
- return;
5033
- } finally {
5034
- this.hideLoading();
5035
5161
  }
5036
5162
  });
5037
5163
  }
@@ -5140,7 +5266,7 @@ class Editor extends Component {
5140
5266
  this.openedPlugName = null;
5141
5267
  }
5142
5268
  }
5143
- var list = "";
5269
+ 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")();
5144
5270
  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';
5145
5271
  const win = window || {};
5146
5272
  const nav = navigator || {};
@@ -5332,7 +5458,7 @@ function Detect(userAgent) {
5332
5458
  }
5333
5459
  return dest;
5334
5460
  }
5335
- var comment = "";
5461
+ 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')();
5336
5462
  class ActionBtn {
5337
5463
  constructor(ctx, conf) {
5338
5464
  __publicField(this, "ctx");
@@ -5660,6 +5786,22 @@ class CommentRender {
5660
5786
  pendingBtn.setClick(() => {
5661
5787
  this.comment.getActions().adminEdit("pending", pendingBtn);
5662
5788
  });
5789
+ const pinnedBtn = new ActionBtn(this.ctx, {
5790
+ text: () => this.data.is_pinned ? this.ctx.$t("unpin") : this.ctx.$t("pin"),
5791
+ adminOnly: true
5792
+ });
5793
+ pinnedBtn.appendTo(this.$actions);
5794
+ pinnedBtn.setClick(() => {
5795
+ this.comment.getActions().adminEdit("pinned", pendingBtn);
5796
+ });
5797
+ const editBtn = new ActionBtn(this.ctx, {
5798
+ text: this.ctx.$t("edit"),
5799
+ adminOnly: true
5800
+ });
5801
+ editBtn.appendTo(this.$actions);
5802
+ editBtn.setClick(() => {
5803
+ this.ctx.editComment(this.data, this.$el);
5804
+ });
5663
5805
  const delBtn = new ActionBtn(this.ctx, {
5664
5806
  text: this.ctx.$t("delete"),
5665
5807
  confirm: true,
@@ -5670,14 +5812,6 @@ class CommentRender {
5670
5812
  delBtn.setClick(() => {
5671
5813
  this.comment.getActions().adminDelete(delBtn);
5672
5814
  });
5673
- const pinnedBtn = new ActionBtn(this.ctx, {
5674
- text: () => this.data.is_pinned ? this.ctx.$t("unpin") : this.ctx.$t("pin"),
5675
- adminOnly: true
5676
- });
5677
- pinnedBtn.appendTo(this.$actions);
5678
- pinnedBtn.setClick(() => {
5679
- this.comment.getActions().adminEdit("pinned", pendingBtn);
5680
- });
5681
5815
  }
5682
5816
  checkHeightLimit() {
5683
5817
  this.checkHeightLimitArea("content");
@@ -5987,7 +6121,7 @@ class Comment extends Component {
5987
6121
  return this.cConf;
5988
6122
  }
5989
6123
  }
5990
- var pagination = "";
6124
+ 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")();
5991
6125
  class Pagination {
5992
6126
  constructor(total, conf) {
5993
6127
  __publicField(this, "conf");
@@ -6235,7 +6369,7 @@ function makeNestCommentNodeList(srcData, sortBy = "DATE_DESC", nestMax = 2) {
6235
6369
  })(nodeList);
6236
6370
  return nodeList;
6237
6371
  }
6238
- const backendMinVersion = "2.1.7";
6372
+ const backendMinVersion = "2.1.10";
6239
6373
  class ListLite extends Component {
6240
6374
  constructor(ctx) {
6241
6375
  super(ctx);
@@ -6333,7 +6467,7 @@ class ListLite extends Component {
6333
6467
  }
6334
6468
  this.data = data;
6335
6469
  const feMinVersion = ((_a = data.api_version) == null ? void 0 : _a.fe_min_version) || "0.0.0";
6336
- if (this.ctx.conf.versionCheck && this.versionCheck("frontend", feMinVersion, "2.3.3"))
6470
+ if (this.ctx.conf.versionCheck && this.versionCheck("frontend", feMinVersion, "2.3.4"))
6337
6471
  return;
6338
6472
  if (this.ctx.conf.versionCheck && this.versionCheck("backend", backendMinVersion, (_b = data.api_version) == null ? void 0 : _b.version))
6339
6473
  return;
@@ -6547,6 +6681,12 @@ class ListLite extends Component {
6547
6681
  this.ctx.trigger("list-loaded");
6548
6682
  this.ctx.trigger("list-inserted", commentData);
6549
6683
  }
6684
+ updateComment(commentData) {
6685
+ const comment2 = this.ctx.findComment(commentData.id);
6686
+ if (comment2) {
6687
+ comment2.setData(commentData);
6688
+ }
6689
+ }
6550
6690
  updateUnread(notifies) {
6551
6691
  this.unread = notifies;
6552
6692
  if (this.unreadHighlight === true) {
@@ -6616,7 +6756,7 @@ class List extends ListLite {
6616
6756
  if (this.ctx.conf.listSort) {
6617
6757
  this.initDropdown();
6618
6758
  }
6619
- this.$el.querySelector(".atk-copyright").innerHTML = `Powered By <a href="https://artalk.js.org" target="_blank" title="Artalk v${"2.3.3"}">Artalk</a>`;
6759
+ this.$el.querySelector(".atk-copyright").innerHTML = `Powered By <a href="https://artalk.js.org" target="_blank" title="Artalk v${"2.3.4"}">Artalk</a>`;
6620
6760
  }
6621
6761
  initListActionBtn() {
6622
6762
  this.$openSidebarBtn = this.$el.querySelector('[data-action="open-sidebar"]');
@@ -6788,7 +6928,7 @@ class List extends ListLite {
6788
6928
  this.showUnreadBadge((notifies == null ? void 0 : notifies.length) || 0);
6789
6929
  }
6790
6930
  }
6791
- var sidebarLayer = "";
6931
+ 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")();
6792
6932
  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';
6793
6933
  class SidebarLayer extends Component {
6794
6934
  constructor(ctx) {
@@ -6934,6 +7074,7 @@ const _Artalk = class {
6934
7074
  __publicField(this, "editor");
6935
7075
  __publicField(this, "list");
6936
7076
  __publicField(this, "sidebarLayer");
7077
+ __publicField(this, "instancePlugins", []);
6937
7078
  this.conf = _Artalk.HandelBaseConf(customConf);
6938
7079
  if (this.conf.el instanceof HTMLElement)
6939
7080
  this.$root = this.conf.el;
@@ -7044,24 +7185,6 @@ const _Artalk = class {
7044
7185
  this.setDarkMode(this.conf.darkMode || false);
7045
7186
  }
7046
7187
  }
7047
- setDarkMode(darkMode) {
7048
- const darkModeClassName = "atk-dark-mode";
7049
- this.ctx.conf.darkMode = darkMode;
7050
- this.ctx.trigger("conf-updated");
7051
- if (this.conf.darkMode) {
7052
- this.$root.classList.add(darkModeClassName);
7053
- } else {
7054
- this.$root.classList.remove(darkModeClassName);
7055
- }
7056
- const { $wrap: $layerWrap } = GetLayerWrap(this.ctx);
7057
- if ($layerWrap) {
7058
- if (this.conf.darkMode) {
7059
- $layerWrap.classList.add(darkModeClassName);
7060
- } else {
7061
- $layerWrap.classList.remove(darkModeClassName);
7062
- }
7063
- }
7064
- }
7065
7188
  on(name, handler) {
7066
7189
  this.ctx.on(name, handler, "external");
7067
7190
  }
@@ -7074,9 +7197,21 @@ const _Artalk = class {
7074
7197
  reload() {
7075
7198
  this.ctx.listReload();
7076
7199
  }
7077
- static Use(plugin) {
7200
+ setDarkMode(darkMode) {
7201
+ this.ctx.setDarkMode(darkMode);
7202
+ }
7203
+ use(plugin) {
7204
+ this.instancePlugins.push(plugin);
7205
+ if (typeof plugin === "function")
7206
+ plugin(this.ctx);
7207
+ }
7208
+ static use(plugin) {
7078
7209
  this.Plugins.push(plugin);
7079
7210
  }
7211
+ static Use(plugin) {
7212
+ this.use(plugin);
7213
+ console.warn("`Use(...)` is deprecated, replace it with lowercase `use(...)`.");
7214
+ }
7080
7215
  static LoadCountWidget(customConf) {
7081
7216
  const conf = this.HandelBaseConf(customConf);
7082
7217
  const ctx = new Context(conf);
@@ -7085,7 +7220,5 @@ const _Artalk = class {
7085
7220
  };
7086
7221
  let Artalk = _Artalk;
7087
7222
  __publicField(Artalk, "defaults", defaults);
7088
- __publicField(Artalk, "Plugins", [
7089
- PvCountWidget
7090
- ]);
7223
+ __publicField(Artalk, "Plugins", [PvCountWidget]);
7091
7224
  export { Artalk as default };