Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifest-beta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "obsidian-linter",
"name": "Linter",
"version": "1.29.0",
"minAppVersion": "1.5.7",
"minAppVersion": "1.9.0",
"description": "Formats and styles your notes. It can be used to format YAML tags, aliases, arrays, and metadata; footnotes; headings; spacing; math blocks; regular markdown contents like list, italics, and bold styles; and more with the use of custom rule options as well.",
"author": "Victor Tao",
"authorUrl": "https://github.com/platers",
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "obsidian-linter",
"name": "Linter",
"version": "1.29.0",
"minAppVersion": "1.5.7",
"minAppVersion": "1.9.0",
"description": "Formats and styles your notes. It can be used to format YAML tags, aliases, arrays, and metadata; footnotes; headings; spacing; math blocks; regular markdown contents like list, italics, and bold styles; and more with the use of custom rule options as well.",
"author": "Victor Tao",
"authorUrl": "https://github.com/platers",
Expand Down
8 changes: 4 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ export default class LinterPlugin extends Plugin {
const saveCommandDefinition = this.app.commands?.commands?.[
'editor:save-file'
];
if (saveCommandDefinition && saveCommandDefinition.callback && this.originalSaveCallback) {
saveCommandDefinition.callback = this.originalSaveCallback;
if (saveCommandDefinition && saveCommandDefinition.checkCallback && this.originalSaveCallback) {
saveCommandDefinition.checkCallback = this.originalSaveCallback;
}
}

Expand Down Expand Up @@ -319,10 +319,10 @@ export default class LinterPlugin extends Plugin {
'editor:save-file'
];

this.originalSaveCallback = saveCommandDefinition?.callback;
this.originalSaveCallback = saveCommandDefinition?.checkCallback;

if (typeof this.originalSaveCallback === 'function') {
saveCommandDefinition.callback = () => {
saveCommandDefinition.checkCallback = () => {
this.originalSaveCallback();
Comment on lines +325 to 326

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per the api docs, shouldn't this be: ?

Suggested change
saveCommandDefinition.checkCallback = () => {
this.originalSaveCallback();
saveCommandDefinition.checkCallback = (checking: boolean) => {
this.originalSaveCallback(checking);

likewise, this.runLinterEditor below should be wrapped with if (!checking) { ... }

Copy link
Contributor Author

@kdnk kdnk May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@baodrate
Thank you! Right. I'll create another PR.


if (this.settings.lintOnSave && this.isEnabled) {
Expand Down