release: v0.1.7 — editing experience: gutter, auto-format, bracket close, drag-drop, outline

feat(core): line number gutter with current line highlight
- .me-gutter rendered alongside textarea, sync-scrolls with content
- .me-gutter-active highlights the line containing the cursor
- config.lineNumbers (default true) to toggle

feat(core): smart Enter auto-formatting
- List continuation: '- ' / '1. ' auto-insert on Enter at end of list item
- Ordered list auto-increment: '1.' → '2.'
- Quote continuation: '> ' auto-insert on Enter at end of quote line
- Empty list/quote item: Enter removes the marker (end list)

feat(core): bracket/quote auto-close
- (), [], {}, <>, "", '', ``, **, __ auto-close pairs
- Selection wrapping: select text then press ( → wraps as (text)
- config.autoBrackets (default true) to toggle

feat(core): drag & drop file support
- Drop image files → auto base64 inline insert ![](data:...)
- Drop text/code files → insert file contents
- Drop external text from browser → insert at cursor

feat(core): outline/TOC panel
- Extracts headings from rendered HTML preview
- Nested tree with indentation by heading level
- Click to scroll-jump in both preview and textarea
- config.outline (default false) to toggle

style: gutter, outline panel, current line highlight CSS

test: 11 new tests for gutter, auto-format, bracket close, outline (532 total)

chore: bump version 0.1.6 → 0.1.7 across all files, site, types
This commit is contained in:
2026-07-24 10:33:12 +08:00
parent 45ed8d5351
commit 289b8e55a6
18 changed files with 539 additions and 24 deletions
+63 -1
View File
@@ -1,7 +1,7 @@
/**
* MetonaEditor Styles - 编辑器样式
* @module styles
* @version 0.1.6
* @version 0.1.7
* @description 编辑器 UI 样式注入与管理
*/
@@ -127,6 +127,32 @@ const generateCSS = () => {
overflow: hidden;
position: relative;
}
/* ============ 编辑区内层(v0.1.7 ============ */
.me-editor-inner { display: flex; height: 100%; overflow: hidden; position: relative; }
.me-gutter {
flex: 0 0 auto;
min-width: 36px;
padding: 16px 8px 16px 6px;
overflow: hidden;
background: var(--md-code-bg);
border-right: 1px solid var(--md-border);
color: var(--md-muted);
font-family: var(--md-mono);
font-size: 12px;
line-height: 1.7;
text-align: right;
user-select: none;
white-space: pre;
}
.me-gutter-line { padding-right: 4px; }
.me-gutter-active {
color: var(--md-accent);
font-weight: 600;
background: rgba(59, 130, 246, 0.08);
border-radius: 3px;
}
.me-divider {
flex: 0 0 1px;
background: var(--md-border);
@@ -454,6 +480,42 @@ const generateCSS = () => {
margin-left: 24px;
}
/* ============ 大纲面板(v0.1.7 ============ */
.me-outline {
position: absolute;
top: 0; right: 0;
width: 220px;
height: 100%;
overflow-y: auto;
background: var(--md-preview-bg);
border-left: 1px solid var(--md-border);
padding: 12px 14px;
font-size: 13px;
z-index: 15;
}
.me-outline-title {
font-weight: 650;
margin-bottom: 8px;
padding-bottom: 6px;
border-bottom: 1px solid var(--md-border);
color: var(--md-text);
}
.me-outline ul { list-style: none; padding: 0; margin: 0; }
.me-outline li { margin: 2px 0; }
.me-outline a {
color: var(--md-muted);
text-decoration: none;
display: block;
padding: 2px 6px;
border-radius: 4px;
transition: background 0.1s, color 0.1s;
}
.me-outline a:hover { background: var(--md-code-bg); color: var(--md-accent); }
.me-outline-l1 a { font-weight: 600; color: var(--md-text); }
.me-outline-l2 a { padding-left: 12px; }
.me-outline-l3 a { padding-left: 20px; font-size: 12px; }
.me-outline-l4 a { padding-left: 28px; font-size: 12px; }
/* ============ 打印样式 ============ */
@media print {
.me-wrapper { border: 0 !important; box-shadow: none !important; }