Skip to content

Commit

Permalink
1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dy-sh committed Apr 7, 2021
1 parent 92e907c commit 8022e66
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { App, Plugin, PluginSettingTab, Setting, MarkdownView } from 'obsidian';
import * as CodeMirror from "codemirror";

interface PluginSettings {
language1: string;
language: string;
language2: string;
language3: string;
}

const DEFAULT_SETTINGS: PluginSettings = {
language1: '',
language: '',
language2: '',
language3: '',
}
Expand All @@ -30,7 +30,7 @@ export default class CodeBlockFromSelection extends Plugin {
addCommands(): void {
this.addCommand({
id: 'code-block-from-selection-1',
name: this.settings.language1 ? `language1 (${this.settings.language1})` : "language1",
name: this.settings.language ? `language1 (${this.settings.language})` : "language1",
callback: () => this.insertCodeBlock("language1")
});

Expand All @@ -54,7 +54,7 @@ export default class CodeBlockFromSelection extends Plugin {
let selectedText = this.getSelectedText(editor);
let line = this.getLineUnderCursor(editor).start.line

let language = this.settings.language1;
let language = this.settings.language;
if (setting === "language2") {
language = this.settings.language2;
}
Expand Down Expand Up @@ -129,9 +129,9 @@ class SettingTab extends PluginSettingTab {
.setDesc('')
.addText(text => text
.setPlaceholder('Example: c++')
.setValue(this.plugin.settings.language1)
.setValue(this.plugin.settings.language)
.onChange(async (value) => {
this.plugin.settings.language1 = value;
this.plugin.settings.language = value;
await this.plugin.saveSettings();

this.plugin.addCommands()
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "code-block-from-selection",
"name": "Code block from selection",
"version": "1.0.3",
"version": "1.0.4",
"minAppVersion": "0.9.12",
"description": "Adds code block for the selected text",
"author": "Dmitry Savosh",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-code-block-from-selection",
"version": "1.0.3",
"version": "1.0.4",
"description": "Adds code block for the selected text",
"main": "main.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"1.0.4": "0.9.12",
"1.0.3": "0.9.12",
"1.0.2": "0.9.12",
"1.0.1": "0.9.12"
Expand Down

0 comments on commit 8022e66

Please sign in to comment.