Skip to content

Commit

Permalink
Merge pull request #48 from Hi-Windom/dev2301
Browse files Browse the repository at this point in the history
1.1.2
  • Loading branch information
Soltus authored Jan 11, 2023
2 parents d5a0ba3 + 0658b8b commit 1cac817
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 20 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,23 @@

## ✨ 正式开启公测

### v1.1 聚合说明

> 2023-01-?? released
<p>
<img src="https://img.shields.io/badge/SiYuan-2.6.2-green" alt="适配 SiYuan v2.6.2" title="建议先更新思源版本" style="cursor:pointer;height: 38px;margin: 3px auto;"/>
<img src="https://img.shields.io/badge/winsay-1.5-green" alt="适配 Sofill- v1.5" title="建议先更新Sofill-版本" style="cursor:pointer;height: 38px;margin: 3px auto;"/>
<img src="https://img.shields.io/badge/-%E6%9E%84%E5%BB%BA-yellow" alt="这是一个构建版本" title="建议手动删除旧版本后再下载,而不是直接更新" style="cursor:pointer;height: 38px;margin: 3px;"/> <br>
<img src="https://img.shields.io/badge/Android-NO-red?logo=Android" title="" style="margin: 3px auto;"/>
<img src="https://img.shields.io/badge/Windows 11-PASS-green?logo=Windows 11" title="" style="margin: 3px auto;"/>
<img src="https://img.shields.io/badge/Docker-NO-red?logo=Docker" title="" style="margin: 3px auto;"/>
</p>

引入特性:

1. [【导出助手】导出PDF支持根据一级标题分页 · Issue #12 · v1.1.2](https://github.com/Hi-Windom/lili/issues/12)

### 主题设置界面入口指南

Step 1 确保在思源软件设置里关闭了【隐藏底部状态栏】
Expand Down
8 changes: 8 additions & 0 deletions extension/plugin/Export_Helper/css/custom__split_byH1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@media print {
.h1 {
page-break-before: always;
}
}
.h1 {
page-break-before: always;
}
41 changes: 24 additions & 17 deletions extension/plugin/Export_Helper/export.html
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
#tell {
margin-bottom: 2em;
}

#configs table {
min-width: 100%;
font-size: 1.31em;
}

#configs th,
#configs td {
border: 1px #000000 solid;
padding: 3px;
}
</style>
</head>

<body>
<div>
<p style="font-size:10.5pt"><span style="font-family:'Microsoft JhengHei'">你好</span><span
style="font-family:'Courier New'"></span><span style="font-family:'Microsoft JhengHei'">我是导出助手</span></p>
<p style="font-size:10.5pt"><span style="font-family:'Courier New'; -aw-import:ignore">&nbsp;</span></p>
<p style="font-size:10.5pt"><span style="font-family:'Microsoft JhengHei'">我可以</span><span
style="font-family:'Courier New'"></span></p>
<p style="font-size:10.5pt"><span style="font-family:'Courier New'; -aw-import:ignore">&nbsp;</span></p>
<ol type="1" style="margin:0pt; padding-left:0pt">
<li style="margin-left:17.6pt; padding-left:7.6pt; font-family:'Courier New'; font-size:10.5pt"><span
style="font-family:'Microsoft JhengHei'">更好地预览导出效果</span></li>
<li style="margin-left:17.6pt; padding-left:7.6pt; font-family:'Courier New'; font-size:10.5pt"><span
style="font-family:'Microsoft JhengHei'">选择不同的页脚</span></li>
<li style="margin-left:17.6pt; padding-left:7.6pt; font-family:'Courier New'; font-size:10.5pt"><span
style="font-family:'Microsoft JhengHei'">敬请期待</span></li>
</ol>
</div>
<div id="tell">
<p>以下表格显示了额外的配置,修改它们请在主题设置面板>扩展>导出助手配置界面完成</p>
</div>
<div id="configs"></div>
</body>
</html>

</html>
38 changes: 36 additions & 2 deletions extension/plugin/Export_Helper/renderPDF.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,11 +658,42 @@ export const renderPDF = (id) => {
await window.siyuan.printWin.webContents.insertCSS(css);
event.preventDefault();
} else {
window.siyuan.printWin.webContents.removeInsertedCSS(key_action_auto_folded);
window.siyuan.printWin.webContents.removeInsertedCSS(
key_action_auto_folded
);
key_action_auto_folded = null;
}
});
ipcMain.on("export-pdf-lili-more", (event, data) => {

let custom__split_byH1 = localStorage.getItem(
"SC_lili_cp_extension_plugin__Export_Helper__custom__split_byH1"
);
if (custom__split_byH1 == "true") {
let file = `${window.siyuan.config.system.confDir}/appearance/themes/Sofill=/extension/plugin/Export_Helper/css/custom__split_byH1.css`;
let css = fs.readFileSync(file).toString();
window.siyuan.printWin.webContents.insertCSS(css);
}
ipcMain.on("export-pdf-lili-more", async (event, data) => {
const configsHTML = `
<table>
<thead>
<tr>
<th>项</th>
<th>值</th>
</tr>
</thead>
<tbody>
<tr>
<td>根据一级标题分页</td>
<td>${custom__split_byH1}</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>
`;
if (!window.siyuan.printWin) {
return;
}
Expand Down Expand Up @@ -693,6 +724,9 @@ export const renderPDF = (id) => {
`http://${host}:${port}/extension/plugin/Export_Helper/export.html`
);
child.once("ready-to-show", () => {
child.webContents.executeJavaScript(
`document.querySelector("#configs").innerHTML = \`${configsHTML}\`;`
);
child.show();
});
child.on("closed", () => {
Expand Down
2 changes: 1 addition & 1 deletion theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Sofill=",
"author": "Soltus",
"url": "https://github.com/Hi-Windom/lili",
"version": "1.1.1",
"version": "1.1.2",
"modes": [
"light"
]
Expand Down

0 comments on commit 1cac817

Please sign in to comment.