mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-02 23:08:49 +01:00
🚨
This commit is contained in:
parent
04c26d6862
commit
54bb368142
3 changed files with 10 additions and 10 deletions
|
|
@ -8,17 +8,17 @@ let renderKeyboardToolbarTimeout: number;
|
|||
let showKeyboardToolbarUtil = false;
|
||||
|
||||
const getSlashItem = (value: string, icon: string, text: string, focus = "false") => {
|
||||
let iconHTML
|
||||
let iconHTML;
|
||||
if (icon && icon.startsWith("icon")) {
|
||||
iconHTML = `<svg class="keyboard__slash-icon"><use xlink:href="#${icon}"></use></svg>`
|
||||
iconHTML = `<svg class="keyboard__slash-icon"><use xlink:href="#${icon}"></use></svg>`;
|
||||
} else {
|
||||
iconHTML = icon;
|
||||
}
|
||||
return `<div class="keyboard__slash-item" data-focus="${focus}" data-value="${encodeURIComponent(value)}">
|
||||
${iconHTML}
|
||||
<span class="keyboard__slash-text">${text}</span>
|
||||
</div>`
|
||||
}
|
||||
</div>`;
|
||||
};
|
||||
|
||||
const renderSlashMenu = (protyle: IProtyle, toolbarElement: Element) => {
|
||||
protyle.hint.splitChar = "/";
|
||||
|
|
@ -101,7 +101,7 @@ const renderSlashMenu = (protyle: IProtyle, toolbarElement: Element) => {
|
|||
</div>
|
||||
<div class="keyboard__slash-title"></div>
|
||||
<div class="keyboard__slash-block">
|
||||
${getSlashItem(Constants.ZWSP + 3, "iconDownload", window.siyuan.languages.insertAsset + '<input class="b3-form__upload" type="file"' + (protyle.options.upload.accept ? (' multiple="' + protyle.options.upload.accept + '"') : "") + '/>', "true")}
|
||||
${getSlashItem(Constants.ZWSP + 3, "iconDownload", window.siyuan.languages.insertAsset + '<input class="b3-form__upload" type="file"' + (protyle.options.upload.accept ? (' multiple="' + protyle.options.upload.accept + '"') : "") + "/>", "true")}
|
||||
${getSlashItem('<iframe sandbox="allow-forms allow-presentation allow-same-origin allow-scripts allow-modals" src="" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>', "iconLanguage", window.siyuan.languages.insertIframeURL, "true")}
|
||||
</div>
|
||||
<div class="keyboard__slash-block">
|
||||
|
|
@ -333,7 +333,7 @@ export const initKeyboardToolbar = () => {
|
|||
const slashBtnElement = hasClosestByClassName(event.target as HTMLElement, "keyboard__slash-item");
|
||||
const protyle = window.siyuan.mobile.editor.protyle;
|
||||
if (slashBtnElement) {
|
||||
const dataValue = decodeURIComponent(slashBtnElement.getAttribute("data-value"))
|
||||
const dataValue = decodeURIComponent(slashBtnElement.getAttribute("data-value"));
|
||||
protyle.hint.fill(dataValue, protyle, false); // 点击后 range 会改变
|
||||
if (dataValue !== Constants.ZWSP + 3) {
|
||||
event.preventDefault();
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ const popSide = (render = true) => {
|
|||
activeBlur();
|
||||
document.getElementById("sidebar").style.left = "0";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const handleTouchEnd = (event: TouchEvent) => {
|
||||
if (window.siyuan.mobile.editor) {
|
||||
|
|
@ -218,4 +218,4 @@ const transformMask = (opacity: number) => {
|
|||
const maskElement = document.querySelector(".side-mask") as HTMLElement;
|
||||
maskElement.classList.remove("fn__none");
|
||||
maskElement.style.opacity = Math.min((1 - opacity), 0.86).toString();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -276,11 +276,11 @@ export const initWindow = () => {
|
|||
setStorageVal(Constants.LOCAL_EXPORTPDF, window.siyuan.storage[Constants.LOCAL_EXPORTPDF]);
|
||||
try {
|
||||
if (window.siyuan.config.export.pdfFooter.trim()) {
|
||||
const response = await fetchSyncPost("/api/template/renderSprig", {template:window.siyuan.config.export.pdfFooter})
|
||||
const response = await fetchSyncPost("/api/template/renderSprig", {template:window.siyuan.config.export.pdfFooter});
|
||||
ipcData.pdfOptions.displayHeaderFooter = true;
|
||||
ipcData.pdfOptions.headerTemplate = "<span></span>";
|
||||
ipcData.pdfOptions.footerTemplate = `<div style="text-align:center;width:100%;font-size:8px;line-height:12px;">
|
||||
${response.data.replace("%pages", '<span class=totalPages></span>').replace("%page", "<span class=pageNumber></span>")}
|
||||
${response.data.replace("%pages", "<span class=totalPages></span>").replace("%page", "<span class=pageNumber></span>")}
|
||||
</div>`;
|
||||
}
|
||||
window.siyuan.printWin.webContents.printToPDF(ipcData.pdfOptions).then((pdfData) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue