-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: adjust hierarchy notes show nothing #330
Comments
export let modal: ModifyHierItemModal;
export let settings: BCSettings;
export let hnItem: HNItem;
export let file: TFile;
export let rel: "up" | "same" | "down";
interface HNItem {
depth: number;
line: string;
lineNo: number;
}
let inputEl: HTMLInputElement;
let newItem = modal.app.workspace.activeLeaf.view.file.basename
const buildNewItem = (
newItem: string,
depth = hnItem.depth,
preview = false
) =>
`${" ".repeat(Math.round(depth / (preview ? 2 : 1)))}- ${
preview ? newItem || "<Empty>" : makeWiki(newItem)
}`; default value of quick add HN should be file name. |
in only onChooseItem(item: HNItem, evt: MouseEvent | KeyboardEvent): void {
if (evt instanceof KeyboardEvent && evt.key === "Delete") {
this.deleteItem(item);
}else if (evt instanceof KeyboardEvent && evt.key == "Enter" && evt.shiftKey ){
const view = this.app.workspace.getActiveViewOfType(MarkdownView);
const { editor } = view ?? {};
if (!editor) return;
//@ts-ignore
view.leaf.openFile(this.file, { active: true, mode: "source" });
editor.setCursor({ line: item.lineNo, ch: item.depth + 2 });
} else if (evt instanceof KeyboardEvent || evt instanceof MouseEvent) {
let rel : "up" | "down" | "same" ;
if (evt instanceof MouseEvent && evt.type == "click") {
rel = "down"
}
if ( evt instanceof KeyboardEvent ) {
if ( evt.key === "Enter") rel = "down"
}
if ( evt instanceof KeyboardEvent && evt.shiftKey ) {
if (evt.key === "ArrowUp") rel = "up"
if ( evt.key === "ArrowDown" ) rel = "down"
if (evt.key === "ArrowRight") rel = "same"
}
new ModifyHierItemModal(
this.app,
this.plugin,
item,
this.file,
rel
).open();
this.close();
}
} |
also using if clause is clearer than |
This will be resolved by your PR :) |
I try out the
adjust hierarchy note
feature but it shows nothing.I have no idea what the problem is. The index refresh without any problem. Should be some problem in the code.
CleanShot.2022-02-07.at.15.39.19.mp4
Version: 2.52.0
The text was updated successfully, but these errors were encountered: