diff --git a/assets/creator-studio/build/index.asset.php b/assets/creator-studio/build/index.asset.php index d1800bc8..f8d3d31f 100644 --- a/assets/creator-studio/build/index.asset.php +++ b/assets/creator-studio/build/index.asset.php @@ -1 +1 @@ - array('react', 'wp-element', 'wp-i18n'), 'version' => 'b411c17006fd7ed53e70'); + array('react', 'wp-element', 'wp-i18n'), 'version' => '5aca6e340eab7503b9b9'); diff --git a/assets/creator-studio/build/index.css b/assets/creator-studio/build/index.css index c1eab2b4..68817f93 100644 --- a/assets/creator-studio/build/index.css +++ b/assets/creator-studio/build/index.css @@ -1 +1 @@ -.jio-page-submit{background:#f6f6f6}body.jio-page-submit.has-static-nav,body.jio-page-submit.nav-fixed{padding-top:0!important}.jio-page-submit .float-btn,.jio-page-submit .footer,.jio-page-submit .footer-tabbar,.jio-page-submit .header,.jio-page-submit .jio-float-buttons{display:none!important}.jio-page-submit #main-content.container{max-width:none;padding:0}#jio-creator-studio.is-ready{display:block}.jio-creator{--jc-ink:#2b2b2b;--jc-ink-soft:#7d8683;--jc-paper:#f6f6f6;--jc-line:#e6e9e8;--jc-accent:#267665;--jc-accent-strong:#1d5f52;--jc-warn:#b4573f;--jc-bar:64px;-webkit-font-smoothing:antialiased;background:var(--jc-paper);color:var(--jc-ink);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans SC,PingFang SC,Microsoft YaHei,sans-serif;min-height:100vh;min-height:100dvh;padding-top:var(--jc-bar)}.jio-creator *,.jio-creator :after,.jio-creator :before{box-sizing:border-box}.jio-creator button{color:inherit;font:inherit}.jio-creator__bar{align-items:center;background:rgba(250,251,250,.98);border-bottom:1px solid var(--jc-line);box-shadow:0 2px 8px rgba(27,46,39,.035);display:flex;gap:clamp(10px,1.7vw,24px);height:var(--jc-bar);left:0;padding:0 clamp(14px,2.4vw,30px);position:fixed;right:0;top:0;z-index:300}.jio-creator__bar-actions,.jio-creator__bar-left{align-items:center;display:flex;flex:0 0 auto;gap:9px;min-width:0}.jio-creator__bar-left{border-right:1px solid var(--jc-line);padding-right:clamp(10px,1.5vw,20px)}.jio-creator__bar-actions{gap:7px;margin-left:auto}.jio-creator__bar-brand{color:var(--jc-accent-strong);font-family:Songti SC,"Noto Serif SC","Source Han Serif SC",serif;font-size:17px;font-weight:700;letter-spacing:-.04em}.jio-creator__bar-divider{background:var(--jc-line);height:18px;width:1px}.jio-creator__bar-mode{color:var(--jc-ink-soft);font-size:13px;white-space:nowrap}.jio-creator__back{align-items:center;border-radius:7px;color:var(--jc-ink-soft);display:inline-flex;height:30px;justify-content:center;text-decoration:none;width:30px}.jio-creator__back:focus-visible,.jio-creator__back:hover{background:#edf3f0;color:var(--jc-accent);outline:0}.jio-creator__toolbar-tools{align-items:center;display:flex;flex:1 1 auto;gap:7px;min-width:0;overflow-x:auto;scrollbar-width:none}.jio-creator__toolbar-tools::-webkit-scrollbar{display:none}.jio-creator__toolbar-group{align-items:center;display:inline-flex;flex:0 0 auto;gap:2px}.jio-creator__toolbar-divider{background:var(--jc-line);flex:0 0 auto;height:22px;width:1px}.jio-creator__tool-btn{align-items:center;background:transparent;border:0;border-radius:6px;color:#5f6664;cursor:pointer;display:inline-flex;flex:0 0 auto;flex-direction:column;font-size:11px;gap:2px;height:46px;justify-content:center;line-height:1.2;min-width:40px;padding:5px 6px;width:auto}.jio-creator__tool-btn i{font-size:14px;line-height:1}.jio-creator__tool-btn:focus-visible:not(:disabled),.jio-creator__tool-btn:hover:not(:disabled){background:#f0f2f1;color:var(--jc-accent-strong);outline:0}.jio-creator__tool-btn:disabled{color:#c7d0cc;cursor:default}.jio-creator__tool-label{max-width:52px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.jio-creator__format-field{align-items:center;border-radius:6px;cursor:pointer;display:inline-flex;flex:0 0 auto;flex-direction:column;gap:2px;height:46px;justify-content:center;min-width:48px;padding:5px 6px;position:relative;width:auto}.jio-creator__format-field i{font-size:14px;line-height:1}.jio-creator__format-field:focus-within,.jio-creator__format-field:hover{background:#f0f2f1;color:var(--jc-accent-strong)}.jio-creator__format-field:focus-within{outline:2px solid rgba(38,118,101,.35);outline-offset:-2px}.jio-creator__format-select{background:transparent;border:0;color:inherit;cursor:pointer;font:inherit;height:100%;inset:0;opacity:0;padding:0;position:absolute;width:100%}.jio-creator__format-select:disabled{cursor:default}.jio-creator__save-draft{align-items:center;background:#fff;border:1px solid var(--jc-line);border-radius:7px;color:var(--jc-ink-soft);cursor:pointer;display:inline-flex;flex:0 0 auto;font-size:13px;gap:7px;justify-content:center;min-height:34px;padding:0 10px;white-space:nowrap}.jio-creator__save-draft:focus-visible:not(:disabled),.jio-creator__save-draft:hover:not(:disabled){background:#f7faf8;border-color:#b7cdc3;color:var(--jc-accent-strong);outline:0}.jio-creator__save-draft:disabled{cursor:default;opacity:.55}.jio-creator__save{align-items:center;color:var(--jc-ink-soft);display:inline-flex;flex:0 0 auto;font-size:12px;gap:6px;white-space:nowrap}.jio-creator__save>i{color:var(--jc-line);font-size:7px}.jio-creator__save time{font-variant-numeric:tabular-nums;opacity:.7}.jio-creator__save.is-saved>i{color:var(--jc-accent)}.jio-creator__save.is-conflict,.jio-creator__save.is-conflict>i,.jio-creator__save.is-error,.jio-creator__save.is-error>i{color:var(--jc-warn)}.jio-creator__btn,.jio-creator__ghost,.jio-creator__primary{align-items:center;border:1px solid transparent;border-radius:7px;cursor:pointer;display:inline-flex;font-size:13px;justify-content:center;min-height:34px;padding:0 13px;transition:background .18s ease,border-color .18s ease,color .18s ease;white-space:nowrap}.jio-creator__ghost{background:transparent;border-color:var(--jc-line)}.jio-creator__ghost:focus-visible,.jio-creator__ghost:hover{border-color:var(--jc-accent);color:var(--jc-accent)}.jio-creator__primary{background:var(--jc-accent);color:#fff}.jio-creator__primary:focus-visible,.jio-creator__primary:hover{background:var(--jc-accent-strong)}.jio-creator__primary:disabled{cursor:not-allowed;opacity:.5}.jio-creator__notice{align-items:center;background:#f1f5f2;border-bottom:1px solid var(--jc-line);color:var(--jc-ink-soft);display:flex;font-size:13px;gap:12px;margin:0 auto;max-width:820px;padding:10px 16px}.jio-creator__notice>span{flex:1}.jio-creator__notice button{background:transparent;border:0;color:var(--jc-accent);cursor:pointer}.jio-creator__notice.is-error{background:#fdf2ee;color:var(--jc-warn)}.jio-creator__hint{color:var(--jc-ink-soft);font-size:13px;margin:18px auto 0;max-width:820px;padding:0 clamp(16px,4vw,40px)}.jio-creator__canvas{background:#fff;border-radius:4px;box-shadow:0 1px 2px rgba(24,39,34,.04),0 8px 28px rgba(24,39,34,.05);margin:40px auto 0;padding:clamp(30px,4vw,50px) clamp(28px,5vw,56px) clamp(36px,5vw,56px);width:min(900px,100% - clamp(24px,6vw,72px))}.jio-creator__title{display:block;margin-bottom:0}.jio-creator__title textarea{background:transparent;border:0;border-bottom:1px solid #eef0ef;color:#2b2b2b;font-family:inherit;font-size:clamp(26px,3vw,32px);font-weight:700;letter-spacing:.01em;line-height:1.35;min-height:46px;padding:0 0 16px;resize:none;width:100%}.jio-creator__title textarea:focus{border-bottom-color:#dfe3e1;outline:0}.jio-creator__title textarea::-moz-placeholder{color:#c3c7c5;font-weight:700}.jio-creator__title textarea::placeholder{color:#c3c7c5;font-weight:700}.jio-creator__editor{margin:22px 0 0;min-height:52vh;position:relative}.jio-creator__editor .mce-top-part,.jio-creator__editor .quicktags-toolbar,.jio-creator__editor .tox .tox-editor-header,.jio-creator__editor .tox .tox-statusbar,.jio-creator__editor .wp-editor-tabs,.jio-creator__editor .wp-media-buttons{display:none!important}.jio-creator__editor .wp-editor-container,.jio-creator__editor .wp-editor-wrap{background:transparent;border:0;box-shadow:none}.jio-creator__editor .mce-tinymce,.jio-creator__editor .tox-tinymce{background:transparent;border:0!important;box-shadow:none!important}.jio-creator__editor .mce-container-body,.jio-creator__editor .mce-edit-area,.jio-creator__editor .tox .tox-edit-area{background:transparent;border:0!important}.jio-creator__editor .mce-edit-area iframe,.jio-creator__editor .tox .tox-edit-area__iframe{min-height:52vh}.jio-creator__editor textarea{background:transparent;border:0;color:#2b2b2b;font:inherit;font-size:16px;line-height:1.8;min-height:52vh;padding:0;resize:vertical;width:100%}.jio-creator__editor textarea::-moz-placeholder{color:#b9bfbc}.jio-creator__editor textarea::placeholder{color:#b9bfbc}.jio-creator__settings{background:#fff;border-radius:4px;box-shadow:0 1px 2px rgba(24,39,34,.04),0 8px 28px rgba(24,39,34,.05);margin:20px auto clamp(48px,10vh,140px);padding:clamp(20px,3vw,28px) clamp(24px,4vw,40px);width:min(900px,100% - clamp(24px,6vw,72px))}.jio-creator__settings-title{color:#2b2b2b;font-size:15px;font-weight:600;margin:0 0 4px}.jio-creator__setting-row{align-items:center;border-bottom:1px solid #f2f4f3;display:flex;gap:20px;justify-content:space-between;padding:16px 0}.jio-creator__setting-row:last-of-type{border-bottom:0}.jio-creator__setting-copy{min-width:0}.jio-creator__setting-label{color:#2b2b2b;display:block;font-size:14px;font-weight:500}.jio-creator__setting-help{color:#9aa2a0;font-size:12px;line-height:1.6;margin:4px 0 0}.jio-creator__cover-control{align-items:center;display:flex;flex:0 0 auto;gap:8px;position:relative}.jio-creator__cover-input{height:1px;opacity:0;overflow:hidden;pointer-events:none;position:absolute;width:1px}.jio-creator__cover-add{align-items:center;background:transparent;border:1px dashed #d8dedb;border-radius:6px;color:#7c8683;cursor:pointer;display:inline-flex;font-size:13px;gap:7px;min-height:34px;padding:0 14px}.jio-creator__cover-add:focus-visible:not(:disabled),.jio-creator__cover-add:hover:not(:disabled){border-color:var(--jc-accent);color:var(--jc-accent-strong);outline:0}.jio-creator__cover-add:disabled{cursor:default;opacity:.6}.jio-creator__cover-preview{background:#eef1f0;border:0;border-radius:6px;cursor:pointer;display:block;height:63px;overflow:hidden;padding:0;width:112px}.jio-creator__cover-preview img{display:block;height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.jio-creator__cover-preview:focus-visible{outline:2px solid var(--jc-accent);outline-offset:2px}.jio-creator__cover-clear{align-items:center;background:transparent;border:0;border-radius:50%;color:#98a19e;cursor:pointer;display:inline-flex;height:26px;justify-content:center;width:26px}.jio-creator__cover-clear:focus-visible,.jio-creator__cover-clear:hover{background:#f3f5f4;color:var(--jc-warn);outline:0}.jio-creator__schedule{align-items:center;display:flex;flex-wrap:wrap;gap:12px;padding:4px 0 18px}.jio-creator__schedule label{align-items:center;color:#6f7875;display:inline-flex;font-size:13px;gap:10px}.jio-creator__schedule input[type=datetime-local]{background:#fff;border:1px solid #e3e7e5;border-radius:6px;color:#2b2b2b;font:inherit;font-size:13px;height:36px;padding:0 10px}.jio-creator__schedule .jio-creator-muted{flex:1 1 100%}.jio-creator-drawer{display:flex;inset:0;justify-content:flex-end;position:fixed;z-index:500}.jio-creator-drawer__backdrop{background:rgba(23,34,31,.32);border:0;cursor:default;inset:0;position:absolute}.jio-creator-drawer__panel{background:#fff;box-shadow:-20px 0 60px rgba(20,32,28,.16);display:flex;flex-direction:column;height:100%;position:relative;width:min(460px,100%)}.jio-creator-drawer__head{align-items:center;border-bottom:1px solid #e6e9e8;display:flex;justify-content:space-between;padding:20px 24px}.jio-creator-drawer__head h2{font-size:17px;font-weight:600;margin:0}.jio-creator-drawer__close{background:transparent;border:0;color:#7d8683;cursor:pointer}.jio-creator-drawer__body{flex:1;overflow-y:auto;padding:20px 24px 32px}.jio-creator-drawer__note{background:#f2f7f4;border-left:3px solid #267665;color:#7d8683;font-size:13px;line-height:1.6;margin:0 0 20px;padding:12px 14px}.jio-creator-drawer__foot{background:#fff;border-top:1px solid #e6e9e8;display:flex;flex-direction:column;gap:12px;padding:16px 24px calc(16px + env(safe-area-inset-bottom))}.jio-creator-drawer__foot .jio-creator-primary{flex:1}.jio-creator-drawer__actions{align-items:center;display:flex;gap:12px}.jio-creator-drawer__captcha{min-height:40px}.jio-creator-field{margin-bottom:26px}.jio-creator-field>h3{color:#2b2b2b;font-size:13px;font-weight:600;margin:0 0 10px}.jio-creator-muted{color:#7d8683;font-size:12px;line-height:1.6;margin:0}.jio-creator-error{color:#b4573f;font-size:12px;margin:8px 0 0}.jio-creator-chips{display:flex;flex-wrap:wrap;gap:8px}.jio-creator-chip{align-items:center;border:1px solid #e6e9e8;border-radius:999px;color:#7d8683;cursor:pointer;display:inline-flex;font-size:13px;gap:6px;padding:5px 12px}.jio-creator-chip input{clip:rect(0,0,0,0);height:1px;overflow:hidden;position:absolute;width:1px}.jio-creator-chip.is-active{background:#eef5f2;border-color:#267665;color:#1d5f52}.jio-creator-chip button{background:transparent;border:0;color:inherit;cursor:pointer}.jio-creator-inline{display:flex;gap:8px;margin-top:10px}.jio-creator-inline input:not([type]),.jio-creator-inline input[type=text]{border:1px solid #e6e9e8;border-radius:8px;flex:1;height:36px;min-width:0;padding:0 12px}.jio-creator-inline label{align-items:center;display:inline-flex;font-size:13px;gap:6px}.jio-creator-switch{align-items:flex-start;display:flex;gap:16px;justify-content:space-between}.jio-creator-switch h3{font-size:13px;margin:0 0 4px}.jio-creator-toggle{flex:0 0 auto;position:relative}.jio-creator-toggle input{height:1px;opacity:0;position:absolute;width:1px}.jio-creator-toggle span{background:#d6dfda;border-radius:999px;display:block;height:24px;transition:background .18s ease;width:42px}.jio-creator-toggle span:after{background:#fff;border-radius:50%;content:"";display:block;height:18px;margin:3px;transition:transform .18s ease;width:18px}.jio-creator-toggle input:checked+span{background:#267665}.jio-creator-toggle input:checked+span:after{transform:translateX(18px)}.jio-creator-toggle input:focus-visible+span{outline:2px solid #267665;outline-offset:2px}.jio-creator-pay{background:#fcfdfc;border:1px solid #e6e9e8;border-radius:10px;margin-top:16px;padding:16px}.jio-creator-input{align-items:center;display:flex;font-size:13px;gap:12px;justify-content:space-between;margin-top:12px}.jio-creator-input input{border:1px solid #e6e9e8;border-radius:8px;height:36px;padding:0 12px;text-align:right;width:140px}.jio-creator-cover{border-radius:10px;overflow:hidden;position:relative}.jio-creator-cover img{aspect-ratio:2/1;display:block;-o-object-fit:cover;object-fit:cover;width:100%}.jio-creator-cover button{background:rgba(0,0,0,.55);border:0;border-radius:50%;color:#fff;cursor:pointer;height:30px;position:absolute;right:8px;top:8px;width:30px}.jio-creator-cover-empty{align-items:center;background:#fafcfb;border:1px dashed #e6e9e8;border-radius:10px;color:#7d8683;cursor:pointer;display:flex;flex-direction:column;font-size:13px;gap:8px;justify-content:center;min-height:120px}.jio-creator-cover-empty input{height:1px;opacity:0;position:absolute;width:1px}.jio-creator-attachments{border-top:1px solid #e6e9e8;margin-top:18px;padding-top:16px}.jio-creator-attachments__head{align-items:center;display:flex;gap:12px;justify-content:space-between}.jio-creator-attachments__head h4{font-size:13px;margin:0}.jio-creator-upload{align-items:center;border:1px solid #e6e9e8;border-radius:8px;color:#1d5f52;cursor:pointer;display:inline-flex;font-size:12px;min-height:32px;padding:0 12px}.jio-creator-upload input{height:1px;opacity:0;position:absolute;width:1px}.jio-creator-files{list-style:none;margin:12px 0 0;padding:0}.jio-creator-files li{align-items:center;border-bottom:1px solid #f0f4f1;display:flex;font-size:13px;gap:10px;padding:8px 0}.jio-creator-files button{background:transparent;border:0;color:#7d8683;cursor:pointer;margin-left:auto}.jio-creator-files__name{align-items:center;display:inline-flex;gap:8px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.jio-creator-files__name i{color:#267665}.jio-creator-reuse{font-size:13px;margin-top:14px}.jio-creator-reuse summary{color:#7d8683;cursor:pointer}.jio-creator-reuse ul{list-style:none;margin:10px 0 0;padding:0}.jio-creator-reuse li{align-items:center;display:flex;gap:10px;padding:6px 0}.jio-creator-reuse button{background:#fff;border:1px solid #e6e9e8;border-radius:6px;cursor:pointer;margin-left:auto}.jio-creator-link{background:transparent;border:0;color:var(--jc-ink-soft,#7d8683);cursor:pointer;font-size:13px;text-decoration:underline}.jio-creator-dialog{align-items:center;display:flex;inset:0;justify-content:center;padding:20px;position:fixed;z-index:560}.jio-creator-dialog__backdrop{background:rgba(23,34,31,.34);border:0;cursor:default;inset:0;position:absolute}.jio-creator-dialog__panel{background:#fff;border-radius:14px;box-shadow:0 24px 70px rgba(20,32,28,.22);display:flex;flex-direction:column;max-height:min(82vh,640px);overflow:hidden;position:relative;width:min(460px,100%)}.jio-creator-dialog__head{align-items:center;border-bottom:1px solid #eef1f0;display:flex;justify-content:space-between;padding:18px 20px 12px}.jio-creator-dialog__head h2{font-size:16px;font-weight:600;margin:0}.jio-creator-dialog__close{align-items:center;background:transparent;border:0;border-radius:50%;color:#7d8683;cursor:pointer;display:inline-flex;height:30px;justify-content:center;width:30px}.jio-creator-dialog__close:focus-visible,.jio-creator-dialog__close:hover{background:#f2f5f3;outline:0}.jio-creator-dialog__body{display:flex;flex:1;flex-direction:column;gap:14px;overflow-y:auto;padding:18px 20px 20px}.jio-creator-dialog__row{display:flex;gap:14px}.jio-creator-dialog__row label{flex:1}.jio-creator-dialog__field,.jio-creator-dialog__row label{display:flex;flex-direction:column;gap:6px}.jio-creator-dialog__field>span,.jio-creator-dialog__row label>span{color:#6f7875;font-size:12px}.jio-creator-dialog__field input,.jio-creator-dialog__field select,.jio-creator-dialog__row input{background:#fff;border:1px solid #e3e7e5;border-radius:8px;color:#2b2b2b;font:inherit;font-size:14px;height:38px;padding:0 10px}.jio-creator-dialog__field textarea{background:#fff;border:1px solid #e3e7e5;border-radius:8px;color:#2b2b2b;font:inherit;font-size:14px;line-height:1.7;padding:10px;resize:vertical;width:100%}.jio-creator-dialog__field textarea:focus{outline:2px solid rgba(38,118,101,.25);outline-offset:-1px}.jio-creator-dialog__check{align-items:center;color:#4f5957;cursor:pointer;display:inline-flex;font-size:13px;gap:8px}.jio-creator-dialog__check input{accent-color:var(--jc-accent);cursor:pointer;height:15px;width:15px}.jio-creator-dialog__foot{background:#fff;border-top:1px solid #eef1f0;display:flex;gap:10px;justify-content:flex-end;padding:14px 20px calc(14px + env(safe-area-inset-bottom))}.jio-creator-dialog__ghost,.jio-creator-dialog__primary{align-items:center;border-radius:8px;cursor:pointer;display:inline-flex;font-size:14px;justify-content:center;min-height:36px;padding:0 16px}.jio-creator-dialog__ghost{background:#fff;border:1px solid #e3e7e5;color:#5f6664}.jio-creator-dialog__ghost:focus-visible,.jio-creator-dialog__ghost:hover{border-color:#b7cdc3;outline:0}.jio-creator-dialog__primary{background:var(--jc-accent);border:1px solid transparent;color:#fff}.jio-creator-dialog__primary:focus-visible:not(:disabled),.jio-creator-dialog__primary:hover:not(:disabled){background:var(--jc-accent-strong);outline:0}.jio-creator-dialog__primary:disabled{cursor:not-allowed;opacity:.5}.jio-creator__quote{flex:0 0 auto;position:relative}.jio-creator__quote-menu{background:#fff;border-radius:10px;box-shadow:0 12px 34px rgba(20,32,28,.18);display:flex;flex-direction:column;left:50%;padding:6px;position:absolute;top:calc(100% + 6px);transform:translateX(-50%);width:148px;z-index:400}.jio-creator__quote-option{align-items:center;background:transparent;border:0;border-radius:7px;color:#4f5957;cursor:pointer;display:flex;font-size:13px;gap:8px;padding:8px 10px;text-align:left;white-space:nowrap}.jio-creator__quote-option:focus-visible,.jio-creator__quote-option:hover{background:#f2f5f3;outline:0}.jio-creator__quote-swatch{background:#6f7875;border-radius:50%;flex:0 0 auto;height:10px;width:10px}.is-red .jio-creator__quote-swatch{background:#dc3f3f}.is-blue .jio-creator__quote-swatch{background:#0092ff}.is-green .jio-creator__quote-swatch{background:#23790e}@media(max-width:767px){.jio-creator{--jc-bar:60px}.jio-creator__bar{gap:7px;padding:0 8px}.jio-creator__bar-left{gap:5px;padding-right:7px}.jio-creator__bar-divider,.jio-creator__bar-mode{display:none}.jio-creator__bar-brand{font-size:15px}.jio-creator__bar-actions{gap:5px}.jio-creator__toolbar-tools{gap:4px}.jio-creator__toolbar-group{gap:0}.jio-creator__tool-btn{min-width:36px;padding:4px}.jio-creator__tool-btn i{font-size:13px}.jio-creator__tool-label{font-size:10px;max-width:42px}.jio-creator__format-field{min-width:42px;padding:4px}.jio-creator__bar-actions .jio-creator__save{display:none}.jio-creator__save-draft{font-size:0;min-width:34px;padding:0;width:34px}.jio-creator__save-draft i{font-size:13px}.jio-creator__preview{font-size:12px;min-height:32px;padding:0 8px}.jio-creator__primary{font-size:12px;min-height:32px;padding:0 10px}.jio-creator__ghost{padding:0 8px}.jio-creator__canvas{margin:14px auto 0;padding:22px 18px 28px;width:calc(100% - 20px)}.jio-creator__settings{margin:12px auto calc(40px + env(safe-area-inset-bottom));padding:18px;width:calc(100% - 20px)}.jio-creator__setting-row{gap:12px}.jio-creator__title textarea{font-size:24px}.jio-creator__editor .mce-edit-area iframe,.jio-creator__editor .tox .tox-edit-area__iframe{min-height:48vh}.jio-creator-drawer{display:block}.jio-creator-drawer__backdrop{display:none}.jio-creator-drawer__panel{border-radius:0;box-shadow:none;height:100dvh;width:100%}.jio-creator-drawer__foot{background:#fff;bottom:0;position:sticky}}@media(prefers-reduced-motion:reduce){.jio-creator *{animation:none!important;transition:none!important}} +.jio-page-submit{background:#f6f6f6}body.jio-page-submit.has-static-nav,body.jio-page-submit.nav-fixed{padding-top:0!important}.jio-page-submit .float-btn,.jio-page-submit .footer,.jio-page-submit .footer-tabbar,.jio-page-submit .header,.jio-page-submit .jio-float-buttons{display:none!important}.jio-page-submit #main-content.container{max-width:none;padding:0}#jio-creator-studio.is-ready{display:block}.jio-creator{--jc-ink:#2b2b2b;--jc-ink-soft:#7d8683;--jc-paper:#f6f6f6;--jc-line:#e6e9e8;--jc-accent:#267665;--jc-accent-strong:#1d5f52;--jc-warn:#b4573f;--jc-bar:64px;--jc-status:52px;-webkit-font-smoothing:antialiased;background:var(--jc-paper);color:var(--jc-ink);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans SC,PingFang SC,Microsoft YaHei,sans-serif;min-height:100vh;min-height:100dvh;padding-bottom:var(--jc-status);padding-top:var(--jc-bar)}.jio-creator *,.jio-creator :after,.jio-creator :before{box-sizing:border-box}.jio-creator button{color:inherit;font:inherit}.jio-creator__bar{align-items:center;background:rgba(250,251,250,.98);border-bottom:1px solid var(--jc-line);box-shadow:0 2px 8px rgba(27,46,39,.035);display:flex;gap:clamp(10px,1.7vw,24px);height:var(--jc-bar);left:0;padding:0 clamp(14px,2.4vw,30px);position:fixed;right:0;top:0;z-index:300}.jio-creator__bar-actions,.jio-creator__bar-left{align-items:center;display:flex;flex:0 0 auto;gap:9px;min-width:0}.jio-creator__bar-left{border-right:1px solid var(--jc-line);padding-right:clamp(10px,1.5vw,20px)}.jio-creator__bar-actions{gap:7px;margin-left:auto}.jio-creator__bar-brand{color:var(--jc-accent-strong);font-family:Songti SC,"Noto Serif SC","Source Han Serif SC",serif;font-size:17px;font-weight:700;letter-spacing:-.04em}.jio-creator__bar-divider{background:var(--jc-line);height:18px;width:1px}.jio-creator__bar-mode{color:var(--jc-ink-soft);font-size:13px;white-space:nowrap}.jio-creator__back{align-items:center;border-radius:7px;color:var(--jc-ink-soft);display:inline-flex;height:30px;justify-content:center;text-decoration:none;width:30px}.jio-creator__back:focus-visible,.jio-creator__back:hover{background:#edf3f0;color:var(--jc-accent);outline:0}.jio-creator__toolbar-tools{align-items:center;display:flex;flex:1 1 auto;gap:7px;min-width:0;overflow-x:auto;scrollbar-width:none}.jio-creator__toolbar-tools::-webkit-scrollbar{display:none}.jio-creator__toolbar-group{align-items:center;display:inline-flex;flex:0 0 auto;gap:2px}.jio-creator__toolbar-divider{background:var(--jc-line);flex:0 0 auto;height:22px;width:1px}.jio-creator__tool-btn{align-items:center;background:transparent;border:0;border-radius:6px;color:#5f6664;cursor:pointer;display:inline-flex;flex:0 0 auto;flex-direction:column;font-size:11px;gap:2px;height:46px;justify-content:center;line-height:1.2;min-width:40px;padding:5px 6px;width:auto}.jio-creator__tool-btn i{font-size:14px;line-height:1}.jio-creator__tool-btn:focus-visible:not(:disabled),.jio-creator__tool-btn:hover:not(:disabled){background:#f0f2f1;color:var(--jc-accent-strong);outline:0}.jio-creator__tool-btn:disabled{color:#c7d0cc;cursor:default}.jio-creator__tool-label{max-width:52px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.jio-creator__format-field{align-items:center;background:transparent;border:0;border-radius:6px;color:#5f6664;cursor:pointer;display:inline-flex;flex:0 0 auto;flex-direction:column;font-size:11px;gap:2px;height:46px;justify-content:center;line-height:1.2;min-width:40px;padding:5px 6px;position:relative;vertical-align:middle;width:auto}.jio-creator__format-field i{font-size:14px;line-height:1}.jio-creator__format-field:focus-within,.jio-creator__format-field:hover{background:#f0f2f1;color:var(--jc-accent-strong)}.jio-creator__format-field:focus-within{outline:2px solid rgba(38,118,101,.35);outline-offset:-2px}.jio-creator__format-select{background:transparent;border:0;color:inherit;cursor:pointer;font:inherit;height:100%;inset:0;opacity:0;padding:0;position:absolute;width:100%}.jio-creator__format-select:disabled{cursor:default}.jio-creator__save-draft{align-items:center;background:#fff;border:1px solid var(--jc-line);border-radius:7px;color:var(--jc-ink-soft);cursor:pointer;display:inline-flex;flex:0 0 auto;font-size:13px;gap:7px;justify-content:center;min-height:34px;padding:0 10px;white-space:nowrap}.jio-creator__save-draft:focus-visible:not(:disabled),.jio-creator__save-draft:hover:not(:disabled){background:#f7faf8;border-color:#b7cdc3;color:var(--jc-accent-strong);outline:0}.jio-creator__save-draft:disabled{cursor:default;opacity:.55}.jio-creator__save{align-items:center;color:var(--jc-ink-soft);display:inline-flex;flex:0 0 auto;font-size:12px;gap:6px;white-space:nowrap}.jio-creator__save>i{color:var(--jc-line);font-size:7px}.jio-creator__save time{font-variant-numeric:tabular-nums;opacity:.7}.jio-creator__save.is-saved>i{color:var(--jc-accent)}.jio-creator__save.is-conflict,.jio-creator__save.is-conflict>i,.jio-creator__save.is-error,.jio-creator__save.is-error>i{color:var(--jc-warn)}.jio-creator__btn,.jio-creator__ghost,.jio-creator__primary{align-items:center;border:1px solid transparent;border-radius:7px;cursor:pointer;display:inline-flex;font-size:13px;justify-content:center;min-height:34px;padding:0 13px;transition:background .18s ease,border-color .18s ease,color .18s ease;white-space:nowrap}.jio-creator__ghost{background:transparent;border-color:var(--jc-line)}.jio-creator__ghost:focus-visible,.jio-creator__ghost:hover{border-color:var(--jc-accent);color:var(--jc-accent)}.jio-creator__primary{background:var(--jc-accent);color:#fff}.jio-creator__primary:focus-visible,.jio-creator__primary:hover{background:var(--jc-accent-strong)}.jio-creator__primary:disabled{cursor:not-allowed;opacity:.5}.jio-creator__notice{align-items:center;background:#f1f5f2;border-bottom:1px solid var(--jc-line);color:var(--jc-ink-soft);display:flex;font-size:13px;gap:12px;margin:0 auto;max-width:820px;padding:10px 16px}.jio-creator__notice>span{flex:1}.jio-creator__notice button{background:transparent;border:0;color:var(--jc-accent);cursor:pointer}.jio-creator__notice.is-error{background:#fdf2ee;color:var(--jc-warn)}.jio-creator__hint{color:var(--jc-ink-soft);font-size:13px;margin:18px auto 0;max-width:820px;padding:0 clamp(16px,4vw,40px)}.jio-creator__canvas{background:#fff;border-radius:4px;box-shadow:0 1px 2px rgba(24,39,34,.04),0 8px 28px rgba(24,39,34,.05);margin:40px auto 0;padding:clamp(30px,4vw,50px) clamp(28px,5vw,56px) clamp(36px,5vw,56px);width:min(900px,100% - clamp(24px,6vw,72px))}.jio-creator__title{display:block;margin-bottom:0}.jio-creator__title textarea{background:transparent;border:0;border-bottom:1px solid #eef0ef;color:#2b2b2b;font-family:inherit;font-size:clamp(26px,3vw,32px);font-weight:700;letter-spacing:.01em;line-height:1.35;min-height:46px;padding:0 0 16px;resize:none;width:100%}.jio-creator__title textarea:focus{border-bottom-color:#dfe3e1;outline:0}.jio-creator__title textarea::-moz-placeholder{color:#c3c7c5;font-weight:700}.jio-creator__title textarea::placeholder{color:#c3c7c5;font-weight:700}.jio-creator__editor{margin:22px 0 0;min-height:52vh;position:relative}.jio-creator__editor .mce-top-part,.jio-creator__editor .quicktags-toolbar,.jio-creator__editor .tox .tox-editor-header,.jio-creator__editor .tox .tox-statusbar,.jio-creator__editor .wp-editor-tabs,.jio-creator__editor .wp-media-buttons{display:none!important}.jio-creator__editor .wp-editor-container,.jio-creator__editor .wp-editor-wrap{background:transparent;border:0;box-shadow:none}.jio-creator__editor .mce-tinymce,.jio-creator__editor .tox-tinymce{background:transparent;border:0!important;box-shadow:none!important}.jio-creator__editor .mce-container-body,.jio-creator__editor .mce-edit-area,.jio-creator__editor .tox .tox-edit-area{background:transparent;border:0!important}.jio-creator__editor .mce-edit-area iframe,.jio-creator__editor .tox .tox-edit-area__iframe{min-height:52vh;overflow:hidden}.jio-creator__editor textarea{background:transparent;border:0;color:#2b2b2b;font:inherit;font-size:16px;line-height:1.8;min-height:52vh;padding:0;resize:vertical;width:100%}.jio-creator__editor textarea::-moz-placeholder{color:#b9bfbc}.jio-creator__editor textarea::placeholder{color:#b9bfbc}.jio-creator__settings{background:#fff;border-radius:4px;box-shadow:0 1px 2px rgba(24,39,34,.04),0 8px 28px rgba(24,39,34,.05);margin:20px auto clamp(48px,10vh,140px);padding:clamp(20px,3vw,28px) clamp(24px,4vw,40px);width:min(900px,100% - clamp(24px,6vw,72px))}.jio-creator__settings-title{color:#2b2b2b;font-size:15px;font-weight:600;margin:0 0 4px}.jio-creator__setting-row{align-items:center;border-bottom:1px solid #f2f4f3;display:flex;gap:20px;justify-content:space-between;padding:16px 0}.jio-creator__setting-row:last-of-type{border-bottom:0}.jio-creator__setting-copy{min-width:0}.jio-creator__setting-label{color:#2b2b2b;display:block;font-size:14px;font-weight:500}.jio-creator__setting-help{color:#9aa2a0;font-size:12px;line-height:1.6;margin:4px 0 0}.jio-creator__cover-control{align-items:center;display:flex;flex:0 0 auto;gap:8px;position:relative}.jio-creator__cover-input{height:1px;opacity:0;overflow:hidden;pointer-events:none;position:absolute;width:1px}.jio-creator__cover-add{align-items:center;background:transparent;border:1px dashed #d8dedb;border-radius:6px;color:#7c8683;cursor:pointer;display:inline-flex;font-size:13px;gap:7px;min-height:34px;padding:0 14px}.jio-creator__cover-add:focus-visible:not(:disabled),.jio-creator__cover-add:hover:not(:disabled){border-color:var(--jc-accent);color:var(--jc-accent-strong);outline:0}.jio-creator__cover-add:disabled{cursor:default;opacity:.6}.jio-creator__cover-preview{background:#eef1f0;border:0;border-radius:6px;cursor:pointer;display:block;height:63px;overflow:hidden;padding:0;width:112px}.jio-creator__cover-preview img{display:block;height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.jio-creator__cover-preview:focus-visible{outline:2px solid var(--jc-accent);outline-offset:2px}.jio-creator__cover-clear{align-items:center;background:transparent;border:0;border-radius:50%;color:#98a19e;cursor:pointer;display:inline-flex;height:26px;justify-content:center;width:26px}.jio-creator__cover-clear:focus-visible,.jio-creator__cover-clear:hover{background:#f3f5f4;color:var(--jc-warn);outline:0}.jio-creator__schedule{align-items:center;display:flex;flex-wrap:wrap;gap:12px;padding:4px 0 18px}.jio-creator__schedule label{align-items:center;color:#6f7875;display:inline-flex;font-size:13px;gap:10px}.jio-creator__schedule input[type=datetime-local]{background:#fff;border:1px solid #e3e7e5;border-radius:6px;color:#2b2b2b;font:inherit;font-size:13px;height:36px;padding:0 10px}.jio-creator__schedule .jio-creator-muted{flex:1 1 100%}.jio-creator-drawer{display:flex;inset:0;justify-content:flex-end;position:fixed;z-index:500}.jio-creator-drawer__backdrop{background:rgba(23,34,31,.32);border:0;cursor:default;inset:0;position:absolute}.jio-creator-drawer__panel{background:#fff;box-shadow:-20px 0 60px rgba(20,32,28,.16);display:flex;flex-direction:column;height:100%;position:relative;width:min(460px,100%)}.jio-creator-drawer__head{align-items:center;border-bottom:1px solid #e6e9e8;display:flex;justify-content:space-between;padding:20px 24px}.jio-creator-drawer__head h2{font-size:17px;font-weight:600;margin:0}.jio-creator-drawer__close{background:transparent;border:0;color:#7d8683;cursor:pointer}.jio-creator-drawer__body{flex:1;overflow-y:auto;padding:20px 24px 32px}.jio-creator-drawer__note{background:#f2f7f4;border-left:3px solid #267665;color:#7d8683;font-size:13px;line-height:1.6;margin:0 0 20px;padding:12px 14px}.jio-creator-drawer__foot{background:#fff;border-top:1px solid #e6e9e8;display:flex;flex-direction:column;gap:12px;padding:16px 24px calc(16px + env(safe-area-inset-bottom))}.jio-creator-drawer__foot .jio-creator-primary{flex:1}.jio-creator-drawer__actions{align-items:center;display:flex;gap:12px}.jio-creator-drawer__captcha{min-height:40px}.jio-creator-field{margin-bottom:26px}.jio-creator-field>h3{color:#2b2b2b;font-size:13px;font-weight:600;margin:0 0 10px}.jio-creator-muted{color:#7d8683;font-size:12px;line-height:1.6;margin:0}.jio-creator-error{color:#b4573f;font-size:12px;margin:8px 0 0}.jio-creator-chips{display:flex;flex-wrap:wrap;gap:8px}.jio-creator-chip{align-items:center;border:1px solid #e6e9e8;border-radius:999px;color:#7d8683;cursor:pointer;display:inline-flex;font-size:13px;gap:6px;padding:5px 12px}.jio-creator-chip input{clip:rect(0,0,0,0);height:1px;overflow:hidden;position:absolute;width:1px}.jio-creator-chip.is-active{background:#eef5f2;border-color:#267665;color:#1d5f52}.jio-creator-chip button{background:transparent;border:0;color:inherit;cursor:pointer}.jio-creator-inline{display:flex;gap:8px;margin-top:10px}.jio-creator-inline input:not([type]),.jio-creator-inline input[type=text]{border:1px solid #e6e9e8;border-radius:8px;flex:1;height:36px;min-width:0;padding:0 12px}.jio-creator-inline label{align-items:center;display:inline-flex;font-size:13px;gap:6px}.jio-creator-switch{align-items:flex-start;display:flex;gap:16px;justify-content:space-between}.jio-creator-switch h3{font-size:13px;margin:0 0 4px}.jio-creator-toggle{flex:0 0 auto;position:relative}.jio-creator-toggle input{height:1px;opacity:0;position:absolute;width:1px}.jio-creator-toggle span{background:#d6dfda;border-radius:999px;display:block;height:24px;transition:background .18s ease;width:42px}.jio-creator-toggle span:after{background:#fff;border-radius:50%;content:"";display:block;height:18px;margin:3px;transition:transform .18s ease;width:18px}.jio-creator-toggle input:checked+span{background:#267665}.jio-creator-toggle input:checked+span:after{transform:translateX(18px)}.jio-creator-toggle input:focus-visible+span{outline:2px solid #267665;outline-offset:2px}.jio-creator-pay{background:#fcfdfc;border:1px solid #e6e9e8;border-radius:10px;margin-top:16px;padding:16px}.jio-creator-input{align-items:center;display:flex;font-size:13px;gap:12px;justify-content:space-between;margin-top:12px}.jio-creator-input input{border:1px solid #e6e9e8;border-radius:8px;height:36px;padding:0 12px;text-align:right;width:140px}.jio-creator-cover{border-radius:10px;overflow:hidden;position:relative}.jio-creator-cover img{aspect-ratio:2/1;display:block;-o-object-fit:cover;object-fit:cover;width:100%}.jio-creator-cover button{background:rgba(0,0,0,.55);border:0;border-radius:50%;color:#fff;cursor:pointer;height:30px;position:absolute;right:8px;top:8px;width:30px}.jio-creator-cover-empty{align-items:center;background:#fafcfb;border:1px dashed #e6e9e8;border-radius:10px;color:#7d8683;cursor:pointer;display:flex;flex-direction:column;font-size:13px;gap:8px;justify-content:center;min-height:120px}.jio-creator-cover-empty input{height:1px;opacity:0;position:absolute;width:1px}.jio-creator-attachments{border-top:1px solid #e6e9e8;margin-top:18px;padding-top:16px}.jio-creator-attachments__head{align-items:center;display:flex;gap:12px;justify-content:space-between}.jio-creator-attachments__head h4{font-size:13px;margin:0}.jio-creator-upload{align-items:center;border:1px solid #e6e9e8;border-radius:8px;color:#1d5f52;cursor:pointer;display:inline-flex;font-size:12px;min-height:32px;padding:0 12px}.jio-creator-upload input{height:1px;opacity:0;position:absolute;width:1px}.jio-creator-files{list-style:none;margin:12px 0 0;padding:0}.jio-creator-files li{align-items:center;border-bottom:1px solid #f0f4f1;display:flex;font-size:13px;gap:10px;padding:8px 0}.jio-creator-files button{background:transparent;border:0;color:#7d8683;cursor:pointer;margin-left:auto}.jio-creator-files__name{align-items:center;display:inline-flex;gap:8px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.jio-creator-files__name i{color:#267665}.jio-creator-reuse{font-size:13px;margin-top:14px}.jio-creator-reuse summary{color:#7d8683;cursor:pointer}.jio-creator-reuse ul{list-style:none;margin:10px 0 0;padding:0}.jio-creator-reuse li{align-items:center;display:flex;gap:10px;padding:6px 0}.jio-creator-reuse button{background:#fff;border:1px solid #e6e9e8;border-radius:6px;cursor:pointer;margin-left:auto}.jio-creator-link{background:transparent;border:0;color:var(--jc-ink-soft,#7d8683);cursor:pointer;font-size:13px;text-decoration:underline}.jio-creator-dialog{align-items:center;display:flex;inset:0;justify-content:center;padding:20px;position:fixed;z-index:560}.jio-creator-dialog__backdrop{background:rgba(23,34,31,.34);border:0;cursor:default;inset:0;position:absolute}.jio-creator-dialog__panel{background:#fff;border-radius:14px;box-shadow:0 24px 70px rgba(20,32,28,.22);display:flex;flex-direction:column;max-height:min(82vh,640px);overflow:hidden;position:relative;width:min(460px,100%)}.jio-creator-dialog__head{align-items:center;border-bottom:1px solid #eef1f0;display:flex;justify-content:space-between;padding:18px 20px 12px}.jio-creator-dialog__head h2{font-size:16px;font-weight:600;margin:0}.jio-creator-dialog__close{align-items:center;background:transparent;border:0;border-radius:50%;color:#7d8683;cursor:pointer;display:inline-flex;height:30px;justify-content:center;width:30px}.jio-creator-dialog__close:focus-visible,.jio-creator-dialog__close:hover{background:#f2f5f3;outline:0}.jio-creator-dialog__body{display:flex;flex:1;flex-direction:column;gap:14px;overflow-y:auto;padding:18px 20px 20px}.jio-creator-dialog__row{display:flex;gap:14px}.jio-creator-dialog__row label{flex:1}.jio-creator-dialog__field,.jio-creator-dialog__row label{display:flex;flex-direction:column;gap:6px}.jio-creator-dialog__field>span,.jio-creator-dialog__row label>span{color:#6f7875;font-size:12px}.jio-creator-dialog__field input,.jio-creator-dialog__field select,.jio-creator-dialog__row input{background:#fff;border:1px solid #e3e7e5;border-radius:8px;color:#2b2b2b;font:inherit;font-size:14px;height:38px;padding:0 10px}.jio-creator-dialog__field textarea{background:#fff;border:1px solid #e3e7e5;border-radius:8px;color:#2b2b2b;font:inherit;font-size:14px;line-height:1.7;padding:10px;resize:vertical;width:100%}.jio-creator-dialog__field textarea:focus{outline:2px solid rgba(38,118,101,.25);outline-offset:-1px}.jio-creator-dialog__check{align-items:center;color:#4f5957;cursor:pointer;display:inline-flex;font-size:13px;gap:8px}.jio-creator-dialog__check input{accent-color:var(--jc-accent);cursor:pointer;height:15px;width:15px}.jio-creator-dialog__foot{background:#fff;border-top:1px solid #eef1f0;display:flex;gap:10px;justify-content:flex-end;padding:14px 20px calc(14px + env(safe-area-inset-bottom))}.jio-creator-dialog__ghost,.jio-creator-dialog__primary{align-items:center;border-radius:8px;cursor:pointer;display:inline-flex;font-size:14px;justify-content:center;min-height:36px;padding:0 16px}.jio-creator-dialog__ghost{background:#fff;border:1px solid #e3e7e5;color:#5f6664}.jio-creator-dialog__ghost:focus-visible,.jio-creator-dialog__ghost:hover{border-color:#b7cdc3;outline:0}.jio-creator-dialog__primary{background:var(--jc-accent);border:1px solid transparent;color:#fff}.jio-creator-dialog__primary:focus-visible:not(:disabled),.jio-creator-dialog__primary:hover:not(:disabled){background:var(--jc-accent-strong);outline:0}.jio-creator-dialog__primary:disabled{cursor:not-allowed;opacity:.5}.jio-creator__quote{flex:0 0 auto;position:relative}.jio-creator__quote-menu{background:#fff;border-radius:10px;box-shadow:0 12px 34px rgba(20,32,28,.18);display:flex;flex-direction:column;left:50%;padding:6px;position:absolute;top:calc(100% + 6px);transform:translateX(-50%);width:148px;z-index:400}.jio-creator__quote-option{align-items:center;background:transparent;border:0;border-radius:7px;color:#4f5957;cursor:pointer;display:flex;font-size:13px;gap:8px;padding:8px 10px;text-align:left;white-space:nowrap}.jio-creator__quote-option:focus-visible,.jio-creator__quote-option:hover{background:#f2f5f3;outline:0}.jio-creator__quote-swatch{background:#6f7875;border-radius:50%;flex:0 0 auto;height:10px;width:10px}.is-red .jio-creator__quote-swatch{background:#dc3f3f}.is-blue .jio-creator__quote-swatch{background:#0092ff}.is-green .jio-creator__quote-swatch{background:#23790e}.jio-creator__status{align-items:center;background:hsla(0,0%,100%,.97);border-top:1px solid #e6e9e8;bottom:0;box-shadow:0 -2px 10px rgba(24,39,34,.04);color:#7d8683;display:flex;font-size:12px;gap:16px;height:var(--jc-status);left:0;padding:0 clamp(14px,2.4vw,28px) env(safe-area-inset-bottom);position:fixed;right:0;z-index:310}.jio-creator__status-actions,.jio-creator__status-left,.jio-creator__status-meta{align-items:center;display:flex;gap:10px;min-width:0}.jio-creator__status-count{color:#4f5957;font-variant-numeric:tabular-nums}.jio-creator__status-mode{color:#a3aca9;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.jio-creator__status-meta{color:#93a09b}.jio-creator__status-meta .jio-creator__save{font-size:12px}.jio-creator__status-dot{color:#c9d1ce}.jio-creator__status-actions{gap:8px;margin-left:auto}.jio-creator__status-ghost,.jio-creator__status-primary{align-items:center;border-radius:7px;cursor:pointer;display:inline-flex;font-size:13px;justify-content:center;min-height:32px;padding:0 14px;white-space:nowrap}.jio-creator__status-ghost{background:#fff;border:1px solid #e3e7e5;color:#5f6664}.jio-creator__status-ghost:focus-visible:not(:disabled),.jio-creator__status-ghost:hover:not(:disabled){border-color:#b7cdc3;color:var(--jc-accent-strong);outline:0}.jio-creator__status-ghost:disabled{cursor:default;opacity:.55}.jio-creator__status-primary{background:var(--jc-accent);border:1px solid transparent;color:#fff}.jio-creator__status-primary:focus-visible:not(:disabled),.jio-creator__status-primary:hover:not(:disabled){background:var(--jc-accent-strong);outline:0}.jio-creator__status-primary:disabled{cursor:default;opacity:.55}.jio-creator__lang-grid{display:grid;gap:8px;grid-template-columns:repeat(4,minmax(0,1fr))}.jio-creator__lang-item{background:#fff;border:1px solid #e6e9e8;border-radius:8px;color:#4f5957;cursor:pointer;font-size:13px;padding:9px 6px}.jio-creator__lang-item:focus-visible,.jio-creator__lang-item:hover{border-color:#b7cdc3;color:var(--jc-accent-strong);outline:0}.jio-creator__lang-item.is-active{background:#eff6f3;border-color:var(--jc-accent);color:var(--jc-accent-strong)}.jio-creator__block-actions{display:flex;gap:6px;opacity:0;position:absolute;right:6px;top:6px;transition:opacity .15s ease;z-index:5}.jio-creator__block-actions.is-visible{opacity:1}.jio-creator__block-action{align-items:center;background:#fff;border:1px solid #e3e7e5;border-radius:6px;color:#7d8683;cursor:pointer;display:inline-flex;font-size:12px;height:26px;justify-content:center;width:26px}.jio-creator__block-action:focus-visible,.jio-creator__block-action:hover{border-color:#e6b8ad;color:#b4573f;outline:0}@media(max-width:767px){.jio-creator__status{gap:8px;height:56px;padding:0 10px env(safe-area-inset-bottom)}.jio-creator__status-meta,.jio-creator__status-mode{display:none}.jio-creator__status-ghost{padding:0 10px}.jio-creator__status-primary{padding:0 12px}.jio-creator__lang-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.jio-creator{--jc-bar:60px}.jio-creator__bar{gap:7px;padding:0 8px}.jio-creator__bar-left{gap:5px;padding-right:7px}.jio-creator__bar-divider,.jio-creator__bar-mode{display:none}.jio-creator__bar-brand{font-size:15px}.jio-creator__bar-actions{gap:5px}.jio-creator__toolbar-tools{gap:4px}.jio-creator__toolbar-group{gap:0}.jio-creator__tool-btn{min-width:36px;padding:4px}.jio-creator__tool-btn i{font-size:13px}.jio-creator__tool-label{font-size:10px;max-width:42px}.jio-creator__format-field{height:46px;min-width:36px;padding:4px}.jio-creator__format-field i{font-size:13px}.jio-creator__bar-actions .jio-creator__save{display:none}.jio-creator__save-draft{font-size:0;min-width:34px;padding:0;width:34px}.jio-creator__save-draft i{font-size:13px}.jio-creator__preview{font-size:12px;min-height:32px;padding:0 8px}.jio-creator__primary{font-size:12px;min-height:32px;padding:0 10px}.jio-creator__ghost{padding:0 8px}.jio-creator__canvas{margin:14px auto 0;padding:22px 18px 28px;width:calc(100% - 20px)}.jio-creator__settings{margin:12px auto calc(24px + env(safe-area-inset-bottom));padding:18px;width:calc(100% - 20px)}.jio-creator__setting-row{gap:12px}.jio-creator__title textarea{font-size:24px}.jio-creator__editor .mce-edit-area iframe,.jio-creator__editor .tox .tox-edit-area__iframe{min-height:48vh}.jio-creator-drawer{display:block}.jio-creator-drawer__backdrop{display:none}.jio-creator-drawer__panel{border-radius:0;box-shadow:none;height:100dvh;width:100%}.jio-creator-drawer__foot{background:#fff;bottom:0;position:sticky}}@media(prefers-reduced-motion:reduce){.jio-creator *{animation:none!important;transition:none!important}} diff --git a/assets/creator-studio/build/index.js b/assets/creator-studio/build/index.js index acc8d50e..98dc0419 100644 --- a/assets/creator-studio/build/index.js +++ b/assets/creator-studio/build/index.js @@ -1,3 +1,8 @@ -(()=>{"use strict";const e=window.React,t=window.wp.element,a=window.wp.i18n;function n(e,t){const a=e&&(e.message||e.error)||(401===t?"登录状态已失效,请刷新页面重新登录。":"请求失败,请稍后重试。"),n=new Error(String(a));return n.status=t,n.code=e&&e.code?String(e.code):"",n.data=e,n}async function o(e){try{return await e.json()}catch(e){return null}}async function r(e,t,a){const r=await fetch(e,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":a},body:JSON.stringify(t)}),l=await o(r);if(!r.ok)throw n(l,r.status);return l}async function l(e,t,a,r={}){const l=new FormData;l.append("file",t),Object.entries(r).forEach(([e,t])=>l.append(e,t));const i=await fetch(e,{method:"POST",credentials:"same-origin",headers:{"X-WP-Nonce":a},body:l}),c=await o(i);if(!i.ok)throw n(c,i.status);return c}const i=window.jioCreatorStudio||{},c=i.nonce||"";function s(n){const{draft:o,setDraft:r,capabilities:s,limits:u,taxonomy:d,isPublishedEdit:m,onClose:p,onSaveDraft:_,onSubmit:f,privateStorage:b,privateUploads:g,saving:h,captcha:j}=n,[y,E]=(0,t.useState)(""),[v,k]=(0,t.useState)(""),[N,w]=(0,t.useState)(!1),C=(0,t.useRef)(null),S=(0,t.useRef)(null);(0,t.useEffect)(()=>{const e=S.current,t=document.getElementById("jio-creator-captcha");if(!e||!t)return;const a=t.parentElement;return e.appendChild(t),t.removeAttribute("hidden"),()=>{a&&(a.appendChild(t),t.setAttribute("hidden",""))}},[]);const x=(0,t.useMemo)(()=>(o.title||"").trim().length,[o.title])>=Number(u.titleMin||1),q=()=>{const e=y.trim();if(!e)return;const t=e.split(/[,,\n]+/u).map(e=>e.trim()).filter(Boolean);r({tags:Array.from(new Set([...o.tags,...t]))}),E("")};return(0,e.createElement)("div",{className:"jio-creator-drawer",role:"dialog","aria-modal":"true","aria-labelledby":"jio-creator-publish-title"},(0,e.createElement)("button",{type:"button",className:"jio-creator-drawer__backdrop","aria-label":(0,a.__)("关闭","jio"),onClick:p}),(0,e.createElement)("div",{className:"jio-creator-drawer__panel"},(0,e.createElement)("header",{className:"jio-creator-drawer__head"},(0,e.createElement)("h2",{id:"jio-creator-publish-title"},m?(0,a.__)("提交改稿","jio"):(0,a.__)("发布文章","jio")),(0,e.createElement)("button",{type:"button",className:"jio-creator-drawer__close",onClick:p,"aria-label":(0,a.__)("关闭","jio")},(0,e.createElement)("i",{className:"fa fas fa-times","aria-hidden":"true"}))),(0,e.createElement)("div",{className:"jio-creator-drawer__body"},m&&(0,e.createElement)("p",{className:"jio-creator-drawer__note"},(0,a.__)("审核通过前,读者看到的仍然是当前线上版本。","jio")),(0,e.createElement)("section",{className:"jio-creator-field"},(0,e.createElement)("h3",null,(0,a.__)("分类","jio")),(0,e.createElement)("div",{className:"jio-creator-chips"},0===d.categories.length&&(0,e.createElement)("span",{className:"jio-creator-muted"},(0,a.__)("暂无可选分类","jio")),d.categories.map(t=>(0,e.createElement)("label",{key:t.id,className:"jio-creator-chip"+(o.categories.includes(t.id)?" is-active":"")},(0,e.createElement)("input",{type:"checkbox",checked:o.categories.includes(t.id),onChange:()=>(e=>{const t=o.categories.includes(e);r({categories:t?o.categories.filter(t=>t!==e):[...o.categories,e]})})(t.id)}),(0,e.createElement)("span",null,t.name))))),d.tags&&(0,e.createElement)("section",{className:"jio-creator-field"},(0,e.createElement)("h3",null,(0,a.__)("标签","jio")),(0,e.createElement)("div",{className:"jio-creator-chips"},o.tags.map(t=>(0,e.createElement)("span",{key:t,className:"jio-creator-chip is-active"},(0,e.createElement)("span",null,t),(0,e.createElement)("button",{type:"button",onClick:()=>r({tags:o.tags.filter(e=>e!==t)}),"aria-label":(0,a.sprintf)((0,a.__)("移除标签 %s","jio"),t)},(0,e.createElement)("i",{className:"fa fas fa-times","aria-hidden":"true"}))))),(0,e.createElement)("div",{className:"jio-creator-inline"},(0,e.createElement)("input",{type:"text",value:y,placeholder:(0,a.__)("输入标签,逗号分隔","jio"),onChange:e=>E(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),q())}}),(0,e.createElement)("button",{type:"button",onClick:q},(0,a.__)("添加","jio")))),d.customDefs.map(t=>(0,e.createElement)("section",{className:"jio-creator-field",key:t.key},(0,e.createElement)("h3",null,t.name),(0,e.createElement)("div",{className:"jio-creator-chips"},t.values.map(a=>{const n=o.custom[t.key]||[],l=n.includes(a.key);return(0,e.createElement)("label",{key:a.key,className:"jio-creator-chip"+(l?" is-active":"")},(0,e.createElement)("input",{type:"checkbox",checked:l,onChange:()=>r({custom:{...o.custom,[t.key]:l?n.filter(e=>e!==a.key):[...n,a.key]}})}),(0,e.createElement)("span",null,a.name))})))),s.canPay&&(0,e.createElement)("section",{className:"jio-creator-field"},(0,e.createElement)("div",{className:"jio-creator-switch"},(0,e.createElement)("div",null,(0,e.createElement)("h3",null,(0,a.__)("付费内容","jio")),(0,e.createElement)("p",{className:"jio-creator-muted"},(0,a.__)("开启后,未购买读者只能看到免费部分。","jio"))),(0,e.createElement)("label",{className:"jio-creator-toggle"},(0,e.createElement)("input",{type:"checkbox",checked:o.pay.enabled,onChange:e=>r({pay:{...o.pay,enabled:e.target.checked}})}),(0,e.createElement)("span",{"aria-hidden":"true"}))),o.pay.enabled&&(0,e.createElement)("div",{className:"jio-creator-pay"},(0,e.createElement)("div",{className:"jio-creator-inline"},(0,e.createElement)("label",null,(0,e.createElement)("input",{type:"radio",checked:"cash"===o.pay.modo,onChange:()=>r({pay:{...o.pay,modo:"cash"}})}),(0,e.createElement)("span",null,(0,a.__)("现金","jio"))),(0,e.createElement)("label",null,(0,e.createElement)("input",{type:"radio",checked:"points"===o.pay.modo,onChange:()=>r({pay:{...o.pay,modo:"points"}})}),(0,e.createElement)("span",null,(0,a.__)("积分","jio")))),"cash"===o.pay.modo?(0,e.createElement)("label",{className:"jio-creator-input"},(0,e.createElement)("span",null,(0,a.__)("价格","jio")),(0,e.createElement)("input",{type:"number",min:Number(u.priceMin||0),step:"0.01",value:o.pay.price,onChange:e=>r({pay:{...o.pay,price:e.target.value}})})):(0,e.createElement)("label",{className:"jio-creator-input"},(0,e.createElement)("span",null,(0,a.__)("积分价格","jio")),(0,e.createElement)("input",{type:"number",min:0,step:"1",value:o.pay.points,onChange:e=>r({pay:{...o.pay,points:Number(e.target.value)||0}})})),s.canPayDownload&&(0,e.createElement)("div",{className:"jio-creator-attachments"},(0,e.createElement)("div",{className:"jio-creator-attachments__head"},(0,e.createElement)("h4",null,(0,a.__)("资料附件","jio")),b?(0,e.createElement)("label",{className:"jio-creator-upload"},(0,e.createElement)("input",{ref:C,type:"file",onChange:()=>{(async()=>{const e=C.current?.files?.[0];if(e){k(""),w(!0);try{const t=await l(i.creator.privateUrl,e,c,{post_id:String(o.postId||0)}),a={type:"protected",assetKey:String(t.asset_key||""),fileName:String(t.name||e.name),sizeBytes:Number(t.size||e.size),sizeLabel:String(t.size_label||""),label:""};r({pay:{...o.pay,enabled:!0,downloads:[...o.pay.downloads,a]}}),C.current&&(C.current.value="")}catch(e){k(String(e?.message||(0,a.__)("资料上传失败","jio")))}finally{w(!1)}}})()},disabled:N}),(0,e.createElement)("span",null,N?(0,a.__)("上传中…","jio"):(0,a.__)("添加 PDF / ZIP","jio"))):(0,e.createElement)("p",{className:"jio-creator-muted"},(0,a.__)("私有附件存储尚未配置,暂时不能上传付费资料。","jio"))),v&&(0,e.createElement)("p",{className:"jio-creator-error"},v),o.pay.downloads.length>0&&(0,e.createElement)("ul",{className:"jio-creator-files"},o.pay.downloads.map((t,n)=>(0,e.createElement)("li",{key:`${t.assetKey||t.url}-${n}`},(0,e.createElement)("span",{className:"jio-creator-files__name"},t.assetKey?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("i",{className:"fa fas fa-lock","aria-hidden":"true"}),t.fileName||t.label||(0,a.__)("受保护资料","jio")):(0,e.createElement)(e.Fragment,null,(0,e.createElement)("i",{className:"fa fas fa-link","aria-hidden":"true"}),t.label||t.url)),t.sizeLabel&&(0,e.createElement)("span",{className:"jio-creator-muted"},t.sizeLabel),(0,e.createElement)("button",{type:"button",onClick:()=>(e=>{r({pay:{...o.pay,downloads:o.pay.downloads.filter((t,a)=>a!==e)}})})(n),"aria-label":(0,a.__)("移除","jio")},(0,e.createElement)("i",{className:"fa fas fa-times","aria-hidden":"true"}))))),g.length>0&&(0,e.createElement)("details",{className:"jio-creator-reuse"},(0,e.createElement)("summary",null,(0,a.__)("从已上传资料中选择","jio")),(0,e.createElement)("ul",null,g.filter(e=>!o.pay.downloads.some(t=>t.assetKey===e.assetKey)).map(t=>(0,e.createElement)("li",{key:t.assetKey},(0,e.createElement)("span",null,t.fileName),(0,e.createElement)("span",{className:"jio-creator-muted"},t.sizeLabel),(0,e.createElement)("button",{type:"button",onClick:()=>r({pay:{...o.pay,enabled:!0,downloads:[...o.pay.downloads,{...t,type:"protected"}]}})},(0,a.__)("使用","jio"))))))))),!s.canPay&&s.canSaveDraft&&(0,e.createElement)("p",{className:"jio-creator-muted"},(0,a.__)("当前账号不能设置付费内容。","jio"))),(0,e.createElement)("footer",{className:"jio-creator-drawer__foot"},j&&(0,e.createElement)("div",{className:"jio-creator-drawer__captcha",ref:S}),(0,e.createElement)("div",{className:"jio-creator-drawer__actions"},(0,e.createElement)("button",{type:"button",className:"jio-creator-ghost",onClick:_,disabled:h},(0,a.__)("保存草稿","jio")),(0,e.createElement)("button",{type:"button",className:"jio-creator-primary",onClick:()=>f(!1),disabled:h||!x},m?(0,a.__)("提交审核","jio"):s.canPublishNow?(0,a.__)("发布","jio"):(0,a.__)("提交审核","jio")),s.canPublishNow&&(0,e.createElement)("button",{type:"button",className:"jio-creator-link",onClick:()=>f(!0),disabled:h||!x},(0,a.__)("立即发布","jio"))))))}function u({label:t,icon:a,ready:n,onClick:o,title:r}){return(0,e.createElement)("button",{type:"button",className:"jio-creator__tool-btn",disabled:!n,onClick:o,title:r||t,"aria-label":r||t},(0,e.createElement)("i",{className:a,"aria-hidden":"true"}),(0,e.createElement)("span",{className:"jio-creator__tool-label"},t))}function d({ready:n,canUndo:o,canRedo:r,formatValue:l,onFormatChange:i,capabilities:c,onCommand:s,onRememberSelection:d,onOpenLink:m,onOpenMedia:p,onInsertBlock:_,onInsertQuote:f}){const[b,g]=(0,t.useState)(!1),h=(0,t.useRef)(null);return(0,t.useEffect)(()=>{if(!b)return;const e=e=>{h.current?.contains(e.target)||g(!1)},t=e=>{"Escape"===e.key&&g(!1)};return document.addEventListener("pointerdown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",t)}},[b]),(0,e.createElement)("div",{className:"jio-creator__toolbar-tools",role:"toolbar","aria-label":(0,a.__)("正文编辑工具","jio"),onMouseDown:e=>{d(),e.target.closest("button")&&e.preventDefault()}},(0,e.createElement)("div",{className:"jio-creator__toolbar-group",role:"group","aria-label":(0,a.__)("撤销和重做","jio")},(0,e.createElement)(u,{label:(0,a.__)("撤销","jio"),icon:"fa fas fa-undo",ready:o,onClick:()=>s("undo")}),(0,e.createElement)(u,{label:(0,a.__)("重做","jio"),icon:"fa fas fa-redo",ready:r,onClick:()=>s("redo")})),(0,e.createElement)("span",{className:"jio-creator__toolbar-divider","aria-hidden":"true"}),(0,e.createElement)("div",{className:"jio-creator__toolbar-group",role:"group","aria-label":(0,a.__)("段落样式","jio")},(0,e.createElement)("label",{className:"jio-creator__format-field"},(0,e.createElement)("select",{className:"jio-creator__format-select","aria-label":(0,a.__)("标题级别","jio"),value:"blockquote"===l?"p":l,disabled:!n,onFocus:d,onChange:e=>{i(e.target.value),s("format",e.target.value)}},(0,e.createElement)("option",{value:"p"},(0,a.__)("正文","jio")),(0,e.createElement)("option",{value:"h1"},(0,a.__)("标题 1","jio")),(0,e.createElement)("option",{value:"h2"},(0,a.__)("标题 2","jio")),(0,e.createElement)("option",{value:"h3"},(0,a.__)("标题 3","jio"))),(0,e.createElement)("i",{className:"fa fas fa-heading","aria-hidden":"true"}),(0,e.createElement)("span",{className:"jio-creator__tool-label"},(0,a.__)("标题","jio")))),(0,e.createElement)("span",{className:"jio-creator__toolbar-divider","aria-hidden":"true"}),(0,e.createElement)("div",{className:"jio-creator__toolbar-group",role:"group","aria-label":(0,a.__)("文字格式","jio")},(0,e.createElement)(u,{label:(0,a.__)("加粗","jio"),icon:"fa fas fa-bold",ready:n,onClick:()=>s("Bold")}),(0,e.createElement)(u,{label:(0,a.__)("斜体","jio"),icon:"fa fas fa-italic",ready:n,onClick:()=>s("Italic")}),(0,e.createElement)(u,{label:(0,a.__)("下划线","jio"),icon:"fa fas fa-underline",ready:n,onClick:()=>s("Underline")})),(0,e.createElement)("span",{className:"jio-creator__toolbar-divider","aria-hidden":"true"}),(0,e.createElement)("div",{className:"jio-creator__toolbar-group",role:"group","aria-label":(0,a.__)("段落块","jio")},(0,e.createElement)(u,{label:(0,a.__)("列表","jio"),icon:"fa fas fa-list-ul",ready:n,onClick:()=>_("list")}),(0,e.createElement)(u,{label:(0,a.__)("目录","jio"),icon:"fa fas fa-list-ol",ready:n,onClick:()=>_("toc")}),(0,e.createElement)("div",{className:"jio-creator__quote",ref:h},(0,e.createElement)(u,{label:(0,a.__)("引用","jio"),icon:"fa fas fa-quote-left",ready:n,onClick:()=>g(e=>!e)}),b&&(0,e.createElement)("div",{className:"jio-creator__quote-menu",role:"menu","aria-label":(0,a.__)("引用样式","jio")},[{key:"",label:(0,a.__)("灰色引用","jio"),className:""},{key:"qe_wzk_c-red",label:(0,a.__)("红色引用","jio"),className:"is-red"},{key:"qe_wzk_lan",label:(0,a.__)("蓝色引用","jio"),className:"is-blue"},{key:"qe_wzk_lv",label:(0,a.__)("绿色引用","jio"),className:"is-green"}].map(t=>(0,e.createElement)("button",{key:t.key||"default",type:"button",role:"menuitem",className:`jio-creator__quote-option ${t.className}`.trim(),onClick:()=>{g(!1),f(t.key)}},(0,e.createElement)("span",{className:"jio-creator__quote-swatch","aria-hidden":"true"}),t.label)))),(0,e.createElement)(u,{label:(0,a.__)("分割线","jio"),icon:"fa fas fa-minus",ready:n,onClick:()=>_("divider")}),(0,e.createElement)(u,{label:(0,a.__)("代码块","jio"),icon:"fa fas fa-code",ready:n,onClick:()=>_("code")}),(0,e.createElement)(u,{label:(0,a.__)("注释","jio"),icon:"fa fas fa-comment-dots",ready:n,onClick:()=>_("footnote")}),(0,e.createElement)(u,{label:(0,a.__)("公式","jio"),icon:"fa fas fa-square-root-alt",ready:n,onClick:()=>_("math")}),(0,e.createElement)(u,{label:(0,a.__)("表格","jio"),icon:"fa fas fa-table",ready:n,onClick:()=>_("table")})),(0,e.createElement)("span",{className:"jio-creator__toolbar-divider","aria-hidden":"true"}),(0,e.createElement)("div",{className:"jio-creator__toolbar-group",role:"group","aria-label":(0,a.__)("媒体和链接","jio")},c.canUploadImage&&(0,e.createElement)(u,{label:(0,a.__)("图片","jio"),icon:"fa far fa-image",ready:n,onClick:()=>p("image")}),(c.canUploadVideo||c.canEmbed)&&(0,e.createElement)(u,{label:(0,a.__)("视频","jio"),icon:"fa fas fa-video",ready:n,onClick:()=>p("video")}),(0,e.createElement)(u,{label:(0,a.__)("链接","jio"),icon:"fa fas fa-link",ready:n,onClick:m}),c.canUploadFile&&(0,e.createElement)(u,{label:(0,a.__)("附件","jio"),icon:"fa fas fa-paperclip",ready:n,onClick:()=>p("file")})))}const m=window.jioCreatorStudio||{},p=m.nonce||"",_=e=>String(e).padStart(2,"0");function f(e){return`${e.getFullYear()}-${_(e.getMonth()+1)}-${_(e.getDate())}T${_(e.getHours())}:${_(e.getMinutes())}`}function b({featured:n,canEditCover:o,canSchedule:r,scheduleEnabled:i,scheduleAt:c,onFeaturedChange:s,onScheduleChange:u}){const d=(0,t.useRef)(null),[_,b]=(0,t.useState)(!1),[g,h]=(0,t.useState)(""),j=(0,t.useMemo)(()=>f(new Date(Date.now()+3e5)),[]),y="string"==typeof n?.data?.url?n.data.url:"";return(0,e.createElement)("section",{className:"jio-creator__settings","aria-label":(0,a.__)("发布设置","jio")},(0,e.createElement)("h2",{className:"jio-creator__settings-title"},(0,a.__)("发布设置","jio")),o&&(0,e.createElement)("div",{className:"jio-creator__setting-row"},(0,e.createElement)("div",{className:"jio-creator__setting-copy"},(0,e.createElement)("span",{className:"jio-creator__setting-label"},(0,a.__)("添加封面","jio")),(0,e.createElement)("p",{className:"jio-creator__setting-help"},(0,a.__)("用于列表卡片、分享卡片;不设置时自动使用正文首图。","jio"))),(0,e.createElement)("div",{className:"jio-creator__cover-control"},y?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("button",{type:"button",className:"jio-creator__cover-preview",onClick:()=>d.current?.click(),"aria-label":(0,a.__)("更换封面","jio")},(0,e.createElement)("img",{src:y,alt:""})),(0,e.createElement)("button",{type:"button",className:"jio-creator__cover-clear",onClick:()=>s({type:"",data:{}}),"aria-label":(0,a.__)("移除封面","jio")},(0,e.createElement)("i",{className:"fa fas fa-times","aria-hidden":"true"}))):(0,e.createElement)("button",{type:"button",className:"jio-creator__cover-add",onClick:()=>d.current?.click(),disabled:_},(0,e.createElement)("i",{className:"fa fas fa-plus","aria-hidden":"true"}),(0,e.createElement)("span",null,_?(0,a.__)("上传中…","jio"):(0,a.__)("添加封面","jio"))),(0,e.createElement)("input",{ref:d,type:"file",accept:"image/*",className:"jio-creator__cover-input",onChange:()=>{(async()=>{const e=d.current?.files?.[0],t=m.media?.uploadUrl?.image;if(e&&t){h(""),b(!0);try{const n=await l(t,e,p),o=Number(n.attachment_id||n.id||0),r=String(n.url||"");if(!o||!r)throw new Error((0,a.__)("上传后无法读取图片。","jio"));s({type:"image",mediaId:o,data:{id:o,url:r}})}catch(e){h(String(e?.message||(0,a.__)("上传失败","jio")))}finally{b(!1),d.current&&(d.current.value="")}}})()}}))),g&&(0,e.createElement)("p",{className:"jio-creator-error"},g),(0,e.createElement)("div",{className:"jio-creator__setting-row"},(0,e.createElement)("div",{className:"jio-creator__setting-copy"},(0,e.createElement)("span",{className:"jio-creator__setting-label"},(0,a.__)("定时发布","jio")),(0,e.createElement)("p",{className:"jio-creator__setting-help"},r?(0,a.__)("开启后到点自动发布,发布前不会出现在文章列表。","jio"):(0,a.__)("当前账号提交后需要审核,审核通过后才会发布。","jio"))),(0,e.createElement)("label",{className:"jio-creator-toggle"},(0,e.createElement)("input",{type:"checkbox",checked:i,disabled:!r,onChange:e=>u(e.target.checked,c||f(new Date(Date.now()+36e5)))}),(0,e.createElement)("span",{"aria-hidden":"true"}))),r&&i&&(0,e.createElement)("div",{className:"jio-creator__schedule"},(0,e.createElement)("label",null,(0,e.createElement)("span",null,(0,a.__)("发布时间","jio")),(0,e.createElement)("input",{type:"datetime-local",value:c,min:j,onChange:e=>u(!0,e.target.value)})),(0,e.createElement)("p",{className:"jio-creator-muted"},(0,a.sprintf)(/* translators: %s: site timezone */ /* translators: %s: site timezone */ -(0,a.__)("按站点时区(%s)发布,至少需要晚于当前时间 1 分钟。","jio"),String(m.timezone||"UTC")))))}const g={ready:(0,a.__)("尚未保存","jio"),saving:(0,a.__)("保存中…","jio"),saved:(0,a.__)("已保存","jio"),error:(0,a.__)("保存失败","jio"),conflict:(0,a.__)("内容已在别处更新","jio"),submitting:(0,a.__)("提交中…","jio"),submitted:(0,a.__)("已提交","jio")};function h({value:t}){return(0,e.createElement)("span",{className:`jio-creator__save is-${t.state}`,role:"status","aria-live":"polite"},(0,e.createElement)("i",{className:"fa fas fa-circle","aria-hidden":"true"}),(0,e.createElement)("span",null,g[t.state]||g.ready),"saved"===t.state&&t.at?(0,e.createElement)("time",null,t.at):null)}function j(e){const t=(e.downloads||[]).map(e=>{const t="string"==typeof e.assetKey?e.assetKey:"";if(t)return{type:"protected",asset_key:t,label:"string"==typeof e.label?e.label:""};const a="string"==typeof e.url?e.url.trim():"";return a?{type:"direct",url:a,label:"string"==typeof e.label?e.label:"",extract_code:"string"==typeof e.extractCode?e.extractCode:""}:null}).filter(Boolean);return{enabled:!!e.enabled,fields:{pay_type:e.enabled?t.length>0?"download":"reading":"no",pay_modo:"points"===e.modo?"points":"0",price:"points"===e.modo?"0.00":String(e.price||"0.00"),points_price:"points"===e.modo?Math.max(0,Number(e.points)||0):0,vip1_price:"points"===e.modo?"0.00":String(e.vip1Price||"0.00"),vip2_price:"points"===e.modo?"0.00":String(e.vip2Price||"0.00"),pay_limit:Number(e.payLimit)||0,downloads:t}}}const y=e=>e.replace(/&/g,"&").replace(//g,">").replace(/"/g,"""),E=[{value:"generic",label:(0,a.__)("通用","jio")},{value:"javascript",label:"JavaScript"},{value:"typescript",label:"TypeScript"},{value:"php",label:"PHP"},{value:"python",label:"Python"},{value:"java",label:"Java"},{value:"go",label:"Go"},{value:"rust",label:"Rust"},{value:"csharp",label:"C#"},{value:"cpp",label:"C++"},{value:"sql",label:"SQL"},{value:"json",label:"JSON"},{value:"bash",label:"Shell"},{value:"css",label:"CSS"},{value:"html",label:"HTML"},{value:"markdown",label:"Markdown"}];const v=(e,t,a)=>Math.min(a,Math.max(t,Number.isFinite(e)?Math.round(e):t)),k={table:(0,a.__)("插入表格","jio"),math:(0,a.__)("插入公式","jio"),footnote:(0,a.__)("插入注释","jio")};function N({kind:n,onSubmit:o,onClose:r}){const[l,i]=(0,t.useState)(3),[c,s]=(0,t.useState)(3),[u,d]=(0,t.useState)(!0),[m,p]=(0,t.useState)(!1),[_,f]=(0,t.useState)("a^2 + b^2 = c^2"),[b,g]=(0,t.useState)(!0),[h,j]=(0,t.useState)(""),y=(0,t.useRef)(null),E=(0,t.useRef)(null),N=(0,t.useRef)(null),w=(0,t.useRef)(null);(0,t.useEffect)(()=>{(E.current||N.current||w.current)?.focus();const e=e=>{"Escape"===e.key&&(e.preventDefault(),r())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[r]);const C=(0,t.useMemo)(()=>"footnote"===n?""!==h.trim():"math"!==n||""!==_.trim(),[n,h,_]);return(0,e.createElement)("div",{className:"jio-creator-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"jio-creator-dialog-title"},(0,e.createElement)("button",{type:"button",className:"jio-creator-dialog__backdrop","aria-label":(0,a.__)("关闭","jio"),onClick:r}),(0,e.createElement)("div",{className:"jio-creator-dialog__panel",ref:y},(0,e.createElement)("header",{className:"jio-creator-dialog__head"},(0,e.createElement)("h2",{id:"jio-creator-dialog-title"},k[n]),(0,e.createElement)("button",{type:"button",className:"jio-creator-dialog__close",onClick:r,"aria-label":(0,a.__)("关闭","jio")},(0,e.createElement)("i",{className:"fa fas fa-times","aria-hidden":"true"}))),(0,e.createElement)("div",{className:"jio-creator-dialog__body"},"table"===n&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"jio-creator-dialog__row"},(0,e.createElement)("label",null,(0,e.createElement)("span",null,(0,a.__)("行数","jio")),(0,e.createElement)("input",{ref:E,type:"number",min:1,max:20,value:l,onChange:e=>i(Number(e.target.value))})),(0,e.createElement)("label",null,(0,e.createElement)("span",null,(0,a.__)("列数","jio")),(0,e.createElement)("input",{type:"number",min:1,max:10,value:c,onChange:e=>s(Number(e.target.value))}))),(0,e.createElement)("label",{className:"jio-creator-dialog__check"},(0,e.createElement)("input",{type:"checkbox",checked:u,onChange:e=>d(e.target.checked)}),(0,e.createElement)("span",null,(0,a.__)("首行为表头","jio"))),(0,e.createElement)("label",{className:"jio-creator-dialog__check"},(0,e.createElement)("input",{type:"checkbox",checked:m,onChange:e=>p(e.target.checked)}),(0,e.createElement)("span",null,(0,a.__)("隔行变色","jio")))),"math"===n&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("label",{className:"jio-creator-dialog__field"},(0,e.createElement)("span",null,(0,a.__)("公式","jio")),(0,e.createElement)("textarea",{ref:N,rows:3,value:_,onChange:e=>f(e.target.value),placeholder:"a^2 + b^2 = c^2"})),(0,e.createElement)("p",{className:"jio-creator-muted"},(0,a.__)("支持上标 ^ 与下标 _,例如 x^2 与 a_n;暂不支持完整 LaTeX。","jio")),(0,e.createElement)("label",{className:"jio-creator-dialog__check"},(0,e.createElement)("input",{type:"checkbox",checked:b,onChange:e=>g(e.target.checked)}),(0,e.createElement)("span",null,(0,a.__)("独占一行显示","jio")))),"footnote"===n&&(0,e.createElement)("label",{className:"jio-creator-dialog__field"},(0,e.createElement)("span",null,(0,a.__)("注释内容","jio")),(0,e.createElement)("textarea",{ref:w,rows:4,value:h,onChange:e=>j(e.target.value),placeholder:(0,a.__)("填写要补充说明的内容","jio")}))),(0,e.createElement)("footer",{className:"jio-creator-dialog__foot"},(0,e.createElement)("button",{type:"button",className:"jio-creator-dialog__ghost",onClick:r},(0,a.__)("取消","jio")),(0,e.createElement)("button",{type:"button",className:"jio-creator-dialog__primary",onClick:()=>{C&&o("table"!==n?"math"!==n?{kind:n,note:h.trim()}:{kind:n,formula:_.trim(),display:b}:{kind:n,rows:v(l,1,20),cols:v(c,1,10),header:u,striped:m})},disabled:!C},(0,a.__)("插入","jio")))))}const w=window.jioCreatorStudio||{},C=w.nonce||"",S=`jio-studio-${w.sourceId||0}`,x="jio-creator-content";function q(){const e=w.pay||{},t=w.categories&&w.categories.selected||[],a=w.tags&&w.tags.items||[];return{postId:Number(w.sourceId||0),versionId:Number(w.versionId||0),rev:Number(w.versionRev||0),title:String(w.title||""),content:String(w.content||""),schedule:{enabled:!1,at:""},categories:t.map(Number),tags:a.slice(),custom:w.custom||{},featured:w.featured||{type:"",data:{}},pay:{enabled:!!e.enabled,modo:"points"===e.payModo?"points":"cash",price:String(e.price||"0.00"),points:Number(e.points||0),vip1Price:String(e.vip1Price||"0.00"),vip2Price:String(e.vip2Price||"0.00"),payLimit:Number(e.payLimit||0),downloads:Array.isArray(e.downloads)?e.downloads:[]}}}function M(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")}function L(e){const t=String(e||"").trim();if(!t)return"";try{const e=new URL(t,window.location.href);return"http:"===e.protocol||"https:"===e.protocol?e.href:""}catch(e){return""}}function $(){const[n,o]=(0,t.useState)(q),l=(0,t.useRef)(n);l.current=n;const i=(0,t.useRef)(null),c=(0,t.useRef)(null),u=(0,t.useRef)(null),m=(0,t.useRef)(!1),p=(0,t.useRef)(()=>{}),[_,f]=(0,t.useState)(!1),[g,v]=(0,t.useState)({canUndo:!1,canRedo:!1}),[k,$]=(0,t.useState)("p"),[I,R]=(0,t.useState)(()=>({state:w.sourceId||w.versionId||w.content?"saved":"ready",at:""})),[D,P]=(0,t.useState)(!1),[z,U]=(0,t.useState)(null),[F,T]=(0,t.useState)(null),[B,O]=(0,t.useState)(null),A=(0,t.useRef)(!1),K=(0,t.useRef)(0),J=w.capabilities||{},H={titleMin:Number(w.limits?.titleMin||1),titleMax:Number(w.limits?.titleMax||30),titlePlaceholder:String(w.limits?.titlePlaceholder||(0,a.__)("请输入标题","jio")),priceMin:Number(w.pay?.priceMin||0),priceMax:Number(w.pay?.priceMax||0),pointsMin:Number(w.pay?.pointsMin||0),pointsMax:Number(w.pay?.pointsMax||0)},V=!!w.isPublished,Q=(0,t.useCallback)(e=>{A.current=!0,K.current+=1;const t={...l.current,...e};l.current=t,o(t)},[]),X=(0,t.useCallback)(e=>{if(e===l.current.content)return;A.current=!0,K.current+=1;const t={...l.current,content:e};l.current=t,o(t)},[]),W=(0,t.useCallback)(e=>{const t=e?.undoManager;t&&v({canUndo:"function"==typeof t.hasUndo&&t.hasUndo(),canRedo:"function"==typeof t.hasRedo&&t.hasRedo()})},[]),Y=(0,t.useCallback)(e=>{const t=e?.selection?.getNode(),a=t?e.dom.getParent(t,"p,h1,h2,h3,blockquote")||t:null,n=a?.nodeName?.toLowerCase()||"p";$(["h1","h2","h3","blockquote"].includes(n)?n:"p")},[]),G=(0,t.useCallback)((e={})=>{const t=l.current;return{post_id:t.postId,version_id:t.versionId,rev:t.rev,title:t.title,content:t.content,categories:t.categories,tags:t.tags,custom:t.custom,featured:t.featured,schedule:{enabled:!!t.schedule.enabled,at:t.schedule.enabled?t.schedule.at:""},pay:j(t.pay),...e}},[]),Z=(0,t.useCallback)(async(e=!1)=>{const t=i.current;t&&!t.removed&&X(t.getContent());const a=l.current;if(!A.current&&(a.postId>0||a.versionId>0))return!0;const n=K.current,c=""!==a.title.trim()||""!==function(e){const t=document.createElement("div");return t.innerHTML=e,(t.textContent||"").replace(/\s+/g,"")}(a.content).trim();if(e&&!c)return!0;R({state:"saving",at:""});try{const t=await r(w.creator.saveUrl,G({autosave:e}),C),a={...l.current,postId:Number(t.post_id||l.current.postId||0),versionId:Number(t.version_id||l.current.versionId||0),rev:Number(t.rev||t.versionRev||l.current.rev||0)};window.jioSubmitData&&(window.jioSubmitData.postId=a.postId);const i=K.current===n;return A.current=!i,l.current=a,o(a),R({state:i?"saved":"saving",at:i?(new Date).toLocaleTimeString():""}),i}catch(e){return R({state:409===e?.status?"conflict":"error",at:""}),!1}},[G]);p.current=()=>{Z(!1)};const ee=(0,t.useCallback)(async e=>{if(await Z(!1)){R({state:"submitting",at:""});try{let t="";const n=window.JioCaptcha;if(w.captcha?.enabled&&n&&"function"==typeof n.run){const e=await n.run("front_submit");if(null===e)return R({state:"ready",at:""}),void T({tone:"error",text:(0,a.__)("请先完成人机验证","jio")});t=String(e?.jio_captcha_proof||"")}const o=await r(w.creator.submitUrl,G({post_id:l.current.postId,version_id:l.current.versionId,rev:l.current.rev,publish_now:e,captcha_proof:t}),C);A.current=!1,R({state:"submitted",at:""}),T({tone:"ok",text:String(o.message||(0,a.__)("已提交","jio"))}),P(!1);const i=o.url||o.goto||w.urls?.center;i&&window.setTimeout(()=>{window.location.href=i},900)}catch(e){R({state:"error",at:""}),T({tone:"error",text:String(e?.message||(0,a.__)("提交失败","jio"))})}}else T({tone:"error",text:(0,a.__)("内容保存失败,请重试后再提交","jio")})},[G,Z]),te=(0,t.useCallback)(async()=>{if(await Z(!1))try{const e=await r(w.creator.previewUrl,{post_id:l.current.postId,version_id:l.current.versionId},C);e.url&&window.open(String(e.url),"_blank","noopener")}catch(e){T({tone:"error",text:String(e?.message||(0,a.__)("预览失败","jio"))})}},[Z]),{markLocalSaved:ae,clear:ne}=function({key:e,snapshot:a,onFound:n}){const o=(0,t.useRef)(a);o.current=a;const r=(0,t.useRef)(!1);return(0,t.useEffect)(()=>{if(!r.current){r.current=!0;try{const t=window.localStorage.getItem(e);if(!t)return;const o=JSON.parse(t),r="string"==typeof o.at?Date.parse(o.at):NaN;if(!Number.isFinite(r)||Date.now()-r>6048e5)return void window.localStorage.removeItem(e);"string"==typeof o.content&&o.content!==a.content&&n(String(o.at))}catch(t){window.localStorage.removeItem(e)}}},[e,n,a.content]),{markLocalSaved:(0,t.useCallback)(()=>{try{window.localStorage.setItem(e,JSON.stringify(o.current))}catch(e){}},[e]),clear:(0,t.useCallback)(()=>{try{window.localStorage.removeItem(e)}catch(e){}},[e])}}({key:S,snapshot:{title:n.title,content:n.content,at:(new Date).toISOString()},onFound:e=>O({savedAt:e})}),oe=function({enabled:e,onSave:a,onLocal:n,remoteDelay:o=4e3,localDelay:r=1500}){const l=(0,t.useRef)(null),i=(0,t.useRef)(null),c=(0,t.useRef)(!1),s=(0,t.useRef)(a),u=(0,t.useRef)(n);s.current=a,u.current=n;const d=(0,t.useCallback)(()=>{l.current&&(window.clearTimeout(l.current),l.current=null),i.current&&(window.clearTimeout(i.current),i.current=null)},[]),m=(0,t.useCallback)(async()=>{if(!c.current){c.current=!0;try{await s.current()}finally{c.current=!1}}},[]),p=(0,t.useCallback)(()=>{d(),u.current(),e&&(i.current=window.setTimeout(()=>u.current(),r),l.current=window.setTimeout(()=>{m()},o))},[d,e,m,r,o]);return(0,t.useEffect)(()=>{if(!e)return;const t=()=>{"hidden"===document.visibilityState&&m()},a=()=>{m()};return document.addEventListener("visibilitychange",t),window.addEventListener("blur",a),()=>{document.removeEventListener("visibilitychange",t),window.removeEventListener("blur",a),d()}},[d,e,m]),(0,t.useMemo)(()=>({schedule:p,flush:m,cancel:d}),[d,m,p])}({enabled:!!J.isLoggedIn,onSave:async()=>{const e=await Z(!0);return e&&ne(),e},onLocal:ae}).schedule;(0,t.useEffect)(()=>{A.current&&oe()},[n,oe]),(0,t.useEffect)(()=>{const e=e=>{A.current&&(e.preventDefault(),e.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[]),(0,t.useEffect)(()=>{const e=e=>{(e.metaKey||e.ctrlKey)&&"s"===e.key.toLowerCase()&&(e.preventDefault(),Z(!1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[Z]),(0,t.useEffect)(()=>{const e=window.wp?.editor;if(!e||"function"!=typeof e.initialize)return void T({tone:"error",text:(0,a.__)("TinyMCE 加载失败,请刷新页面后重试。","jio")});const t={quicktags:!1,tinymce:{menubar:!1,statusbar:!1,resize:!1,toolbar1:"",toolbar2:"",toolbar3:"",plugins:"paste,link,lists,wordpress,wplink",wpautop:!0,body_class:"jio-creator__tinymce",content_css:w.creator?.contentCss||"",content_style:'\nbody {\n\tmargin: 0;\n\tcolor: #2b2b2b;\n\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;\n\tfont-size: 16px;\n\tline-height: 1.8;\n\tletter-spacing: 0.01em;\n}\np { margin: 0 0 1.1em; }\nh1, h2, h3, h4, h5, h6 { margin: 1.5em 0 0.65em; line-height: 1.4; }\nimg, iframe { max-width: 100%; }\nimg { height: auto; }\n\n/* 代码块:右上角显示当前语言,点击即可更换(交互在父组件里接管)。 */\n.enlighter-pre {\n\tposition: relative;\n\tmargin: 0 0 1.1em;\n\tpadding: 40px 14px 14px;\n\toverflow: auto;\n\tborder-radius: 8px;\n\tbackground: #f2f4f5;\n\tcursor: pointer;\n}\n.enlighter-pre code.gl {\n\tdisplay: block;\n\tborder: 0;\n\tbackground: transparent;\n\tcolor: #2b2b2b;\n\tfont-family: Consolas, Monaco, monospace;\n\tfont-size: 13px;\n\tline-height: 1.5;\n\twhite-space: pre-wrap;\n}\n.enlighter-pre::before {\n\tposition: absolute;\n\ttop: 9px;\n\tright: 9px;\n\tpadding: 3px 10px;\n\tborder-radius: 4px;\n\tbackground: linear-gradient(135deg, #3dcabd 10%, #254bdd 100%);\n\tcolor: #fff;\n\tcontent: attr(data-jio-code-label);\n\tfont-size: 12px;\n\tline-height: 1.5;\n\tpointer-events: none;\n}\n\n/* 引用:与前台主题的 .quote_q 视觉一致。 */\n.quote_q {\n\tposition: relative;\n\tmargin: 10px 0 20px;\n\tpadding: 1.2em;\n\tborder-radius: 6px;\n\tcolor: var(--quote-color, #555);\n\tbackground: rgba(85, 85, 85, 0.04);\n}\n.quote_q.qe_wzk_c-red { --quote-color: #dc3f3f; background: rgba(220, 63, 63, 0.05); }\n.quote_q.qe_wzk_lan { --quote-color: #0092ff; background: rgba(0, 146, 255, 0.05); }\n.quote_q.qe_wzk_lv { --quote-color: #23790e; background: rgba(35, 121, 14, 0.05); }\n.quote_q::after {\n\tposition: absolute;\n\ttop: 18px;\n\tleft: 18px;\n\tcolor: var(--quote-color, #555);\n\tcontent: \'\\201C\';\n\tfont-size: 1.4em;\n\tline-height: 1;\n\topacity: 0.6;\n}\n.quote_q > div { padding-left: 2em; opacity: 0.85; }\n.quote_q > div > p:last-child { margin-bottom: 0; }\n\n/* 表格。 */\n.jio-content-table {\n\twidth: 100%;\n\tmargin: 0 0 1.1em;\n\tborder-collapse: collapse;\n\tfont-size: 14px;\n}\n.jio-content-table th,\n.jio-content-table td {\n\tpadding: 10px 12px;\n\tborder: 1px solid #e6e9e8;\n\tline-height: 1.6;\n}\n.jio-content-table thead th {\n\tbackground: #f6f8f7;\n\tfont-weight: 600;\n\ttext-align: left;\n}\n.jio-content-table.is-striped tbody tr:nth-child(odd) td { background: #f7f9f8; }\n\n/* 公式与目录占位。 */\n.jio-math { font-family: "Cambria Math", "Latin Modern Math", "Times New Roman", serif; }\n.jio-math--block { display: block; margin: 12px 0; text-align: center; }\n.jio-toc-placeholder {\n\theight: 40px;\n\tmargin: 0 0 1.1em;\n\tborder: 1px dashed #d3ded8;\n\tborder-radius: 8px;\n\tbackground: #f7faf9;\n\tcolor: #8c9a94;\n\tfont-size: 12px;\n\tline-height: 40px;\n\ttext-align: center;\n}\n.jio-toc-placeholder::after { content: \'目录将在发布后自动生成\'; }\n\n/* 注释上标:编辑器里只显示序号,发布后由服务端渲染脚注列表。 */\n.jio-footnote-ref,\n.jio-footnote-ref a {\n\tcolor: #267665;\n\tfont-size: 0.8em;\n\ttext-decoration: none;\n\tvertical-align: super;\n}\n\n/* 附件链接。 */\n.jio-file-link {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 6px;\n\tpadding: 6px 12px;\n\tborder: 1px solid #e6e9e8;\n\tborder-radius: 6px;\n\tbackground: #f7f8f8;\n\ttext-decoration: none;\n}\n',height:650,placeholder:String(w.limits?.contentPlaceholder||""),setup:e=>{i.current=e,e.on("init",()=>{m.current=!0,f(!0),null!==u.current&&(e.setContent(u.current),u.current=null),W(e),Y(e)}),e.on("NodeChange",()=>Y(e)),e.on("input change Undo Redo AddUndo",()=>{X(e.getContent()),W(e)}),e.on("keydown",t=>{if((t.metaKey||t.ctrlKey)&&83===t.keyCode)return t.preventDefault(),void p.current();!function(e,t){const a=Number(t.keyCode);if(8!==a&&46!==a)return;const n=e.selection;if(!n||!n.isCollapsed())return;const o=e.getBody(),r=n.getNode(),l=(i=r)&&1===i.nodeType&&""===(i.textContent||"").trim()&&!e.dom.getParent(i,"table,pre,hr,.quote_q,.jio-math--block,.jio-toc-placeholder",o)?r:null;var i;const c=l?8===a?l.previousElementSibling:l.nextElementSibling:null;if((e=>!!e&&1===e.nodeType&&!!e.matches?.("table,pre,hr,.quote_q,.jio-math--block,.jio-toc-placeholder"))(c))return t.preventDefault(),e.dom.remove(c),e.nodeChanged(),void e.undoManager.add();const s=e.dom.getParent(r,"table,pre,hr,.quote_q,.jio-math--block,.jio-toc-placeholder",o);if(!s)return;const u=t=>{const a=e.dom.createRng();a.selectNodeContents(s),a.collapse(t);const o=n.getRng();return o&&"function"==typeof o.compareBoundaryPoints&&0===o.compareBoundaryPoints(t?1:3,a)};if(!(8===a&&u(!0)||46===a&&u(!1)))return;t.preventDefault();const d=s.parentElement;e.dom.remove(s),d&&0===d.children.length&&(e.setContent("

"),e.selection.setCursorLocation(e.getBody().firstChild,0)),e.nodeChanged(),e.undoManager.add()}(e,t)})}}};return e.initialize(x,t),()=>{e.remove?.(x),m.current=!1,i.current=null}},[X]);const re=(0,t.useCallback)(()=>{try{const e=window.localStorage.getItem(S);if(e){const t=JSON.parse(e),a={};"string"==typeof t.title&&(a.title=t.title),"string"==typeof t.content&&(a.content=t.content),Q(a),"string"==typeof t.content&&(m.current?i.current?.setContent(t.content):u.current=t.content)}}catch(e){}O(null)},[Q]),le=(0,t.useCallback)(()=>{const e=i.current;e&&!e.removed&&(c.current=e.selection.getBookmark(2,!0))},[]),ie=(0,t.useCallback)(()=>{const e=i.current;if(!e||e.removed)return null;if(e.focus(),c.current){try{e.selection.moveToBookmark(c.current)}catch(e){}c.current=null}return e},[]),ce=(0,t.useCallback)((e,t)=>{const a=ie();a&&("undo"===e?a.undoManager.undo():"redo"===e?a.undoManager.redo():"format"===e?("p"===t?a.execCommand("FormatBlock",!1,"p"):a.formatter.toggle(t||"h2"),Y(a)):a.execCommand(e),a.nodeChanged())},[ie]),se=(0,t.useCallback)(()=>{const e=ie();if(!e)return;const t=window.wpLink;if(t&&"function"==typeof t.open)return void t.open(e.id);const n=window.prompt((0,a.__)("输入链接地址","jio"),"https://"),o=n?L(n):"";o&&e.execCommand("mceInsertLink",!1,{href:o})},[ie]),ue=(0,t.useCallback)(e=>{const t=ie();t&&e&&(t.insertContent(e),t.nodeChanged(),X(t.getContent()),W(t))},[ie]),de=(0,t.useCallback)(e=>{le(),"table"!==e&&"math"!==e&&"footnote"!==e?"code"!==e?"list"!==e?"toc"!==e?"divider"===e&&ue("

"):ue("

[jio_toc]

"):ue("

"):ue(function(e="generic",t=""){const n=y(""!==t?t:(0,a.__)("在此输入代码","jio")),o=y(function(e){return E.find(t=>t.value===e)?.label||e}(e));return`
`+n+"

"}("generic")):U(e)},[ue,le]),me=(0,t.useCallback)(e=>{const t=ie();if(!t)return;const a=String(t.selection.getContent()||"").trim(),n=t.dom.getParent(t.selection.getNode(),".quote_q");if(n)return n.className="quote_q quote-mce"+(e?` ${e}`:""),void t.nodeChanged();ue(function(e,t){const a=["quote_q","quote-mce"];t&&a.push(t);const n=""!==e.trim()?`

${e}

`:"

";return`
${n}

`}(a,e))},[ie,ue]),pe=(0,t.useCallback)(e=>{U(null),"table"===e.kind?ue(function({rows:e,cols:t,header:n,striped:o}){const r=Math.max(1,Math.min(20,e)),l=Math.max(1,Math.min(10,t)),i=e=>Array.from({length:l},(t,n)=>`<${e}>${"th"===e?y(`${(0,a.__)("列","jio")} ${n+1}`):""}`).join("");let c="";n&&(c+=`${i("th")}`);const s=Math.max(1,n?r-1:r);c+=`${Array.from({length:s},()=>`${i("td")}`).join("")}`;const u=["jio-content-table"];return o&&u.push("is-striped"),`${c}

`}(e)):"math"===e.kind?ue(function({formula:e,display:t}){const a=y(e.trim());return t?`

[jio_math display="1"]${a}[/jio_math]

`:`

[jio_math display="0"]${a}[/jio_math]

`}(e)):ue(function(e){const t=e.trim()||(0,a.__)("注释内容","jio");return`

[jio_footnote]${y(t)}[/jio_footnote]

`}(e.note))},[ue]),_e=(0,t.useCallback)(e=>{const t=i.current,n=window.JioSubmitMedia;t&&n&&"function"==typeof n.open?(le(),n.open({type:e,multiple:"image"===e&&void 0,onSelect:t=>{const a=Array.isArray(t)?t:[t],n=ie();if(!n)return;const o=a.map(t=>{const a=L(t?.large_url||t?.url);if(!a)return"";const n=Number(t.attachment_id||t.id||0),o=n>0?` data-edit-file-id="${n}"`:"";if("image"===e){const e=L(t?.url||a),n=e?` data-full-url="${M(e)}"`:"";return`

${M(String(t.name||t.title||

`}if("file"===e){const e=String(t.filename||t.name||a.split("/").pop()||"");return`

${M(e)}

`}return`

`}).join("");o&&(n.insertContent(o),n.nodeChanged(),X(n.getContent()),W(n))},onEmbed:e=>{const t=ie();t&&(t.insertContent(`${e}

`),t.nodeChanged(),X(t.getContent()),W(t))}})):T({tone:"error",text:(0,a.__)("媒体工具尚未加载,请刷新页面后重试。","jio")})},[ie,le]);return(0,e.createElement)("div",{className:"jio-creator","data-status":w.status||"","data-editor-ready":_?"true":"false"},(0,e.createElement)("header",{className:"jio-creator__bar"},(0,e.createElement)("div",{className:"jio-creator__bar-left"},(0,e.createElement)("a",{className:"jio-creator__back",href:w.urls?.center||"/","aria-label":(0,a.__)("返回作者中心","jio")},(0,e.createElement)("i",{className:"fa fas fa-angle-left","aria-hidden":"true"})),(0,e.createElement)("span",{className:"jio-creator__bar-brand"},"Jio"),(0,e.createElement)("span",{className:"jio-creator__bar-divider","aria-hidden":"true"}),(0,e.createElement)("span",{className:"jio-creator__bar-mode"},V?(0,a.__)("修改文章","jio"):(0,a.__)("写文章","jio"))),(0,e.createElement)(d,{ready:_,formatValue:k,onFormatChange:$,canUndo:g.canUndo,canRedo:g.canRedo,capabilities:J,onCommand:ce,onRememberSelection:le,onOpenLink:se,onOpenMedia:_e,onInsertBlock:de,onInsertQuote:me}),(0,e.createElement)("div",{className:"jio-creator__bar-actions jio-creator__toolbar-extension","data-toolbar-extension":!0,"aria-label":(0,a.__)("工具扩展区","jio")},(0,e.createElement)(h,{value:I}),(0,e.createElement)("button",{type:"button",className:"jio-creator__save-draft",onClick:()=>{Z(!1)},disabled:!_},(0,e.createElement)("i",{className:"fa fas fa-save","aria-hidden":"true"}),(0,e.createElement)("span",null,(0,a.__)("保存草稿","jio"))),(0,e.createElement)("button",{type:"button",className:"jio-creator__ghost jio-creator__preview",onClick:()=>{te()}},(0,a.__)("预览","jio")),(0,e.createElement)("button",{type:"button",className:"jio-creator__primary",onClick:()=>P(!0)},V?(0,a.__)("提交改稿","jio"):(0,a.__)("发布","jio")))),B&&(0,e.createElement)("div",{className:"jio-creator__notice",role:"status"},(0,e.createElement)("span",null,(0,a.__)("发现本地未同步的草稿。","jio")),(0,e.createElement)("button",{type:"button",onClick:re},(0,a.__)("恢复","jio")),(0,e.createElement)("button",{type:"button",onClick:()=>O(null)},(0,a.__)("忽略","jio"))),F&&(0,e.createElement)("div",{className:`jio-creator__notice is-${F.tone}`,role:"status"},(0,e.createElement)("span",null,F.text),(0,e.createElement)("button",{type:"button",onClick:()=>T(null),"aria-label":(0,a.__)("关闭","jio")},(0,e.createElement)("i",{className:"fa fas fa-times","aria-hidden":"true"}))),V&&(0,e.createElement)("p",{className:"jio-creator__hint"},(0,a.__)("这篇改稿不会立即覆盖线上文章;审核通过后才会替换。","jio")),(0,e.createElement)("main",{className:"jio-creator__canvas"},(0,e.createElement)("label",{className:"jio-creator__title"},(0,e.createElement)("span",{className:"screen-reader-text"},(0,a.__)("文章标题","jio")),(0,e.createElement)("textarea",{value:n.title,onChange:e=>Q({title:e.target.value}),rows:1,placeholder:(0,a.sprintf)(/* translators: %d: max title length */ /* translators: %d: max title length */ -(0,a.__)("请输入标题(最多 %d 个字)","jio"),Number(H.titleMax)||100),spellCheck:!1,maxLength:Number(H.titleMax)||100})),(0,e.createElement)("div",{className:"jio-creator__editor","data-editor-ready":_?"true":"false"},(0,e.createElement)("textarea",{id:x,defaultValue:n.content,onChange:e=>X(e.target.value),"aria-label":(0,a.__)("文章正文","jio")}))),(0,e.createElement)(b,{featured:n.featured,canEditCover:!!J.canUploadImage,canSchedule:!!J.canSchedule,scheduleEnabled:!!n.schedule.enabled,scheduleAt:n.schedule.at,onFeaturedChange:e=>Q({featured:e}),onScheduleChange:(e,t)=>Q({schedule:{enabled:e,at:t}})}),z&&(0,e.createElement)(N,{kind:z,onSubmit:pe,onClose:()=>U(null)}),D&&(0,e.createElement)(s,{draft:n,setDraft:Q,capabilities:J,limits:H,taxonomy:{categories:w.categories&&w.categories.items||[],tags:!!w.tags?.enabled,customDefs:w.customDefs||[]},isPublishedEdit:V,onClose:()=>P(!1),onSaveDraft:()=>{Z(!1)},onSubmit:e=>{ee(e)},privateStorage:!!w.privateStorage,privateUploads:w.privateUploads||[],captcha:!!w.captcha?.enabled,saving:"saving"===I.state||"submitting"===I.state}))}function I(){const a=document.getElementById("jio-creator-studio");a&&(a.classList.add("is-ready"),(0,t.createRoot)(a).render((0,e.createElement)($,null)))}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",I):I()})(); \ No newline at end of file +(()=>{"use strict";const e=window.React,t=window.wp.element,a=window.wp.i18n;function n(e,t){const a=e&&(e.message||e.error)||(401===t?"登录状态已失效,请刷新页面重新登录。":"请求失败,请稍后重试。"),n=new Error(String(a));return n.status=t,n.code=e&&e.code?String(e.code):"",n.data=e,n}async function o(e){try{return await e.json()}catch(e){return null}}async function r(e,t,a){const r=await fetch(e,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":a},body:JSON.stringify(t)}),l=await o(r);if(!r.ok)throw n(l,r.status);return l}async function l(e,t,a,r={}){const l=new FormData;l.append("file",t),Object.entries(r).forEach(([e,t])=>l.append(e,t));const i=await fetch(e,{method:"POST",credentials:"same-origin",headers:{"X-WP-Nonce":a},body:l}),c=await o(i);if(!i.ok)throw n(c,i.status);return c}const i=window.jioCreatorStudio||{},c=i.nonce||"";function s(n){const{draft:o,setDraft:r,capabilities:s,limits:d,taxonomy:u,isPublishedEdit:m,onClose:p,onSaveDraft:_,onSubmit:f,privateStorage:b,privateUploads:g,saving:h,captcha:j}=n,[y,E]=(0,t.useState)(""),[v,k]=(0,t.useState)(""),[N,w]=(0,t.useState)(!1),C=(0,t.useRef)(null),S=(0,t.useRef)(null);(0,t.useEffect)(()=>{const e=S.current,t=document.getElementById("jio-creator-captcha");if(!e||!t)return;const a=t.parentElement;return e.appendChild(t),t.removeAttribute("hidden"),()=>{a&&(a.appendChild(t),t.setAttribute("hidden",""))}},[]);const x=(0,t.useMemo)(()=>(o.title||"").trim().length,[o.title])>=Number(d.titleMin||1),M=()=>{const e=y.trim();if(!e)return;const t=e.split(/[,,\n]+/u).map(e=>e.trim()).filter(Boolean);r({tags:Array.from(new Set([...o.tags,...t]))}),E("")};return(0,e.createElement)("div",{className:"jio-creator-drawer",role:"dialog","aria-modal":"true","aria-labelledby":"jio-creator-publish-title"},(0,e.createElement)("button",{type:"button",className:"jio-creator-drawer__backdrop","aria-label":(0,a.__)("关闭","jio"),onClick:p}),(0,e.createElement)("div",{className:"jio-creator-drawer__panel"},(0,e.createElement)("header",{className:"jio-creator-drawer__head"},(0,e.createElement)("h2",{id:"jio-creator-publish-title"},m?(0,a.__)("提交改稿","jio"):(0,a.__)("发布文章","jio")),(0,e.createElement)("button",{type:"button",className:"jio-creator-drawer__close",onClick:p,"aria-label":(0,a.__)("关闭","jio")},(0,e.createElement)("i",{className:"fa fas fa-times","aria-hidden":"true"}))),(0,e.createElement)("div",{className:"jio-creator-drawer__body"},m&&(0,e.createElement)("p",{className:"jio-creator-drawer__note"},(0,a.__)("审核通过前,读者看到的仍然是当前线上版本。","jio")),(0,e.createElement)("section",{className:"jio-creator-field"},(0,e.createElement)("h3",null,(0,a.__)("分类","jio")),(0,e.createElement)("div",{className:"jio-creator-chips"},0===u.categories.length&&(0,e.createElement)("span",{className:"jio-creator-muted"},(0,a.__)("暂无可选分类","jio")),u.categories.map(t=>(0,e.createElement)("label",{key:t.id,className:"jio-creator-chip"+(o.categories.includes(t.id)?" is-active":"")},(0,e.createElement)("input",{type:"checkbox",checked:o.categories.includes(t.id),onChange:()=>(e=>{const t=o.categories.includes(e);r({categories:t?o.categories.filter(t=>t!==e):[...o.categories,e]})})(t.id)}),(0,e.createElement)("span",null,t.name))))),u.tags&&(0,e.createElement)("section",{className:"jio-creator-field"},(0,e.createElement)("h3",null,(0,a.__)("标签","jio")),(0,e.createElement)("div",{className:"jio-creator-chips"},o.tags.map(t=>(0,e.createElement)("span",{key:t,className:"jio-creator-chip is-active"},(0,e.createElement)("span",null,t),(0,e.createElement)("button",{type:"button",onClick:()=>r({tags:o.tags.filter(e=>e!==t)}),"aria-label":(0,a.sprintf)((0,a.__)("移除标签 %s","jio"),t)},(0,e.createElement)("i",{className:"fa fas fa-times","aria-hidden":"true"}))))),(0,e.createElement)("div",{className:"jio-creator-inline"},(0,e.createElement)("input",{type:"text",value:y,placeholder:(0,a.__)("输入标签,逗号分隔","jio"),onChange:e=>E(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),M())}}),(0,e.createElement)("button",{type:"button",onClick:M},(0,a.__)("添加","jio")))),u.customDefs.map(t=>(0,e.createElement)("section",{className:"jio-creator-field",key:t.key},(0,e.createElement)("h3",null,t.name),(0,e.createElement)("div",{className:"jio-creator-chips"},t.values.map(a=>{const n=o.custom[t.key]||[],l=n.includes(a.key);return(0,e.createElement)("label",{key:a.key,className:"jio-creator-chip"+(l?" is-active":"")},(0,e.createElement)("input",{type:"checkbox",checked:l,onChange:()=>r({custom:{...o.custom,[t.key]:l?n.filter(e=>e!==a.key):[...n,a.key]}})}),(0,e.createElement)("span",null,a.name))})))),s.canPay&&(0,e.createElement)("section",{className:"jio-creator-field"},(0,e.createElement)("div",{className:"jio-creator-switch"},(0,e.createElement)("div",null,(0,e.createElement)("h3",null,(0,a.__)("付费内容","jio")),(0,e.createElement)("p",{className:"jio-creator-muted"},(0,a.__)("开启后,未购买读者只能看到免费部分。","jio"))),(0,e.createElement)("label",{className:"jio-creator-toggle"},(0,e.createElement)("input",{type:"checkbox",checked:o.pay.enabled,onChange:e=>r({pay:{...o.pay,enabled:e.target.checked}})}),(0,e.createElement)("span",{"aria-hidden":"true"}))),o.pay.enabled&&(0,e.createElement)("div",{className:"jio-creator-pay"},(0,e.createElement)("div",{className:"jio-creator-inline"},(0,e.createElement)("label",null,(0,e.createElement)("input",{type:"radio",checked:"cash"===o.pay.modo,onChange:()=>r({pay:{...o.pay,modo:"cash"}})}),(0,e.createElement)("span",null,(0,a.__)("现金","jio"))),(0,e.createElement)("label",null,(0,e.createElement)("input",{type:"radio",checked:"points"===o.pay.modo,onChange:()=>r({pay:{...o.pay,modo:"points"}})}),(0,e.createElement)("span",null,(0,a.__)("积分","jio")))),"cash"===o.pay.modo?(0,e.createElement)("label",{className:"jio-creator-input"},(0,e.createElement)("span",null,(0,a.__)("价格","jio")),(0,e.createElement)("input",{type:"number",min:Number(d.priceMin||0),step:"0.01",value:o.pay.price,onChange:e=>r({pay:{...o.pay,price:e.target.value}})})):(0,e.createElement)("label",{className:"jio-creator-input"},(0,e.createElement)("span",null,(0,a.__)("积分价格","jio")),(0,e.createElement)("input",{type:"number",min:0,step:"1",value:o.pay.points,onChange:e=>r({pay:{...o.pay,points:Number(e.target.value)||0}})})),s.canPayDownload&&(0,e.createElement)("div",{className:"jio-creator-attachments"},(0,e.createElement)("div",{className:"jio-creator-attachments__head"},(0,e.createElement)("h4",null,(0,a.__)("资料附件","jio")),b?(0,e.createElement)("label",{className:"jio-creator-upload"},(0,e.createElement)("input",{ref:C,type:"file",onChange:()=>{(async()=>{const e=C.current?.files?.[0];if(e){k(""),w(!0);try{const t=await l(i.creator.privateUrl,e,c,{post_id:String(o.postId||0)}),a={type:"protected",assetKey:String(t.asset_key||""),fileName:String(t.name||e.name),sizeBytes:Number(t.size||e.size),sizeLabel:String(t.size_label||""),label:""};r({pay:{...o.pay,enabled:!0,downloads:[...o.pay.downloads,a]}}),C.current&&(C.current.value="")}catch(e){k(String(e?.message||(0,a.__)("资料上传失败","jio")))}finally{w(!1)}}})()},disabled:N}),(0,e.createElement)("span",null,N?(0,a.__)("上传中…","jio"):(0,a.__)("添加 PDF / ZIP","jio"))):(0,e.createElement)("p",{className:"jio-creator-muted"},(0,a.__)("私有附件存储尚未配置,暂时不能上传付费资料。","jio"))),v&&(0,e.createElement)("p",{className:"jio-creator-error"},v),o.pay.downloads.length>0&&(0,e.createElement)("ul",{className:"jio-creator-files"},o.pay.downloads.map((t,n)=>(0,e.createElement)("li",{key:`${t.assetKey||t.url}-${n}`},(0,e.createElement)("span",{className:"jio-creator-files__name"},t.assetKey?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("i",{className:"fa fas fa-lock","aria-hidden":"true"}),t.fileName||t.label||(0,a.__)("受保护资料","jio")):(0,e.createElement)(e.Fragment,null,(0,e.createElement)("i",{className:"fa fas fa-link","aria-hidden":"true"}),t.label||t.url)),t.sizeLabel&&(0,e.createElement)("span",{className:"jio-creator-muted"},t.sizeLabel),(0,e.createElement)("button",{type:"button",onClick:()=>(e=>{r({pay:{...o.pay,downloads:o.pay.downloads.filter((t,a)=>a!==e)}})})(n),"aria-label":(0,a.__)("移除","jio")},(0,e.createElement)("i",{className:"fa fas fa-times","aria-hidden":"true"}))))),g.length>0&&(0,e.createElement)("details",{className:"jio-creator-reuse"},(0,e.createElement)("summary",null,(0,a.__)("从已上传资料中选择","jio")),(0,e.createElement)("ul",null,g.filter(e=>!o.pay.downloads.some(t=>t.assetKey===e.assetKey)).map(t=>(0,e.createElement)("li",{key:t.assetKey},(0,e.createElement)("span",null,t.fileName),(0,e.createElement)("span",{className:"jio-creator-muted"},t.sizeLabel),(0,e.createElement)("button",{type:"button",onClick:()=>r({pay:{...o.pay,enabled:!0,downloads:[...o.pay.downloads,{...t,type:"protected"}]}})},(0,a.__)("使用","jio"))))))))),!s.canPay&&s.canSaveDraft&&(0,e.createElement)("p",{className:"jio-creator-muted"},(0,a.__)("当前账号不能设置付费内容。","jio"))),(0,e.createElement)("footer",{className:"jio-creator-drawer__foot"},j&&(0,e.createElement)("div",{className:"jio-creator-drawer__captcha",ref:S}),(0,e.createElement)("div",{className:"jio-creator-drawer__actions"},(0,e.createElement)("button",{type:"button",className:"jio-creator-ghost",onClick:_,disabled:h},(0,a.__)("保存草稿","jio")),(0,e.createElement)("button",{type:"button",className:"jio-creator-primary",onClick:()=>f(!1),disabled:h||!x},m?(0,a.__)("提交审核","jio"):s.canPublishNow?(0,a.__)("发布","jio"):(0,a.__)("提交审核","jio")),s.canPublishNow&&(0,e.createElement)("button",{type:"button",className:"jio-creator-link",onClick:()=>f(!0),disabled:h||!x},(0,a.__)("立即发布","jio"))))))}function d({label:t,icon:a,ready:n,onClick:o,title:r}){return(0,e.createElement)("button",{type:"button",className:"jio-creator__tool-btn",disabled:!n,onClick:o,title:r||t,"aria-label":r||t},(0,e.createElement)("i",{className:a,"aria-hidden":"true"}),(0,e.createElement)("span",{className:"jio-creator__tool-label"},t))}function u({ready:n,canUndo:o,canRedo:r,formatValue:l,onFormatChange:i,capabilities:c,onCommand:s,onRememberSelection:u,onOpenLink:m,onOpenMedia:p,onInsertBlock:_,onInsertQuote:f}){const[b,g]=(0,t.useState)(!1),h=(0,t.useRef)(null);return(0,t.useEffect)(()=>{if(!b)return;const e=e=>{h.current?.contains(e.target)||g(!1)},t=e=>{"Escape"===e.key&&g(!1)};return document.addEventListener("pointerdown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",t)}},[b]),(0,e.createElement)("div",{className:"jio-creator__toolbar-tools",role:"toolbar","aria-label":(0,a.__)("正文编辑工具","jio"),onMouseDown:e=>{u(),e.target.closest("button")&&e.preventDefault()}},(0,e.createElement)("div",{className:"jio-creator__toolbar-group",role:"group","aria-label":(0,a.__)("撤销和重做","jio")},(0,e.createElement)(d,{label:(0,a.__)("撤销","jio"),icon:"fa fas fa-undo",ready:o,onClick:()=>s("undo")}),(0,e.createElement)(d,{label:(0,a.__)("重做","jio"),icon:"fa fas fa-redo",ready:r,onClick:()=>s("redo")})),(0,e.createElement)("span",{className:"jio-creator__toolbar-divider","aria-hidden":"true"}),(0,e.createElement)("div",{className:"jio-creator__toolbar-group",role:"group","aria-label":(0,a.__)("段落样式","jio")},(0,e.createElement)("label",{className:"jio-creator__format-field"},(0,e.createElement)("select",{className:"jio-creator__format-select","aria-label":(0,a.__)("标题级别","jio"),value:"blockquote"===l?"p":l,disabled:!n,onFocus:u,onChange:e=>{i(e.target.value),s("format",e.target.value)}},(0,e.createElement)("option",{value:"p"},(0,a.__)("正文","jio")),(0,e.createElement)("option",{value:"h1"},(0,a.__)("标题 1","jio")),(0,e.createElement)("option",{value:"h2"},(0,a.__)("标题 2","jio")),(0,e.createElement)("option",{value:"h3"},(0,a.__)("标题 3","jio"))),(0,e.createElement)("i",{className:"fa fas fa-heading","aria-hidden":"true"}),(0,e.createElement)("span",{className:"jio-creator__tool-label"},(0,a.__)("标题","jio")))),(0,e.createElement)("span",{className:"jio-creator__toolbar-divider","aria-hidden":"true"}),(0,e.createElement)("div",{className:"jio-creator__toolbar-group",role:"group","aria-label":(0,a.__)("文字格式","jio")},(0,e.createElement)(d,{label:(0,a.__)("加粗","jio"),icon:"fa fas fa-bold",ready:n,onClick:()=>s("Bold")}),(0,e.createElement)(d,{label:(0,a.__)("斜体","jio"),icon:"fa fas fa-italic",ready:n,onClick:()=>s("Italic")}),(0,e.createElement)(d,{label:(0,a.__)("下划线","jio"),icon:"fa fas fa-underline",ready:n,onClick:()=>s("Underline")})),(0,e.createElement)("span",{className:"jio-creator__toolbar-divider","aria-hidden":"true"}),(0,e.createElement)("div",{className:"jio-creator__toolbar-group",role:"group","aria-label":(0,a.__)("段落块","jio")},(0,e.createElement)(d,{label:(0,a.__)("列表","jio"),icon:"fa fas fa-list-ul",ready:n,onClick:()=>_("list")}),(0,e.createElement)(d,{label:(0,a.__)("目录","jio"),icon:"fa fas fa-list-ol",ready:n,onClick:()=>_("toc")}),(0,e.createElement)("div",{className:"jio-creator__quote",ref:h},(0,e.createElement)(d,{label:(0,a.__)("引用","jio"),icon:"fa fas fa-quote-left",ready:n,onClick:()=>g(e=>!e)}),b&&(0,e.createElement)("div",{className:"jio-creator__quote-menu",role:"menu","aria-label":(0,a.__)("引用样式","jio")},[{key:"",label:(0,a.__)("灰色引用","jio"),className:""},{key:"qe_wzk_c-red",label:(0,a.__)("红色引用","jio"),className:"is-red"},{key:"qe_wzk_lan",label:(0,a.__)("蓝色引用","jio"),className:"is-blue"},{key:"qe_wzk_lv",label:(0,a.__)("绿色引用","jio"),className:"is-green"}].map(t=>(0,e.createElement)("button",{key:t.key||"default",type:"button",role:"menuitem",className:`jio-creator__quote-option ${t.className}`.trim(),onClick:()=>{g(!1),f(t.key)}},(0,e.createElement)("span",{className:"jio-creator__quote-swatch","aria-hidden":"true"}),t.label)))),(0,e.createElement)(d,{label:(0,a.__)("分割线","jio"),icon:"fa fas fa-minus",ready:n,onClick:()=>_("divider")}),(0,e.createElement)(d,{label:(0,a.__)("代码块","jio"),icon:"fa fas fa-code",ready:n,onClick:()=>_("code")}),(0,e.createElement)(d,{label:(0,a.__)("注释","jio"),icon:"fa fas fa-comment-dots",ready:n,onClick:()=>_("footnote")}),(0,e.createElement)(d,{label:(0,a.__)("公式","jio"),icon:"fa fas fa-square-root-alt",ready:n,onClick:()=>_("math")}),(0,e.createElement)(d,{label:(0,a.__)("表格","jio"),icon:"fa fas fa-table",ready:n,onClick:()=>_("table")})),(0,e.createElement)("span",{className:"jio-creator__toolbar-divider","aria-hidden":"true"}),(0,e.createElement)("div",{className:"jio-creator__toolbar-group",role:"group","aria-label":(0,a.__)("媒体和链接","jio")},c.canUploadImage&&(0,e.createElement)(d,{label:(0,a.__)("图片","jio"),icon:"fa far fa-image",ready:n,onClick:()=>p("image")}),(c.canUploadVideo||c.canEmbed)&&(0,e.createElement)(d,{label:(0,a.__)("视频","jio"),icon:"fa fas fa-video",ready:n,onClick:()=>p("video")}),(0,e.createElement)(d,{label:(0,a.__)("链接","jio"),icon:"fa fas fa-link",ready:n,onClick:m}),c.canUploadFile&&(0,e.createElement)(d,{label:(0,a.__)("附件","jio"),icon:"fa fas fa-paperclip",ready:n,onClick:()=>p("file")})))}const m=window.jioCreatorStudio||{},p=m.nonce||"",_=e=>String(e).padStart(2,"0");function f(e){return`${e.getFullYear()}-${_(e.getMonth()+1)}-${_(e.getDate())}T${_(e.getHours())}:${_(e.getMinutes())}`}function b({featured:n,canEditCover:o,canSchedule:r,scheduleEnabled:i,scheduleAt:c,onFeaturedChange:s,onScheduleChange:d}){const u=(0,t.useRef)(null),[_,b]=(0,t.useState)(!1),[g,h]=(0,t.useState)(""),j=(0,t.useMemo)(()=>f(new Date(Date.now()+3e5)),[]),y="string"==typeof n?.data?.url?n.data.url:"";return(0,e.createElement)("section",{className:"jio-creator__settings","aria-label":(0,a.__)("发布设置","jio")},(0,e.createElement)("h2",{className:"jio-creator__settings-title"},(0,a.__)("发布设置","jio")),o&&(0,e.createElement)("div",{className:"jio-creator__setting-row"},(0,e.createElement)("div",{className:"jio-creator__setting-copy"},(0,e.createElement)("span",{className:"jio-creator__setting-label"},(0,a.__)("添加封面","jio")),(0,e.createElement)("p",{className:"jio-creator__setting-help"},(0,a.__)("用于列表卡片、分享卡片;不设置时自动使用正文首图。","jio"))),(0,e.createElement)("div",{className:"jio-creator__cover-control"},y?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("button",{type:"button",className:"jio-creator__cover-preview",onClick:()=>u.current?.click(),"aria-label":(0,a.__)("更换封面","jio")},(0,e.createElement)("img",{src:y,alt:""})),(0,e.createElement)("button",{type:"button",className:"jio-creator__cover-clear",onClick:()=>s({type:"",data:{}}),"aria-label":(0,a.__)("移除封面","jio")},(0,e.createElement)("i",{className:"fa fas fa-times","aria-hidden":"true"}))):(0,e.createElement)("button",{type:"button",className:"jio-creator__cover-add",onClick:()=>u.current?.click(),disabled:_},(0,e.createElement)("i",{className:"fa fas fa-plus","aria-hidden":"true"}),(0,e.createElement)("span",null,_?(0,a.__)("上传中…","jio"):(0,a.__)("添加封面","jio"))),(0,e.createElement)("input",{ref:u,type:"file",accept:"image/*",className:"jio-creator__cover-input",onChange:()=>{(async()=>{const e=u.current?.files?.[0],t=m.media?.uploadUrl?.image;if(e&&t){h(""),b(!0);try{const n=await l(t,e,p),o=Number(n.attachment_id||n.id||0),r=String(n.url||"");if(!o||!r)throw new Error((0,a.__)("上传后无法读取图片。","jio"));s({type:"image",mediaId:o,data:{id:o,url:r}})}catch(e){h(String(e?.message||(0,a.__)("上传失败","jio")))}finally{b(!1),u.current&&(u.current.value="")}}})()}}))),g&&(0,e.createElement)("p",{className:"jio-creator-error"},g),(0,e.createElement)("div",{className:"jio-creator__setting-row"},(0,e.createElement)("div",{className:"jio-creator__setting-copy"},(0,e.createElement)("span",{className:"jio-creator__setting-label"},(0,a.__)("定时发布","jio")),(0,e.createElement)("p",{className:"jio-creator__setting-help"},r?(0,a.__)("开启后到点自动发布,发布前不会出现在文章列表。","jio"):(0,a.__)("当前账号提交后需要审核,审核通过后才会发布。","jio"))),(0,e.createElement)("label",{className:"jio-creator-toggle"},(0,e.createElement)("input",{type:"checkbox",checked:i,disabled:!r,onChange:e=>d(e.target.checked,c||f(new Date(Date.now()+36e5)))}),(0,e.createElement)("span",{"aria-hidden":"true"}))),r&&i&&(0,e.createElement)("div",{className:"jio-creator__schedule"},(0,e.createElement)("label",null,(0,e.createElement)("span",null,(0,a.__)("发布时间","jio")),(0,e.createElement)("input",{type:"datetime-local",value:c,min:j,onChange:e=>d(!0,e.target.value)})),(0,e.createElement)("p",{className:"jio-creator-muted"},(0,a.sprintf)(/* translators: %s: site timezone */ /* translators: %s: site timezone */ +(0,a.__)("按站点时区(%s)发布,至少需要晚于当前时间 1 分钟。","jio"),String(m.timezone||"UTC")))))}function g(e){const t=(e.downloads||[]).map(e=>{const t="string"==typeof e.assetKey?e.assetKey:"";if(t)return{type:"protected",asset_key:t,label:"string"==typeof e.label?e.label:""};const a="string"==typeof e.url?e.url.trim():"";return a?{type:"direct",url:a,label:"string"==typeof e.label?e.label:"",extract_code:"string"==typeof e.extractCode?e.extractCode:""}:null}).filter(Boolean);return{enabled:!!e.enabled,fields:{pay_type:e.enabled?t.length>0?"download":"reading":"no",pay_modo:"points"===e.modo?"points":"0",price:"points"===e.modo?"0.00":String(e.price||"0.00"),points_price:"points"===e.modo?Math.max(0,Number(e.points)||0):0,vip1_price:"points"===e.modo?"0.00":String(e.vip1Price||"0.00"),vip2_price:"points"===e.modo?"0.00":String(e.vip2Price||"0.00"),pay_limit:Number(e.payLimit)||0,downloads:t}}}const h=e=>e.replace(/&/g,"&").replace(/"/g,""").replace(//g,">");function j(e){if(!e||-1===e.indexOf("data-jio-")&&-1===e.indexOf("jio-code-lang"))return e;const t=document.createElement("div");return t.innerHTML=e,t.querySelectorAll("[data-jio-math-source]").forEach(e=>{const t=e.getAttribute("data-jio-math-source")||"",a="0"!==e.getAttribute("data-jio-math-display"),n=`[jio_math display="${a?"1":"0"}"]${t}[/jio_math]`,o=e.closest("p");a&&o&&o.textContent?.trim()===e.textContent?.trim()?o.textContent=n:e.replaceWith(document.createTextNode(n))}),t.querySelectorAll("[data-jio-footnote]").forEach(e=>{const t=e.getAttribute("data-jio-footnote")||"";e.replaceWith(document.createTextNode(`[jio_footnote]${t}[/jio_footnote]`))}),t.querySelectorAll(".jio-code-lang").forEach(e=>e.remove()),t.innerHTML}function y(e){return e&&-1!==e.indexOf("[jio_")?e.replace(/\[jio_math display="([01])"\]([\s\S]*?)\[\/jio_math\]/g,(e,t,a)=>"0"===t?`${E(a)}`:`

${E(a)}

`).replace(/\[jio_footnote\]([\s\S]*?)\[\/jio_footnote\]/g,(e,t)=>`${t}`):e}const E=e=>e.replace(/&/g,"&").replace(//g,">").replace(/\^\{([^{}]*)\}|\^(\S)/gu,"$1$2").replace(/_\{([^{}]*)\}|_(\S)/gu,"$1$2"),v={ready:(0,a.__)("尚未保存","jio"),saving:(0,a.__)("保存中…","jio"),saved:(0,a.__)("已保存","jio"),error:(0,a.__)("保存失败","jio"),conflict:(0,a.__)("内容已在别处更新","jio"),submitting:(0,a.__)("提交中…","jio"),submitted:(0,a.__)("已提交","jio")};function k({value:t}){return(0,e.createElement)("span",{className:`jio-creator__save is-${t.state}`,role:"status","aria-live":"polite"},(0,e.createElement)("i",{className:"fa fas fa-circle","aria-hidden":"true"}),(0,e.createElement)("span",null,v[t.state]||v.ready),"saved"===t.state&&t.at?(0,e.createElement)("time",null,t.at):null)}const N=36e5,w=24*N,C=30*w,S=365*w,x={ready:(0,a.__)("草稿","jio"),saving:(0,a.__)("保存中","jio"),saved:(0,a.__)("草稿","jio"),error:(0,a.__)("保存失败","jio"),conflict:(0,a.__)("冲突","jio"),submitting:(0,a.__)("提交中","jio"),submitted:(0,a.__)("已提交","jio")};function M({charCount:t,saveState:n,isPublishedEdit:o,saving:r,onSaveDraft:l,onPreview:i,onPublish:c}){const s=n.at?function(e,t=Date.now()){const n=Date.parse(e);if(!Number.isFinite(n))return"";const o=Math.max(0,t-n);return o<6e4?(0,a.__)("刚刚","jio"):oe.replace(/&/g,"&").replace(//g,">").replace(/"/g,"""),q=[{value:"generic",label:(0,a.__)("通用","jio")},{value:"javascript",label:"JavaScript"},{value:"typescript",label:"TypeScript"},{value:"php",label:"PHP"},{value:"python",label:"Python"},{value:"java",label:"Java"},{value:"go",label:"Go"},{value:"rust",label:"Rust"},{value:"csharp",label:"C#"},{value:"cpp",label:"C++"},{value:"sql",label:"SQL"},{value:"json",label:"JSON"},{value:"bash",label:"Shell"},{value:"css",label:"CSS"},{value:"html",label:"HTML"},{value:"markdown",label:"Markdown"}];const L=(e,t,a)=>Math.min(a,Math.max(t,Number.isFinite(e)?Math.round(e):t)),I={table:(0,a.__)("插入表格","jio"),math:(0,a.__)("插入公式","jio"),footnote:(0,a.__)("插入注释","jio")};function R({kind:n,onSubmit:o,onClose:r}){const[l,i]=(0,t.useState)(3),[c,s]=(0,t.useState)(3),[d,u]=(0,t.useState)(!0),[m,p]=(0,t.useState)(!1),[_,f]=(0,t.useState)("a^2 + b^2 = c^2"),[b,g]=(0,t.useState)(!0),[h,j]=(0,t.useState)(""),y=(0,t.useRef)(null),E=(0,t.useRef)(null),v=(0,t.useRef)(null),k=(0,t.useRef)(null);(0,t.useEffect)(()=>{(E.current||v.current||k.current)?.focus();const e=e=>{"Escape"===e.key&&(e.preventDefault(),r())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[r]);const N=(0,t.useMemo)(()=>"footnote"===n?""!==h.trim():"math"!==n||""!==_.trim(),[n,h,_]);return(0,e.createElement)("div",{className:"jio-creator-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"jio-creator-dialog-title"},(0,e.createElement)("button",{type:"button",className:"jio-creator-dialog__backdrop","aria-label":(0,a.__)("关闭","jio"),onClick:r}),(0,e.createElement)("div",{className:"jio-creator-dialog__panel",ref:y},(0,e.createElement)("header",{className:"jio-creator-dialog__head"},(0,e.createElement)("h2",{id:"jio-creator-dialog-title"},I[n]),(0,e.createElement)("button",{type:"button",className:"jio-creator-dialog__close",onClick:r,"aria-label":(0,a.__)("关闭","jio")},(0,e.createElement)("i",{className:"fa fas fa-times","aria-hidden":"true"}))),(0,e.createElement)("div",{className:"jio-creator-dialog__body"},"table"===n&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"jio-creator-dialog__row"},(0,e.createElement)("label",null,(0,e.createElement)("span",null,(0,a.__)("行数","jio")),(0,e.createElement)("input",{ref:E,type:"number",min:1,max:20,value:l,onChange:e=>i(Number(e.target.value))})),(0,e.createElement)("label",null,(0,e.createElement)("span",null,(0,a.__)("列数","jio")),(0,e.createElement)("input",{type:"number",min:1,max:10,value:c,onChange:e=>s(Number(e.target.value))}))),(0,e.createElement)("label",{className:"jio-creator-dialog__check"},(0,e.createElement)("input",{type:"checkbox",checked:d,onChange:e=>u(e.target.checked)}),(0,e.createElement)("span",null,(0,a.__)("首行为表头","jio"))),(0,e.createElement)("label",{className:"jio-creator-dialog__check"},(0,e.createElement)("input",{type:"checkbox",checked:m,onChange:e=>p(e.target.checked)}),(0,e.createElement)("span",null,(0,a.__)("隔行变色","jio")))),"math"===n&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("label",{className:"jio-creator-dialog__field"},(0,e.createElement)("span",null,(0,a.__)("公式","jio")),(0,e.createElement)("textarea",{ref:v,rows:3,value:_,onChange:e=>f(e.target.value),placeholder:"a^2 + b^2 = c^2"})),(0,e.createElement)("p",{className:"jio-creator-muted"},(0,a.__)("支持上标 ^ 与下标 _,例如 x^2 与 a_n;暂不支持完整 LaTeX。","jio")),(0,e.createElement)("label",{className:"jio-creator-dialog__check"},(0,e.createElement)("input",{type:"checkbox",checked:b,onChange:e=>g(e.target.checked)}),(0,e.createElement)("span",null,(0,a.__)("独占一行显示","jio")))),"footnote"===n&&(0,e.createElement)("label",{className:"jio-creator-dialog__field"},(0,e.createElement)("span",null,(0,a.__)("注释内容","jio")),(0,e.createElement)("textarea",{ref:k,rows:4,value:h,onChange:e=>j(e.target.value),placeholder:(0,a.__)("填写要补充说明的内容","jio")}))),(0,e.createElement)("footer",{className:"jio-creator-dialog__foot"},(0,e.createElement)("button",{type:"button",className:"jio-creator-dialog__ghost",onClick:r},(0,a.__)("取消","jio")),(0,e.createElement)("button",{type:"button",className:"jio-creator-dialog__primary",onClick:()=>{N&&o("table"!==n?"math"!==n?{kind:n,note:h.trim()}:{kind:n,formula:_.trim(),display:b}:{kind:n,rows:L(l,1,20),cols:L(c,1,10),header:d,striped:m})},disabled:!N},(0,a.__)("插入","jio")))))}const D=window.jioCreatorStudio||{},P=D.nonce||"",z=`jio-studio-${D.sourceId||0}`,A="jio-creator-content";function T(){const e=D.pay||{},t=D.categories&&D.categories.selected||[],a=D.tags&&D.tags.items||[];return{postId:Number(D.sourceId||0),versionId:Number(D.versionId||0),rev:Number(D.versionRev||0),title:String(D.title||""),content:String(D.content||""),schedule:{enabled:!1,at:""},categories:t.map(Number),tags:a.slice(),custom:D.custom||{},featured:D.featured||{type:"",data:{}},pay:{enabled:!!e.enabled,modo:"points"===e.payModo?"points":"cash",price:String(e.price||"0.00"),points:Number(e.points||0),vip1Price:String(e.vip1Price||"0.00"),vip2Price:String(e.vip2Price||"0.00"),payLimit:Number(e.payLimit||0),downloads:Array.isArray(e.downloads)?e.downloads:[]}}}function U(e){if(!e||e.removed)return;const t=e.getDoc(),a=e.getContentAreaContainer()?.querySelector("iframe");if(!t||!a)return;const n=Math.max(320,t.documentElement.scrollHeight,t.body?t.body.scrollHeight:0);a.style.height=`${n}px`,a.style.overflow="hidden"}function B(e){var t;const a=null!==(t=e?.getBody?.())&&void 0!==t?t:null;a&&a.querySelectorAll("pre.enlighter-pre[data-jio-code]").forEach(e=>{const t=e.querySelector(":scope > .jio-code-lang"),a=e.getAttribute("data-enlighter-language")||"generic";if(t){t.setAttribute("data-jio-code-lang",a);const e=q.find(e=>e.value===a)?.label||a;return void((t.textContent||"")!==e&&(t.textContent=e))}const n=document.createElement("span");n.className="jio-code-lang",n.contentEditable="false",n.setAttribute("data-jio-code-lang",a),n.textContent=q.find(e=>e.value===a)?.label||a,e.insertBefore(n,e.firstChild)})}function F(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")}function O(e){const t=String(e||"").trim();if(!t)return"";try{const e=new URL(t,window.location.href);return"http:"===e.protocol||"https:"===e.protocol?e.href:""}catch(e){return""}}function K(e){const t=document.createElement("div");return t.innerHTML=e,(t.textContent||"").replace(/\s+/g,"")}function H(){const[n,o]=(0,t.useState)(T),l=(0,t.useRef)(n);l.current=n;const i=(0,t.useRef)(null),c=(0,t.useRef)(null),d=(0,t.useRef)(null),m=(0,t.useRef)(!1),p=(0,t.useRef)(()=>{}),[_,f]=(0,t.useState)(!1),[h,E]=(0,t.useState)({canUndo:!1,canRedo:!1}),[v,k]=(0,t.useState)("p"),[N,w]=(0,t.useState)(()=>({state:D.sourceId||D.versionId||D.content?"saved":"ready",at:""})),[C,S]=(0,t.useState)(!1),[x,L]=(0,t.useState)(null),[I,H]=(0,t.useState)(null),J=(0,t.useRef)(null),[V,W]=(0,t.useState)(null),[Q,X]=(0,t.useState)(null),Y=(0,t.useRef)(!1),G=(0,t.useRef)(0),Z=D.capabilities||{},ee={titleMin:Number(D.limits?.titleMin||1),titleMax:Number(D.limits?.titleMax||30),titlePlaceholder:String(D.limits?.titlePlaceholder||(0,a.__)("请输入标题","jio")),priceMin:Number(D.pay?.priceMin||0),priceMax:Number(D.pay?.priceMax||0),pointsMin:Number(D.pay?.pointsMin||0),pointsMax:Number(D.pay?.pointsMax||0)},te=!!D.isPublished,ae=(0,t.useMemo)(()=>Array.from(K(n.content)).length,[n.content]),ne=(0,t.useCallback)(e=>{Y.current=!0,G.current+=1;const t={...l.current,...e};l.current=t,o(t)},[]),oe=(0,t.useCallback)(e=>{if(e===l.current.content)return;Y.current=!0,G.current+=1;const t={...l.current,content:e};l.current=t,o(t)},[]),re=(0,t.useCallback)(e=>{const t=e?.undoManager;t&&E({canUndo:"function"==typeof t.hasUndo&&t.hasUndo(),canRedo:"function"==typeof t.hasRedo&&t.hasRedo()})},[]),le=(0,t.useCallback)(e=>{const t=e?.selection?.getNode(),a=t?e.dom.getParent(t,"p,h1,h2,h3,blockquote")||t:null,n=a?.nodeName?.toLowerCase()||"p";k(["h1","h2","h3","blockquote"].includes(n)?n:"p")},[]),ie=(0,t.useCallback)((e={})=>{const t=l.current;return{post_id:t.postId,version_id:t.versionId,rev:t.rev,title:t.title,content:t.content,categories:t.categories,tags:t.tags,custom:t.custom,featured:t.featured,schedule:{enabled:!!t.schedule.enabled,at:t.schedule.enabled?t.schedule.at:""},pay:g(t.pay),...e}},[]),ce=(0,t.useCallback)(async(e=!1)=>{const t=i.current;t&&!t.removed&&oe(j(t.getContent()));const a=l.current;if(!Y.current&&(a.postId>0||a.versionId>0))return!0;const n=G.current,c=""!==a.title.trim()||""!==K(a.content).trim();if(e&&!c)return!0;w({state:"saving",at:""});try{const t=await r(D.creator.saveUrl,ie({autosave:e}),P),a={...l.current,postId:Number(t.post_id||l.current.postId||0),versionId:Number(t.version_id||l.current.versionId||0),rev:Number(t.rev||t.versionRev||l.current.rev||0)};window.jioSubmitData&&(window.jioSubmitData.postId=a.postId);const i=G.current===n;return Y.current=!i,l.current=a,o(a),w({state:i?"saved":"saving",at:i?(new Date).toLocaleTimeString():""}),i}catch(e){return w({state:409===e?.status?"conflict":"error",at:""}),!1}},[ie]);p.current=()=>{ce(!1)};const se=(0,t.useCallback)(async e=>{if(await ce(!1)){w({state:"submitting",at:""});try{let t="";const n=window.JioCaptcha;if(D.captcha?.enabled&&n&&"function"==typeof n.run){const e=await n.run("front_submit");if(null===e)return w({state:"ready",at:""}),void W({tone:"error",text:(0,a.__)("请先完成人机验证","jio")});t=String(e?.jio_captcha_proof||"")}const o=await r(D.creator.submitUrl,ie({post_id:l.current.postId,version_id:l.current.versionId,rev:l.current.rev,publish_now:e,captcha_proof:t}),P);Y.current=!1,w({state:"submitted",at:""}),W({tone:"ok",text:String(o.message||(0,a.__)("已提交","jio"))}),S(!1);const i=o.url||o.goto||D.urls?.center;i&&window.setTimeout(()=>{window.location.href=i},900)}catch(e){w({state:"error",at:""}),W({tone:"error",text:String(e?.message||(0,a.__)("提交失败","jio"))})}}else W({tone:"error",text:(0,a.__)("内容保存失败,请重试后再提交","jio")})},[ie,ce]),de=(0,t.useCallback)(async()=>{if(await ce(!1))try{const e=await r(D.creator.previewUrl,{post_id:l.current.postId,version_id:l.current.versionId},P);e.url&&window.open(String(e.url),"_blank","noopener")}catch(e){W({tone:"error",text:String(e?.message||(0,a.__)("预览失败","jio"))})}},[ce]),{markLocalSaved:ue,clear:me}=function({key:e,snapshot:a,onFound:n}){const o=(0,t.useRef)(a);o.current=a;const r=(0,t.useRef)(!1);return(0,t.useEffect)(()=>{if(!r.current){r.current=!0;try{const t=window.localStorage.getItem(e);if(!t)return;const o=JSON.parse(t),r="string"==typeof o.at?Date.parse(o.at):NaN;if(!Number.isFinite(r)||Date.now()-r>6048e5)return void window.localStorage.removeItem(e);"string"==typeof o.content&&o.content!==a.content&&n(String(o.at))}catch(t){window.localStorage.removeItem(e)}}},[e,n,a.content]),{markLocalSaved:(0,t.useCallback)(()=>{try{window.localStorage.setItem(e,JSON.stringify(o.current))}catch(e){}},[e]),clear:(0,t.useCallback)(()=>{try{window.localStorage.removeItem(e)}catch(e){}},[e])}}({key:z,snapshot:{title:n.title,content:n.content,at:(new Date).toISOString()},onFound:e=>X({savedAt:e})}),pe=function({enabled:e,onSave:a,onLocal:n,remoteDelay:o=4e3,localDelay:r=1500}){const l=(0,t.useRef)(null),i=(0,t.useRef)(null),c=(0,t.useRef)(!1),s=(0,t.useRef)(a),d=(0,t.useRef)(n);s.current=a,d.current=n;const u=(0,t.useCallback)(()=>{l.current&&(window.clearTimeout(l.current),l.current=null),i.current&&(window.clearTimeout(i.current),i.current=null)},[]),m=(0,t.useCallback)(async()=>{if(!c.current){c.current=!0;try{await s.current()}finally{c.current=!1}}},[]),p=(0,t.useCallback)(()=>{u(),d.current(),e&&(i.current=window.setTimeout(()=>d.current(),r),l.current=window.setTimeout(()=>{m()},o))},[u,e,m,r,o]);return(0,t.useEffect)(()=>{if(!e)return;const t=()=>{"hidden"===document.visibilityState&&m()},a=()=>{m()};return document.addEventListener("visibilitychange",t),window.addEventListener("blur",a),()=>{document.removeEventListener("visibilitychange",t),window.removeEventListener("blur",a),u()}},[u,e,m]),(0,t.useMemo)(()=>({schedule:p,flush:m,cancel:u}),[u,m,p])}({enabled:!!Z.isLoggedIn,onSave:async()=>{const e=await ce(!0);return e&&me(),e},onLocal:ue}).schedule;(0,t.useEffect)(()=>{Y.current&&pe()},[n,pe]),(0,t.useEffect)(()=>{const e=e=>{Y.current&&(e.preventDefault(),e.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[]),(0,t.useEffect)(()=>{const e=e=>{(e.metaKey||e.ctrlKey)&&"s"===e.key.toLowerCase()&&(e.preventDefault(),ce(!1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ce]),(0,t.useEffect)(()=>{const e=window.wp?.editor;if(!e||"function"!=typeof e.initialize)return void W({tone:"error",text:(0,a.__)("TinyMCE 加载失败,请刷新页面后重试。","jio")});const t={quicktags:!1,tinymce:{menubar:!1,statusbar:!1,resize:!1,toolbar1:"",toolbar2:"",toolbar3:"",plugins:"paste,link,lists,wordpress,wplink",wpautop:!0,body_class:"jio-creator__tinymce",content_css:D.creator?.contentCss||"",content_style:'\nbody {\n\tmargin: 0;\n\tcolor: #2b2b2b;\n\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;\n\tfont-size: 16px;\n\tline-height: 1.8;\n\tletter-spacing: 0.01em;\n}\np { margin: 0 0 1.1em; }\nh1, h2, h3, h4, h5, h6 { margin: 1.5em 0 0.65em; line-height: 1.4; }\nimg, iframe { max-width: 100%; }\nimg { height: auto; }\n\n/* 代码块:右上角显示当前语言,点击即可更换(交互在父组件里接管)。 */\n.enlighter-pre {\n\tposition: relative;\n\tmargin: 0 0 1.1em;\n\tpadding: 40px 14px 14px;\n\toverflow: auto;\n\tborder-radius: 8px;\n\tbackground: #f2f4f5;\n\tcursor: pointer;\n}\n.enlighter-pre code.gl {\n\tdisplay: block;\n\tborder: 0;\n\tbackground: transparent;\n\tcolor: #2b2b2b;\n\tfont-family: Consolas, Monaco, monospace;\n\tfont-size: 13px;\n\tline-height: 1.5;\n\twhite-space: pre-wrap;\n}\n.enlighter-pre .jio-code-lang {\n\tposition: absolute;\n\ttop: 9px;\n\tright: 9px;\n\tpadding: 3px 10px;\n\tborder-radius: 4px;\n\tbackground: linear-gradient(135deg, #3dcabd 10%, #254bdd 100%);\n\tcolor: #fff;\n\tfont-size: 12px;\n\tline-height: 1.5;\n\tcursor: pointer;\n\tuser-select: none;\n}\n.enlighter-pre .jio-code-lang:hover {\n\tfilter: brightness(1.08);\n}\n\n/* 引用:与前台主题的 .quote_q 视觉一致。 */\n.quote_q {\n\tposition: relative;\n\tmargin: 10px 0 20px;\n\tpadding: 1.2em;\n\tborder-radius: 6px;\n\tcolor: var(--quote-color, #555);\n\tbackground: rgba(85, 85, 85, 0.04);\n}\n.quote_q.qe_wzk_c-red { --quote-color: #dc3f3f; background: rgba(220, 63, 63, 0.05); }\n.quote_q.qe_wzk_lan { --quote-color: #0092ff; background: rgba(0, 146, 255, 0.05); }\n.quote_q.qe_wzk_lv { --quote-color: #23790e; background: rgba(35, 121, 14, 0.05); }\n.quote_q::after {\n\tposition: absolute;\n\ttop: 18px;\n\tleft: 18px;\n\tcolor: var(--quote-color, #555);\n\tcontent: \'\\201C\';\n\tfont-size: 1.4em;\n\tline-height: 1;\n\topacity: 0.6;\n}\n.quote_q > div { padding-left: 2em; opacity: 0.85; }\n.quote_q > div > p:last-child { margin-bottom: 0; }\n\n/* 表格。 */\n.jio-content-table {\n\twidth: 100%;\n\tmargin: 0 0 1.1em;\n\tborder-collapse: collapse;\n\tfont-size: 14px;\n}\n.jio-content-table th,\n.jio-content-table td {\n\tpadding: 10px 12px;\n\tborder: 1px solid #e6e9e8;\n\tline-height: 1.6;\n}\n.jio-content-table thead th {\n\tbackground: #f6f8f7;\n\tfont-weight: 600;\n\ttext-align: left;\n}\n.jio-content-table.is-striped tbody tr:nth-child(odd) td { background: #f7f9f8; }\n\n/* 公式。 */\n.jio-math {\n\tfont-family: "Cambria Math", "Latin Modern Math", "Times New Roman", serif;\n\tfont-size: 1.05em;\n\twhite-space: pre-wrap;\n}\n.jio-math--block {\n\tdisplay: block;\n\tmargin: 12px 0;\n\tpadding: 10px;\n\tborder-radius: 6px;\n\tbackground: #f8faf9;\n\ttext-align: center;\n}\n.jio-math sup, .jio-math sub { font-size: 0.72em; }\n.jio-toc-placeholder {\n\theight: 40px;\n\tmargin: 0 0 1.1em;\n\tborder: 1px dashed #d3ded8;\n\tborder-radius: 8px;\n\tbackground: #f7faf9;\n\tcolor: #8c9a94;\n\tfont-size: 12px;\n\tline-height: 40px;\n\ttext-align: center;\n}\n.jio-toc-placeholder::after { content: \'目录将在发布后自动生成\'; }\n\n/* 注释:编辑器里显示上标标记,发布后由服务端渲染编号与注释列表。 */\n.jio-footnote-ref {\n\tdisplay: inline-block;\n\tmax-width: 100%;\n\tpadding: 0 6px;\n\tborder-radius: 4px;\n\tbackground: #eef5f2;\n\tcolor: #267665;\n\tfont-size: 0.78em;\n\tline-height: 1.6;\n\tvertical-align: super;\n\tcursor: default;\n}\n.jio-footnote-ref::before {\n\tcontent: \'注 \';\n\topacity: 0.6;\n}\n\n/* 附件链接。 */\n.jio-file-link {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 6px;\n\tpadding: 6px 12px;\n\tborder: 1px solid #e6e9e8;\n\tborder-radius: 6px;\n\tbackground: #f7f8f8;\n\ttext-decoration: none;\n}\n',height:520,placeholder:String(D.limits?.contentPlaceholder||""),setup:e=>{i.current=e,e.on("init",()=>{m.current=!0,f(!0),null!==d.current?(e.setContent(y(d.current)),d.current=null):e.setContent(y(e.getContent())),B(e),U(e),function(e){const t=e.getDoc();if(!t||t.getElementById("jio-block-actions"))return;const a=t.createElement("div");a.id="jio-block-actions",a.className="jio-creator__block-actions",a.innerHTML='',t.body.appendChild(a);let n=null;const o=()=>{n=null,a.classList.remove("is-visible")};t.addEventListener("mouseover",e=>{const r=e.target?.closest?.("table,pre.enlighter-pre,hr,.quote_q,p");r&&r!==t.body&&!r.classList.contains("jio-code-lang")&&(e=>{if(!e||e===t.body)return void o();if("P"===e.tagName&&""===(e.textContent||"").trim())return void o();n=e;const r=e.getBoundingClientRect();a.style.top=`${r.top+t.documentElement.scrollTop+6}px`,a.style.left=r.right-40+"px",a.classList.add("is-visible")})(r)}),t.addEventListener("mouseleave",o),a.addEventListener("mousedown",e=>e.preventDefault()),a.addEventListener("click",t=>{const a=t.target?.closest("[data-jio-block-delete]");if(!a||!n)return;t.preventDefault();const r=n;o(),e.undoManager.transact(()=>{e.dom.remove(r)}),e.nodeChanged(),e.undoManager.add(),0===e.getBody().children.length&&(e.setContent("

"),e.selection.setCursorLocation(e.getBody().firstChild,0)),U(e)})}(e),re(e),le(e)}),e.on("NodeChange",()=>le(e)),e.on("input change Undo Redo AddUndo",()=>{oe(j(e.getContent())),re(e),B(e),U(e)}),e.on("keydown",t=>{if((t.metaKey||t.ctrlKey)&&83===t.keyCode)return t.preventDefault(),void p.current();!function(e,t){const a=Number(t.keyCode);if(8!==a&&46!==a)return;const n=e.selection;if(!n||!n.isCollapsed())return;const o=e.getBody(),r=n.getNode(),l=(i=r)&&1===i.nodeType&&""===(i.textContent||"").trim()&&!e.dom.getParent(i,"table,pre,hr,.quote_q,.jio-math--block,.jio-toc-placeholder",o)?r:null;var i;const c=l?8===a?l.previousElementSibling:l.nextElementSibling:null;if((e=>!!e&&1===e.nodeType&&!!e.matches?.("table,pre,hr,.quote_q,.jio-math--block,.jio-toc-placeholder"))(c))return t.preventDefault(),e.dom.remove(c),e.nodeChanged(),void e.undoManager.add();const s=e.dom.getParent(r,"table,pre,hr,.quote_q,.jio-math--block,.jio-toc-placeholder",o);if(!s)return;const d=t=>{const a=e.dom.createRng();a.selectNodeContents(s),a.collapse(t);const o=n.getRng();return o&&"function"==typeof o.compareBoundaryPoints&&0===o.compareBoundaryPoints(t?1:3,a)};if(!(8===a&&d(!0)||46===a&&d(!1)))return;t.preventDefault();const u=s.parentElement;e.dom.remove(s),u&&0===u.children.length&&(e.setContent("

"),e.selection.setCursorLocation(e.getBody().firstChild,0)),e.nodeChanged(),e.undoManager.add()}(e,t)})}}};return e.initialize(A,t),()=>{e.remove?.(A),m.current=!1,i.current=null}},[oe]);const _e=(0,t.useCallback)(()=>{try{const e=window.localStorage.getItem(z);if(e){const t=JSON.parse(e),a={};"string"==typeof t.title&&(a.title=t.title),"string"==typeof t.content&&(a.content=t.content),ne(a),"string"==typeof t.content&&(m.current?i.current?.setContent(t.content):d.current=t.content)}}catch(e){}X(null)},[ne]),fe=(0,t.useCallback)(()=>{const e=i.current;e&&!e.removed&&(c.current=e.selection.getBookmark(2,!0))},[]),be=(0,t.useCallback)(()=>{const e=i.current;if(!e||e.removed)return null;if(e.focus(),c.current){try{e.selection.moveToBookmark(c.current)}catch(e){}c.current=null}return e},[]),ge=(0,t.useCallback)((e,t)=>{const a=be();a&&("undo"===e?a.undoManager.undo():"redo"===e?a.undoManager.redo():"format"===e?("p"===t?a.execCommand("FormatBlock",!1,"p"):a.formatter.toggle(t||"h2"),le(a)):a.execCommand(e),a.nodeChanged())},[be]),he=(0,t.useCallback)(()=>{const e=be();if(!e)return;const t=window.wpLink;if(t&&"function"==typeof t.open)return void t.open(e.id);const n=window.prompt((0,a.__)("输入链接地址","jio"),"https://"),o=n?O(n):"";o&&e.execCommand("mceInsertLink",!1,{href:o})},[be]),je=(0,t.useCallback)(e=>{const t=be();t&&e&&(t.insertContent(e),t.nodeChanged(),oe(j(t.getContent())),re(t),B(t))},[be]),ye=(0,t.useCallback)(e=>{fe(),"table"!==e&&"math"!==e&&"footnote"!==e?"code"!==e?"list"!==e?"toc"!==e?"divider"===e&&je("

"):je("

[jio_toc]

"):je("

"):je(function(e="generic",t=""){const n=$(""!==t?t:(0,a.__)("在此输入代码","jio"));return`
`+n+"

"}("generic")):L(e)},[je,fe]),Ee=(0,t.useCallback)(e=>{const t=be();if(!t)return;const a=String(t.selection.getContent()||"").trim(),n=t.dom.getParent(t.selection.getNode(),".quote_q");if(n)return n.className="quote_q quote-mce"+(e?` ${e}`:""),void t.nodeChanged();je(function(e,t){const a=["quote_q","quote-mce"];t&&a.push(t);const n=""!==e.trim()?`

${e}

`:"

";return`
${n}

`}(a,e))},[be,je]),ve=(0,t.useCallback)(e=>{L(null),"table"===e.kind?je(function({rows:e,cols:t,header:n,striped:o}){const r=Math.max(1,Math.min(20,e)),l=Math.max(1,Math.min(10,t)),i=e=>Array.from({length:l},(t,n)=>`<${e}>${"th"===e?$(`${(0,a.__)("列","jio")} ${n+1}`):""}`).join("");let c="";n&&(c+=`${i("th")}`);const s=Math.max(1,n?r-1:r);c+=`${Array.from({length:s},()=>`${i("td")}`).join("")}`;const d=["jio-content-table"];return o&&d.push("is-striped"),`${c}

`}(e)):"math"===e.kind?je(function({formula:e,display:t}){const a=(n=e.trim(),$(n).replace(/\^\{([^{}]*)\}|\^(\S)/gu,"$1$2").replace(/_\{([^{}]*)\}|_(\S)/gu,"$1$2"));var n;const o=`data-jio-math-source="${$(e.trim())}" data-jio-math-display="${t?"1":"0"}"`;return t?`

${a}

`:`${a}`}(e)):je(function(e){const t=e.trim()||(0,a.__)("注释内容","jio");return`${$(t)}`}(e.note))},[je]),ke=(0,t.useCallback)(e=>{const t=i.current,n=window.JioSubmitMedia;t&&n&&"function"==typeof n.open?(fe(),n.open({type:e,multiple:"image"===e&&void 0,onSelect:t=>{const a=Array.isArray(t)?t:[t],n=be();if(!n)return;const o=a.map(t=>{const a=O(t?.large_url||t?.url);if(!a)return"";const n=Number(t.attachment_id||t.id||0),o=n>0?` data-edit-file-id="${n}"`:"";if("image"===e){const e=O(t?.url||a),n=e?` data-full-url="${F(e)}"`:"";return`

${F(String(t.name||t.title||

`}if("file"===e){const e=String(t.filename||t.name||a.split("/").pop()||"");return`

${F(e)}

`}return`

`}).join("");o&&(n.insertContent(o),n.nodeChanged(),oe(n.getContent()),re(n))},onEmbed:e=>{const t=be();t&&(t.insertContent(`${e}

`),t.nodeChanged(),oe(t.getContent()),re(t))}})):W({tone:"error",text:(0,a.__)("媒体工具尚未加载,请刷新页面后重试。","jio")})},[be,fe]);return(0,e.createElement)("div",{className:"jio-creator","data-status":D.status||"","data-editor-ready":_?"true":"false"},(0,e.createElement)("header",{className:"jio-creator__bar"},(0,e.createElement)("div",{className:"jio-creator__bar-left"},(0,e.createElement)("a",{className:"jio-creator__back",href:D.urls?.center||"/","aria-label":(0,a.__)("返回作者中心","jio")},(0,e.createElement)("i",{className:"fa fas fa-angle-left","aria-hidden":"true"})),(0,e.createElement)("span",{className:"jio-creator__bar-brand"},"Jio"),(0,e.createElement)("span",{className:"jio-creator__bar-divider","aria-hidden":"true"}),(0,e.createElement)("span",{className:"jio-creator__bar-mode"},te?(0,a.__)("修改文章","jio"):(0,a.__)("写文章","jio"))),(0,e.createElement)(u,{ready:_,formatValue:v,onFormatChange:k,canUndo:h.canUndo,canRedo:h.canRedo,capabilities:Z,onCommand:ge,onRememberSelection:fe,onOpenLink:he,onOpenMedia:ke,onInsertBlock:ye,onInsertQuote:Ee})),Q&&(0,e.createElement)("div",{className:"jio-creator__notice",role:"status"},(0,e.createElement)("span",null,(0,a.__)("发现本地未同步的草稿。","jio")),(0,e.createElement)("button",{type:"button",onClick:_e},(0,a.__)("恢复","jio")),(0,e.createElement)("button",{type:"button",onClick:()=>X(null)},(0,a.__)("忽略","jio"))),V&&(0,e.createElement)("div",{className:`jio-creator__notice is-${V.tone}`,role:"status"},(0,e.createElement)("span",null,V.text),(0,e.createElement)("button",{type:"button",onClick:()=>W(null),"aria-label":(0,a.__)("关闭","jio")},(0,e.createElement)("i",{className:"fa fas fa-times","aria-hidden":"true"}))),te&&(0,e.createElement)("p",{className:"jio-creator__hint"},(0,a.__)("这篇改稿不会立即覆盖线上文章;审核通过后才会替换。","jio")),(0,e.createElement)("main",{className:"jio-creator__canvas"},(0,e.createElement)("label",{className:"jio-creator__title"},(0,e.createElement)("span",{className:"screen-reader-text"},(0,a.__)("文章标题","jio")),(0,e.createElement)("textarea",{value:n.title,onChange:e=>ne({title:e.target.value}),rows:1,placeholder:(0,a.sprintf)(/* translators: %d: max title length */ /* translators: %d: max title length */ +(0,a.__)("请输入标题(最多 %d 个字)","jio"),Number(ee.titleMax)||100),spellCheck:!1,maxLength:Number(ee.titleMax)||100})),(0,e.createElement)("div",{className:"jio-creator__editor","data-editor-ready":_?"true":"false"},(0,e.createElement)("textarea",{id:A,defaultValue:n.content,onChange:e=>oe(e.target.value),"aria-label":(0,a.__)("文章正文","jio")}))),(0,e.createElement)(b,{featured:n.featured,canEditCover:!!Z.canUploadImage,canSchedule:!!Z.canSchedule,scheduleEnabled:!!n.schedule.enabled,scheduleAt:n.schedule.at,onFeaturedChange:e=>ne({featured:e}),onScheduleChange:(e,t)=>ne({schedule:{enabled:e,at:t}})}),null!==I&&(0,e.createElement)("div",{className:"jio-creator-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"jio-code-lang-title"},(0,e.createElement)("button",{type:"button",className:"jio-creator-dialog__backdrop","aria-label":(0,a.__)("关闭","jio"),onClick:()=>H(null)}),(0,e.createElement)("div",{className:"jio-creator-dialog__panel"},(0,e.createElement)("header",{className:"jio-creator-dialog__head"},(0,e.createElement)("h2",{id:"jio-code-lang-title"},(0,a.__)("代码语言","jio")),(0,e.createElement)("button",{type:"button",className:"jio-creator-dialog__close",onClick:()=>H(null),"aria-label":(0,a.__)("关闭","jio")},(0,e.createElement)("i",{className:"fa fas fa-times","aria-hidden":"true"}))),(0,e.createElement)("div",{className:"jio-creator-dialog__body"},(0,e.createElement)("div",{className:"jio-creator__lang-grid"},q.map(t=>(0,e.createElement)("button",{key:t.value,type:"button",className:"jio-creator__lang-item"+(t.value===I?" is-active":""),onClick:()=>{const e=J.current;if(J.current=null,H(null),!e)return;e.setAttribute("data-enlighter-language",t.value);const a=e.querySelector("code");a&&a.setAttribute("data-enlighter-language",t.value),B(i.current),oe(j(i.current.getContent()))}},t.label)))))),x&&(0,e.createElement)(R,{kind:x,onSubmit:ve,onClose:()=>L(null)}),(0,e.createElement)(M,{charCount:ae,saveState:N,isPublishedEdit:te,saving:!_||"saving"===N.state||"submitting"===N.state,onSaveDraft:()=>{ce(!1)},onPreview:()=>{de()},onPublish:()=>S(!0)}),C&&(0,e.createElement)(s,{draft:n,setDraft:ne,capabilities:Z,limits:ee,taxonomy:{categories:D.categories&&D.categories.items||[],tags:!!D.tags?.enabled,customDefs:D.customDefs||[]},isPublishedEdit:te,onClose:()=>S(!1),onSaveDraft:()=>{ce(!1)},onSubmit:e=>{se(e)},privateStorage:!!D.privateStorage,privateUploads:D.privateUploads||[],captcha:!!D.captcha?.enabled,saving:"saving"===N.state||"submitting"===N.state}))}function J(){const a=document.getElementById("jio-creator-studio");a&&(a.classList.add("is-ready"),(0,t.createRoot)(a).render((0,e.createElement)(H,null)))}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",J):J()})(); \ No newline at end of file diff --git a/assets/creator-studio/src/components/status-bar.tsx b/assets/creator-studio/src/components/status-bar.tsx new file mode 100644 index 00000000..3abfe433 --- /dev/null +++ b/assets/creator-studio/src/components/status-bar.tsx @@ -0,0 +1,125 @@ +/** + * 底部固定状态栏。 + * + * 与公众号/知乎一致:左侧是字数与输入法状态,中间是草稿时间,右侧是预览与发布。 + * 固定在视口底部,不随正文滚动。 + * + * @package Jio + */ + +import { __, sprintf } from '@wordpress/i18n'; + +import { SaveState, type SaveStateValue } from './save-state'; + +type Props = { + charCount: number; + saveState: SaveStateValue; + isPublishedEdit: boolean; + saving: boolean; + onSaveDraft: () => void; + onPreview: () => void; + onPublish: () => void; +}; + +const MINUTE = 60 * 1000; +const HOUR = 60 * MINUTE; +const DAY = 24 * HOUR; +const MONTH = 30 * DAY; +const YEAR = 365 * DAY; + +/** 相对时间:刚刚 / X分钟前 / X小时前 … 与参考编辑器一致。 */ +export function relativeTime(iso: string, now = Date.now()): string { + const at = Date.parse(iso); + if (!Number.isFinite(at)) { + return ''; + } + const diff = Math.max(0, now - at); + if (diff < MINUTE) { + return __('刚刚', 'jio'); + } + if (diff < HOUR) { + return sprintf( + /* translators: %d: minutes */ + __('%d分钟前', 'jio'), + Math.floor(diff / MINUTE) + ); + } + if (diff < DAY) { + return sprintf( + /* translators: %d: hours */ + __('%d小时前', 'jio'), + Math.floor(diff / HOUR) + ); + } + if (diff < MONTH) { + return sprintf( + /* translators: %d: days */ + __('%d天前', 'jio'), + Math.floor(diff / DAY) + ); + } + if (diff < YEAR) { + return sprintf( + /* translators: %d: months */ + __('%d个月前', 'jio'), + Math.floor(diff / MONTH) + ); + } + return sprintf( + /* translators: %d: years */ + __('%d年前', 'jio'), + Math.floor(diff / YEAR) + ); +} + +const STATUS_LABELS: Record = { + ready: __('草稿', 'jio'), + saving: __('保存中', 'jio'), + saved: __('草稿', 'jio'), + error: __('保存失败', 'jio'), + conflict: __('冲突', 'jio'), + submitting: __('提交中', 'jio'), + submitted: __('已提交', 'jio'), +}; + +export function StatusBar({ + charCount, + saveState, + isPublishedEdit, + saving, + onSaveDraft, + onPreview, + onPublish, +}: Props) { + const savedAt = saveState.at ? relativeTime(saveState.at) : ''; + const status = STATUS_LABELS[saveState.state] || STATUS_LABELS.ready; + + return ( +
+
+ + {__('字数', 'jio')}:{charCount} + + {__('Markdown 语法输入中', 'jio')} +
+ +
+ + + {savedAt || status} +
+ +
+ + + +
+
+ ); +} diff --git a/assets/creator-studio/src/editor-content-style.ts b/assets/creator-studio/src/editor-content-style.ts index 6fb09106..8ff3c607 100644 --- a/assets/creator-studio/src/editor-content-style.ts +++ b/assets/creator-studio/src/editor-content-style.ts @@ -42,7 +42,7 @@ img { height: auto; } line-height: 1.5; white-space: pre-wrap; } -.enlighter-pre::before { +.enlighter-pre .jio-code-lang { position: absolute; top: 9px; right: 9px; @@ -50,10 +50,13 @@ img { height: auto; } border-radius: 4px; background: linear-gradient(135deg, #3dcabd 10%, #254bdd 100%); color: #fff; - content: attr(data-jio-code-label); font-size: 12px; line-height: 1.5; - pointer-events: none; + cursor: pointer; + user-select: none; +} +.enlighter-pre .jio-code-lang:hover { + filter: brightness(1.08); } /* 引用:与前台主题的 .quote_q 视觉一致。 */ @@ -101,9 +104,21 @@ img { height: auto; } } .jio-content-table.is-striped tbody tr:nth-child(odd) td { background: #f7f9f8; } -/* 公式与目录占位。 */ -.jio-math { font-family: "Cambria Math", "Latin Modern Math", "Times New Roman", serif; } -.jio-math--block { display: block; margin: 12px 0; text-align: center; } +/* 公式。 */ +.jio-math { + font-family: "Cambria Math", "Latin Modern Math", "Times New Roman", serif; + font-size: 1.05em; + white-space: pre-wrap; +} +.jio-math--block { + display: block; + margin: 12px 0; + padding: 10px; + border-radius: 6px; + background: #f8faf9; + text-align: center; +} +.jio-math sup, .jio-math sub { font-size: 0.72em; } .jio-toc-placeholder { height: 40px; margin: 0 0 1.1em; @@ -117,13 +132,22 @@ img { height: auto; } } .jio-toc-placeholder::after { content: '目录将在发布后自动生成'; } -/* 注释上标:编辑器里只显示序号,发布后由服务端渲染脚注列表。 */ -.jio-footnote-ref, -.jio-footnote-ref a { +/* 注释:编辑器里显示上标标记,发布后由服务端渲染编号与注释列表。 */ +.jio-footnote-ref { + display: inline-block; + max-width: 100%; + padding: 0 6px; + border-radius: 4px; + background: #eef5f2; color: #267665; - font-size: 0.8em; - text-decoration: none; + font-size: 0.78em; + line-height: 1.6; vertical-align: super; + cursor: default; +} +.jio-footnote-ref::before { + content: '注 '; + opacity: 0.6; } /* 附件链接。 */ diff --git a/assets/creator-studio/src/index.tsx b/assets/creator-studio/src/index.tsx index 4c441608..29862bc3 100644 --- a/assets/creator-studio/src/index.tsx +++ b/assets/creator-studio/src/index.tsx @@ -7,19 +7,22 @@ * @package Jio */ -import { createRoot, useCallback, useEffect, useRef, useState } from '@wordpress/element'; +import { createRoot, useCallback, useEffect, useMemo, useRef, useState } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; import { apiPost } from './services/api'; import { PublishDrawer } from './panels/publish-drawer'; import { EditorToolbar } from './components/editor-toolbar'; import { PublishSettings } from './components/publish-settings'; -import { SaveState, type SaveStateValue } from './components/save-state'; +import { type SaveStateValue } from './components/save-state'; import { useAutosave } from './hooks/use-autosave'; import { useLocalRecovery } from './hooks/use-local-recovery'; import { normalizePayForRequest } from './utils/pay'; import { EDITOR_CONTENT_STYLE } from './editor-content-style'; +import { hydrateBlocks, serializeBlocks } from './utils/serialize'; +import { StatusBar } from './components/status-bar'; import { + CODE_LANGUAGES, codeBlockMarkup, dividerMarkup, footnoteMarkup, @@ -174,6 +177,160 @@ function removeAdjacentBlock(editor: any, event: any): void { editor.undoManager.add(); } +/** + * 在编辑器里为每个代码块渲染语言角标,并保证回车不会跳出代码区。 + * + * 角标是编辑期提示(纯 UI),保存前由 serializeBlocks 移除。 + */ +/** + * 在代码块内回车时保持在代码里换行,而不是跳出到普通段落。 + * + * TinyMCE 默认把 pre 当成不可持续输入的块,回车会新建段落,导致代码跑到 + * 代码块外面。这里手动插入换行并保持光标在 code 内。 + */ +/** + * 让 iframe 高度跟随正文增长,避免编辑器内部出现第二根滚动条。 + * + * TinyMCE 的 iframe 不会自动撑高;这里测量内容高度并同步容器, + * 页面整体滚动由外层工作台负责。 + */ +function syncEditorHeight(editor: any): void { + if (!editor || editor.removed) { + return; + } + const doc = editor.getDoc(); + const iframe = editor.getContentAreaContainer()?.querySelector('iframe') as HTMLIFrameElement | null; + if (!doc || !iframe) { + return; + } + const height = Math.max( + 320, + doc.documentElement.scrollHeight, + doc.body ? doc.body.scrollHeight : 0 + ); + iframe.style.height = `${height}px`; + iframe.style.overflow = 'hidden'; +} + +function keepCaretInsideCode(editor: any, event: any): boolean { + if (Number(event.keyCode) !== 13 || event.shiftKey) { + return false; + } + const pre = editor.dom.getParent(editor.selection.getNode(), 'pre.enlighter-pre'); + if (!pre) { + return false; + } + event.preventDefault(); + const code = pre.querySelector('code') || pre; + editor.selection.setCursorLocation(code, code.childNodes.length); + editor.insertContent('
'); + editor.nodeChanged(); + return true; +} + +/** 可整体删除的块级元素选择器。 */ +const BLOCK_SELECTOR = 'table,pre.enlighter-pre,hr,.quote_q,p'; + +/** + * 给表格 / 代码块 / 引用等块渲染一个浮层删除按钮。 + * + * 与 WPS 的块操作一致:鼠标悬停到块上时在右上角出现删除入口, + * 避免只能靠反复按退格键。 + */ +function installBlockActions(editor: any): void { + const doc = editor.getDoc(); + if (!doc || doc.getElementById('jio-block-actions')) { + return; + } + const bar = doc.createElement('div'); + bar.id = 'jio-block-actions'; + bar.className = 'jio-creator__block-actions'; + bar.innerHTML = + ''; + doc.body.appendChild(bar); + + let current: HTMLElement | null = null; + + const hide = () => { + current = null; + bar.classList.remove('is-visible'); + }; + + const show = (block: HTMLElement) => { + if (!block || block === doc.body) { + hide(); + return; + } + // 空段落没有删除价值,交给退格键处理。 + if (block.tagName === 'P' && (block.textContent || '').trim() === '') { + hide(); + return; + } + current = block; + const rect = block.getBoundingClientRect(); + bar.style.top = `${rect.top + doc.documentElement.scrollTop + 6}px`; + bar.style.left = `${rect.right - 40}px`; + bar.classList.add('is-visible'); + }; + + doc.addEventListener('mouseover', (event: MouseEvent) => { + const block = (event.target as HTMLElement)?.closest?.(BLOCK_SELECTOR) as HTMLElement | null; + if (block && block !== doc.body && !block.classList.contains('jio-code-lang')) { + show(block); + } + }); + + doc.addEventListener('mouseleave', hide); + + bar.addEventListener('mousedown', (event: MouseEvent) => event.preventDefault()); + bar.addEventListener('click', (event: MouseEvent) => { + const button = (event.target as HTMLElement)?.closest('[data-jio-block-delete]'); + if (!button || !current) { + return; + } + event.preventDefault(); + const target = current; + hide(); + editor.undoManager.transact(() => { + editor.dom.remove(target); + }); + editor.nodeChanged(); + editor.undoManager.add(); + if (editor.getBody().children.length === 0) { + editor.setContent('

'); + editor.selection.setCursorLocation(editor.getBody().firstChild, 0); + } + syncEditorHeight(editor); + }); +} + +function syncCodeLabels(editor: any): void { + const root: HTMLElement | null = editor?.getBody?.() ?? null; + if (!root) { + return; + } + root.querySelectorAll('pre.enlighter-pre[data-jio-code]').forEach((pre) => { + const existing = pre.querySelector(':scope > .jio-code-lang'); + const language = pre.getAttribute('data-enlighter-language') || 'generic'; + if (existing) { + existing.setAttribute('data-jio-code-lang', language); + const label = CODE_LANGUAGES.find((item) => item.value === language)?.label || language; + if ((existing.textContent || '') !== label) { + existing.textContent = label; + } + return; + } + const badge = document.createElement('span'); + badge.className = 'jio-code-lang'; + badge.contentEditable = 'false'; + badge.setAttribute('data-jio-code-lang', language); + badge.textContent = CODE_LANGUAGES.find((item) => item.value === language)?.label || language; + pre.insertBefore(badge, pre.firstChild); + }); +} + function escapeAttribute(value: string): string { return value.replace(/&/g, '&').replace(/"/g, '"').replace(//g, '>'); } @@ -215,6 +372,8 @@ function Studio(): JSX.Element { })); const [drawerOpen, setDrawerOpen] = useState(false); const [blockDialog, setBlockDialog] = useState(null); + const [codeLanguage, setCodeLanguage] = useState(null); + const codeTargetRef = useRef(null); const [notice, setNotice] = useState<{ tone: 'ok' | 'error'; text: string } | null>(null); const [recovery, setRecovery] = useState(null); const dirtyRef = useRef(false); @@ -231,6 +390,7 @@ function Studio(): JSX.Element { pointsMax: Number(bootstrap.pay?.pointsMax || 0), }; const isPublishedEdit = !!bootstrap.isPublished; + const charCount = useMemo(() => Array.from(plainText(draft.content)).length, [draft.content]); const patchDraft = useCallback((patch: Partial) => { dirtyRef.current = true; @@ -292,7 +452,7 @@ function Studio(): JSX.Element { async (autosave = false): Promise => { const editor = editorRef.current; if (editor && !editor.removed) { - updateContent(editor.getContent()); + updateContent(serializeBlocks(editor.getContent())); } const current = draftRef.current; if (!dirtyRef.current && (current.postId > 0 || current.versionId > 0)) { @@ -468,7 +628,8 @@ function Studio(): JSX.Element { body_class: 'jio-creator__tinymce', content_css: bootstrap.creator?.contentCss || '', content_style: EDITOR_CONTENT_STYLE, - height: 650, + // iframe 高度随后由 autoresize 随正文增长,这里只给初始值。 + height: 520, placeholder: String(bootstrap.limits?.contentPlaceholder || ''), setup: (editor: any) => { editorRef.current = editor; @@ -476,17 +637,24 @@ function Studio(): JSX.Element { editorReadyRef.current = true; setEditorReady(true); if (pendingRestoreContentRef.current !== null) { - editor.setContent(pendingRestoreContentRef.current); + editor.setContent(hydrateBlocks(pendingRestoreContentRef.current)); pendingRestoreContentRef.current = null; + } else { + editor.setContent(hydrateBlocks(editor.getContent())); } + syncCodeLabels(editor); + syncEditorHeight(editor); + installBlockActions(editor); updateHistoryAvailability(editor); updateFormatValue(editor); }); editor.on('NodeChange', () => updateFormatValue(editor)); // 代码块右上角的语言标签:点击整块即可换语言,等价于公众号的「高亮」入口。 editor.on('input change Undo Redo AddUndo', () => { - updateContent(editor.getContent()); + updateContent(serializeBlocks(editor.getContent())); updateHistoryAvailability(editor); + syncCodeLabels(editor); + syncEditorHeight(editor); }); editor.on('keydown', (event: any) => { if ((event.metaKey || event.ctrlKey) && event.keyCode === 83) { @@ -601,8 +769,9 @@ function Studio(): JSX.Element { } editor.insertContent(html); editor.nodeChanged(); - updateContent(editor.getContent()); + updateContent(serializeBlocks(editor.getContent())); updateHistoryAvailability(editor); + syncCodeLabels(editor); }, [focusEditor]); // 直接插入、无需参数的小块;需要参数的块打开通用弹窗。 @@ -736,18 +905,6 @@ function Studio(): JSX.Element { onInsertBlock={insertBlock} onInsertQuote={insertQuote} /> -
- -