Skip to content

Commit

Permalink
Updated version to 1.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
srz2 committed Nov 14, 2023
1 parent 77d765e commit 7e14c82
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 7 deletions.
38 changes: 36 additions & 2 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import { App, Editor, MarkdownView, Modal, Notice, Plugin, PluginSettingTab, Set

interface LocalSettings {
jira_instance_url: string;
local_issue_path: string;
}

const DEFAULT_SETTINGS: LocalSettings = {
jira_instance_url: ''
jira_instance_url: '',
local_issue_path: ''
}

export default class JiraLinkerPlugin extends Plugin {
Expand All @@ -16,7 +18,7 @@ export default class JiraLinkerPlugin extends Plugin {
async onload() {
await this.loadSettings();

// This adds an editor command that can perform some operation on the current editor instance
// This adds an editor command that can link a Jira issue to the local Jira instance
this.addCommand({
id: 'cmd-link-jira-issue',
name: 'Link Jira issue',
Expand Down Expand Up @@ -44,6 +46,24 @@ export default class JiraLinkerPlugin extends Plugin {
}
});

// This adds an editor command that can link a Jira issue to a local issue _Info page
this.addCommand({
id: 'cmd-link-jira-issue-info',
name: 'Link Jira issue to info',
editorCallback: (editor: Editor, view: MarkdownView) => {
const local_issue_path = this.settings.local_issue_path;
const content = editor.getSelection();

if (content == ''){
// Do nothing
return;
} else {
// Replace content with local _Issue relative path
editor.replaceSelection(`[[${local_issue_path}/${content}/_Info|${content}]]`);
}
}
});

// This adds a settings tab so the user can configure various aspects of the plugin
this.addSettingTab(new JiraLinkerSettingTab(this.app, this));
}
Expand Down Expand Up @@ -126,5 +146,19 @@ class JiraLinkerSettingTab extends PluginSettingTab {
this.plugin.settings.jira_instance_url = value;
await this.plugin.saveSettings();
}));

new Setting(containerEl)
.setName('Local Issue Path')
.setDesc('The relative path to your issue folder')
.addText(text => text
.setPlaceholder('Relative issue path')
.setValue(this.plugin.settings.local_issue_path)
.onChange(async (value) => {
if (value.endsWith('/')) {
value = value.slice(0, -1);
}
this.plugin.settings.local_issue_path = value;
await this.plugin.saveSettings();
}));
}
}
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "jira-linker",
"name": "Jira Linker",
"version": "1.0.4",
"version": "1.0.6",
"minAppVersion": "0.15.0",
"description": "Quickly format a Jira issue tag as a link to you Jira instance.",
"author": "Steven Zilberberg",
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": "jira-linker",
"version": "1.0.4",
"version": "1.0.6",
"description": "This is a simple plugin which adds a jira linker command",
"main": "main.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"1.0.4": "0.15.0"
"1.0.6": "0.15.0"
}

0 comments on commit 7e14c82

Please sign in to comment.