Skip to content
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

Did this miss the editorCallback() and editorCheckCallback() ? #29

Open
yajamon opened this issue Jul 3, 2022 · 1 comment
Open

Did this miss the editorCallback() and editorCheckCallback() ? #29

yajamon opened this issue Jul 3, 2022 · 1 comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested

Comments

@yajamon
Copy link
Owner

yajamon commented Jul 3, 2022

When I look at the Command of the obsidian-api, I notice that there are editorCallback() and editorCheckCallback().
However, this plugin doesn't seem to be tied to that part.
I haven't investigated it yet. If there is a problem, please add an issue in Bug Report format. At that time, I will be grateful.

Ref. https://github.com/obsidianmd/obsidian-api/blob/d4b79f95ccf3838a305915a137a844250766d023/obsidian.d.ts#L535-L546
Ref.

if (target.callback) {
command.callback = () => {
const target = app.commands.commands[alias.commandId];
if (target) {
target.callback();
} else {
new Notice("Missing command. The command may be invalid.");
}
};
}
if (target.checkCallback) {
command.checkCallback = (checking) => {
const target = app.commands.commands[alias.commandId];
if (target) {
return target.checkCallback(checking);
}
if (checking) {
// Don't hide the probrem.
return true;
} else {
new Notice("Missing command. The command may be invalid.");
}
}
}
this.addCommand(command);

@yajamon yajamon added help wanted Extra attention is needed good first issue Good for newcomers question Further information is requested labels Jul 3, 2022
@yajamon
Copy link
Owner Author

yajamon commented Jul 3, 2022

obsidian-apiCommand を見ると、editorCallback()editorCheckCallback() があるが、このプラグインはまだ実装していないように見える。
この件はまだ調査をしていません。もし不具合があれば、Bug Report形式でissueを追加してもらえると助かります。

Ref. https://github.com/obsidianmd/obsidian-api/blob/d4b79f95ccf3838a305915a137a844250766d023/obsidian.d.ts#L535-L546
Ref.

if (target.callback) {
command.callback = () => {
const target = app.commands.commands[alias.commandId];
if (target) {
target.callback();
} else {
new Notice("Missing command. The command may be invalid.");
}
};
}
if (target.checkCallback) {
command.checkCallback = (checking) => {
const target = app.commands.commands[alias.commandId];
if (target) {
return target.checkCallback(checking);
}
if (checking) {
// Don't hide the probrem.
return true;
} else {
new Notice("Missing command. The command may be invalid.");
}
}
}
this.addCommand(command);

私の予想では、エディタ用のコマンドにエイリアスを追加し、それを実行すれば検証できるはずです。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant