hotfix v1.5.1

This commit is contained in:
wanxp 2022-10-31 01:22:52 +08:00
parent 44bc498994
commit 8eb87e85b0
4 changed files with 6 additions and 5 deletions

@ -50,7 +50,6 @@ export default class DoubanPlugin extends Plugin {
} }
async getDoubanTextForActiveFile(editor: Editor) { async getDoubanTextForActiveFile(editor: Editor) {
this.doubanStatusBar = this.addStatusBarItem();
const activeFile = await this.app.workspace.getActiveFile(); const activeFile = await this.app.workspace.getActiveFile();
if (activeFile) { if (activeFile) {
const searchTerm = activeFile.basename; const searchTerm = activeFile.basename;
@ -67,7 +66,9 @@ export default class DoubanPlugin extends Plugin {
async onload() { async onload() {
await this.loadSettings(); await this.loadSettings();
this.addCommand({ this.doubanStatusBar = this.addStatusBarItem();
this.addCommand({
id: "search-douban-by-current-file-name", id: "search-douban-by-current-file-name",
name: i18nHelper.getMessage("110001"), name: i18nHelper.getMessage("110001"),
editorCallback: (editor: Editor) => editorCallback: (editor: Editor) =>
@ -102,6 +103,7 @@ export default class DoubanPlugin extends Plugin {
} }
showStatus(origin:string, message:string) { showStatus(origin:string, message:string) {
this.doubanStatusBar.empty(); this.doubanStatusBar.empty();
// @ts-ignore // @ts-ignore
this.doubanStatusBar.setText(i18nHelper.getMessage(origin).replace('{0}', message)); this.doubanStatusBar.setText(i18nHelper.getMessage(origin).replace('{0}', message));

@ -114,7 +114,7 @@ export default abstract class DoubanAbstractLoadHandler<T extends DoubanSubject>
.then(this.parseSubjectFromHtml) .then(this.parseSubjectFromHtml)
.then(content => this.toEditor(editor, content)) .then(content => this.toEditor(editor, content))
// .then(content => content ? editor.replaceSelection(content) : content) // .then(content => content ? editor.replaceSelection(content) : content)
.catch(log.error(i18nHelper.getMessage('130101'))) .catch(e => log.error(i18nHelper.getMessage('130101')))
; ;
} }

@ -53,7 +53,6 @@ export class DoubanSearchModal extends Modal {
async onClose() { async onClose() {
let {contentEl} = this; let {contentEl} = this;
contentEl.empty(); contentEl.empty();
if (this.searchTerm) { if (this.searchTerm) {
await this.plugin.search(this.searchTerm, this.editor); await this.plugin.search(this.searchTerm, this.editor);

@ -14,7 +14,7 @@ class Logger {
} }
public info(e: any): any { public info(e: any): any {
console.log(`Douban Plugin info:` + `${typeof e == 'string' ? e : JSON.stringify(e)}`); // console.log(`Douban Plugin info:` + `${typeof e == 'string' ? e : JSON.stringify(e)}`);
return e; return e;
} }