This commit is contained in:
Vanessa 2023-03-19 21:21:41 +08:00
parent 3db0b0cf94
commit eba5808af2

View file

@ -105,8 +105,9 @@ const renderPDF = (id: string) => {
position: fixed;
right: 0;
top: 0;
overflow: auto;
overflow-y: auto;
bottom: 0;
overflow-x: hidden;
}
#preview {
@ -240,6 +241,8 @@ const renderPDF = (id: string) => {
const setLineNumberWidth = (element) => {
// 为保持代码块宽度一致,全部都进行宽度设定 https://github.com/siyuan-note/siyuan/issues/7692
previewElement.querySelectorAll('.hljs').forEach((item) => {
// 强制换行 https://ld246.com/article/1679228783553
item.parentElement.setAttribute("linewrap", "true");
item.parentElement.style.width = "";
item.parentElement.style.width = item.parentElement.clientWidth + "px";
item.removeAttribute('data-render');
@ -248,6 +251,7 @@ const renderPDF = (id: string) => {
previewElement.querySelectorAll('[data-type="NodeMathBlock"]').forEach((item) => {
item.style.width = "";
item.style.width = item.clientWidth + "px";
item.removeAttribute('data-render');
})
Protyle.mathRender(previewElement, "${servePath}/stage/protyle", true);
}