mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-21 11:30:42 +08:00
This commit is contained in:
parent
268f83cf9e
commit
902ad918c1
@ -81,7 +81,7 @@ class Protyle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.init();
|
this.init();
|
||||||
if (!options.action.includes(Constants.CB_GET_HISTORY)) {
|
if (!mergedOptions.action.includes(Constants.CB_GET_HISTORY)) {
|
||||||
this.protyle.ws = new Model({
|
this.protyle.ws = new Model({
|
||||||
id: this.protyle.id,
|
id: this.protyle.id,
|
||||||
type: "protyle",
|
type: "protyle",
|
||||||
@ -164,13 +164,13 @@ class Protyle {
|
|||||||
fetchPost("/api/filetree/getDoc", {
|
fetchPost("/api/filetree/getDoc", {
|
||||||
id: options.blockId,
|
id: options.blockId,
|
||||||
k: options.key || "",
|
k: options.key || "",
|
||||||
mode: (options.action && options.action.includes(Constants.CB_GET_CONTEXT)) ? 3 : 0, // 0: 仅当前 ID(默认值),1:向上 2:向下,3:上下都加载,4:加载最后
|
mode: (mergedOptions.action && mergedOptions.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,
|
size: mergedOptions.action?.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,
|
||||||
}, getResponse => {
|
}, getResponse => {
|
||||||
onGet(getResponse, this.protyle, options.action, options.scrollAttr);
|
onGet(getResponse, this.protyle, mergedOptions.action, options.scrollAttr);
|
||||||
if (this.protyle.model) {
|
if (this.protyle.model) {
|
||||||
/// #if !MOBILE
|
/// #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);
|
setPanelFocus(this.protyle.model.element.parentElement.parentElement);
|
||||||
}
|
}
|
||||||
updatePanelByEditor(this.protyle, false);
|
updatePanelByEditor(this.protyle, false);
|
||||||
|
@ -17,6 +17,7 @@ export class Options {
|
|||||||
breadcrumbDocName: false,
|
breadcrumbDocName: false,
|
||||||
breadcrumbContext: false
|
breadcrumbContext: false
|
||||||
},
|
},
|
||||||
|
action: [],
|
||||||
after: undefined,
|
after: undefined,
|
||||||
classes: {
|
classes: {
|
||||||
preview: "",
|
preview: "",
|
||||||
|
@ -136,7 +136,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||||||
window.siyuan.menus.menu.remove();
|
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();
|
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[],
|
blockPaths: IBreadcrumb[],
|
||||||
dom: string
|
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