mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 18:10:12 +01:00
🎨 闪卡可以编辑
This commit is contained in:
parent
3d682a115d
commit
c874aab825
1 changed files with 8 additions and 10 deletions
|
|
@ -3,7 +3,7 @@ import {fetchPost} from "../util/fetch";
|
||||||
import {isMobile} from "../util/functions";
|
import {isMobile} from "../util/functions";
|
||||||
import {Protyle} from "../protyle";
|
import {Protyle} from "../protyle";
|
||||||
import {Constants} from "../constants";
|
import {Constants} from "../constants";
|
||||||
import {disabledProtyle, onGet} from "../protyle/util/onGet";
|
import {onGet} from "../protyle/util/onGet";
|
||||||
import {hasClosestByClassName} from "../protyle/util/hasClosest";
|
import {hasClosestByClassName} from "../protyle/util/hasClosest";
|
||||||
|
|
||||||
export const openCard = () => {
|
export const openCard = () => {
|
||||||
|
|
@ -47,21 +47,19 @@ export const openCard = () => {
|
||||||
dialog.element.querySelector("input").focus();
|
dialog.element.querySelector("input").focus();
|
||||||
const editor = new Protyle(dialog.element.querySelector("[data-type='render']") as HTMLElement, {
|
const editor = new Protyle(dialog.element.querySelector("[data-type='render']") as HTMLElement, {
|
||||||
blockId: "",
|
blockId: "",
|
||||||
action: [Constants.CB_GET_HISTORY],
|
action: [Constants.CB_GET_ALL],
|
||||||
render: {
|
render: {
|
||||||
background: false,
|
background: false,
|
||||||
title: false,
|
title: false,
|
||||||
gutter: false,
|
gutter: true,
|
||||||
breadcrumb: false,
|
breadcrumbDocName: true,
|
||||||
breadcrumbDocName: false,
|
breadcrumbContext: true,
|
||||||
breadcrumbContext: false,
|
|
||||||
},
|
},
|
||||||
typewriterMode: false
|
typewriterMode: false
|
||||||
});
|
});
|
||||||
disabledProtyle(editor.protyle);
|
|
||||||
if (blocks.length > 0) {
|
if (blocks.length > 0) {
|
||||||
fetchPost("/api/riff/renderRiffCard", {blockID: blocks[index].blockID}, (response) => {
|
fetchPost("/api/riff/renderRiffCard", {blockID: blocks[index].blockID}, (response) => {
|
||||||
onGet(response, editor.protyle, [Constants.CB_GET_HISTORY, Constants.CB_GET_HTML]);
|
onGet(response, editor.protyle, [Constants.CB_GET_ALL, Constants.CB_GET_HTML]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
dialog.element.setAttribute("data-key", window.siyuan.config.keymap.general.riffCard.custom);
|
dialog.element.setAttribute("data-key", window.siyuan.config.keymap.general.riffCard.custom);
|
||||||
|
|
@ -79,7 +77,7 @@ export const openCard = () => {
|
||||||
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/riff/renderRiffCard", {blockID: blocks[index].blockID}, (response) => {
|
||||||
onGet(response, editor.protyle, [Constants.CB_GET_HISTORY, Constants.CB_GET_HTML]);
|
onGet(response, editor.protyle, [Constants.CB_GET_ALL, Constants.CB_GET_HTML]);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
countElement.classList.add("fn__none");
|
countElement.classList.add("fn__none");
|
||||||
|
|
@ -135,7 +133,7 @@ export const openCard = () => {
|
||||||
}
|
}
|
||||||
countElement.firstElementChild.innerHTML = (index + 1).toString();
|
countElement.firstElementChild.innerHTML = (index + 1).toString();
|
||||||
fetchPost("/api/riff/renderRiffCard", {blockID: blocks[index].blockID}, (response) => {
|
fetchPost("/api/riff/renderRiffCard", {blockID: blocks[index].blockID}, (response) => {
|
||||||
onGet(response, editor.protyle, [Constants.CB_GET_HISTORY, Constants.CB_GET_HTML]);
|
onGet(response, editor.protyle, [Constants.CB_GET_ALL, Constants.CB_GET_HTML]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue