Skip to content

Commit

Permalink
Update readme with a better map, increment version
Browse files Browse the repository at this point in the history
  • Loading branch information
damonsk committed Nov 4, 2024
1 parent 0dc4a7a commit 3d06551
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 107 deletions.
40 changes: 28 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,34 @@ Add a code block to your markdown file using Source mode ` ```wardleymap ` inclu
### Example

```wardleymap
title Sample Wardley Map
note "This is a simple example" at 0.5 0.5 [0.89, 0.08]
component Customer [0.58, 0.17]
component Website [0.52, 0.68]
component Payment Gateway [0.25, 0.60]
component Hosting [0.3, 0.4]
Customer -> Website
Website -> Payment Gateway
Website -> Hosting
title Tea Shop
anchor Business [0.95, 0.63]
anchor Public [0.95, 0.78]
component Cup of Tea [0.79, 0.61] label [-67.61, 4.90]
component Cup [0.73, 0.78] label [15.05, -10.00]
component Tea [0.63, 0.81]
component Hot Water [0.52, 0.80]
component Water [0.38, 0.82]
component Kettle [0.43, 0.35] label [-57, 4]
evolve Kettle->Electric Kettle 0.62 label [16, 5]
component Power [0.1, 0.7] label [-27, 20]
evolve Power 0.89 label [-12, 21]
Business->Cup of Tea
Public->Cup of Tea
Cup of Tea->Cup
Cup of Tea->Tea
Cup of Tea->Hot Water
Hot Water->Water
Hot Water->Kettle; limited by
Kettle->Power
annotation 1 [[0.43,0.49],[0.08,0.79]] Standardising power allows Kettles to evolve faster
annotation 2 [0.48, 0.85] Hot water is obvious and well known
annotations [0.72, 0.03]
note +a generic note appeared [0.23, 0.33]
style wardley
size [800,400]
```

Expand Down
98 changes: 6 additions & 92 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import { App, Editor, MarkdownView, Modal, Notice, Plugin, PluginSettingTab, Setting, TFile } from 'obsidian';
import { Plugin, TFile } from 'obsidian';
import { Root, createRoot } from 'react-dom/client';
import React from 'react';
import {MapViewContainer} from './MapViewContainer';

interface MyPluginSettings {
interface WardleyMapsPluginSettings {
mySetting: string;
}

const DEFAULT_SETTINGS: MyPluginSettings = {
const DEFAULT_SETTINGS: WardleyMapsPluginSettings = {
mySetting: 'default'
}

export default class MyPlugin extends Plugin {
settings: MyPluginSettings;
export default class WardleyMapsPlugin extends Plugin {
settings: WardleyMapsPluginSettings;

async onload() {
await this.loadSettings();
this.registerMarkdownCodeBlockProcessor('wardleymap', async (source, el, ctx) => {
console.log("Wardley Map Code Block Processor", [source, el, ctx]);
el.appendChild(document.createTextNode(source));
let root: Root;
if (el instanceof Element) {
Expand Down Expand Up @@ -46,8 +45,6 @@ export default class MyPlugin extends Plugin {
// Join lines back and save the file
const updatedContent = lines.join('\n');
await this.app.vault.modify(activeFile, updatedContent);

console.log('Wardley map block updated successfully');
} else {
console.error('Unable to locate the active file or file is not a TFile');
}
Expand All @@ -58,47 +55,6 @@ export default class MyPlugin extends Plugin {
root.render(reactComponent);
}
});

// // This adds an editor command that can perform some operation on the current editor instance
// this.addCommand({
// id: 'sample-editor-command',
// name: 'Sample editor command',
// editorCallback: (editor: Editor, view: MarkdownView) => {
// console.log(editor.getSelection());
// editor.replaceSelection('Sample Editor Command');
// }
// });
// // This adds a complex command that can check whether the current state of the app allows execution of the command
// this.addCommand({
// id: 'open-sample-modal-complex',
// name: 'Open sample modal (complex)',
// checkCallback: (checking: boolean) => {
// // Conditions to check
// const markdownView = this.app.workspace.getActiveViewOfType(MarkdownView);
// if (markdownView) {
// // If checking is true, we're simply "checking" if the command can be run.
// // If checking is false, then we want to actually perform the operation.
// if (!checking) {
// new SampleModal(this.app).open();
// }

// // This command will only show up in Command Palette when the check function returns true
// return true;
// }
// }
// });

// // This adds a settings tab so the user can configure various aspects of the plugin
// this.addSettingTab(new SampleSettingTab(this.app, this));

// // If the plugin hooks up any global DOM events (on parts of the app that doesn't belong to this plugin)
// // Using this function will automatically remove the event listener when this plugin is disabled.
// this.registerDomEvent(document, 'click', (evt: MouseEvent) => {
// console.log('click', evt);
// });

// // When registering intervals, this function will automatically clear the interval when the plugin is disabled.
// this.registerInterval(window.setInterval(() => console.log('setInterval'), 5 * 60 * 1000));
}

onunload() {
Expand All @@ -112,46 +68,4 @@ export default class MyPlugin extends Plugin {
async saveSettings() {
await this.saveData(this.settings);
}
}

// class SampleModal extends Modal {
// constructor(app: App) {
// super(app);
// }

// onOpen() {
// const {contentEl} = this;
// contentEl.setText('Woah!');
// }

// onClose() {
// const {contentEl} = this;
// contentEl.empty();
// }
// }

// class SampleSettingTab extends PluginSettingTab {
// plugin: MyPlugin;

// constructor(app: App, plugin: MyPlugin) {
// super(app, plugin);
// this.plugin = plugin;
// }

// display(): void {
// const {containerEl} = this;

// containerEl.empty();

// new Setting(containerEl)
// .setName('Setting #1')
// .setDesc('It\'s a secret')
// .addText(text => text
// .setPlaceholder('Enter your secret')
// .setValue(this.plugin.settings.mySetting)
// .onChange(async (value) => {
// this.plugin.settings.mySetting = value;
// await this.plugin.saveSettings();
// }));
// }
// }
}
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"id": "wardley-maps",
"name": "Wardley Maps",
"version": "1.0.5",
"version": "1.0.6",
"minAppVersion": "0.15.0",
"description": "View and edit Wardley Maps in Obsidian using the Online Wardley Maps format.",
"author": "Damon Skelhorn",
"authorUrl": "https://github.com/damonsk/obsidian-wardley-maps",
"authorUrl": "https://docs.onlinewardleymaps.com/about/",
"isDesktopOnly": false,
"fundingUrl": "https://www.patreon.com/mapsascode"
}
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"1.0.2": "0.15.0",
"1.0.3": "0.15.0",
"1.0.4": "0.15.0",
"1.0.5": "0.15.0"
"1.0.5": "0.15.0",
"1.0.6": "0.15.0"
}

0 comments on commit 3d06551

Please sign in to comment.