-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically remove blank lines in HTML blocks #7921
Comments
麻烦给出原始的 HTML 块内容。 |
<div>
<button id="button">
更新用户指南
</button>
<script type="module">
{
/* 自定义 ID */
const CUSTOM_ID = "E4555D40-2E2B-4C40-9598-AE05B77CEB9F";
/**
* HTML 块中的脚本获取当前块相关信息
* @param {string} customID 内部定义的 ID
* @returns {string} id 当前 HTML 块 ID
* @returns {HTMLElement} block 当前 HTML 块
* @returns {HTMLElement} shadowRoot 当前 HTML 块 shadowRoot
*/
function This(customID) {
let protyle = document.querySelector(`protyle-html[data-content*="${customID}"]`);
if (protyle) {
let block = protyle.parentElement.parentElement;
return {
id: block.dataset.nodeId,
block: block,
shadowRoot: protyle.shadowRoot,
};
} else return null;
}
const NOTEBOOKS_ID_LIST = [
"20210808180117-czj9bvb", // 简体中文用户指南
"20211226090932-5lcq56f", // 繁体中文用户指南
"20210808180117-6v0mkxr", // 英文用户指南
]; // 用户指南笔记本 ID 列表
const URL = "/api/notebook/openNotebook"; // 重新打开笔记本的 API
const THIS = This(CUSTOM_ID); // 获取当前 HTML 块相关信息
const BUTTON = THIS.shadowRoot.getElementById("button"); // 获取按钮元素
async function reOpenUserGuide() {
NOTEBOOKS_ID_LIST.forEach(notebook_id => {
fetch(URL, {
body: JSON.stringify({
notebook: notebook_id,
}),
method: 'POST',
});
});
}
BUTTON.addEventListener("click", reOpenUserGuide);
}
</script>
</div> |
Zuoqiu-Yingyi
added a commit
to Zuoqiu-Yingyi/siyuan
that referenced
this issue
Apr 14, 2023
貌似还是没完全修好 2.8.5-dev2 中 HTML 块内插入如下内容 <div>
123
</div>
关闭输入框后再打开输入框, 结尾会多出一个 标签, 如下所示 <div>
123
</div>
</div> |
应该定位到问题了, 稍后我提交一个 PR |
Zuoqiu-Yingyi
added a commit
to Zuoqiu-Yingyi/siyuan
that referenced
this issue
Apr 15, 2023
commit 5f06c8c Merge: 3e9f5a3 d22a269 Author: Vanessa <lly219@gmail.com> Date: Sat Apr 15 11:39:25 2023 +0800 Merge remote-tracking branch 'origin/dev' into dev commit 3e9f5a3 Author: Vanessa <lly219@gmail.com> Date: Sat Apr 15 11:39:09 2023 +0800 :art: fix siyuan-note#8005 commit d22a269 Author: Liang Ding <d@b3log.org> Date: Sat Apr 15 11:26:06 2023 +0800 :memo: Add explanation of what "SiYuan" means to the SiYuan User Guide Fix siyuan-note#8004 commit 1ad395c Author: Vanessa <lly219@gmail.com> Date: Fri Apr 14 23:03:14 2023 +0800 :rotating_light: commit 2ee6b54 Author: Vanessa <lly219@gmail.com> Date: Fri Apr 14 23:02:44 2023 +0800 :bug: fix siyuan-note#7979 commit 671f182 Author: Vanessa <lly219@gmail.com> Date: Fri Apr 14 22:42:21 2023 +0800 :rotating_light: commit 7557c77 Merge: 8680611 d79f97d Author: Vanessa <lly219@gmail.com> Date: Fri Apr 14 22:26:52 2023 +0800 Merge remote-tracking branch 'origin/dev' into dev commit 8680611 Author: Vanessa <lly219@gmail.com> Date: Fri Apr 14 22:26:34 2023 +0800 :art: fix siyuan-note#7979 commit d79f97d Author: 绛亽 <83791825+Soltus@users.noreply.github.com> Date: Fri Apr 14 20:59:03 2023 +0800 Update package.json (siyuan-note#8002) commit 73b6ee5 Author: Liang Ding <d@b3log.org> Date: Fri Apr 14 20:55:59 2023 +0800 :octocat: Security report just in English commit ffd148e Author: Liang Ding <d@b3log.org> Date: Fri Apr 14 20:54:49 2023 +0800 :octocat: PR template just in English commit 867852a Author: Liang Ding <d@b3log.org> Date: Fri Apr 14 20:39:09 2023 +0800 :art: Add OCR-related operations to the picture menu siyuan-note#7203 commit acffdeb Author: Liang Ding <d@b3log.org> Date: Fri Apr 14 20:31:41 2023 +0800 :art: Add OCR-related operations to the picture menu siyuan-note#7203 commit dfe0f4c Author: Liang Ding <d@b3log.org> Date: Fri Apr 14 20:25:58 2023 +0800 :art: Add OCR-related operations to the picture menu siyuan-note#7203 commit 2231d08 Author: Vanessa <lly219@gmail.com> Date: Fri Apr 14 20:21:09 2023 +0800 :lipstick: fix siyuan-note#7986 commit b15cfb0 Merge: a339747 de440b8 Author: Vanessa <lly219@gmail.com> Date: Fri Apr 14 20:10:02 2023 +0800 Merge remote-tracking branch 'origin/dev' into dev commit a339747 Author: Vanessa <lly219@gmail.com> Date: Fri Apr 14 20:09:44 2023 +0800 :art: fix siyuan-note#7982 commit de440b8 Author: Liang Ding <d@b3log.org> Date: Fri Apr 14 20:05:36 2023 +0800 :arrow_up: Upgrade PNPM version commit 6d7d8a8 Author: Liang Ding <d@b3log.org> Date: Fri Apr 14 20:02:24 2023 +0800 :art: Reduce holding time of open user guide tip commit 35c954d Author: Liang Ding <d@b3log.org> Date: Fri Apr 14 20:02:07 2023 +0800 :art: Reduce holding time of open user guide tip commit dd2a1b2 Author: Vanessa <lly219@gmail.com> Date: Fri Apr 14 16:51:54 2023 +0800 :art: siyuan-note#7203 commit c2ca60c Merge: 7d8f725 28f3920 Author: Vanessa <lly219@gmail.com> Date: Fri Apr 14 16:44:56 2023 +0800 Merge remote-tracking branch 'origin/dev' into dev commit 7d8f725 Author: Vanessa <lly219@gmail.com> Date: Fri Apr 14 16:44:42 2023 +0800 :art: siyuan-note#7954 commit 28f3920 Author: 颖逸 <49649786+Zuoqiu-Yingyi@users.noreply.github.com> Date: Fri Apr 14 16:38:35 2023 +0800 :art: fix siyuan-note#7921 (siyuan-note#7997) commit 862d0db Author: Liang Ding <d@b3log.org> Date: Fri Apr 14 16:36:04 2023 +0800 :art: Spaced repetition interface supports review by document selection siyuan-note#7954 commit 4529221 Author: Vanessa <lly219@gmail.com> Date: Fri Apr 14 16:32:52 2023 +0800 :art: siyuan-note#7954 commit e7091c3 Merge: e4a77c9 d7bea02 Author: Vanessa <lly219@gmail.com> Date: Fri Apr 14 16:27:43 2023 +0800 Merge remote-tracking branch 'origin/dev' into dev commit e4a77c9 Author: Vanessa <lly219@gmail.com> Date: Fri Apr 14 16:27:28 2023 +0800 :art: siyuan-note#7954
Zuoqiu-Yingyi
added a commit
to Zuoqiu-Yingyi/siyuan
that referenced
this issue
Apr 15, 2023
Zuoqiu-Yingyi
added a commit
to Zuoqiu-Yingyi/siyuan
that referenced
this issue
Apr 15, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
HTML 块存在空行时造成运行时异常
Is there an existing issue for this?
Can the issue be reproduced with the default theme (daylight/midnight)?
Could the issue be due to extensions?
Describe the problem
HTML 块存在空行时提示
形成了多个 HTML 块,为防止数据丢失请使用 <div> 标签包裹并去掉空行
, 然后点击编辑按钮进行编辑时出现运行时异常When there are empty lines in the HTML block, prompts
Multiple HTML blocks are formed. To prevent data loss, please use <div> tags to wrap and remove blank lines
, and then click the Edit button to edit a runtime exception when editingExpected result
HTML 块在保存时自动移除空行
HTML blocks automatically remove empty lines when saved
Screenshot or screen recording presentation
No response
Version environment
Log file
More information
No response
The text was updated successfully, but these errors were encountered: