Compare commits
4 Commits
v1.3.11
...
b9feb2f764
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9feb2f764 | ||
|
|
97a70bc23b | ||
|
|
437619cfff | ||
|
|
10ef109353 |
@@ -183,7 +183,7 @@ export class XiaohongshuPreview {
|
|||||||
this.articleHTML = articleHTML;
|
this.articleHTML = articleHTML;
|
||||||
this.currentFile = file;
|
this.currentFile = file;
|
||||||
|
|
||||||
new Notice('正在分页...');
|
//new Notice('正在分页...');
|
||||||
|
|
||||||
// 创建临时容器用于分页
|
// 创建临时容器用于分页
|
||||||
const tempContainer = document.createElement('div');
|
const tempContainer = document.createElement('div');
|
||||||
@@ -200,7 +200,7 @@ export class XiaohongshuPreview {
|
|||||||
// 在分页前先应用主题与高亮,确保测量使用正确样式
|
// 在分页前先应用主题与高亮,确保测量使用正确样式
|
||||||
this.applyThemeCSS();
|
this.applyThemeCSS();
|
||||||
this.pages = await paginateArticle(tempContainer, this.settings);
|
this.pages = await paginateArticle(tempContainer, this.settings);
|
||||||
new Notice(`分页完成:共 ${this.pages.length} 页`);
|
//new Notice(`分页完成:共 ${this.pages.length} 页`);
|
||||||
|
|
||||||
this.currentPageIndex = 0;
|
this.currentPageIndex = 0;
|
||||||
// 初次渲染时应用当前主题
|
// 初次渲染时应用当前主题
|
||||||
@@ -520,7 +520,7 @@ export class XiaohongshuPreview {
|
|||||||
if (!this.articleHTML) return;
|
if (!this.articleHTML) return;
|
||||||
const totalBefore = this.pages.length || 1;
|
const totalBefore = this.pages.length || 1;
|
||||||
const posRatio = (this.currentPageIndex + 0.5) / totalBefore; // 以当前页中心作为相对位置
|
const posRatio = (this.currentPageIndex + 0.5) / totalBefore; // 以当前页中心作为相对位置
|
||||||
new Notice('重新分页中...');
|
//new Notice('重新分页中...');
|
||||||
|
|
||||||
const tempContainer = document.createElement('div');
|
const tempContainer = document.createElement('div');
|
||||||
tempContainer.innerHTML = this.articleHTML;
|
tempContainer.innerHTML = this.articleHTML;
|
||||||
@@ -539,7 +539,7 @@ export class XiaohongshuPreview {
|
|||||||
this.currentPageIndex = 0;
|
this.currentPageIndex = 0;
|
||||||
}
|
}
|
||||||
this.renderCurrentPage();
|
this.renderCurrentPage();
|
||||||
new Notice(`重新分页完成:共 ${this.pages.length} 页`);
|
//new Notice(`重新分页完成:共 ${this.pages.length} 页`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('重新分页失败', e);
|
console.error('重新分页失败', e);
|
||||||
new Notice('重新分页失败');
|
new Notice('重新分页失败');
|
||||||
|
|||||||
31
todolist.md
31
todolist.md
@@ -56,8 +56,25 @@
|
|||||||
- 点击"全部页切图",把所有html页面转为png图片,图片保存路径和命名按此前设置。
|
- 点击"全部页切图",把所有html页面转为png图片,图片保存路径和命名按此前设置。
|
||||||
✅
|
✅
|
||||||
|
|
||||||
3. 整合xhs登陆和发布功能。
|
3. 目前xhs模式发布功能未实现,因为没有登录。
|
||||||
-
|
整合xhs登陆和发布功能。
|
||||||
|
- 在“用户配置”tab中增加“小红书用户名”配置项,默认13357108011。(⚠️ **后续可能需要维护多账号**)
|
||||||
|
- xhslogin项目,XHS_PHONE=13357108011 XHS_AUTO_CLOSE=1 npm run publish -- --title "恢复功能测试" --content "验证恢复核心功能后保留优化的代码" --images "/Users/gavin/myweb/static/img/ibook笔记.png" --visibility private --collection 自嗨 --timestamp
|
||||||
|
其中:
|
||||||
|
- 参数XHS_PHONE为“小红书用户名”配置项。
|
||||||
|
- title取markdown文章的title
|
||||||
|
- content取markdown文章frontmatter中的description信息,如果没有description或内容为空,取markdown正文前2段(段以空行隔离,不超过300字[n];段1+段2>n,取段1;段1+段2+段3>n,取段1段2 ……)
|
||||||
|
- images取小红书切图结果,按文章次序。
|
||||||
|
- visibility在小红书模式下,预览页的工具栏中增加"公开"checkbox,默认为不选,即private。
|
||||||
|
- collection在小红书模式下,预览页的工具栏中增加下拉框选择,下拉框内容从登录小红书自动获取。
|
||||||
|
- timestamp是调试使用,默认使用
|
||||||
|
|
||||||
|
❓ 重构后无法运行,原因是obsidian中playwright环境没有。
|
||||||
|
❌ 要用xhslogin 的 Playwright 逻辑,就必须把 Playwright 当成外部依赖加载(运行前安装 playwright 和浏览器内核)。 如果一定要彻底摆脱 Playwright,只能回到 webview 方案,重新实现一次自动化流程,与其说“利用现成 Chromium”,不如说“自己写网页自动化框架”,工作量很大。
|
||||||
|
|
||||||
|
**改变思路**:
|
||||||
|
xhslogin改造成MCP server部署在远端服务器上。插件中只要实现mcp client就可以了。
|
||||||
|
这样xhslogin项目没有必要整合到note2any中。
|
||||||
|
|
||||||
## 问题
|
## 问题
|
||||||
1. "发布平台"首次选“小红书”时,预览页面没有加载当前文章。
|
1. "发布平台"首次选“小红书”时,预览页面没有加载当前文章。
|
||||||
@@ -121,11 +138,21 @@ SOLVE:obsidian控制台打印信息,定位在哪里阻塞,AI修复。
|
|||||||
10. 新建docs文件夹,把除了README和todolist以外的markdown文件放到docs中。
|
10. 新建docs文件夹,把除了README和todolist以外的markdown文件放到docs中。
|
||||||
✅
|
✅
|
||||||
|
|
||||||
|
11. `` -- 不应该渲染为图片链接
|
||||||
|
|
||||||
|
|
||||||
## 经验
|
## 经验
|
||||||
1. 在不确定AI是否理解,或者需求是否准确的情况下,先用codex chat模式提问,看回答确定AI理解是否准确。
|
1. 在不确定AI是否理解,或者需求是否准确的情况下,先用codex chat模式提问,看回答确定AI理解是否准确。
|
||||||
尤其对于较大规模的重构需求,这点很重要 ‼️ 。
|
尤其对于较大规模的重构需求,这点很重要 ‼️ 。
|
||||||
|
|
||||||
|
例如:
|
||||||
|
这个思路有问题。我提供命令行只是对参数做说明,这些参数实际上是函数参数。
|
||||||
|
我需要把xhslogin的功能代码无缝的整合进现有项目中,而不是通过命令行传参的方式实现。
|
||||||
|
这么做的同时,保持结构和模块清晰。
|
||||||
|
请再提供思路,我来审核下。
|
||||||
|
|
||||||
2. 复杂页面,codex生成的css可能无比复杂,不便于维护修改。
|
2. 复杂页面,codex生成的css可能无比复杂,不便于维护修改。
|
||||||
自己写布局demo原型,让codex参考布局修改(原来元素美化的css可保留)。
|
自己写布局demo原型,让codex参考布局修改(原来元素美化的css可保留)。
|
||||||
demo原型可以手绘后,拍照让chatgpt生成,在此基础上自己修改。
|
demo原型可以手绘后,拍照让chatgpt生成,在此基础上自己修改。
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user