mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-21 03:21:21 +08:00
This commit is contained in:
parent
268f83cf9e
commit
902ad918c1
@ -81,7 +81,7 @@ class Protyle {
|
||||
}
|
||||
|
||||
this.init();
|
||||
if (!options.action.includes(Constants.CB_GET_HISTORY)) {
|
||||
if (!mergedOptions.action.includes(Constants.CB_GET_HISTORY)) {
|
||||
this.protyle.ws = new Model({
|
||||
id: this.protyle.id,
|
||||
type: "protyle",
|
||||
@ -164,13 +164,13 @@ class Protyle {
|
||||
fetchPost("/api/filetree/getDoc", {
|
||||
id: options.blockId,
|
||||
k: options.key || "",
|
||||
mode: (options.action && options.action.includes(Constants.CB_GET_CONTEXT)) ? 3 : 0, // 0: 仅当前 ID(默认值),1:向上 2:向下,3:上下都加载,4:加载最后
|
||||
size: options.action?.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,
|
||||
mode: (mergedOptions.action && mergedOptions.action.includes(Constants.CB_GET_CONTEXT)) ? 3 : 0, // 0: 仅当前 ID(默认值),1:向上 2:向下,3:上下都加载,4:加载最后
|
||||
size: mergedOptions.action?.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, this.protyle, options.action, options.scrollAttr);
|
||||
onGet(getResponse, this.protyle, mergedOptions.action, options.scrollAttr);
|
||||
if (this.protyle.model) {
|
||||
/// #if !MOBILE
|
||||
if (options.action?.includes(Constants.CB_GET_FOCUS)) {
|
||||
if (mergedOptions.action?.includes(Constants.CB_GET_FOCUS)) {
|
||||
setPanelFocus(this.protyle.model.element.parentElement.parentElement);
|
||||
}
|
||||
updatePanelByEditor(this.protyle, false);
|
||||
|
@ -17,6 +17,7 @@ export class Options {
|
||||
breadcrumbDocName: false,
|
||||
breadcrumbContext: false
|
||||
},
|
||||
action: [],
|
||||
after: undefined,
|
||||
classes: {
|
||||
preview: "",
|
||||
|
@ -136,7 +136,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||
window.siyuan.menus.menu.remove();
|
||||
}
|
||||
|
||||
if (!["Alt", "Meta", "Shift", "Control", "CapsLock", "Escape"].includes(event.key)) {
|
||||
if (!["Alt", "Meta", "Shift", "Control", "CapsLock", "Escape"].includes(event.key) && protyle.options.render.breadcrumb) {
|
||||
protyle.breadcrumb.hide();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,32 @@
|
||||
export const renderBacklink = (protype: IProtyle, backlinkData: {
|
||||
import {getIconByType} from "../../editor/getIcon";
|
||||
import {removeLoading} from "../ui/initUI";
|
||||
|
||||
export const renderBacklink = (protyle: IProtyle, backlinkData: {
|
||||
blockPaths: IBreadcrumb[],
|
||||
dom: string
|
||||
}[]) => {
|
||||
|
||||
protyle.block.showAll = true
|
||||
let html = ""
|
||||
backlinkData.forEach(item => {
|
||||
html += genBreadcrumb(item.blockPaths) + item.dom
|
||||
});
|
||||
protyle.wysiwyg.element.innerHTML = html
|
||||
removeLoading(protyle);
|
||||
}
|
||||
|
||||
const genBreadcrumb = (blockPaths: IBreadcrumb[]) => {
|
||||
let html = ''
|
||||
blockPaths.forEach((item, index) => {
|
||||
if (index === 0) {
|
||||
return;
|
||||
}
|
||||
html += `<span class="protyle-breadcrumb__item" data-node-id="${item.id}">
|
||||
<svg class="popover__block" data-id="${item.id}"><use xlink:href="#${getIconByType(item.type, item.subType)}"></use></svg>
|
||||
<span class="protyle-breadcrumb__text" title="${item.name}">${item.name}</span>
|
||||
</span>`;
|
||||
if (index !== blockPaths.length - 1) {
|
||||
html += '<svg class="protyle-breadcrumb__arrow"><use xlink:href="#iconRight"></use></svg>';
|
||||
}
|
||||
})
|
||||
return `<div contenteditable="false" class="protyle-breadcrumb__bar protyle-breadcrumb__bar--nowrap">${html}</div>`;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user