Skip to content

Commit

Permalink
release: 0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
RyotaUshio committed Apr 30, 2024
1 parent 2d6321f commit 788ad2e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "better-note-composer",
"name": "Better Note Composer",
"version": "0.1.1",
"version": "0.1.2",
"minAppVersion": "1.3.5",
"description": "",
"author": "Ryota Ushio",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-better-note-composer",
"version": "0.1.1",
"version": "0.1.2",
"description": "An Obsidian.md plugin",
"scripts": {
"dev": "node esbuild.config.mjs",
Expand Down
50 changes: 25 additions & 25 deletions src/modals.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import BetterNoteComposerPlugin from 'main';
import { FuzzySuggestModal, Notice, Platform, TFile } from 'obsidian';
import { FuzzySuggestModal, Keymap, Notice, Platform, TFile } from 'obsidian';
import { createFileIfNotExist } from 'utils';


Expand Down Expand Up @@ -35,35 +35,35 @@ export class MarkdownFileChooserModal extends FuzzySuggestModal<TFile> {
// @ts-ignore
this.scope.register(null, 'Enter', (evt) => {
if (!evt.isComposing) {
if (Keymap.isModifier(evt, 'Shift')) {
let path = this.inputEl.value;

if (path.includes('.')) {
const extension = path.split('.').last();
if (extension && extension !== 'md') {
new Notice(`${this.plugin.manifest.name}: Non-markdown file is not allowed`);
return;
}
}

if (!path.endsWith('.md')) {
path += '.md';
}

createFileIfNotExist(this.app, path, '')
.then((file) => {
if (file) this.onSubmit(file, evt);
});
this.close();

return false;
}

// @ts-ignore
this.chooser.useSelectedItem(evt);
return false;
}
});

this.scope.register(['Shift'], 'Enter', (evt) => {
let path = this.inputEl.value;

if (path.includes('.')) {
const extension = path.split('.').last();
if (extension && extension !== 'md') {
new Notice(`${this.plugin.manifest.name}: Non-markdown file is not allowed`);
return;
}
}

if (!path.endsWith('.md')) {
path += '.md';
}

createFileIfNotExist(this.app, path, '')
.then((file) => {
if (file) this.onSubmit(file, evt);
});
this.close();

return false;
});
}

get settings() {
Expand Down

0 comments on commit 788ad2e

Please sign in to comment.