mail-editor-pancake 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -4
- package/package.json +1 -1
- package/packages/blocks/dist/index.d.ts +12 -0
- package/packages/blocks/dist/index.js +175 -136
- package/packages/blocks/dist/index.js.map +1 -1
- package/packages/blocks/src/index.ts +2 -0
- package/packages/blocks/src/social.ts +8 -11
- package/packages/blocks/src/socialGroup.ts +8 -11
- package/packages/blocks/src/socialShared.ts +52 -0
- package/packages/core/dist/index.d.ts +56 -3
- package/packages/core/dist/index.js +1134 -942
- package/packages/core/dist/index.js.map +1 -1
- package/packages/core/dist/style.css +1 -1
- package/packages/core/src/editor/Canvas.ts +9 -0
- package/packages/core/src/editor/Editor.ts +217 -50
- package/packages/core/src/editor/InlineEditor.ts +10 -0
- package/packages/core/src/editor/styles.css +49 -8
- package/packages/core/src/index.ts +11 -0
- package/packages/core/src/types.ts +2 -0
- package/packages/core/src/utils/richHtmlInsert.ts +16 -0
- package/packages/core/src/variables/index.ts +91 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
@import"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap";.sm-root{--sm-bg: #f5f6f8;--sm-panel-bg: #ffffff;--sm-border: #e6e8ec;--sm-text: #1f2328;--sm-text-muted: #6b7280;--sm-primary: #4f46e5;--sm-primary-soft: #eef2ff;--sm-danger: #dc2626;--sm-canvas-bg: #eceef2;--sm-radius: 8px;--sm-radius-sm: 6px;--sm-shadow: 0 1px 2px rgba(16, 24, 40, .06);--sm-shadow-md: 0 4px 16px rgba(16, 24, 40, .08);--sm-surface: #ffffff;--sm-surface-hover: #f5f6f8;--sm-ghost-hover-bg: #f0f1f4;--sm-code-bg: #fafbfc;--sm-modal-footer-bg: #fafbfc;--sm-placeholder: #9aa0a6;--sm-outline-muted: #c7cad1;--sm-empty-column-border: #d6d8dd;--sm-empty-column-stripe: rgba(0, 0, 0, .02);--sm-on-primary: #ffffff;--sm-gallery-cell-bg: #ebecef;--sm-gallery-thumb-bg: #dde1e8;--sm-gallery-cell-hover-border: #d6d9df;--sm-layout-col-left: 240px;--sm-layout-col-right: 300px;--sm-canvas-pad-top: 48px;--sm-canvas-pad-x: 24px;--sm-canvas-pad-bottom: 24px;position:relative;display:grid;grid-template-rows:48px 1fr;height:100%;min-height:480px;font:13px/1.5 -apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,sans-serif;color:var(--sm-text);background:var(--sm-bg)}.sm-root:fullscreen,.sm-root:-webkit-full-screen{width:100%;height:100%;background:var(--sm-bg)}.sm-root *,.sm-root *:before,.sm-root *:after{box-sizing:border-box}.sm-root[data-sm-theme=dark]{--sm-bg: #0f1419;--sm-panel-bg: #1a1f26;--sm-border: #30363d;--sm-text: #e6edf3;--sm-text-muted: #8b949e;--sm-primary: #818cf8;--sm-primary-soft: rgba(129, 140, 248, .18);--sm-danger: #f85149;--sm-canvas-bg: #111820;--sm-shadow: 0 1px 2px rgba(0, 0, 0, .4);--sm-shadow-md: 0 4px 16px rgba(0, 0, 0, .5);--sm-surface: #22272e;--sm-surface-hover: #323940;--sm-ghost-hover-bg: #2d333b;--sm-code-bg: #161b22;--sm-modal-footer-bg: #1c2128;--sm-placeholder: #8b949e;--sm-outline-muted: #484f58;--sm-empty-column-border: #3d444d;--sm-empty-column-stripe: rgba(255, 255, 255, .04);--sm-on-primary: #ffffff;--sm-gallery-cell-bg: #252c36;--sm-gallery-thumb-bg: #343d4a;--sm-gallery-cell-hover-border: #484f58}@media (prefers-color-scheme: dark){.sm-root[data-sm-theme=system]{--sm-bg: #0f1419;--sm-panel-bg: #1a1f26;--sm-border: #30363d;--sm-text: #e6edf3;--sm-text-muted: #8b949e;--sm-primary: #818cf8;--sm-primary-soft: rgba(129, 140, 248, .18);--sm-danger: #f85149;--sm-canvas-bg: #111820;--sm-shadow: 0 1px 2px rgba(0, 0, 0, .4);--sm-shadow-md: 0 4px 16px rgba(0, 0, 0, .5);--sm-surface: #22272e;--sm-surface-hover: #323940;--sm-ghost-hover-bg: #2d333b;--sm-code-bg: #161b22;--sm-modal-footer-bg: #1c2128;--sm-placeholder: #8b949e;--sm-outline-muted: #484f58;--sm-empty-column-border: #3d444d;--sm-empty-column-stripe: rgba(255, 255, 255, .04);--sm-on-primary: #ffffff;--sm-gallery-cell-bg: #252c36;--sm-gallery-thumb-bg: #343d4a;--sm-gallery-cell-hover-border: #484f58}}.sm-topbar{position:relative;z-index:1;display:flex;align-items:center;gap:8px;padding:0 12px;background:var(--sm-panel-bg);border-bottom:1px solid var(--sm-border)}.sm-topbar__group{display:flex;align-items:center;gap:4px}.sm-topbar__title{font-weight:600;margin-right:8px}.sm-topbar__spacer{flex:1}.sm-focus-crumb{display:flex;align-items:center;flex-wrap:wrap;gap:2px;width:100%;min-width:0;font-size:12px;line-height:1.35;color:var(--sm-text-muted)}.sm-focus-crumb__sep{flex-shrink:0;padding:0 2px;color:var(--sm-text-muted);opacity:.55;-webkit-user-select:none;user-select:none}.sm-focus-crumb__item{display:inline-block;max-width:9em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border:0;background:transparent;padding:2px 6px;margin:0;border-radius:var(--sm-radius-sm);font:inherit;font-size:12px;color:var(--sm-text-muted);cursor:pointer;vertical-align:middle}.sm-focus-crumb__item:hover{background:var(--sm-ghost-hover-bg);color:var(--sm-text)}.sm-focus-crumb__item--current{color:var(--sm-text);font-weight:600;cursor:default}.sm-focus-crumb__item--current:hover{background:transparent;color:var(--sm-text)}.sm-topbar__theme-seg{flex-shrink:0}.sm-topbar__theme-group{display:flex;align-items:center;gap:8px}.sm-topbar__accent{display:inline-flex;align-items:center;flex-shrink:0}.sm-topbar__accent-input{width:28px;height:28px;padding:0;border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);background:var(--sm-surface);cursor:pointer}.sm-topbar__accent-input::-webkit-color-swatch-wrapper{padding:2px}.sm-topbar__accent-input::-webkit-color-swatch{border:none;border-radius:2px}.sm-topbar__theme-btn{min-width:28px;padding:0 6px;display:inline-flex;align-items:center;justify-content:center}.sm-topbar__theme-btn svg{display:block;flex-shrink:0}.sm-topbar__icon-btn{flex-shrink:0;min-width:28px;width:28px;height:28px;padding:0;justify-content:center;gap:0}.sm-topbar__icon-btn svg{display:block;flex-shrink:0}.sm-topbar__toggle-btn[aria-pressed=true]{background:var(--sm-primary-soft);color:var(--sm-primary)}.sm-topbar__toggle-btn .sm-layout-borders-check{opacity:0;transition:opacity .12s ease}.sm-topbar__toggle-btn[aria-pressed=true] .sm-layout-borders-check{opacity:1}.sm-btn{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 10px;border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);background:var(--sm-surface);color:var(--sm-text);cursor:pointer;font:inherit}.sm-btn:hover{background:var(--sm-surface-hover)}.sm-btn[disabled]{opacity:.45;cursor:not-allowed}.sm-btn--primary{background:var(--sm-primary);border-color:var(--sm-primary);color:var(--sm-on-primary)}.sm-btn--primary:hover:not([disabled]){background:var(--sm-primary);border-color:var(--sm-primary);color:var(--sm-on-primary);filter:brightness(1.05)}.sm-btn--ghost{border-color:transparent;background:transparent}.sm-btn--ghost:hover{background:var(--sm-ghost-hover-bg)}.sm-btn--secondary{border:1px solid var(--sm-border);background:var(--sm-surface);color:var(--sm-text);font-size:12px;padding:0 10px;height:30px;border-radius:var(--sm-radius-sm);white-space:nowrap}.sm-btn--secondary:hover{background:var(--sm-surface-hover);border-color:var(--sm-outline-muted)}.sm-segmented{display:inline-flex;border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);overflow:hidden;background:var(--sm-surface)}.sm-segmented__item{display:inline-flex;align-items:center;justify-content:center;height:28px;padding:0 12px;border:0;background:transparent;cursor:pointer;font:inherit;color:var(--sm-text-muted)}.sm-segmented__item--active{background:var(--sm-primary-soft);color:var(--sm-primary);font-weight:600}.sm-segmented--fill{display:flex;width:100%;align-self:stretch}.sm-segmented--fill .sm-segmented__item{flex:1;min-width:0;padding:0 6px}.sm-body{position:relative;z-index:2;display:grid;grid-template-columns:var(--sm-layout-col-left) minmax(0,1fr) var(--sm-layout-col-right);min-height:0;overflow:auto}.sm-body.sm-body--source{grid-template-columns:minmax(0,1fr)}.sm-panel{background:var(--sm-panel-bg);border-right:1px solid var(--sm-border);overflow:auto;min-width:0}.sm-panel--right{border-right:0;border-left:1px solid var(--sm-border);display:flex;flex-direction:column;overflow:hidden}.sm-panel__head{flex-shrink:0;padding:10px 12px 8px;border-bottom:1px solid var(--sm-border);background:var(--sm-panel-bg)}.sm-panel__head[hidden]{display:none}.sm-panel__body{flex:1;min-height:0;overflow:auto}.sm-panel__title{font-size:12px;font-weight:600;color:var(--sm-text-muted);letter-spacing:.04em;text-transform:uppercase;padding:12px 16px 6px}.sm-blocks{padding:8px 12px 24px}.sm-blocks__group+.sm-blocks__group{margin-top:12px}.sm-blocks__grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.sm-block-card{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:12px 6px;border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);background:var(--sm-surface);cursor:grab;-webkit-user-select:none;user-select:none;text-align:center;transition:border-color .15s,box-shadow .15s}.sm-block-card:hover{border-color:var(--sm-primary);box-shadow:var(--sm-shadow)}.sm-block-card:active{cursor:grabbing}.sm-block-card__icon{width:24px;height:24px;color:var(--sm-text-muted)}.sm-block-card__name{font-size:12px;color:var(--sm-text)}.sm-canvas-wrap{background:var(--sm-canvas-bg);padding:var(--sm-canvas-pad-top) var(--sm-canvas-pad-x) var(--sm-canvas-pad-bottom);overflow:auto;min-width:0}@media (max-width: 1366px){.sm-root{--sm-layout-col-left: 208px;--sm-layout-col-right: 268px;--sm-canvas-pad-top: 36px;--sm-canvas-pad-x: 16px;--sm-canvas-pad-bottom: 20px}}@media (max-width: 1180px){.sm-root{--sm-layout-col-left: 184px;--sm-layout-col-right: 244px;--sm-canvas-pad-top: 28px;--sm-canvas-pad-x: 12px;--sm-canvas-pad-bottom: 16px}}.sm-canvas{max-width:100%;margin:0 auto;background:#fff;border-radius:var(--sm-radius);box-shadow:var(--sm-shadow-md);min-height:400px;--sm-editor-link-color: #ff5a00}.sm-canvas a:not([style^="color:"]):not([style*=";color:"]):not([style*="; color:"]),.sm-canvas a:not([style^="color:"]):not([style*=";color:"]):not([style*="; color:"]):link,.sm-canvas a:not([style^="color:"]):not([style*=";color:"]):not([style*="; color:"]):visited,.sm-canvas a:not([style^="color:"]):not([style*=";color:"]):not([style*="; color:"]):hover,.sm-canvas a:not([style^="color:"]):not([style*=";color:"]):not([style*="; color:"]):active{color:var(--sm-editor-link-color)}.sm-canvas .sm-text-content :where(p){margin:0}.sm-canvas .sm-text-content :where(p,li,td,th,span,div,h1,h2,h3,h4,h5,h6,address,caption){font-weight:inherit}.sm-canvas .sm-text-content :where(strong,b){font-weight:bolder}.sm-canvas .sm-text-content :where(ul,ol){margin:.5em 0;padding-left:1.5em;list-style-position:outside}.sm-canvas .sm-text-content ul{list-style-type:disc}.sm-canvas .sm-text-content ol{list-style-type:decimal}.sm-section-host{position:relative}.sm-section-host:hover,.sm-section-host.is-selected,.sm-section-host.sm-chosen,.sm-section-host.sm-drag{z-index:5}.sm-section{position:relative;outline:1px dashed transparent;outline-offset:-1px;transition:outline-color .12s}.sm-root.sm-show-layout-borders .sm-section,.sm-section-host:hover .sm-section{outline-color:var(--sm-outline-muted)}.sm-section-host.is-selected .sm-section{outline:2px solid var(--sm-primary)}.sm-section__toolbar{position:absolute;top:auto;bottom:100%;right:8px;left:auto;margin-bottom:10px;z-index:10;display:none;align-items:center;gap:6px;flex-direction:row;flex-wrap:nowrap;max-width:calc(100% - 16px);pointer-events:auto;transition:margin-bottom .12s ease;transform:none}.sm-section-host:has(.sm-block:hover) .sm-section,.sm-section-host:has(.sm-block.is-selected) .sm-section,.sm-section-host:has(.sm-block.is-editing) .sm-section{position:relative;z-index:20}.sm-section-host.is-selected .sm-section__toolbar,.sm-section-host:hover .sm-section__toolbar,.sm-section-host.sm-chosen .sm-section__toolbar,.sm-section-host.sm-drag .sm-section__toolbar{display:inline-flex}.sm-section__toolbar-label{font-size:11px;font-weight:600;color:var(--sm-text-muted);background:var(--sm-surface);padding:3px 10px;border-radius:6px;border:1px solid var(--sm-border);box-shadow:var(--sm-shadow);white-space:nowrap;-webkit-user-select:none;user-select:none;flex-shrink:0}.sm-section-host.is-selected .sm-section__toolbar-label{border-color:var(--sm-primary-soft);color:var(--sm-primary)}.sm-section__toolbar-actions{display:none;align-items:center;gap:4px;flex-shrink:0}.sm-section-host.is-selected .sm-section__toolbar-actions,.sm-section-host.sm-chosen .sm-section__toolbar-actions,.sm-section-host.sm-drag .sm-section__toolbar-actions{display:inline-flex}.sm-section-host.is-selected .sm-section__toolbar,.sm-section-host.sm-chosen .sm-section__toolbar,.sm-section-host.sm-drag .sm-section__toolbar{background:#1f2328eb;padding:4px 6px;border-radius:6px;box-shadow:0 4px 14px #10182824}.sm-section-host.is-selected .sm-section__toolbar-label,.sm-section-host.sm-chosen .sm-section__toolbar-label,.sm-section-host.sm-drag .sm-section__toolbar-label{background:transparent;border:0;box-shadow:none;padding:0;color:#ffffffe0}.sm-tool-btn{width:24px;height:24px;display:inline-flex;align-items:center;justify-content:center;background:var(--sm-primary);color:var(--sm-on-primary);border:0;border-radius:4px;cursor:pointer}.sm-tool-btn:hover{filter:brightness(1.1)}.sm-tool-btn--danger{background:var(--sm-danger)}.sm-section__handle{cursor:grab}.sm-section__handle:active{cursor:grabbing}.sm-section__columns{position:relative;display:flex;width:100%}.sm-section-host.sm-chosen .sm-section__columns,.sm-section-host.sm-drag .sm-section__columns{pointer-events:none}.sm-column{flex:1 1 auto;min-height:0;padding:0;border:1px dashed transparent;position:relative}.sm-column.is-empty{border-color:var(--sm-empty-column-border);background:repeating-linear-gradient(45deg,transparent 0 6px,var(--sm-empty-column-stripe) 6px 12px);min-height:60px}.sm-column.is-empty:after{content:"拖入组件 · 双击插入文本";position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;color:var(--sm-text-muted);font-size:12px;pointer-events:none}.sm-block{position:relative;outline:1px dashed transparent;outline-offset:0}.sm-root.sm-show-layout-borders .sm-block:not(.is-selected):not(.is-editing){outline-color:var(--sm-outline-muted)}.sm-block:hover:not(.is-selected):not(.is-editing){outline-color:var(--sm-outline-muted)}.sm-block.is-selected:not(.is-editing){outline:2px solid var(--sm-primary)}.sm-block.is-editing{outline:1px dashed color-mix(in srgb,var(--sm-primary) 55%,var(--sm-border));outline-offset:3px;cursor:text;z-index:3}.sm-block:hover:not(.is-editing),.sm-block.is-selected:not(.is-editing){z-index:2}.sm-block__content{position:relative}.sm-block__toolbar{position:absolute;top:auto;bottom:100%;right:0;margin-bottom:8px;z-index:30;display:none;align-items:center;gap:6px;flex-wrap:nowrap;justify-content:flex-end;max-width:min(100%,440px);padding:4px 6px;border-radius:6px;box-shadow:0 4px 14px #10182824;pointer-events:auto;transform:none}.sm-block:hover .sm-block__toolbar,.sm-block.is-selected .sm-block__toolbar,.sm-block.is-editing .sm-block__toolbar{display:inline-flex}.sm-block:not(.is-selected):not(.is-editing):hover .sm-block__toolbar{background:var(--sm-surface);border:1px solid var(--sm-border);box-shadow:var(--sm-shadow);padding:3px 8px}.sm-block.is-selected .sm-block__toolbar,.sm-block.is-editing .sm-block__toolbar{background:#1f2328eb;border:0}.sm-block__toolbar-name{font-size:11px;font-weight:600;margin-right:2px;max-width:10em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-user-select:none;user-select:none}.sm-block:not(.is-selected):not(.is-editing) .sm-block__toolbar-name{color:var(--sm-text-muted)}.sm-block.is-selected .sm-block__toolbar-name,.sm-block.is-editing .sm-block__toolbar-name{color:#ffffffe0}.sm-block__toolbar-actions{display:none;align-items:center;gap:6px;flex-wrap:wrap;justify-content:flex-end}.sm-block.is-selected .sm-block__toolbar-actions,.sm-block.is-editing .sm-block__toolbar-actions{display:inline-flex}.sm-block__handle{cursor:grab}.sm-block__handle:active{cursor:grabbing}.sm-block.is-locked:before{content:"已锁定为代码";position:absolute;top:4px;right:4px;background:#f59e0b;color:var(--sm-on-primary);font-size:10px;padding:2px 6px;border-radius:4px;z-index:3}.sm-empty-doc{padding:80px 24px;text-align:center;color:var(--sm-text-muted)}.sm-ghost{opacity:.4}.sm-chosen{cursor:grabbing}.sm-drag{box-shadow:var(--sm-shadow-md)}.sm-add-section-bar{display:flex;align-items:center;justify-content:center;gap:8px;padding:8px;margin:8px 12px 12px;border:1px dashed var(--sm-border);border-radius:var(--sm-radius-sm);color:var(--sm-text-muted)}.sm-add-section-bar__btn{display:inline-flex;align-items:center;gap:4px;padding:4px 8px;border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);background:var(--sm-surface);cursor:pointer;color:var(--sm-text)}.sm-add-section-bar__btn:hover{border-color:var(--sm-primary);color:var(--sm-primary)}.sm-tabs{display:flex;border-bottom:1px solid var(--sm-border);background:var(--sm-panel-bg);position:sticky;top:0;z-index:1}.sm-tabs__item{flex:1;height:36px;border:0;background:transparent;cursor:pointer;font:inherit;color:var(--sm-text-muted);border-bottom:2px solid transparent}.sm-tabs__item--active{color:var(--sm-primary);font-weight:600;border-bottom-color:var(--sm-primary)}.sm-form{padding:12px 16px 24px;display:flex;flex-direction:column;gap:10px}.sm-social-link-list{display:flex;flex-direction:column;gap:12px}.sm-social-link-list__row{display:flex;flex-direction:column;gap:6px;padding-bottom:10px;border-bottom:1px solid var(--sm-border)}.sm-social-link-list__row:last-of-type{border-bottom:none;padding-bottom:0}.sm-social-link-list__row-main{display:grid;grid-template-columns:minmax(0,96px) 1fr auto;gap:6px;align-items:center}.sm-social-link-list__row-extras{display:grid;grid-template-columns:1fr 1fr minmax(52px,72px);gap:6px;align-items:center}.sm-social-link-list__color{width:100%;height:32px;padding:2px;border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);cursor:pointer;box-sizing:border-box;background:var(--sm-surface)}.sm-social-link-list__color--compact{height:32px;min-width:0}.sm-social-link-list__network,.sm-social-link-list__href{min-width:0}.sm-social-link-list__remove{width:28px;height:28px;padding:0;border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);background:var(--sm-surface);cursor:pointer;font-size:16px;line-height:1;color:var(--sm-text-muted)}.sm-social-link-list__remove:hover{border-color:var(--sm-danger);color:var(--sm-danger)}.sm-social-link-list__add{margin-top:4px;align-self:flex-start}.sm-field{display:flex;flex-direction:column;gap:4px}.sm-field__label{font-size:12px;color:var(--sm-text-muted)}.sm-field__help{font-size:11px;color:var(--sm-text-muted)}.sm-image-field__row{display:flex;flex-wrap:wrap;align-items:center;gap:6px}.sm-image-field__url{flex:1 1 120px;min-width:0}.sm-image-field__btn{flex-shrink:0}.sm-image-field__file{position:absolute;width:0;height:0;opacity:0;pointer-events:none}.sm-input,.sm-textarea,.sm-select{width:100%;height:30px;padding:0 8px;border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);font:inherit;background:var(--sm-surface);color:var(--sm-text)}.sm-textarea{height:auto;min-height:64px;padding:6px 8px;resize:vertical}.sm-input:focus,.sm-textarea:focus,.sm-select:focus{outline:2px solid var(--sm-primary-soft);border-color:var(--sm-primary)}.sm-spacing-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:4px}.sm-spacing-grid input{text-align:center}.sm-spacing-rows{display:flex;flex-direction:column;gap:8px}.sm-spacing-row{display:flex;align-items:center;gap:10px;min-width:0}.sm-spacing-row__axis{flex:0 0 18px;font-size:11px;color:var(--sm-text-muted);text-align:center;line-height:1.2}.sm-spacing-row input[type=range],.sm-field__slider-row input[type=range],.sm-width-field__slider-row input[type=range]{cursor:pointer}.sm-spacing-row input[type=range]::-webkit-slider-thumb,.sm-field__slider-row input[type=range]::-webkit-slider-thumb,.sm-width-field__slider-row input[type=range]::-webkit-slider-thumb{cursor:pointer}.sm-spacing-row input[type=range]{flex:1 1 auto;min-width:0;height:28px;accent-color:var(--sm-primary)}.sm-spacing-row .sm-input{flex:0 0 64px;width:64px;min-width:64px;text-align:center}.sm-spacing-field__label-row{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}.sm-spacing-field__reset{flex-shrink:0;height:26px;padding:0 8px;font-size:11px}.sm-field__label-row,.sm-inherit-switch{display:flex;align-items:center;justify-content:space-between;gap:8px}.sm-inherit-switch__label{display:inline-flex;align-items:center;gap:6px;cursor:pointer;-webkit-user-select:none;user-select:none}.sm-inherit-switch__text{font-size:12px;color:var(--sm-text-muted)}.sm-inherit-switch__input{width:28px;height:16px;margin:0;accent-color:var(--sm-primary);cursor:pointer}.sm-inherit-switch__value{font-size:12px;color:var(--sm-text-muted);font-variant-numeric:tabular-nums}.sm-inherit-switch__value[hidden]{display:none}.sm-segmented--disabled{opacity:.45}.sm-field__slider-row{display:flex;align-items:center;gap:8px}.sm-field__slider-row--inherit{opacity:.55}.sm-field__slider-row--inherit input[type=range]{accent-color:var(--sm-outline-muted)}.sm-field__slider-row--inherit input[type=number]:disabled{background:var(--sm-surface-hover);color:var(--sm-text-muted)}.sm-input--inherit-disabled{opacity:.55}.sm-field__slider-row input[type=range]{flex:1;min-width:0;height:28px;accent-color:var(--sm-primary)}.sm-field__slider-row .sm-input{flex:0 0 64px;width:64px;min-width:64px;flex-shrink:0;text-align:center}.sm-segmented--wrap{flex-wrap:wrap;max-width:100%}.sm-width-field__modes{width:100%}.sm-width-field__slider-row{display:flex;align-items:center;gap:10px;min-width:0}.sm-width-field__slider-row input[type=range]{flex:1 1 auto;min-width:0;height:28px;accent-color:var(--sm-primary)}.sm-width-field__slider-row .sm-input{flex:0 0 64px;width:64px;min-width:64px;text-align:center}.sm-width-field__slider-row.is-disabled{opacity:.45;pointer-events:none}.sm-color-row{display:flex;align-items:center;gap:6px}.sm-color-row input[type=color]{width:28px;height:28px;padding:0;border:1px solid var(--sm-border);border-radius:6px;background:none;cursor:pointer}.sm-color-row input[type=color].sm-color-row__pick--inherit{opacity:.55;border-style:dashed}.sm-empty-form{padding:24px 16px;color:var(--sm-text-muted);text-align:center;font-size:12px}.sm-code-pane{display:flex;flex-direction:column;gap:8px;padding:8px 12px 16px}.sm-code-pane__header{display:flex;align-items:center;justify-content:space-between;gap:8px}.sm-code-pane__title{font-size:12px;color:var(--sm-text-muted)}.sm-code{border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);background:var(--sm-code-bg);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:12px;min-height:200px}.sm-code .cm-editor{background:var(--sm-code-bg)!important;color:var(--sm-text)}.sm-code .cm-content{padding:8px;color:var(--sm-text)}.sm-doc-source{height:100%;display:flex;flex-direction:column}.sm-doc-source__bar{display:flex;gap:8px;padding:8px 12px;border-bottom:1px solid var(--sm-border);background:var(--sm-panel-bg)}.sm-doc-source__body{flex:1;min-height:0;padding:8px 12px;background:var(--sm-code-bg);overflow:auto}.sm-doc-source__body .cm-editor{height:100%;background:var(--sm-code-bg)!important;color:var(--sm-text)}.sm-doc-source__body .cm-content{color:var(--sm-text)}.sm-inline-editing{outline:2px dashed color-mix(in srgb,var(--sm-primary) 70%,var(--sm-outline-muted))!important;outline-offset:2px;box-shadow:none;border-radius:2px;background-color:color-mix(in srgb,var(--sm-primary-soft) 55%,transparent);cursor:text;min-height:1em;caret-color:var(--sm-primary);transition:outline-color .12s ease,box-shadow .12s ease,background-color .12s ease}.sm-inline-editing:focus{outline:2px solid var(--sm-primary)!important;outline-offset:2px;box-shadow:0 0 0 4px var(--sm-primary-soft);background-color:color-mix(in srgb,var(--sm-primary-soft) 35%,transparent)}.sm-inline-editing:empty:before{content:attr(data-placeholder);color:var(--sm-placeholder);pointer-events:none}.sm-floating-toolbar{position:absolute;z-index:200;display:none;align-items:center;gap:2px;padding:4px 6px;background:#1f2328;color:#fff;border-radius:8px;box-shadow:0 6px 24px #1018282e;pointer-events:auto;-webkit-user-select:none;user-select:none;white-space:nowrap;flex-wrap:wrap;max-width:calc(100% - 16px)}.sm-floating-toolbar.is-visible{display:inline-flex}.sm-floating-toolbar__group{display:inline-flex;align-items:center;gap:2px}.sm-floating-toolbar__sep{width:1px;align-self:stretch;background:#ffffff1f;margin:4px}.sm-floating-toolbar__btn{display:inline-flex;align-items:center;justify-content:center;height:26px;min-width:26px;padding:0 6px;border:0;border-radius:4px;background:transparent;color:#fff;font:inherit;cursor:pointer}.sm-floating-toolbar__btn:hover{background:#ffffff1f}.sm-floating-toolbar__btn.is-active{background:var(--sm-primary)}.sm-floating-toolbar__select{height:26px;border:0;border-radius:4px;background:#ffffff14;color:#fff;padding:0 6px;font:inherit;max-width:130px}.sm-floating-toolbar__select option{color:#1f2328}.sm-floating-toolbar__color{width:26px;height:26px;padding:0;border:0;border-radius:4px;background:#ffffff14;cursor:pointer}.sm-floating-toolbar__link-panel{display:none;flex-basis:100%;align-items:center;gap:6px;padding:4px 4px 0}.sm-floating-toolbar__link-panel.is-visible{display:flex}.sm-floating-toolbar__link-panel .sm-input{flex:1;height:26px;background:#ffffff14;border-color:#ffffff2e;color:#fff}.sm-floating-toolbar__link-panel .sm-input::placeholder{color:#ffffff80}.sm-floating-toolbar__link-panel .sm-btn{height:26px}.sm-color-picker-layer{position:absolute;z-index:210}.sm-color-picker{width:220px;padding:10px;background:var(--sm-surface, #fff);border:1px solid var(--sm-border, #e6e8ec);border-radius:var(--sm-radius-sm, 6px);box-shadow:var(--sm-shadow-md, 0 4px 16px rgba(16, 24, 40, .08))}.sm-color-picker__head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}.sm-color-picker__title{font-size:12px;font-weight:600;color:var(--sm-text, #1f2328)}.sm-color-picker__close{flex-shrink:0;width:24px;height:24px;padding:0;border:0;border-radius:var(--sm-radius-sm, 6px);background:transparent;color:var(--sm-text-muted, #6b7280);font-size:18px;line-height:1;cursor:pointer}.sm-color-picker__close:hover{background:var(--sm-ghost-hover-bg, #f0f1f4);color:var(--sm-text, #1f2328)}.sm-color-picker__swatches{display:grid;grid-template-columns:repeat(8,1fr);gap:4px;margin-bottom:8px}.sm-color-picker__swatch{width:100%;aspect-ratio:1;padding:0;border:1px solid rgba(0,0,0,.08);border-radius:4px;cursor:pointer}.sm-color-picker__swatch:hover{outline:2px solid var(--sm-primary, #4f46e5);outline-offset:1px}.sm-color-picker__native{width:100%;height:32px;margin-bottom:6px;padding:0;border:1px solid var(--sm-border, #e6e8ec);border-radius:6px;cursor:pointer}.sm-color-picker__hex{width:100%;text-align:center}.sm-color-picker__foot{display:flex;justify-content:flex-end;margin-top:8px}.sm-color-picker__clear{height:26px;font-size:12px}.sm-popover{position:absolute;z-index:100;min-width:220px;max-height:280px;overflow:auto;background:var(--sm-surface);border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);box-shadow:var(--sm-shadow-md)}.sm-popover__item{display:flex;flex-direction:column;gap:2px;padding:8px 12px;cursor:pointer;border:0;width:100%;text-align:left;background:transparent;font:inherit}.sm-popover__item:hover{background:var(--sm-primary-soft)}.sm-popover__key{font-family:monospace;color:var(--sm-primary)}.sm-popover__label{font-size:11px;color:var(--sm-text-muted)}.sm-modal__mask{position:fixed;top:0;right:0;bottom:0;left:0;z-index:300;display:flex;align-items:center;justify-content:center;background:#0f172a73;opacity:0;transition:opacity .18s ease;--sm-border: #e6e8ec;--sm-outline-muted: #c7cad1;--sm-surface: #ffffff;--sm-surface-hover: #f5f6f8;--sm-text: #1f2328;--sm-text-muted: #6b7280;--sm-primary: #4f46e5;--sm-primary-soft: #eef2ff;--sm-on-primary: #ffffff;--sm-danger: #dc2626;--sm-ghost-hover-bg: #f0f1f4;--sm-code-bg: #fafbfc;--sm-modal-footer-bg: #fafbfc;--sm-canvas-bg: #eceef2;--sm-panel-bg: #ffffff;--sm-radius-sm: 6px;--sm-radius: 8px;--sm-shadow: 0 1px 2px rgba(16, 24, 40, .06);--sm-shadow-md: 0 4px 16px rgba(16, 24, 40, .08)}.sm-modal__mask.is-open{opacity:1}.sm-modal__card{display:flex;flex-direction:column;background:var(--sm-panel-bg, #ffffff);color:var(--sm-text, #1f2328);border-radius:12px;border:1px solid var(--sm-border, #e6e8ec);box-shadow:0 0 0 1px #ffffff14 inset,0 24px 48px #0f172a24,0 8px 24px #0f172a14;max-width:96vw;max-height:92vh;transform:translateY(8px) scale(.98);transition:transform .18s ease;overflow:hidden}.sm-modal__mask.is-open .sm-modal__card{transform:translateY(0) scale(1)}.sm-modal__card.sm-modal--preview{max-height:calc(100vh - 24px);min-height:50%;height:auto}.sm-modal__card.sm-modal--preview .sm-modal__body{flex:1 1 auto;min-height:0;overflow:hidden}.sm-modal__card.sm-modal--preview .sm-modal__body.sm-modal__body--center{flex-direction:column;align-items:center;justify-content:flex-start}.sm-modal__card.sm-modal--preview .sm-preview__viewport{flex:0 0 auto;width:var(--sm-preview-w);max-width:100%}.sm-modal__header{display:flex;align-items:center;gap:8px;padding:12px 16px;background:var(--sm-panel-bg, #ffffff);border-bottom:1px solid var(--sm-border, #e6e8ec)}.sm-modal__title{font-weight:600;font-size:14px}.sm-modal__header-tools{margin-left:auto;display:inline-flex;align-items:center;gap:6px}.sm-modal__close{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border:0;border-radius:6px;background:transparent;color:var(--sm-text-muted, #6b7280);cursor:pointer}.sm-modal__close:hover{background:var(--sm-ghost-hover-bg, #f0f1f4);color:var(--sm-text, #1f2328)}.sm-modal__body{flex:1;min-height:0;overflow:auto;background:var(--sm-panel-bg, #ffffff)}.sm-modal__body--center{display:flex;align-items:flex-start;justify-content:center;background:var(--sm-canvas-bg, #eceef2);padding:16px}.sm-modal__footer{display:flex;justify-content:flex-end;gap:8px;padding:10px 16px;border-top:1px solid var(--sm-border, #e6e8ec);background:var(--sm-modal-footer-bg, #fafbfc)}.sm-modal__footer:empty{display:none}.sm-modal--gallery .sm-modal__body{padding:0;display:flex;flex-direction:column;min-height:240px}.sm-modal--gallery .sm-modal__header{padding:14px 18px;background:linear-gradient(180deg,var(--sm-modal-footer-bg, #fafbfc) 0%,var(--sm-panel-bg, #ffffff) 100%)}.sm-modal--gallery .sm-modal__title{font-size:15px;font-weight:600;letter-spacing:-.02em}.sm-modal--gallery .sm-modal__footer{padding:12px 18px;gap:10px}.sm-gallery-modal{--sm-gallery-gap: 12px;--sm-gallery-cell-border: var(--sm-border, #e6e8ec);--sm-gallery-cell-radius: 8px;--sm-gallery-thumb-h: 88px;box-sizing:border-box;display:flex;flex-direction:column;gap:var(--sm-gallery-gap);flex:1;min-height:0;padding:14px 16px 16px;background:var(--sm-panel-bg, #ffffff);color:var(--sm-text, #1f2328)}.sm-gallery-modal__toolbar{flex-shrink:0}.sm-gallery-modal__toolbar-row{display:flex;flex-wrap:wrap;align-items:center;gap:10px}.sm-gallery-modal__search{flex:1 1 140px;min-width:100px;height:32px;padding-left:32px;background-color:var(--sm-surface, #ffffff);background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='6' cy='6' r='4.25'/%3E%3Cpath d='M9.5 9.5 12 12'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:10px center;background-size:14px 14px}.sm-gallery-modal__addurl-input{flex:1 1 min(220px,36vw);min-width:120px;height:32px}.sm-gallery-modal__toolbar-action{flex-shrink:0;height:32px;min-width:72px;justify-content:center;font-size:12px;font-weight:500;padding:0 14px}.sm-gallery-modal__file{position:absolute;width:0;height:0;opacity:0;pointer-events:none}.sm-gallery-modal__error{font-size:12px;color:var(--sm-danger, #dc2626);flex-shrink:0}.sm-gallery-modal__scroll{flex:1;min-height:0;overflow:auto;display:flex;flex-direction:column;gap:10px;padding:4px;margin-top:2px;background:var(--sm-modal-footer-bg, #fafbfc);border:1px solid var(--sm-border, #e6e8ec);border-radius:var(--sm-radius-sm, 6px)}.sm-gallery-modal__grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(104px,1fr));gap:8px;width:100%;min-width:0}.sm-gallery-modal__grid>*{min-width:0}.sm-gallery-modal__cell-wrap{position:relative;min-width:0;max-width:100%}.sm-gallery-modal__cell-delete{position:absolute;top:2px;right:2px;z-index:2;width:22px;height:22px;padding:0;margin:0;border:0;border-radius:4px;background:#0f172ad1;color:var(--sm-on-primary, #ffffff);font-size:16px;line-height:1;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}.sm-gallery-modal__cell-delete:hover{background:var(--sm-danger, #dc2626)}.sm-gallery-modal__cell{display:flex;flex-direction:column;align-items:stretch;margin:0;padding:6px;border:2px solid transparent;border-radius:var(--sm-gallery-cell-radius);background:var(--sm-gallery-cell-bg, #ebecef);cursor:pointer;text-align:left;font:inherit;color:inherit;transition:border-color .12s,box-shadow .12s;box-sizing:border-box;min-width:0;width:100%;max-width:100%;overflow:hidden;box-shadow:0 1px 2px #0f172a0d}.sm-gallery-modal__cell:hover{border-color:var(--sm-gallery-cell-hover-border, #d6d9df);box-shadow:0 4px 12px #0f172a12}.sm-gallery-modal__cell.is-selected{border-color:var(--sm-primary, #4f46e5);box-shadow:0 0 0 2px var(--sm-primary-soft, #eef2ff),0 4px 14px #4f46e51f}.sm-gallery-modal__thumb{display:block;flex-shrink:0;width:100%;max-width:100%;max-height:var(--sm-gallery-thumb-h);border-radius:4px;background:var(--sm-gallery-thumb-bg, #dde1e8)}.sm-gallery-modal__caption{font-size:11px;color:var(--sm-text-muted, #6b7280);margin-top:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.sm-gallery-modal__empty{grid-column:1 / -1;text-align:center;font-size:13px;color:var(--sm-text-muted, #6b7280);padding:28px 12px}.sm-gallery-modal__loadmore{align-self:center;margin-top:10px;height:34px;min-width:128px;justify-content:center;font-size:12px;font-weight:500}.sm-preview__viewport{--sm-preview-w: 800px;width:var(--sm-preview-w);max-width:100%;min-height:200px;background:#fff;border-radius:12px;border:1px solid var(--sm-border, #e6e8ec);box-shadow:var(--sm-shadow-md, 0 4px 16px rgba(16, 24, 40, .08));overflow:hidden;transition:width .2s ease,height .2s ease}.sm-preview__frame{width:100%;height:100%;border:0;background:#fff}.sm-modal--export .sm-modal__body,.sm-modal--block-code .sm-modal__body{padding:0;background:var(--sm-code-bg, #fafbfc)}.sm-export__editor{height:100%;background:var(--sm-code-bg, #fafbfc)}.sm-export__editor .cm-editor{height:100%;background:var(--sm-code-bg, #fafbfc)!important;color:var(--sm-text, #1f2328)}.sm-export__editor .cm-content{padding:12px;font-size:12px;color:var(--sm-text, #1f2328)}.sm-toast{position:absolute;left:50%;bottom:16px;transform:translate(-50%) translateY(8px);padding:6px 12px;background:#0f172adb;color:var(--sm-on-primary);font-size:12px;border-radius:6px;opacity:0;pointer-events:none;transition:opacity .18s,transform .18s}.sm-toast.is-visible{opacity:1;transform:translate(-50%) translateY(0)}
|
|
1
|
+
@import"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap";.sm-root{--sm-bg: #f5f6f8;--sm-panel-bg: #ffffff;--sm-border: #e6e8ec;--sm-text: #1f2328;--sm-text-muted: #6b7280;--sm-primary: #4f46e5;--sm-primary-soft: #eef2ff;--sm-danger: #dc2626;--sm-canvas-bg: #eceef2;--sm-radius: 8px;--sm-radius-sm: 6px;--sm-shadow: 0 1px 2px rgba(16, 24, 40, .06);--sm-shadow-md: 0 4px 16px rgba(16, 24, 40, .08);--sm-surface: #ffffff;--sm-surface-hover: #f5f6f8;--sm-ghost-hover-bg: #f0f1f4;--sm-code-bg: #fafbfc;--sm-modal-footer-bg: #fafbfc;--sm-placeholder: #9aa0a6;--sm-outline-muted: #c7cad1;--sm-empty-column-border: #d6d8dd;--sm-empty-column-stripe: rgba(0, 0, 0, .02);--sm-on-primary: #ffffff;--sm-gallery-cell-bg: #ebecef;--sm-gallery-thumb-bg: #dde1e8;--sm-gallery-cell-hover-border: #d6d9df;--sm-layout-col-left: 240px;--sm-layout-col-right: 300px;--sm-canvas-pad-top: 48px;--sm-canvas-pad-x: 24px;--sm-canvas-pad-bottom: 24px;position:relative;display:grid;grid-template-rows:48px 1fr;height:100%;min-height:480px;font:13px/1.5 -apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,sans-serif;color:var(--sm-text);background:var(--sm-bg)}.sm-root:fullscreen,.sm-root:-webkit-full-screen{width:100%;height:100%;background:var(--sm-bg)}.sm-root *,.sm-root *:before,.sm-root *:after{box-sizing:border-box}.sm-root[data-sm-theme=dark]{--sm-bg: #0f1419;--sm-panel-bg: #1a1f26;--sm-border: #30363d;--sm-text: #e6edf3;--sm-text-muted: #8b949e;--sm-primary: #818cf8;--sm-primary-soft: rgba(129, 140, 248, .18);--sm-danger: #f85149;--sm-canvas-bg: #111820;--sm-shadow: 0 1px 2px rgba(0, 0, 0, .4);--sm-shadow-md: 0 4px 16px rgba(0, 0, 0, .5);--sm-surface: #22272e;--sm-surface-hover: #323940;--sm-ghost-hover-bg: #2d333b;--sm-code-bg: #161b22;--sm-modal-footer-bg: #1c2128;--sm-placeholder: #8b949e;--sm-outline-muted: #484f58;--sm-empty-column-border: #3d444d;--sm-empty-column-stripe: rgba(255, 255, 255, .04);--sm-on-primary: #ffffff;--sm-gallery-cell-bg: #252c36;--sm-gallery-thumb-bg: #343d4a;--sm-gallery-cell-hover-border: #484f58}@media (prefers-color-scheme: dark){.sm-root[data-sm-theme=system]{--sm-bg: #0f1419;--sm-panel-bg: #1a1f26;--sm-border: #30363d;--sm-text: #e6edf3;--sm-text-muted: #8b949e;--sm-primary: #818cf8;--sm-primary-soft: rgba(129, 140, 248, .18);--sm-danger: #f85149;--sm-canvas-bg: #111820;--sm-shadow: 0 1px 2px rgba(0, 0, 0, .4);--sm-shadow-md: 0 4px 16px rgba(0, 0, 0, .5);--sm-surface: #22272e;--sm-surface-hover: #323940;--sm-ghost-hover-bg: #2d333b;--sm-code-bg: #161b22;--sm-modal-footer-bg: #1c2128;--sm-placeholder: #8b949e;--sm-outline-muted: #484f58;--sm-empty-column-border: #3d444d;--sm-empty-column-stripe: rgba(255, 255, 255, .04);--sm-on-primary: #ffffff;--sm-gallery-cell-bg: #252c36;--sm-gallery-thumb-bg: #343d4a;--sm-gallery-cell-hover-border: #484f58}}.sm-topbar{position:relative;z-index:1;display:flex;align-items:center;gap:8px;padding:0 12px;background:var(--sm-panel-bg);border-bottom:1px solid var(--sm-border)}.sm-topbar__group{display:flex;align-items:center;gap:4px}.sm-topbar__title{font-weight:600;margin-right:8px}.sm-topbar__spacer{flex:1}.sm-focus-crumb{display:flex;align-items:center;flex-wrap:wrap;gap:2px;width:100%;min-width:0;font-size:12px;line-height:1.35;color:var(--sm-text-muted)}.sm-focus-crumb__sep{flex-shrink:0;padding:0 2px;color:var(--sm-text-muted);opacity:.55;-webkit-user-select:none;user-select:none}.sm-focus-crumb__item{display:inline-block;max-width:9em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border:0;background:transparent;padding:2px 6px;margin:0;border-radius:var(--sm-radius-sm);font:inherit;font-size:12px;color:var(--sm-text-muted);cursor:pointer;vertical-align:middle}.sm-focus-crumb__item:hover{background:var(--sm-ghost-hover-bg);color:var(--sm-text)}.sm-focus-crumb__item--current{color:var(--sm-text);font-weight:600;cursor:default}.sm-focus-crumb__item--current:hover{background:transparent;color:var(--sm-text)}.sm-topbar__theme-seg{flex-shrink:0}.sm-topbar__theme-group{display:flex;align-items:center;gap:8px}.sm-topbar__accent{display:inline-flex;align-items:center;flex-shrink:0}.sm-topbar__accent-input{width:28px;height:28px;padding:0;border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);background:var(--sm-surface);cursor:pointer}.sm-topbar__accent-input::-webkit-color-swatch-wrapper{padding:2px}.sm-topbar__accent-input::-webkit-color-swatch{border:none;border-radius:2px}.sm-topbar__theme-btn{min-width:28px;padding:0 6px;display:inline-flex;align-items:center;justify-content:center}.sm-topbar__theme-btn svg{display:block;flex-shrink:0}.sm-topbar__icon-btn{flex-shrink:0;min-width:28px;width:28px;height:28px;padding:0;justify-content:center;gap:0}.sm-topbar__icon-btn svg{display:block;flex-shrink:0}.sm-topbar__toggle-btn[aria-pressed=true]{background:var(--sm-primary-soft);color:var(--sm-primary)}.sm-topbar__toggle-btn .sm-layout-borders-check{opacity:0;transition:opacity .12s ease}.sm-topbar__toggle-btn[aria-pressed=true] .sm-layout-borders-check{opacity:1}.sm-btn{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 10px;border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);background:var(--sm-surface);color:var(--sm-text);cursor:pointer;font:inherit}.sm-btn:hover{background:var(--sm-surface-hover)}.sm-btn[disabled]{opacity:.45;cursor:not-allowed}.sm-btn--primary{background:var(--sm-primary);border-color:var(--sm-primary);color:var(--sm-on-primary)}.sm-btn--primary:hover:not([disabled]){background:var(--sm-primary);border-color:var(--sm-primary);color:var(--sm-on-primary);filter:brightness(1.05)}.sm-btn--ghost{border-color:transparent;background:transparent}.sm-btn--ghost:hover{background:var(--sm-ghost-hover-bg)}.sm-btn--secondary{border:1px solid var(--sm-border);background:var(--sm-surface);color:var(--sm-text);font-size:12px;padding:0 10px;height:30px;border-radius:var(--sm-radius-sm);white-space:nowrap}.sm-btn--secondary:hover{background:var(--sm-surface-hover);border-color:var(--sm-outline-muted)}.sm-segmented{display:inline-flex;border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);overflow:hidden;background:var(--sm-surface)}.sm-segmented__item{display:inline-flex;align-items:center;justify-content:center;height:28px;padding:0 12px;border:0;background:transparent;cursor:pointer;font:inherit;color:var(--sm-text-muted)}.sm-segmented__item--active{background:var(--sm-primary-soft);color:var(--sm-primary);font-weight:600}.sm-segmented--fill{display:flex;width:100%;align-self:stretch}.sm-segmented--fill .sm-segmented__item{flex:1;min-width:0;padding:0 6px}.sm-body{position:relative;z-index:2;display:grid;grid-template-columns:var(--sm-layout-col-left) minmax(0,1fr) var(--sm-layout-col-right);min-height:0;overflow:auto}.sm-body.sm-body--source{grid-template-columns:minmax(0,1fr)}.sm-panel{background:var(--sm-panel-bg);border-right:1px solid var(--sm-border);overflow:auto;min-width:0}.sm-panel--right{border-right:0;border-left:1px solid var(--sm-border);display:flex;flex-direction:column;overflow:hidden}.sm-panel__head{flex-shrink:0;padding:10px 12px 8px;border-bottom:1px solid var(--sm-border);background:var(--sm-panel-bg)}.sm-panel__head[hidden]{display:none}.sm-panel__body{flex:1;min-height:0;overflow:auto}.sm-panel__title{font-size:12px;font-weight:600;color:var(--sm-text-muted);letter-spacing:.04em;text-transform:uppercase;padding:12px 16px 6px}.sm-blocks{padding:8px 12px 24px}.sm-blocks__group+.sm-blocks__group{margin-top:12px}.sm-blocks__grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.sm-block-card{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:12px 6px;border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);background:var(--sm-surface);cursor:grab;-webkit-user-select:none;user-select:none;text-align:center;transition:border-color .15s,box-shadow .15s}.sm-block-card:hover{border-color:var(--sm-primary);box-shadow:var(--sm-shadow)}.sm-block-card:active{cursor:grabbing}.sm-block-card__icon{width:24px;height:24px;color:var(--sm-text-muted)}.sm-block-card__name{font-size:12px;color:var(--sm-text)}.sm-canvas-wrap{background:var(--sm-canvas-bg);padding:var(--sm-canvas-pad-top) var(--sm-canvas-pad-x) var(--sm-canvas-pad-bottom);overflow:auto;min-width:0}@media (max-width: 1366px){.sm-root{--sm-layout-col-left: 208px;--sm-layout-col-right: 268px;--sm-canvas-pad-top: 36px;--sm-canvas-pad-x: 16px;--sm-canvas-pad-bottom: 20px}}@media (max-width: 1180px){.sm-root{--sm-layout-col-left: 184px;--sm-layout-col-right: 244px;--sm-canvas-pad-top: 28px;--sm-canvas-pad-x: 12px;--sm-canvas-pad-bottom: 16px}}.sm-canvas{max-width:100%;margin:0 auto;background:#fff;border-radius:var(--sm-radius);box-shadow:var(--sm-shadow-md);min-height:400px;--sm-editor-link-color: #ff5a00}.sm-canvas a:not([style^="color:"]):not([style*=";color:"]):not([style*="; color:"]),.sm-canvas a:not([style^="color:"]):not([style*=";color:"]):not([style*="; color:"]):link,.sm-canvas a:not([style^="color:"]):not([style*=";color:"]):not([style*="; color:"]):visited,.sm-canvas a:not([style^="color:"]):not([style*=";color:"]):not([style*="; color:"]):hover,.sm-canvas a:not([style^="color:"]):not([style*=";color:"]):not([style*="; color:"]):active{color:var(--sm-editor-link-color)}.sm-canvas .sm-text-content :where(p){margin:0}.sm-canvas .sm-text-content :where(p,li,td,th,span,div,h1,h2,h3,h4,h5,h6,address,caption){font-weight:inherit}.sm-canvas .sm-text-content :where(strong,b){font-weight:bolder}.sm-canvas .sm-text-content :where(ul,ol){margin:.5em 0;padding-left:1.5em;list-style-position:outside}.sm-canvas .sm-text-content ul{list-style-type:disc}.sm-canvas .sm-text-content ol{list-style-type:decimal}.sm-section-host{position:relative}.sm-section-host:hover,.sm-section-host.is-selected,.sm-section-host.sm-chosen,.sm-section-host.sm-drag{z-index:5}.sm-section{position:relative;outline:1px dashed transparent;outline-offset:-1px;transition:outline-color .12s}.sm-root.sm-show-layout-borders .sm-section,.sm-section-host:hover .sm-section{outline-color:var(--sm-outline-muted)}.sm-section-host.is-selected .sm-section{outline:2px solid var(--sm-primary)}.sm-section__toolbar{position:absolute;top:auto;bottom:100%;right:8px;left:auto;margin-bottom:10px;z-index:10;display:none;align-items:center;gap:6px;flex-direction:row;flex-wrap:nowrap;max-width:calc(100% - 16px);pointer-events:auto;transition:margin-bottom .12s ease;transform:none}.sm-section-host:has(.sm-block:hover) .sm-section,.sm-section-host:has(.sm-block.is-selected) .sm-section,.sm-section-host:has(.sm-block.is-editing) .sm-section{position:relative;z-index:20}.sm-section-host.is-selected .sm-section__toolbar,.sm-section-host:hover .sm-section__toolbar,.sm-section-host.sm-chosen .sm-section__toolbar,.sm-section-host.sm-drag .sm-section__toolbar{display:inline-flex}.sm-section__toolbar-label{font-size:11px;font-weight:600;color:var(--sm-text-muted);background:var(--sm-surface);padding:3px 10px;border-radius:6px;border:1px solid var(--sm-border);box-shadow:var(--sm-shadow);white-space:nowrap;-webkit-user-select:none;user-select:none;flex-shrink:0}.sm-section-host.is-selected .sm-section__toolbar-label{border-color:var(--sm-primary-soft);color:var(--sm-primary)}.sm-section__toolbar-actions{display:none;align-items:center;gap:4px;flex-shrink:0}.sm-section-host.is-selected .sm-section__toolbar-actions,.sm-section-host.sm-chosen .sm-section__toolbar-actions,.sm-section-host.sm-drag .sm-section__toolbar-actions{display:inline-flex}.sm-section-host.is-selected .sm-section__toolbar,.sm-section-host.sm-chosen .sm-section__toolbar,.sm-section-host.sm-drag .sm-section__toolbar{background:#1f2328eb;padding:4px 6px;border-radius:6px;box-shadow:0 4px 14px #10182824}.sm-section-host.is-selected .sm-section__toolbar-label,.sm-section-host.sm-chosen .sm-section__toolbar-label,.sm-section-host.sm-drag .sm-section__toolbar-label{background:transparent;border:0;box-shadow:none;padding:0;color:#ffffffe0}.sm-tool-btn{width:24px;height:24px;display:inline-flex;align-items:center;justify-content:center;background:var(--sm-primary);color:var(--sm-on-primary);border:0;border-radius:4px;cursor:pointer}.sm-tool-btn:hover{filter:brightness(1.1)}.sm-tool-btn--danger{background:var(--sm-danger)}.sm-section__handle{cursor:grab}.sm-section__handle:active{cursor:grabbing}.sm-section__columns{position:relative;display:flex;width:100%}.sm-section-host.sm-chosen .sm-section__columns,.sm-section-host.sm-drag .sm-section__columns{pointer-events:none}.sm-column{flex:1 1 auto;min-height:0;padding:0;border:1px dashed transparent;position:relative}.sm-column.is-empty{border-color:var(--sm-empty-column-border);background:repeating-linear-gradient(45deg,transparent 0 6px,var(--sm-empty-column-stripe) 6px 12px);min-height:60px}.sm-column.is-empty:after{content:"拖入组件 · 双击插入文本";position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;color:var(--sm-text-muted);font-size:12px;pointer-events:none}.sm-block{position:relative;outline:1px dashed transparent;outline-offset:0}.sm-root.sm-show-layout-borders .sm-block:not(.is-selected):not(.is-editing){outline-color:var(--sm-outline-muted)}.sm-block:hover:not(.is-selected):not(.is-editing){outline-color:var(--sm-outline-muted)}.sm-block.is-selected:not(.is-editing){outline:2px solid var(--sm-primary)}.sm-block.is-editing{outline:1px dashed color-mix(in srgb,var(--sm-primary) 55%,var(--sm-border));outline-offset:3px;cursor:text;z-index:3}.sm-block:hover:not(.is-editing),.sm-block.is-selected:not(.is-editing){z-index:2}.sm-block__content{position:relative}.sm-block__toolbar{position:absolute;top:auto;bottom:100%;right:0;margin-bottom:8px;z-index:30;display:none;align-items:center;gap:6px;flex-wrap:nowrap;justify-content:flex-end;max-width:min(100%,440px);padding:4px 6px;border-radius:6px;box-shadow:0 4px 14px #10182824;pointer-events:auto;transform:none}.sm-block:hover .sm-block__toolbar,.sm-block.is-selected .sm-block__toolbar,.sm-block.is-editing .sm-block__toolbar{display:inline-flex}.sm-block:not(.is-selected):not(.is-editing):hover .sm-block__toolbar{background:var(--sm-surface);border:1px solid var(--sm-border);box-shadow:var(--sm-shadow);padding:3px 8px}.sm-block.is-selected .sm-block__toolbar,.sm-block.is-editing .sm-block__toolbar{background:#1f2328eb;border:0}.sm-block__toolbar-name{font-size:11px;font-weight:600;margin-right:2px;max-width:10em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-user-select:none;user-select:none}.sm-block:not(.is-selected):not(.is-editing) .sm-block__toolbar-name{color:var(--sm-text-muted)}.sm-block.is-selected .sm-block__toolbar-name,.sm-block.is-editing .sm-block__toolbar-name{color:#ffffffe0}.sm-block__toolbar-actions{display:none;align-items:center;gap:6px;flex-wrap:wrap;justify-content:flex-end}.sm-block.is-selected .sm-block__toolbar-actions,.sm-block.is-editing .sm-block__toolbar-actions{display:inline-flex}.sm-block__handle{cursor:grab}.sm-block__handle:active{cursor:grabbing}.sm-block.is-locked:before{content:"已锁定为代码";position:absolute;top:4px;right:4px;background:#f59e0b;color:var(--sm-on-primary);font-size:10px;padding:2px 6px;border-radius:4px;z-index:3}.sm-empty-doc{padding:80px 24px;text-align:center;color:var(--sm-text-muted)}.sm-ghost{opacity:.4}.sm-chosen{cursor:grabbing}.sm-drag{box-shadow:var(--sm-shadow-md)}.sm-add-section-bar{display:flex;align-items:center;justify-content:center;gap:8px;padding:8px;margin:8px 12px 12px;border:1px dashed var(--sm-border);border-radius:var(--sm-radius-sm);color:var(--sm-text-muted)}.sm-add-section-bar__btn{display:inline-flex;align-items:center;gap:4px;padding:4px 8px;border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);background:var(--sm-surface);cursor:pointer;color:var(--sm-text)}.sm-add-section-bar__btn:hover{border-color:var(--sm-primary);color:var(--sm-primary)}.sm-tabs{display:flex;border-bottom:1px solid var(--sm-border);background:var(--sm-panel-bg);position:sticky;top:0;z-index:1}.sm-tabs__item{flex:1;height:36px;border:0;background:transparent;cursor:pointer;font:inherit;color:var(--sm-text-muted);border-bottom:2px solid transparent}.sm-tabs__item--active{color:var(--sm-primary);font-weight:600;border-bottom-color:var(--sm-primary)}.sm-form{padding:12px 16px 24px;display:flex;flex-direction:column;gap:10px}.sm-social-link-list{display:flex;flex-direction:column;gap:12px}.sm-social-link-list__row{display:flex;flex-direction:column;gap:6px;padding-bottom:10px;border-bottom:1px solid var(--sm-border)}.sm-social-link-list__row:last-of-type{border-bottom:none;padding-bottom:0}.sm-social-link-list__row-main{display:grid;grid-template-columns:minmax(0,96px) 1fr auto;gap:6px;align-items:center}.sm-social-link-list__row-extras{display:grid;grid-template-columns:1fr 1fr minmax(52px,72px);gap:6px;align-items:center}.sm-social-link-list__color{width:100%;height:32px;padding:2px;border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);cursor:pointer;box-sizing:border-box;background:var(--sm-surface)}.sm-social-link-list__color--compact{height:32px;min-width:0}.sm-social-link-list__network,.sm-social-link-list__href{min-width:0}.sm-social-link-list__remove{width:28px;height:28px;padding:0;border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);background:var(--sm-surface);cursor:pointer;font-size:16px;line-height:1;color:var(--sm-text-muted)}.sm-social-link-list__remove:hover{border-color:var(--sm-danger);color:var(--sm-danger)}.sm-social-link-list__add{margin-top:4px;align-self:flex-start}.sm-field{display:flex;flex-direction:column;gap:4px}.sm-field__label{font-size:12px;color:var(--sm-text-muted)}.sm-field__help{font-size:11px;color:var(--sm-text-muted)}.sm-image-field__row{display:flex;flex-wrap:wrap;align-items:center;gap:6px}.sm-image-field__url{flex:1 1 120px;min-width:0}.sm-image-field__btn{flex-shrink:0}.sm-image-field__file{position:absolute;width:0;height:0;opacity:0;pointer-events:none}.sm-input,.sm-textarea,.sm-select{width:100%;height:30px;padding:0 8px;border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);font:inherit;background:var(--sm-surface);color:var(--sm-text)}.sm-textarea{height:auto;min-height:64px;padding:6px 8px;resize:vertical}.sm-input:focus,.sm-textarea:focus,.sm-select:focus{outline:2px solid var(--sm-primary-soft);border-color:var(--sm-primary)}.sm-spacing-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:4px}.sm-spacing-grid input{text-align:center}.sm-spacing-rows{display:flex;flex-direction:column;gap:8px}.sm-spacing-row{display:flex;align-items:center;gap:10px;min-width:0}.sm-spacing-row__axis{flex:0 0 18px;font-size:11px;color:var(--sm-text-muted);text-align:center;line-height:1.2}.sm-spacing-row input[type=range],.sm-field__slider-row input[type=range],.sm-width-field__slider-row input[type=range]{cursor:pointer}.sm-spacing-row input[type=range]::-webkit-slider-thumb,.sm-field__slider-row input[type=range]::-webkit-slider-thumb,.sm-width-field__slider-row input[type=range]::-webkit-slider-thumb{cursor:pointer}.sm-spacing-row input[type=range]{flex:1 1 auto;min-width:0;height:28px;accent-color:var(--sm-primary)}.sm-spacing-row .sm-input{flex:0 0 64px;width:64px;min-width:64px;text-align:center}.sm-spacing-field__label-row{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}.sm-spacing-field__reset{flex-shrink:0;height:26px;padding:0 8px;font-size:11px}.sm-field__label-row,.sm-inherit-switch{display:flex;align-items:center;justify-content:space-between;gap:8px}.sm-inherit-switch__label{display:inline-flex;align-items:center;gap:6px;cursor:pointer;-webkit-user-select:none;user-select:none}.sm-inherit-switch__text{font-size:12px;color:var(--sm-text-muted)}.sm-inherit-switch__input{width:28px;height:16px;margin:0;accent-color:var(--sm-primary);cursor:pointer}.sm-inherit-switch__value{font-size:12px;color:var(--sm-text-muted);font-variant-numeric:tabular-nums}.sm-inherit-switch__value[hidden]{display:none}.sm-segmented--disabled{opacity:.45}.sm-field__slider-row{display:flex;align-items:center;gap:8px}.sm-field__slider-row--inherit{opacity:.55}.sm-field__slider-row--inherit input[type=range]{accent-color:var(--sm-outline-muted)}.sm-field__slider-row--inherit input[type=number]:disabled{background:var(--sm-surface-hover);color:var(--sm-text-muted)}.sm-input--inherit-disabled{opacity:.55}.sm-field__slider-row input[type=range]{flex:1;min-width:0;height:28px;accent-color:var(--sm-primary)}.sm-field__slider-row .sm-input{flex:0 0 64px;width:64px;min-width:64px;flex-shrink:0;text-align:center}.sm-segmented--wrap{flex-wrap:wrap;max-width:100%}.sm-width-field__modes{width:100%}.sm-width-field__slider-row{display:flex;align-items:center;gap:10px;min-width:0}.sm-width-field__slider-row input[type=range]{flex:1 1 auto;min-width:0;height:28px;accent-color:var(--sm-primary)}.sm-width-field__slider-row .sm-input{flex:0 0 64px;width:64px;min-width:64px;text-align:center}.sm-width-field__slider-row.is-disabled{opacity:.45;pointer-events:none}.sm-color-row{display:flex;align-items:center;gap:6px}.sm-color-row input[type=color]{width:28px;height:28px;padding:0;border:1px solid var(--sm-border);border-radius:6px;background:none;cursor:pointer}.sm-color-row input[type=color].sm-color-row__pick--inherit{opacity:.55;border-style:dashed}.sm-empty-form{padding:24px 16px;color:var(--sm-text-muted);text-align:center;font-size:12px}.sm-code-pane{display:flex;flex-direction:column;gap:8px;padding:8px 12px 16px}.sm-code-pane__header{display:flex;align-items:center;justify-content:space-between;gap:8px}.sm-code-pane__title{font-size:12px;color:var(--sm-text-muted)}.sm-code{border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);background:var(--sm-code-bg);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:12px;min-height:200px}.sm-code .cm-editor{background:var(--sm-code-bg)!important;color:var(--sm-text)}.sm-code .cm-content{padding:8px;color:var(--sm-text)}.sm-doc-source{height:100%;display:flex;flex-direction:column}.sm-doc-source__bar{display:flex;gap:8px;padding:8px 12px;border-bottom:1px solid var(--sm-border);background:var(--sm-panel-bg)}.sm-doc-source__body{flex:1;min-height:0;padding:8px 12px;background:var(--sm-code-bg);overflow:auto}.sm-doc-source__body .cm-editor{height:100%;background:var(--sm-code-bg)!important;color:var(--sm-text)}.sm-doc-source__body .cm-content{color:var(--sm-text)}.sm-inline-editing{outline:2px dashed color-mix(in srgb,var(--sm-primary) 70%,var(--sm-outline-muted))!important;outline-offset:2px;box-shadow:none;border-radius:2px;background-color:color-mix(in srgb,var(--sm-primary-soft) 55%,transparent);cursor:text;min-height:1em;caret-color:var(--sm-primary);transition:outline-color .12s ease,box-shadow .12s ease,background-color .12s ease}.sm-inline-editing:focus{outline:2px solid var(--sm-primary)!important;outline-offset:2px;box-shadow:0 0 0 4px var(--sm-primary-soft);background-color:color-mix(in srgb,var(--sm-primary-soft) 35%,transparent)}.sm-inline-editing:empty:before{content:attr(data-placeholder);color:var(--sm-placeholder);pointer-events:none}.sm-floating-toolbar{position:absolute;z-index:200;display:none;align-items:center;gap:2px;padding:4px 6px;background:#1f2328;color:#fff;border-radius:8px;box-shadow:0 6px 24px #1018282e;pointer-events:auto;-webkit-user-select:none;user-select:none;white-space:nowrap;flex-wrap:wrap;max-width:calc(100% - 16px)}.sm-floating-toolbar.is-visible{display:inline-flex}.sm-floating-toolbar__group{display:inline-flex;align-items:center;gap:2px}.sm-floating-toolbar__sep{width:1px;align-self:stretch;background:#ffffff1f;margin:4px}.sm-floating-toolbar__btn{display:inline-flex;align-items:center;justify-content:center;height:26px;min-width:26px;padding:0 6px;border:0;border-radius:4px;background:transparent;color:#fff;font:inherit;cursor:pointer}.sm-floating-toolbar__btn:hover{background:#ffffff1f}.sm-floating-toolbar__btn.is-active{background:var(--sm-primary)}.sm-floating-toolbar__select{height:26px;border:0;border-radius:4px;background:#ffffff14;color:#fff;padding:0 6px;font:inherit;max-width:130px}.sm-floating-toolbar__select option{color:#1f2328}.sm-floating-toolbar__color{width:26px;height:26px;padding:0;border:0;border-radius:4px;background:#ffffff14;cursor:pointer}.sm-floating-toolbar__link-panel{display:none;flex-basis:100%;align-items:center;gap:6px;padding:4px 4px 0}.sm-floating-toolbar__link-panel.is-visible{display:flex}.sm-floating-toolbar__link-panel .sm-input{flex:1;height:26px;background:#ffffff14;border-color:#ffffff2e;color:#fff}.sm-floating-toolbar__link-panel .sm-input::placeholder{color:#ffffff80}.sm-floating-toolbar__link-panel .sm-btn{height:26px}.sm-color-picker-layer{position:absolute;z-index:210}.sm-color-picker{width:220px;padding:10px;background:var(--sm-surface, #fff);border:1px solid var(--sm-border, #e6e8ec);border-radius:var(--sm-radius-sm, 6px);box-shadow:var(--sm-shadow-md, 0 4px 16px rgba(16, 24, 40, .08))}.sm-color-picker__head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}.sm-color-picker__title{font-size:12px;font-weight:600;color:var(--sm-text, #1f2328)}.sm-color-picker__close{flex-shrink:0;width:24px;height:24px;padding:0;border:0;border-radius:var(--sm-radius-sm, 6px);background:transparent;color:var(--sm-text-muted, #6b7280);font-size:18px;line-height:1;cursor:pointer}.sm-color-picker__close:hover{background:var(--sm-ghost-hover-bg, #f0f1f4);color:var(--sm-text, #1f2328)}.sm-color-picker__swatches{display:grid;grid-template-columns:repeat(8,1fr);gap:4px;margin-bottom:8px}.sm-color-picker__swatch{width:100%;aspect-ratio:1;padding:0;border:1px solid rgba(0,0,0,.08);border-radius:4px;cursor:pointer}.sm-color-picker__swatch:hover{outline:2px solid var(--sm-primary, #4f46e5);outline-offset:1px}.sm-color-picker__native{width:100%;height:32px;margin-bottom:6px;padding:0;border:1px solid var(--sm-border, #e6e8ec);border-radius:6px;cursor:pointer}.sm-color-picker__hex{width:100%;text-align:center}.sm-color-picker__foot{display:flex;justify-content:flex-end;margin-top:8px}.sm-color-picker__clear{height:26px;font-size:12px}.sm-popover{position:absolute;z-index:100;min-width:260px;background:var(--sm-surface);border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);box-shadow:var(--sm-shadow-md)}.sm-popover--variables{max-height:min(480px,65vh);overflow:auto}.sm-popover__row{display:flex;align-items:stretch;border-bottom:1px solid var(--sm-border)}.sm-popover__row:last-child{border-bottom:0}.sm-popover__item{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0;padding:10px 12px;cursor:pointer;border:0;text-align:left;background:transparent;font:inherit}.sm-popover__item:hover{background:var(--sm-surface-hover)}.sm-popover__label{font-size:13px;color:var(--sm-text)}.sm-popover__key{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:12px;color:var(--sm-text-muted)}.sm-popover__actions{display:flex;flex-shrink:0;align-items:center;gap:6px;margin-right:8px}.sm-popover__action{padding:4px 10px;border:1px solid var(--sm-border);border-radius:var(--sm-radius-sm);background:var(--sm-surface);color:var(--sm-text-muted);font-size:12px;cursor:pointer;white-space:nowrap}.sm-popover__action:hover{background:var(--sm-surface-hover);color:var(--sm-text)}.sm-modal__mask{position:fixed;top:0;right:0;bottom:0;left:0;z-index:300;display:flex;align-items:center;justify-content:center;background:#0f172a73;opacity:0;transition:opacity .18s ease;--sm-border: #e6e8ec;--sm-outline-muted: #c7cad1;--sm-surface: #ffffff;--sm-surface-hover: #f5f6f8;--sm-text: #1f2328;--sm-text-muted: #6b7280;--sm-primary: #4f46e5;--sm-primary-soft: #eef2ff;--sm-on-primary: #ffffff;--sm-danger: #dc2626;--sm-ghost-hover-bg: #f0f1f4;--sm-code-bg: #fafbfc;--sm-modal-footer-bg: #fafbfc;--sm-canvas-bg: #eceef2;--sm-panel-bg: #ffffff;--sm-radius-sm: 6px;--sm-radius: 8px;--sm-shadow: 0 1px 2px rgba(16, 24, 40, .06);--sm-shadow-md: 0 4px 16px rgba(16, 24, 40, .08)}.sm-modal__mask.is-open{opacity:1}.sm-modal__card{display:flex;flex-direction:column;background:var(--sm-panel-bg, #ffffff);color:var(--sm-text, #1f2328);border-radius:12px;border:1px solid var(--sm-border, #e6e8ec);box-shadow:0 0 0 1px #ffffff14 inset,0 24px 48px #0f172a24,0 8px 24px #0f172a14;max-width:96vw;max-height:92vh;transform:translateY(8px) scale(.98);transition:transform .18s ease;overflow:hidden}.sm-modal__mask.is-open .sm-modal__card{transform:translateY(0) scale(1)}.sm-modal__card.sm-modal--preview{max-height:calc(100vh - 24px);min-height:50%;height:auto}.sm-modal__card.sm-modal--preview .sm-modal__body{flex:1 1 auto;min-height:0;overflow:hidden}.sm-modal__card.sm-modal--preview .sm-modal__body.sm-modal__body--center{flex-direction:column;align-items:center;justify-content:flex-start}.sm-modal__card.sm-modal--preview .sm-preview__viewport{flex:0 0 auto;width:var(--sm-preview-w);max-width:100%}.sm-modal__header{display:flex;align-items:center;gap:8px;padding:12px 16px;background:var(--sm-panel-bg, #ffffff);border-bottom:1px solid var(--sm-border, #e6e8ec)}.sm-modal__title{font-weight:600;font-size:14px}.sm-modal__header-tools{margin-left:auto;display:inline-flex;align-items:center;gap:6px}.sm-modal__close{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border:0;border-radius:6px;background:transparent;color:var(--sm-text-muted, #6b7280);cursor:pointer}.sm-modal__close:hover{background:var(--sm-ghost-hover-bg, #f0f1f4);color:var(--sm-text, #1f2328)}.sm-modal__body{flex:1;min-height:0;overflow:auto;background:var(--sm-panel-bg, #ffffff)}.sm-modal__body--center{display:flex;align-items:flex-start;justify-content:center;background:var(--sm-canvas-bg, #eceef2);padding:16px}.sm-modal__footer{display:flex;justify-content:flex-end;gap:8px;padding:10px 16px;border-top:1px solid var(--sm-border, #e6e8ec);background:var(--sm-modal-footer-bg, #fafbfc)}.sm-modal__footer:empty{display:none}.sm-modal--gallery .sm-modal__body{padding:0;display:flex;flex-direction:column;min-height:240px}.sm-modal--gallery .sm-modal__header{padding:14px 18px;background:linear-gradient(180deg,var(--sm-modal-footer-bg, #fafbfc) 0%,var(--sm-panel-bg, #ffffff) 100%)}.sm-modal--gallery .sm-modal__title{font-size:15px;font-weight:600;letter-spacing:-.02em}.sm-modal--gallery .sm-modal__footer{padding:12px 18px;gap:10px}.sm-gallery-modal{--sm-gallery-gap: 12px;--sm-gallery-cell-border: var(--sm-border, #e6e8ec);--sm-gallery-cell-radius: 8px;--sm-gallery-thumb-h: 88px;box-sizing:border-box;display:flex;flex-direction:column;gap:var(--sm-gallery-gap);flex:1;min-height:0;padding:14px 16px 16px;background:var(--sm-panel-bg, #ffffff);color:var(--sm-text, #1f2328)}.sm-gallery-modal__toolbar{flex-shrink:0}.sm-gallery-modal__toolbar-row{display:flex;flex-wrap:wrap;align-items:center;gap:10px}.sm-gallery-modal__search{flex:1 1 140px;min-width:100px;height:32px;padding-left:32px;background-color:var(--sm-surface, #ffffff);background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='6' cy='6' r='4.25'/%3E%3Cpath d='M9.5 9.5 12 12'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:10px center;background-size:14px 14px}.sm-gallery-modal__addurl-input{flex:1 1 min(220px,36vw);min-width:120px;height:32px}.sm-gallery-modal__toolbar-action{flex-shrink:0;height:32px;min-width:72px;justify-content:center;font-size:12px;font-weight:500;padding:0 14px}.sm-gallery-modal__file{position:absolute;width:0;height:0;opacity:0;pointer-events:none}.sm-gallery-modal__error{font-size:12px;color:var(--sm-danger, #dc2626);flex-shrink:0}.sm-gallery-modal__scroll{flex:1;min-height:0;overflow:auto;display:flex;flex-direction:column;gap:10px;padding:4px;margin-top:2px;background:var(--sm-modal-footer-bg, #fafbfc);border:1px solid var(--sm-border, #e6e8ec);border-radius:var(--sm-radius-sm, 6px)}.sm-gallery-modal__grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(104px,1fr));gap:8px;width:100%;min-width:0}.sm-gallery-modal__grid>*{min-width:0}.sm-gallery-modal__cell-wrap{position:relative;min-width:0;max-width:100%}.sm-gallery-modal__cell-delete{position:absolute;top:2px;right:2px;z-index:2;width:22px;height:22px;padding:0;margin:0;border:0;border-radius:4px;background:#0f172ad1;color:var(--sm-on-primary, #ffffff);font-size:16px;line-height:1;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}.sm-gallery-modal__cell-delete:hover{background:var(--sm-danger, #dc2626)}.sm-gallery-modal__cell{display:flex;flex-direction:column;align-items:stretch;margin:0;padding:6px;border:2px solid transparent;border-radius:var(--sm-gallery-cell-radius);background:var(--sm-gallery-cell-bg, #ebecef);cursor:pointer;text-align:left;font:inherit;color:inherit;transition:border-color .12s,box-shadow .12s;box-sizing:border-box;min-width:0;width:100%;max-width:100%;overflow:hidden;box-shadow:0 1px 2px #0f172a0d}.sm-gallery-modal__cell:hover{border-color:var(--sm-gallery-cell-hover-border, #d6d9df);box-shadow:0 4px 12px #0f172a12}.sm-gallery-modal__cell.is-selected{border-color:var(--sm-primary, #4f46e5);box-shadow:0 0 0 2px var(--sm-primary-soft, #eef2ff),0 4px 14px #4f46e51f}.sm-gallery-modal__thumb{display:block;flex-shrink:0;width:100%;max-width:100%;max-height:var(--sm-gallery-thumb-h);border-radius:4px;background:var(--sm-gallery-thumb-bg, #dde1e8)}.sm-gallery-modal__caption{font-size:11px;color:var(--sm-text-muted, #6b7280);margin-top:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.sm-gallery-modal__empty{grid-column:1 / -1;text-align:center;font-size:13px;color:var(--sm-text-muted, #6b7280);padding:28px 12px}.sm-gallery-modal__loadmore{align-self:center;margin-top:10px;height:34px;min-width:128px;justify-content:center;font-size:12px;font-weight:500}.sm-preview__viewport{--sm-preview-w: 800px;width:var(--sm-preview-w);max-width:100%;min-height:200px;background:#fff;border-radius:12px;border:1px solid var(--sm-border, #e6e8ec);box-shadow:var(--sm-shadow-md, 0 4px 16px rgba(16, 24, 40, .08));overflow:hidden;transition:width .2s ease,height .2s ease}.sm-preview__frame{width:100%;height:100%;border:0;background:#fff}.sm-modal--export .sm-modal__body,.sm-modal--block-code .sm-modal__body{padding:0;background:var(--sm-code-bg, #fafbfc)}.sm-export__editor{height:100%;background:var(--sm-code-bg, #fafbfc)}.sm-export__editor .cm-editor{height:100%;background:var(--sm-code-bg, #fafbfc)!important;color:var(--sm-text, #1f2328)}.sm-export__editor .cm-content{padding:12px;font-size:12px;color:var(--sm-text, #1f2328)}.sm-toast{position:absolute;left:50%;bottom:16px;transform:translate(-50%) translateY(8px);padding:6px 12px;background:#0f172adb;color:var(--sm-on-primary);font-size:12px;border-radius:6px;opacity:0;pointer-events:none;transition:opacity .18s,transform .18s}.sm-toast.is-visible{opacity:1;transform:translate(-50%) translateY(0)}
|
|
@@ -112,6 +112,15 @@ export class Canvas {
|
|
|
112
112
|
this.inlineEditor?.commit();
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
/** 强制重绘(内联编辑中会延迟到 commit 后) */
|
|
116
|
+
refresh() {
|
|
117
|
+
if (this.editingBlockId) {
|
|
118
|
+
this.pendingRender = true;
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
this._render();
|
|
122
|
+
}
|
|
123
|
+
|
|
115
124
|
destroy() {
|
|
116
125
|
this.linkNavSuppression.abort();
|
|
117
126
|
this._exitEditing(false);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Registry, defineBlock } from '../registry/registry';
|
|
2
2
|
import { renderDoc } from '../renderer';
|
|
3
|
-
import { Store, pruneSectionIfEmpty } from '../store/store';
|
|
3
|
+
import { Store, createSection, pruneSectionIfEmpty } from '../store/store';
|
|
4
4
|
import type {
|
|
5
5
|
BlockDefinition,
|
|
6
6
|
EditorUiOptions,
|
|
@@ -9,7 +9,13 @@ import type {
|
|
|
9
9
|
Selection,
|
|
10
10
|
Variable,
|
|
11
11
|
} from '../types';
|
|
12
|
+
import {
|
|
13
|
+
buildLinkVariableHtml,
|
|
14
|
+
normalizeVariable,
|
|
15
|
+
variablePlaceholder,
|
|
16
|
+
} from '../variables';
|
|
12
17
|
import { clear, h } from '../utils/dom';
|
|
18
|
+
import { appendInlineToRichHtml } from '../utils/richHtmlInsert';
|
|
13
19
|
import { Canvas } from './Canvas';
|
|
14
20
|
import { ExportModal } from './ExportModal';
|
|
15
21
|
import { LeftPanel } from './LeftPanel';
|
|
@@ -105,6 +111,8 @@ export class MailEditor {
|
|
|
105
111
|
private showLayoutBorders = false;
|
|
106
112
|
/** 「重置内容」时恢复的文档快照(与当前画布内容无关) */
|
|
107
113
|
private presetContentDoc: EmailDoc;
|
|
114
|
+
/** 宿主通过 setVariables 注入的列表;setValue 恢复文档后仍会写回,避免被 doc JSON 里的空数组覆盖 */
|
|
115
|
+
private configuredVariables: Variable[] = [];
|
|
108
116
|
private systemThemeMq: MediaQueryList | null = null;
|
|
109
117
|
private readonly _onSystemThemeMqChange = () => {
|
|
110
118
|
if (this.accentColorOverride) this._applyAccentVars();
|
|
@@ -203,6 +211,7 @@ export class MailEditor {
|
|
|
203
211
|
setValue(doc: EmailDoc) {
|
|
204
212
|
this._blurRightPanelIfFocused();
|
|
205
213
|
this.store.replace(doc);
|
|
214
|
+
this._applyConfiguredVariables();
|
|
206
215
|
}
|
|
207
216
|
|
|
208
217
|
getValue(): EmailDoc {
|
|
@@ -226,6 +235,7 @@ export class MailEditor {
|
|
|
226
235
|
resetToPreset(): void {
|
|
227
236
|
this._blurRightPanelIfFocused();
|
|
228
237
|
this.store.replace(structuredClone(this.presetContentDoc));
|
|
238
|
+
this._applyConfiguredVariables();
|
|
229
239
|
this.store.setSelection(null);
|
|
230
240
|
}
|
|
231
241
|
|
|
@@ -235,15 +245,57 @@ export class MailEditor {
|
|
|
235
245
|
}
|
|
236
246
|
|
|
237
247
|
setVariables(vars: Variable[]) {
|
|
238
|
-
this.
|
|
239
|
-
|
|
240
|
-
});
|
|
248
|
+
this.configuredVariables = vars.map(normalizeVariable);
|
|
249
|
+
this._applyConfiguredVariables();
|
|
241
250
|
}
|
|
242
251
|
|
|
243
252
|
getVariables(): Variable[] {
|
|
253
|
+
if (this.configuredVariables.length) return this.configuredVariables;
|
|
244
254
|
return this.store.doc.variables;
|
|
245
255
|
}
|
|
246
256
|
|
|
257
|
+
private _applyConfiguredVariables() {
|
|
258
|
+
if (!this.configuredVariables.length) return;
|
|
259
|
+
const snapshot = this.configuredVariables.map((v) => ({ ...v }));
|
|
260
|
+
this.store.update((d) => {
|
|
261
|
+
d.variables = snapshot;
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* 插入变量 key(`{{key}}`)。
|
|
267
|
+
* @returns 是否成功插入
|
|
268
|
+
*/
|
|
269
|
+
insertVariableKey(v: Variable): boolean {
|
|
270
|
+
const normalized = normalizeVariable(v);
|
|
271
|
+
return this._insertAtFocus(variablePlaceholder(normalized.key), false);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* 插入链接 / 图片变量对应元素(`<a>` / image 块等)。
|
|
276
|
+
* 非 link/image 时退化为 insertVariableKey。
|
|
277
|
+
*/
|
|
278
|
+
insertVariableElement(v: Variable): boolean {
|
|
279
|
+
const normalized = normalizeVariable(v);
|
|
280
|
+
if (normalized.kind === 'image') {
|
|
281
|
+
return this._insertImageVariable(normalized);
|
|
282
|
+
}
|
|
283
|
+
if (normalized.kind === 'link') {
|
|
284
|
+
const token = variablePlaceholder(normalized.key);
|
|
285
|
+
const html = buildLinkVariableHtml(
|
|
286
|
+
token,
|
|
287
|
+
this.store.doc.styles.linkColor || '#ff5a00',
|
|
288
|
+
);
|
|
289
|
+
return this._insertAtFocus(html, true);
|
|
290
|
+
}
|
|
291
|
+
return this.insertVariableKey(normalized);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/** 同 {@link insertVariableKey} */
|
|
295
|
+
insertVariable(v: Variable): boolean {
|
|
296
|
+
return this.insertVariableKey(v);
|
|
297
|
+
}
|
|
298
|
+
|
|
247
299
|
/** 当前界面主题(`system` 不解析为 light/dark)。 */
|
|
248
300
|
getTheme(): EditorTheme {
|
|
249
301
|
return this.theme;
|
|
@@ -384,9 +436,9 @@ export class MailEditor {
|
|
|
384
436
|
onFullscreenToggle: () => void this._toggleFullscreen(),
|
|
385
437
|
onLayoutBordersToggle: () => this._toggleLayoutBorders(),
|
|
386
438
|
showClearCanvasButton: this.opts.ui?.hideTopbarClearCanvas !== true,
|
|
387
|
-
onClearCanvas: () => this.
|
|
439
|
+
onClearCanvas: () => this.clearCanvas(),
|
|
388
440
|
showResetContentButton: this.opts.ui?.hideTopbarResetContent !== true,
|
|
389
|
-
onResetContent: () => this.
|
|
441
|
+
onResetContent: () => this.resetToPreset(),
|
|
390
442
|
});
|
|
391
443
|
|
|
392
444
|
this.toolbar = new RichTextToolbar({ positionRoot: this.root });
|
|
@@ -431,22 +483,6 @@ export class MailEditor {
|
|
|
431
483
|
this.store.setSelection(null);
|
|
432
484
|
}
|
|
433
485
|
|
|
434
|
-
private _confirmClearCanvas(): void {
|
|
435
|
-
const ok = window.confirm(
|
|
436
|
-
'将移除画布上所有 Section 与组件,邮件全局样式与变量列表会保留。此操作可用撤销(⌘Z)恢复。',
|
|
437
|
-
);
|
|
438
|
-
if (!ok) return;
|
|
439
|
-
this.clearCanvas();
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
private _confirmResetContent(): void {
|
|
443
|
-
const ok = window.confirm(
|
|
444
|
-
'将把邮件正文恢复为预置内容,当前画布上的所有模块将被替换。确定继续?',
|
|
445
|
-
);
|
|
446
|
-
if (!ok) return;
|
|
447
|
-
this.resetToPreset();
|
|
448
|
-
}
|
|
449
|
-
|
|
450
486
|
private _setMode(m: EditorMode) {
|
|
451
487
|
if (this.mode === m) return;
|
|
452
488
|
if (m !== 'design') this.canvas.commitInlineEdit();
|
|
@@ -509,9 +545,11 @@ export class MailEditor {
|
|
|
509
545
|
}
|
|
510
546
|
|
|
511
547
|
private _showVariablePopover(anchor: HTMLElement) {
|
|
512
|
-
|
|
548
|
+
this.canvas.currentInlineEditor?.saveSelection();
|
|
549
|
+
|
|
550
|
+
const vars = this.getVariables();
|
|
513
551
|
if (!vars.length) {
|
|
514
|
-
|
|
552
|
+
this._showToast('暂无可用变量');
|
|
515
553
|
return;
|
|
516
554
|
}
|
|
517
555
|
const existing = this.root.querySelector('.sm-popover');
|
|
@@ -520,25 +558,72 @@ export class MailEditor {
|
|
|
520
558
|
return;
|
|
521
559
|
}
|
|
522
560
|
|
|
523
|
-
const pop = h('div', { class: 'sm-popover' });
|
|
561
|
+
const pop = h('div', { class: 'sm-popover sm-popover--variables' });
|
|
562
|
+
let onDocClick: ((ev: MouseEvent) => void) | null = null;
|
|
563
|
+
const dismissPopover = () => {
|
|
564
|
+
pop.remove();
|
|
565
|
+
if (onDocClick) document.removeEventListener('click', onDocClick, true);
|
|
566
|
+
};
|
|
567
|
+
|
|
524
568
|
for (const v of vars) {
|
|
525
|
-
|
|
569
|
+
const token = variablePlaceholder(v.key);
|
|
570
|
+
const row = h('div', { class: 'sm-popover__row' });
|
|
571
|
+
const actions = h('div', { class: 'sm-popover__actions' });
|
|
572
|
+
if (v.kind === 'link' || v.kind === 'image') {
|
|
573
|
+
actions.append(
|
|
574
|
+
h(
|
|
575
|
+
'button',
|
|
576
|
+
{
|
|
577
|
+
class: 'sm-popover__action',
|
|
578
|
+
type: 'button',
|
|
579
|
+
onclick: (e: Event) => {
|
|
580
|
+
e.stopPropagation();
|
|
581
|
+
this.insertVariableElement(v);
|
|
582
|
+
dismissPopover();
|
|
583
|
+
},
|
|
584
|
+
},
|
|
585
|
+
['插入元素'],
|
|
586
|
+
),
|
|
587
|
+
);
|
|
588
|
+
}
|
|
589
|
+
actions.append(
|
|
590
|
+
h(
|
|
591
|
+
'button',
|
|
592
|
+
{
|
|
593
|
+
class: 'sm-popover__action sm-popover__action--copy',
|
|
594
|
+
type: 'button',
|
|
595
|
+
title: `复制 ${token}`,
|
|
596
|
+
onclick: (e: Event) => {
|
|
597
|
+
e.stopPropagation();
|
|
598
|
+
void copyVariableToken(token).then((ok) => {
|
|
599
|
+
if (!ok) return;
|
|
600
|
+
dismissPopover();
|
|
601
|
+
this._showToast('已复制变量');
|
|
602
|
+
});
|
|
603
|
+
},
|
|
604
|
+
},
|
|
605
|
+
['复制'],
|
|
606
|
+
),
|
|
607
|
+
);
|
|
608
|
+
row.append(
|
|
526
609
|
h(
|
|
527
610
|
'button',
|
|
528
611
|
{
|
|
529
612
|
class: 'sm-popover__item',
|
|
530
613
|
type: 'button',
|
|
531
614
|
onclick: () => {
|
|
532
|
-
this.
|
|
533
|
-
|
|
615
|
+
this.insertVariableKey(v);
|
|
616
|
+
dismissPopover();
|
|
534
617
|
},
|
|
535
618
|
},
|
|
536
619
|
[
|
|
537
|
-
h('span', { class: 'sm-popover__key' }, [`{{${v.key}}}`]),
|
|
538
620
|
h('span', { class: 'sm-popover__label' }, [v.label]),
|
|
621
|
+
h('span', { class: 'sm-popover__key' }, [token]),
|
|
539
622
|
],
|
|
540
623
|
),
|
|
624
|
+
actions,
|
|
541
625
|
);
|
|
626
|
+
pop.append(row);
|
|
542
627
|
}
|
|
543
628
|
|
|
544
629
|
const rect = anchor.getBoundingClientRect();
|
|
@@ -547,27 +632,62 @@ export class MailEditor {
|
|
|
547
632
|
pop.style.left = `${rect.left - rootRect.left}px`;
|
|
548
633
|
this.root.append(pop);
|
|
549
634
|
|
|
550
|
-
|
|
635
|
+
onDocClick = (ev: MouseEvent) => {
|
|
551
636
|
if (!pop.contains(ev.target as Node) && ev.target !== anchor) {
|
|
552
|
-
|
|
553
|
-
document.removeEventListener('click', onDocClick, true);
|
|
637
|
+
dismissPopover();
|
|
554
638
|
}
|
|
555
639
|
};
|
|
556
|
-
setTimeout(() =>
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
640
|
+
setTimeout(() => {
|
|
641
|
+
if (onDocClick) document.addEventListener('click', onDocClick, true);
|
|
642
|
+
}, 0);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
private _showToast(text: string) {
|
|
646
|
+
const t = h('div', { class: 'sm-toast' }, [text]);
|
|
647
|
+
this.root.append(t);
|
|
648
|
+
requestAnimationFrame(() => t.classList.add('is-visible'));
|
|
649
|
+
setTimeout(() => {
|
|
650
|
+
t.classList.remove('is-visible');
|
|
651
|
+
setTimeout(() => t.remove(), 200);
|
|
652
|
+
}, 1400);
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
private _insertImageVariable(v: Variable): boolean {
|
|
656
|
+
const token = variablePlaceholder(v.key);
|
|
657
|
+
const block = this.registry.createBlock('image');
|
|
658
|
+
const props = block.props as { src: string; alt: string };
|
|
659
|
+
props.src = token;
|
|
660
|
+
props.alt = v.label?.trim() || v.key;
|
|
560
661
|
const sel = this.store.selection;
|
|
561
|
-
|
|
662
|
+
this.store.update((d) => {
|
|
663
|
+
if (sel?.kind === 'block') {
|
|
664
|
+
const sec = d.sections.find((s) => s.id === sel.sectionId);
|
|
665
|
+
const col = sec?.columns[sel.columnIndex];
|
|
666
|
+
if (col) {
|
|
667
|
+
const idx = col.blocks.findIndex((b) => b.id === sel.blockId);
|
|
668
|
+
col.blocks.splice(idx >= 0 ? idx + 1 : col.blocks.length, 0, block);
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
let section = d.sections[d.sections.length - 1];
|
|
673
|
+
if (!section) {
|
|
674
|
+
section = createSection('1');
|
|
675
|
+
d.sections.push(section);
|
|
676
|
+
}
|
|
677
|
+
section.columns[0]?.blocks.push(block);
|
|
678
|
+
});
|
|
679
|
+
return true;
|
|
680
|
+
}
|
|
562
681
|
|
|
563
|
-
|
|
682
|
+
/** 在焦点处插入文本或 HTML;失败时返回 false */
|
|
683
|
+
private _insertAtFocus(content: string, asHtml: boolean): boolean {
|
|
564
684
|
const inline = this.canvas.currentInlineEditor;
|
|
565
685
|
if (inline) {
|
|
566
|
-
inline.
|
|
567
|
-
|
|
686
|
+
if (asHtml) inline.insertHtml(content);
|
|
687
|
+
else inline.insertText(content);
|
|
688
|
+
return true;
|
|
568
689
|
}
|
|
569
690
|
|
|
570
|
-
// 次之:当前聚焦的 input/textarea(属性面板)
|
|
571
691
|
const active = document.activeElement as HTMLInputElement | HTMLTextAreaElement | null;
|
|
572
692
|
if (
|
|
573
693
|
active &&
|
|
@@ -576,14 +696,14 @@ export class MailEditor {
|
|
|
576
696
|
) {
|
|
577
697
|
const start = active.selectionStart ?? active.value.length;
|
|
578
698
|
const end = active.selectionEnd ?? active.value.length;
|
|
579
|
-
active.value = active.value.slice(0, start) +
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
return;
|
|
699
|
+
active.value = active.value.slice(0, start) + content + active.value.slice(end);
|
|
700
|
+
active.dispatchEvent(new Event('input', { bubbles: true }));
|
|
701
|
+
return true;
|
|
583
702
|
}
|
|
584
703
|
|
|
585
|
-
|
|
704
|
+
const sel = this.store.selection;
|
|
586
705
|
if (sel?.kind === 'block') {
|
|
706
|
+
let updated = false;
|
|
587
707
|
this.store.update((d) => {
|
|
588
708
|
for (const s of d.sections) {
|
|
589
709
|
for (const c of s.columns) {
|
|
@@ -594,16 +714,40 @@ export class MailEditor {
|
|
|
594
714
|
def?.inlineEditable?.propKey ??
|
|
595
715
|
def?.schema.find((f) => f.type === 'text' || f.type === 'textarea')?.key;
|
|
596
716
|
if (key) {
|
|
597
|
-
const cur = String((b.props as
|
|
598
|
-
|
|
717
|
+
const cur = String((b.props as Record<string, unknown>)[key] ?? '');
|
|
718
|
+
const richInline = def?.inlineEditable && def.inlineEditable.mode !== 'plain';
|
|
719
|
+
(b.props as Record<string, unknown>)[key] = richInline
|
|
720
|
+
? appendInlineToRichHtml(cur, content)
|
|
721
|
+
: cur + content;
|
|
722
|
+
updated = true;
|
|
599
723
|
}
|
|
600
724
|
}
|
|
601
725
|
}
|
|
602
726
|
});
|
|
603
|
-
return;
|
|
727
|
+
if (updated) return true;
|
|
604
728
|
}
|
|
605
729
|
|
|
606
|
-
|
|
730
|
+
const block = this.registry.createBlock('text');
|
|
731
|
+
const wrapped = appendInlineToRichHtml('', content);
|
|
732
|
+
(block.props as { content: string }).content = wrapped;
|
|
733
|
+
this.store.update((d) => {
|
|
734
|
+
let section = d.sections[d.sections.length - 1];
|
|
735
|
+
if (!section) {
|
|
736
|
+
section = createSection('1');
|
|
737
|
+
d.sections.push(section);
|
|
738
|
+
}
|
|
739
|
+
if (sel?.kind === 'block') {
|
|
740
|
+
const sec = d.sections.find((s) => s.id === sel.sectionId);
|
|
741
|
+
const col = sec?.columns[sel.columnIndex];
|
|
742
|
+
if (col) {
|
|
743
|
+
const idx = col.blocks.findIndex((b) => b.id === sel.blockId);
|
|
744
|
+
col.blocks.splice(idx >= 0 ? idx + 1 : col.blocks.length, 0, block);
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
section.columns[0]?.blocks.push(block);
|
|
749
|
+
});
|
|
750
|
+
return true;
|
|
607
751
|
}
|
|
608
752
|
|
|
609
753
|
private _showExport() {
|
|
@@ -654,6 +798,29 @@ export class MailEditor {
|
|
|
654
798
|
}
|
|
655
799
|
}
|
|
656
800
|
|
|
801
|
+
async function copyVariableToken(token: string): Promise<boolean> {
|
|
802
|
+
try {
|
|
803
|
+
await navigator.clipboard.writeText(token);
|
|
804
|
+
return true;
|
|
805
|
+
} catch {
|
|
806
|
+
// fallback
|
|
807
|
+
}
|
|
808
|
+
try {
|
|
809
|
+
const ta = document.createElement('textarea');
|
|
810
|
+
ta.value = token;
|
|
811
|
+
ta.setAttribute('readonly', 'true');
|
|
812
|
+
ta.style.position = 'fixed';
|
|
813
|
+
ta.style.left = '-9999px';
|
|
814
|
+
document.body.appendChild(ta);
|
|
815
|
+
ta.select();
|
|
816
|
+
const ok = document.execCommand('copy');
|
|
817
|
+
document.body.removeChild(ta);
|
|
818
|
+
return ok;
|
|
819
|
+
} catch {
|
|
820
|
+
return false;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
|
|
657
824
|
function smGetFullscreenElement(): Element | null {
|
|
658
825
|
const d = document as Document & { webkitFullscreenElement?: Element | null };
|
|
659
826
|
return document.fullscreenElement ?? d.webkitFullscreenElement ?? null;
|
|
@@ -180,6 +180,14 @@ export class InlineEditor {
|
|
|
180
180
|
this.saveSelection();
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
/** 在当前光标处插入 HTML 片段(供链接类变量使用)。 */
|
|
184
|
+
insertHtml(html: string) {
|
|
185
|
+
this._ensureFocus();
|
|
186
|
+
this._restoreSelection();
|
|
187
|
+
richTextExecCommand('insertHTML', false, html);
|
|
188
|
+
this.saveSelection();
|
|
189
|
+
}
|
|
190
|
+
|
|
183
191
|
/** Toolbar 关闭某个面板/控件后调用,把选区还给编辑区,方便用户继续输入。 */
|
|
184
192
|
refocus() {
|
|
185
193
|
this._ensureFocus();
|
|
@@ -307,6 +315,7 @@ export class InlineEditor {
|
|
|
307
315
|
if (active && (active === el || el.contains(active))) return;
|
|
308
316
|
if (isColorPickerOpen()) return;
|
|
309
317
|
if (active?.closest?.('.sm-floating-toolbar, .sm-color-picker, .sm-color-picker-layer')) return;
|
|
318
|
+
if (active?.closest?.('.sm-topbar, .sm-popover')) return;
|
|
310
319
|
// 从左栏拖入 / 画布内 Sortable 排序:mousedown 会先 blur,若在此时提交会触发画布重渲染并拆掉 drop 目标
|
|
311
320
|
if (active?.closest?.('.sm-panel--left')) return;
|
|
312
321
|
if (active?.closest?.('.sm-block__handle, .sm-section__handle')) return;
|
|
@@ -315,6 +324,7 @@ export class InlineEditor {
|
|
|
315
324
|
if (related?.closest?.('.sm-block-card')) return;
|
|
316
325
|
if (related?.closest?.('.sm-block__handle, .sm-section__handle')) return;
|
|
317
326
|
if (related?.closest?.('.sm-color-picker, .sm-color-picker-layer')) return;
|
|
327
|
+
if (related?.closest?.('.sm-topbar, .sm-popover')) return;
|
|
318
328
|
if (document.querySelector('.sm-root .sm-drag, .sm-root .sm-chosen')) return;
|
|
319
329
|
this.commit();
|
|
320
330
|
}, 0);
|