Block Editor 更新正文及H标题图标

This commit is contained in:
jingrow 2026-06-04 13:32:51 +08:00
parent 08e0fd7464
commit 92c8c95a33
3 changed files with 6 additions and 5 deletions

View File

@ -677,7 +677,8 @@ onBeforeUnmount(() => {
transition: background 0.1s;
}
.be-tb-dropdown-item:hover { background: #f3f4f6; }
.be-tb-dropdown-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.be-tb-dropdown-item svg { width: 16px; height: 16px; flex-shrink: 0; display: block; }
.be-tb-dropdown-item > span { display: inline-flex; align-items: center; }
.be-tb-dropdown-divider { height: 1px; background: #e5e7eb; margin: 4px 0; }
.be-tb-dropdown-item-active { background: #eff6ff; color: #2563eb; font-weight: 600; }

View File

@ -183,7 +183,7 @@ const CHEVRON_RIGHT_ICON = makeSvg(
// ── Turn Into submenu icon map ──
function getTurnIntoIcon(name?: string): string {
const icons: Record<string, string> = {
text: makeSvg('<path d="M6 4v16m0-8h12m0-8v16"/>'),
text: makeSvg('<path d="M7 4h10M12 4v16"/>'),
h1: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><text x="2" y="18" font-family="system-ui,-apple-system,sans-serif" font-size="14" font-weight="700" fill="currentColor" stroke="none">H1</text></svg>',
h2: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><text x="2" y="18" font-family="system-ui,-apple-system,sans-serif" font-size="14" font-weight="700" fill="currentColor" stroke="none">H2</text></svg>',
h3: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><text x="2" y="18" font-family="system-ui,-apple-system,sans-serif" font-size="14" font-weight="700" fill="currentColor" stroke="none">H3</text></svg>',

View File

@ -6,7 +6,7 @@
*/
function makeTextIcon(text: string): string {
return `<text x="1" y="19" font-family="system-ui,-apple-system,sans-serif" font-size="18" font-weight="700" fill="currentColor" stroke="none">${text}</text>`
return `<text x="12" y="12" text-anchor="middle" dominant-baseline="central" font-family="system-ui,-apple-system,sans-serif" font-size="14" font-weight="800" fill="currentColor" stroke="none">${text}</text>`
}
export type IconName = keyof typeof ICONS
@ -28,9 +28,9 @@ const ICONS = {
h4: makeTextIcon('H4'),
h5: makeTextIcon('H5'),
h6: makeTextIcon('H6'),
format_paragraph: '<path d="M6 4v16m0-8h12m0-8v16" stroke-width="2"/>',
format_paragraph: '<path d="M7 4h10M12 4v16"/>',
link: '<path d="m9 15l6-6m-4-3l.463-.536a5 5 0 0 1 7.071 7.072L18 13m-5 5l-.397.534a5.07 5.07 0 0 1-7.127 0a4.97 4.97 0 0 1 0-7.071L6 11"/>',
format_size: '<text x="0.5" y="19" font-family="system-ui,-apple-system,sans-serif" font-size="20" font-weight="700" fill="currentColor" stroke="none">A</text><text x="13" y="19" font-family="system-ui,-apple-system,sans-serif" font-size="14" font-weight="600" fill="currentColor" stroke="none">a</text>',
format_size: '<text x="0.5" y="12" dominant-baseline="central" font-family="system-ui,-apple-system,sans-serif" font-size="20" font-weight="700" fill="currentColor" stroke="none">A</text><text x="13" y="12" dominant-baseline="central" font-family="system-ui,-apple-system,sans-serif" font-size="14" font-weight="600" fill="currentColor" stroke="none">a</text>',
table_menu: '<path d="M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zm0 5h18M10 3v18"/>',
align_left: '<path d="M4 6h16M4 12h10M4 18h14"/>',
align_center: '<path d="M4 6h16M8 12h8M6 18h12"/>',