mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-07-03 14:09:06 +02:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -9,5 +9,6 @@ Some areas we don't consider security vulnerabilities:
|
||||
* Arbitrary file write: Writing files outside the workspace path (e.g., exporting files) is a common user need
|
||||
* Chart/Formula/ABC rendering code injection: This is a common user need, for details please refer to https://github.com/siyuan-note/siyuan/pull/6917
|
||||
* SQL injection
|
||||
* Pandoc Argument Injection: Allowing the setting of `--lua-filter` is a common user need
|
||||
|
||||
Thank you very much!
|
||||
|
||||
@@ -484,6 +484,11 @@ const initMainWindow = () => {
|
||||
}
|
||||
});
|
||||
|
||||
currentWindow.webContents.on('render-process-gone', (event, details) => {
|
||||
console.log('Reason: ', details.reason);
|
||||
console.log('Exit code', details.exitCode);
|
||||
});
|
||||
|
||||
if (windowState.isDevToolsOpened) {
|
||||
currentWindow.webContents.openDevTools({mode: "bottom"});
|
||||
}
|
||||
|
||||
@@ -375,9 +375,43 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
||||
insertHTML(removeZWJ(textPlain).replace(/```/g, "\u200D```"), protyle);
|
||||
return;
|
||||
} else if (siyuanHTML) {
|
||||
async function streamInsert(container: HTMLElement, bigHtmlString: string) {
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.style.display = 'none';
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
const doc = iframe.contentWindow.document;
|
||||
doc.open();
|
||||
|
||||
const chunkSize = 102400;
|
||||
let offset = 0;
|
||||
while (offset < bigHtmlString.length) {
|
||||
const chunk = bigHtmlString.substring(offset, offset + chunkSize);
|
||||
doc.write(chunk);
|
||||
offset += chunkSize;
|
||||
await new Promise(resolve => setTimeout(resolve, 0));
|
||||
}
|
||||
|
||||
doc.close();
|
||||
|
||||
const fragment = document.createDocumentFragment();
|
||||
while (doc.body.firstChild) {
|
||||
fragment.appendChild(doc.body.firstChild);
|
||||
}
|
||||
|
||||
container.innerHTML = '';
|
||||
container.appendChild(fragment);
|
||||
|
||||
document.body.removeChild(iframe);
|
||||
}
|
||||
|
||||
// 编辑器内部粘贴
|
||||
const tempElement = document.createElement("div");
|
||||
tempElement.innerHTML = siyuanHTML;
|
||||
if (1024 * 512 < siyuanHTML.length) {
|
||||
await streamInsert(tempElement, siyuanHTML)
|
||||
} else {
|
||||
tempElement.innerHTML = siyuanHTML;
|
||||
}
|
||||
if (range.toString()) {
|
||||
let types: string[] = [];
|
||||
let linkElement: HTMLElement;
|
||||
|
||||
Reference in New Issue
Block a user