feat: readMe 更改

This commit is contained in:
雷军 2023-09-21 17:07:29 +08:00
parent ecc6a4a876
commit 44f738233e
3 changed files with 62 additions and 3 deletions

View file

@ -13,6 +13,12 @@ If you are using Microsoft Office 365 to create xlsx files, you need to import t
### embed link to markdown
embed link rule:
> ![[`file-folder`/`file-name`#`sheet-name`|`sri`-`sci`:`eri`-`eci`<`sheet-height`>]]
![link](./doc/img/link.gif)
![link](./doc/img/part-link.gif)
@ -21,6 +27,10 @@ If you are using Microsoft Office 365 to create xlsx files, you need to import t
![html](./doc/img/html.gif)
### Setting
![setting](./doc//img/setting.png)
### E-mail
- ljcoder@163.com

BIN
doc/img/setting.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 KiB

View file

@ -8,7 +8,6 @@ import {
Workspace,
MenuItem,
Menu,
MetadataCache
} from "obsidian";
import { ExcelSettings, DEFAULT_SETTINGS } from "./utils/Settings";
import { PaneTarget } from "./utils/ModifierkeyHelper";
@ -182,6 +181,56 @@ export default class ExcelPlugin extends Plugin {
);
}
this.registerEvent(
this.app.workspace.on("editor-menu", (menu, editor, view) => {
if (!view || !(view instanceof MarkdownView)) return;
const file = view.file;
const leaf = view.leaf;
if (!file) return;
const cache = this.app.metadataCache.getFileCache(file);
console.log('---', cache)
if (!cache?.frontmatter || !cache?.frontmatter?.FRONTMATTER_KEY)
return;
menu.addItem((item) =>
item
.setTitle("OPEN_AS_EXCEL")
.setIcon("grid")
.setSection("excel")
.onClick(() => {
//@ts-ignore
this.excelFileModes[leaf.id || file.path] =
VIEW_TYPE_EXCEL;
this.setExcelView(leaf);
})
);
})
);
this.registerEvent(
this.app.workspace.on("file-menu", (menu, file, source, leaf) => {
if (!leaf || !(leaf.view instanceof MarkdownView)) return;
if (!(file instanceof TFile)) return;
const cache = this.app.metadataCache.getFileCache(file);
if (!cache?.frontmatter || !cache?.frontmatter?.FRONTMATTER_KEY)
return;
menu.addItem((item) => {
item.setTitle("OPEN_AS_EXCEL")
.setIcon("grid")
.setSection("pane")
.onClick(() => {
//@ts-ignore
this.excelFileModes[leaf.id || file.path] =
VIEW_TYPE_EXCEL;
this.setExcelView(leaf);
});
});
//@ts-ignore
menu.items.unshift(menu.items.pop());
})
);
const self = this;
// Monkey patch WorkspaceLeaf to open Excalidraw drawings with ExcalidrawView by default
this.register(
@ -216,7 +265,7 @@ export default class ExcelPlugin extends Plugin {
"markdown"
) {
// Then check for the excalidraw frontMatterKey
const cache = this.app.metadataCache.getFileCache(
const cache = this.app.metadataCache.getCache(
state.state.file
);
@ -323,7 +372,7 @@ export default class ExcelPlugin extends Plugin {
}
const fileCache = f ? this.app.metadataCache.getFileCache(f) : null;
return (
!!fileCache?.frontmatter && !!fileCache?.frontmatter?.FRONTMATTER_KEY
!!fileCache?.frontmatter && !!fileCache?.frontmatter[FRONTMATTER_KEY]
);
}
}