Skip to content

Commit ee3b887

Browse files
committed
removed old code
1 parent bf5ef6a commit ee3b887

File tree

2 files changed

+1
-70
lines changed

2 files changed

+1
-70
lines changed

src/main.ts

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { App, Editor, MarkdownView, Modal, Notice, Plugin } from 'obsidian';
1+
import { Editor, MarkdownView, Notice, Plugin } from 'obsidian';
22
import { DEFAULT_SETTINGS, MyPluginSettings, SampleSettingTab } from "./settings";
33
import { copyTextToClipboard } from './utils/clipboard';
44
import { Formatter } from './formatter';
@@ -13,31 +13,9 @@ export default class Format4LinkedIn extends Plugin {
1313
// This creates an icon in the left ribbon. Clicking it will trigger the copy action.
1414
this.addRibbonIcon('clipboard', 'Format4LinkedIn: Copy to Clipboard', (evt: MouseEvent) => {
1515
// Trigger the copy action using the active editor
16-
// (avoid using this.app.commands since App type may not expose it)
1716
this.copyEditorContentToClipboard();
1817
});
1918

20-
// This adds a status bar item to the bottom of the app. Does not work on mobile apps.
21-
const statusBarItemEl = this.addStatusBarItem();
22-
statusBarItemEl.setText('Status bar text');
23-
24-
// This adds a simple command that can be triggered anywhere
25-
this.addCommand({
26-
id: 'open-modal-simple',
27-
name: 'Open modal (simple)',
28-
callback: () => {
29-
new SampleModal(this.app).open();
30-
}
31-
});
32-
// This adds an editor command that can perform some operation on the current editor instance
33-
this.addCommand({
34-
id: 'replace-selected',
35-
name: 'Replace selected content',
36-
editorCallback: (editor: Editor, view: MarkdownView) => {
37-
editor.replaceSelection('Sample editor command');
38-
}
39-
});
40-
4119
// Command to copy current editor markdown to clipboard
4220
this.addCommand({
4321
id: 'format4linkedin:copy-markdown',
@@ -46,39 +24,10 @@ export default class Format4LinkedIn extends Plugin {
4624
this.copyEditorContentToClipboard(editor);
4725
}
4826
});
49-
// This adds a complex command that can check whether the current state of the app allows execution of the command
50-
this.addCommand({
51-
id: 'open-modal-complex',
52-
name: 'Open modal (complex)',
53-
checkCallback: (checking: boolean) => {
54-
// Conditions to check
55-
const markdownView = this.app.workspace.getActiveViewOfType(MarkdownView);
56-
if (markdownView) {
57-
// If checking is true, we're simply "checking" if the command can be run.
58-
// If checking is false, then we want to actually perform the operation.
59-
if (!checking) {
60-
new SampleModal(this.app).open();
61-
}
62-
63-
// This command will only show up in Command Palette when the check function returns true
64-
return true;
65-
}
66-
return false;
67-
}
68-
});
6927

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

73-
// If the plugin hooks up any global DOM events (on parts of the app that doesn't belong to this plugin)
74-
// Using this function will automatically remove the event listener when this plugin is disabled.
75-
// this.registerDomEvent(document, 'click', (evt: MouseEvent) => {
76-
// new Notice("Click");
77-
// });
78-
79-
// When registering intervals, this function will automatically clear the interval when the plugin is disabled.
80-
this.registerInterval(window.setInterval(() => console.log('setInterval'), 5 * 60 * 1000));
81-
8231

8332
}
8433

@@ -123,19 +72,3 @@ export default class Format4LinkedIn extends Plugin {
12372
await this.saveData(this.settings);
12473
}
12574
}
126-
127-
class SampleModal extends Modal {
128-
constructor(app: App) {
129-
super(app);
130-
}
131-
132-
onOpen() {
133-
let { contentEl } = this;
134-
contentEl.setText('Woah!');
135-
}
136-
137-
onClose() {
138-
const { contentEl } = this;
139-
contentEl.empty();
140-
}
141-
}

src/settings.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import Format4LinkedIn from "./main";
44
export type HeaderStyle = 'plain' | 'allcaps' | 'title' | 'sentence';
55

66
export interface MyPluginSettings {
7-
mySetting: string;
87
removeBold: boolean;
98
removeItalic: boolean;
109
header1Style: HeaderStyle;
@@ -15,7 +14,6 @@ export interface MyPluginSettings {
1514
}
1615

1716
export const DEFAULT_SETTINGS: MyPluginSettings = {
18-
mySetting: 'default',
1917
removeBold: false,
2018
removeItalic: false,
2119
header1Style: 'allcaps',

0 commit comments

Comments
 (0)