This commit is contained in:
Vanessa 2022-12-24 22:04:01 +08:00
parent f7352acc45
commit 54d00a4081
5 changed files with 32 additions and 25 deletions

View file

@ -126,13 +126,9 @@
} }
&__cardblock { &__cardblock {
.protyle-wysiwyg { .protyle-wysiwyg [data-node-id][custom-riff-decks] {
padding: 16px;
[data-node-id][custom-riff-decks] {
box-shadow: none; box-shadow: none;
} }
}
&--show span[data-type~=mark] { &--show span[data-type~=mark] {
transition: var(--b3-transition); transition: var(--b3-transition);

View file

@ -51,14 +51,17 @@ export const openCard = () => {
render: { render: {
background: false, background: false,
title: false, title: false,
gutter: true, gutter: false,
breadcrumbDocName: true, breadcrumbDocName: true,
breadcrumbContext: true,
}, },
typewriterMode: false typewriterMode: false
}); });
if (blocks.length > 0) { if (blocks.length > 0) {
fetchPost("/api/riff/renderRiffCard", {blockID: blocks[index].blockID}, (response) => { fetchPost("/api/filetree/getDoc", {
id: blocks[index].blockID,
mode: 0,
size: Constants.SIZE_GET_MAX
}, (response) => {
onGet(response, editor.protyle, [Constants.CB_GET_ALL, Constants.CB_GET_HTML]); onGet(response, editor.protyle, [Constants.CB_GET_ALL, Constants.CB_GET_HTML]);
}); });
} }
@ -76,7 +79,11 @@ export const openCard = () => {
editor.protyle.element.classList.remove("fn__none"); editor.protyle.element.classList.remove("fn__none");
editor.protyle.element.nextElementSibling.classList.add("fn__none"); editor.protyle.element.nextElementSibling.classList.add("fn__none");
actionElement.classList.remove("fn__none"); actionElement.classList.remove("fn__none");
fetchPost("/api/riff/renderRiffCard", {blockID: blocks[index].blockID}, (response) => { fetchPost("/api/filetree/getDoc", {
id: blocks[index].blockID,
mode: 0,
size: Constants.SIZE_GET_MAX
}, (response) => {
onGet(response, editor.protyle, [Constants.CB_GET_ALL, Constants.CB_GET_HTML]); onGet(response, editor.protyle, [Constants.CB_GET_ALL, Constants.CB_GET_HTML]);
}); });
} else { } else {
@ -132,7 +139,11 @@ export const openCard = () => {
return; return;
} }
countElement.firstElementChild.innerHTML = (index + 1).toString(); countElement.firstElementChild.innerHTML = (index + 1).toString();
fetchPost("/api/riff/renderRiffCard", {blockID: blocks[index].blockID}, (response) => { fetchPost("/api/filetree/getDoc", {
id: blocks[index].blockID,
mode: 0,
size: Constants.SIZE_GET_MAX
}, (response) => {
onGet(response, editor.protyle, [Constants.CB_GET_ALL, Constants.CB_GET_HTML]); onGet(response, editor.protyle, [Constants.CB_GET_ALL, Constants.CB_GET_HTML]);
}); });
}); });

View file

@ -7,7 +7,10 @@ let yDiff: number;
export const handleTouchEnd = () => { export const handleTouchEnd = () => {
if (window.siyuan.mobileEditor) { if (window.siyuan.mobileEditor) {
window.siyuan.mobileEditor.protyle.breadcrumb?.show(); document.querySelectorAll(".protyle-breadcrumb__bar--hide").forEach(item => {
item.classList.remove("protyle-breadcrumb__bar--hide")
})
window.siyuan.hideBreadcrumb = false;
} }
if (!clientX || !clientY || navigator.userAgent.indexOf("iPhone") === -1) { if (!clientX || !clientY || navigator.userAgent.indexOf("iPhone") === -1) {

View file

@ -359,6 +359,7 @@ export class Breadcrumb {
<div class="fn__flex">${window.siyuan.languages.image}<span class="fn__space fn__flex-1"></span>${response.data.imageCount}</div> <div class="fn__flex">${window.siyuan.languages.image}<span class="fn__space fn__flex-1"></span>${response.data.imageCount}</div>
<div class="fn__flex">${window.siyuan.languages.ref}<span class="fn__space fn__flex-1"></span>${response.data.refCount}</div>`, <div class="fn__flex">${window.siyuan.languages.ref}<span class="fn__space fn__flex-1"></span>${response.data.refCount}</div>`,
}).element); }).element);
window.siyuan.menus.menu.element.style.zIndex = "310";
window.siyuan.menus.menu.popup(position); window.siyuan.menus.menu.popup(position);
}); });
} }
@ -446,9 +447,4 @@ export class Breadcrumb {
this.element.classList.add("protyle-breadcrumb__bar--hide"); this.element.classList.add("protyle-breadcrumb__bar--hide");
window.siyuan.hideBreadcrumb = true; window.siyuan.hideBreadcrumb = true;
} }
public show() {
this.element.classList.remove("protyle-breadcrumb__bar--hide");
window.siyuan.hideBreadcrumb = false;
}
} }

View file

@ -85,14 +85,10 @@ const switchDialogEvent = (event: MouseEvent, switchDialog: Dialog) => {
export const globalShortcut = () => { export const globalShortcut = () => {
window.addEventListener("mousemove", (event) => { window.addEventListener("mousemove", (event) => {
if (window.siyuan.hideBreadcrumb) { if (window.siyuan.hideBreadcrumb) {
getAllModels().editor.forEach(item => { document.querySelectorAll(".protyle-breadcrumb__bar--hide").forEach(item => {
item.editor.protyle.breadcrumb.show(); item.classList.remove("protyle-breadcrumb__bar--hide")
}); })
window.siyuan.blockPanels.forEach(item => { window.siyuan.hideBreadcrumb = false;
item.editors.forEach(edit => {
edit.protyle.breadcrumb.show();
});
});
} }
const eventPath0 = event.composedPath()[0] as HTMLElement; const eventPath0 = event.composedPath()[0] as HTMLElement;
@ -540,6 +536,11 @@ export const globalShortcut = () => {
} }
if (matchHotKey(window.siyuan.config.keymap.general.riffCard.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.general.riffCard.custom, event)) {
openCard(); openCard();
if (target.classList.contains("protyle-wysiwyg") ||
target.classList.contains("protyle-title__input") ||
target.tagName === "INPUT" || target.tagName === "TEXTAREA") {
target.blur();
}
event.preventDefault(); event.preventDefault();
return; return;
} }