diff --git a/README.md b/README.md index d33166a..f0a42ee 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Note to RED 一键将 Obsidian 笔记转换为小红书图片格式的插件。 -![downloads](https://img.shields.io/badge/downloads-1K-brightgreen) ![version](https://img.shields.io/badge/version-1.0.6-blue) ![license](https://img.shields.io/badge/license-MIT-green) [![Buy Me a Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-支持作者-yellow)](https://ko-fi.com/bruceyeban) +![downloads](https://img.shields.io/badge/dynamic/json?color=brightgreen&label=downloads&query=%24%5B%22note-to-red%22%5D.downloads&url=https%3A%2F%2Fraw.githubusercontent.com%2Fobsidianmd%2Fobsidian-releases%2Fmaster%2Fcommunity-plugin-stats.json&style=flat) ![version](https://img.shields.io/github/v/tag/Yeban8090/note-to-red?color=blue&label=version&style=flat) ![license](https://img.shields.io/badge/license-MIT-green) [![Buy Me a Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-支持作者-yellow)](https://ko-fi.com/bruceyeban) ## 功能特点 - 📝 使用二级标题分割内容,每个标题自动生成一张配图 diff --git a/manifest.json b/manifest.json index 6c72472..956b5f6 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "note-to-red", "name": "Note to RED", - "version": "1.0.6", + "version": "1.0.7", "minAppVersion": "0.15.0", "description": "Convert Markdown notes to RED (Xiaohongshu) style images", "author": "Yeban", diff --git a/src/assets/preview/screenshot1.png b/src/assets/preview/screenshot1.png new file mode 100644 index 0000000..6a9856b Binary files /dev/null and b/src/assets/preview/screenshot1.png differ diff --git a/src/settings/CreateThemeModal.ts b/src/settings/CreateThemeModal.ts index 7bc3a81..493d9ef 100644 --- a/src/settings/CreateThemeModal.ts +++ b/src/settings/CreateThemeModal.ts @@ -558,40 +558,40 @@ export class CreateThemeModal extends Modal { .replace(/border:\s*1px solid\s*#[a-fA-F0-9]+80/, `border: 1px solid ${value}80`); }); }); - - new Setting(headerSection) - .setName('认证图标颜色') - .setDesc('设置认证(已验证)图标的主色') - .addColorPicker(color => { - // 兼容 background: linear-gradient(...) 和 background-color: ... - let currentColor = '#b87333'; - const bgMatch = styles.verifiedIcon.match(/background:\s*linear-gradient\([^,]+,\s*(#[a-fA-F0-9]+)/); - if (bgMatch) { - currentColor = bgMatch[1]; - } else { - const colorMatch = styles.verifiedIcon.match(/background-color:\s*(#[a-fA-F0-9]+)/); - if (colorMatch) { - currentColor = colorMatch[1]; + + new Setting(headerSection) + .setName('认证图标颜色') + .setDesc('设置认证(已验证)图标的主色') + .addColorPicker(color => { + // 兼容 background: linear-gradient(...) 和 background-color: ... + let currentColor = '#b87333'; + const bgMatch = styles.verifiedIcon.match(/background:\s*linear-gradient\([^,]+,\s*(#[a-fA-F0-9]+)/); + if (bgMatch) { + currentColor = bgMatch[1]; + } else { + const colorMatch = styles.verifiedIcon.match(/background-color:\s*(#[a-fA-F0-9]+)/); + if (colorMatch) { + currentColor = colorMatch[1]; + } } - } - color.setValue(currentColor) - .onChange(value => { - // 先处理 linear-gradient - if (styles.verifiedIcon.includes('linear-gradient')) { + color.setValue(currentColor) + .onChange(value => { + // 先处理 linear-gradient + if (styles.verifiedIcon.includes('linear-gradient')) { + styles.verifiedIcon = styles.verifiedIcon + .replace(/background:\s*linear-gradient\([^)]+\)/, `background: linear-gradient(135deg, ${value}, ${value})`); + } + // 再处理 background-color + if (styles.verifiedIcon.includes('background-color')) { + styles.verifiedIcon = styles.verifiedIcon + .replace(/background-color:\s*#[a-fA-F0-9]+/, `background-color: ${value}`); + } + // 统一处理 border 和 box-shadow styles.verifiedIcon = styles.verifiedIcon - .replace(/background:\s*linear-gradient\([^)]+\)/, `background: linear-gradient(135deg, ${value}, ${value})`); - } - // 再处理 background-color - if (styles.verifiedIcon.includes('background-color')) { - styles.verifiedIcon = styles.verifiedIcon - .replace(/background-color:\s*#[a-fA-F0-9]+/, `background-color: ${value}`); - } - // 统一处理 border 和 box-shadow - styles.verifiedIcon = styles.verifiedIcon - .replace(/border:\s*1px solid\s*#[a-fA-F0-9]+80/, `border: 1px solid ${value}80`) - .replace(/box-shadow:\s*0 2px 8px [^;]+;/, `box-shadow: 0 2px 8px ${value}1a;`); - }); - }); + .replace(/border:\s*1px solid\s*#[a-fA-F0-9]+80/, `border: 1px solid ${value}80`) + .replace(/box-shadow:\s*0 2px 8px [^;]+;/, `box-shadow: 0 2px 8px ${value}1a;`); + }); + }); } private addTitleSettings(container: HTMLElement, styles: any) { @@ -669,6 +669,38 @@ export class CreateThemeModal extends Modal { styles.container = styles.container.replace(/background:\s*[^;]+/, `background: ${value}`); }); }); + // 新增:页脚上下内边距设置(只改第一个值,第二个值保持原样) + new Setting(footerSection) + .setName('上下内边距') + .setDesc('设置页脚区域的上下内边距(单位:px)') + .addText(text => { + // 解析当前padding + let match = styles.container.match(/padding:\s*(\d+)px\s*(\d+)px/); + let paddingTop = '16', paddingLR = '16'; + if (match) { + paddingTop = match[1]; + paddingLR = match[2]; + } else { + // 兼容只有一个值的情况 + let single = styles.container.match(/padding:\s*(\d+)px/); + if (single) { + paddingTop = single[1]; + paddingLR = single[1]; + } + } + text.setValue(paddingTop) + .onChange(value => { + const v = parseInt(value) || 16; + // 只替换第一个值,第二个值保持原样 + if (styles.container.match(/padding:\s*\d+px\s*\d+px/)) { + styles.container = styles.container.replace(/padding:\s*\d+px\s*\d+px/, `padding: ${v}px ${paddingLR}px`); + } else if (styles.container.match(/padding:\s*\d+px/)) { + styles.container = styles.container.replace(/padding:\s*\d+px/, `padding: ${v}px ${paddingLR}px`); + } else { + styles.container += ` padding: ${v}px ${paddingLR}px;`; + } + }); + }); } private addParagraphAndEmphasisSettings(container: HTMLElement, styles: any) { diff --git a/src/styles/view/tool-bar.css b/src/styles/view/tool-bar.css index 98a3e77..03b9631 100644 --- a/src/styles/view/tool-bar.css +++ b/src/styles/view/tool-bar.css @@ -81,11 +81,13 @@ margin: 0 20px 0 10px; flex: none ; } +.red-controls-group .red-like-button { + flex: none; +} .red-controls-group .red-export-button { background-color: var(--text-accent); color: var(--text-on-accent); - border: none; } .red-controls-group .red-export-button:hover { color: var(--text-on-accent);