Skip to content

Commit 39a3efc

Browse files
Implement Obsidian review feedback
obsidianmd/obsidian-releases#2272 (comment) Also added a link to the Moment.js docs for quick reference
1 parent a70903b commit 39a3efc

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

main.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// v0.1.0 https://github.com/jamesgreenblue/obsidian-quicknote is licensed under the MIT License
1+
// https://github.com/jamesgreenblue/obsidian-quicknote is licensed under the MIT License
22

33
const LOG_PREFIX = "obsidian-quicknote",
44
LOG_LOADING = "hello",
@@ -11,7 +11,7 @@ const obsidian = require("obsidian"),
1111
const dockMenu = Menu.buildFromTemplate([
1212
{
1313
label: 'New quick note',
14-
click () { this.app.commands.executeCommandById('quicknote:jgb-create-quick-note'); }
14+
click () { this.app.commands.executeCommandById('quicknote:create-quick-note'); }
1515
}
1616
])
1717

@@ -25,7 +25,7 @@ class QuickNotePlugin extends obsidian.Plugin {
2525
}
2626

2727
this.addCommand({
28-
id: "jgb-create-quick-note",
28+
id: "create-quick-note",
2929
name: "New quick note",
3030
icon: "popup-open",
3131
callback: async () => {
@@ -70,6 +70,11 @@ class QuickNotePlugin extends obsidian.Plugin {
7070

7171
}
7272

73+
htmlToFragment = (html) =>
74+
document
75+
.createRange()
76+
.createContextualFragment((html ?? "").replace(/\s+/g, " "));
77+
7378
var DEFAULT_SETTINGS = {
7479
quickNoteTitle: "YYYY-MM-DD [Quick note]"
7580
};
@@ -78,10 +83,7 @@ var SettingTab = class extends obsidian.PluginSettingTab {
7883
display() {
7984
const { containerEl } = this;
8085
containerEl.empty();
81-
containerEl.createEl("h1", {
82-
text: `${this.plugin.manifest.name} ${this.plugin.manifest.version}`
83-
});
84-
new obsidian.Setting(this.containerEl).setName("Quick note title").setDesc("See Moment.js documentation for instructions").addText((text) => {
86+
new obsidian.Setting(this.containerEl).setName("Quick note title").setDesc(htmlToFragment(`See Moment.js <a href="https://momentjs.com/docs/#/displaying/format/" target="_blank" rel="noopener">Format docs</a> for options`)).addText((text) => {
8587
text.setPlaceholder(DEFAULT_SETTINGS.quickNoteTitle).setValue(this.plugin.settings.quickNoteTitle).onChange((newTitle) => {
8688
this.plugin.settings.quickNoteTitle = newTitle;
8789
this.plugin.saveSettings();

manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "quicknote",
33
"name": "Quick note",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"minAppVersion": "0.15.0",
66
"description": "Create a quick note in a floating window (on command or by right-clicking the Obsidian app icon)",
77
"author": "James Greenhalgh MBCS",

0 commit comments

Comments
 (0)