Skip to content

Commit

Permalink
fixed: id, plugin description, comments in CSS, names of the buttons,…
Browse files Browse the repository at this point in the history
… setTooltip
  • Loading branch information
Krusty84 committed Oct 28, 2024
1 parent cc8ecd4 commit 6f3e128
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
13 changes: 7 additions & 6 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {App, Plugin, MarkdownView, Notice, WorkspaceLeaf, setIcon, Keymap} from 'obsidian';
import {App, Plugin, MarkdownView, Notice, WorkspaceLeaf, setIcon, Keymap, setTooltip} from 'obsidian';
import {Compartment} from '@codemirror/state';
import {EditorView} from '@codemirror/view';
import {OccuraPluginSettingTab, OccuraPluginSettings, DEFAULT_SETTINGS} from 'src/settings'
Expand Down Expand Up @@ -33,7 +33,7 @@ export default class OccuraPlugin extends Plugin {
// Register command to toggle highlighting
this.addCommand({
id: 'toggle-highlight-occurrences',
name: 'Toggle Highlight Occurrences',
name: 'Toggle highlight occurrences',
callback: () => {
this.toggleHighlighting();
}
Expand Down Expand Up @@ -194,17 +194,18 @@ export default class OccuraPlugin extends Plugin {
// Remove existing icon classes
iconEl.empty();
setIcon(iconEl, 'highlighter');

// Add appropriate icon
if (this.settings.occuraPluginEnabled) {
this.statusBarOccurrencesNumber = this.addStatusBarItem();
iconEl.setAttribute('aria-label', 'Disable Highlighting');
setTooltip(iconEl, 'Disable highlighting');
iconEl.removeClass('is-disabled');
} else {
if (this.statusBarOccurrencesNumber) {
this.statusBarOccurrencesNumber.remove(); // Removes the element from the DOM
this.statusBarOccurrencesNumber = null; // Cleans up the reference
this.statusBarOccurrencesNumber.remove();
this.statusBarOccurrencesNumber = null;
}
iconEl.setAttribute('aria-label', 'Enable Highlighting');
setTooltip(iconEl, 'Enable highlighting');
iconEl.addClass('is-disabled');
}
}
Expand Down
6 changes: 3 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"id": "occura-09102024",
"id": "occura-word-highlighter",
"name": "Occura",
"version": "1.0.0",
"minAppVersion": "0.15.0",
"description": "A plugin that helps find all occurrences of selected text in notes, similar to Notepad++ or any IDE.",
"description": "Find and highlight all occurrences of selected text in notes, similar to Notepad++ or IDEs.",
"author": "Alexey Sedoykin",
"authorUrl": "https://www.linkedin.com/in/sedoykin",
"isDesktopOnly": false
}
}
9 changes: 0 additions & 9 deletions styles.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
/*
This CSS file will be included with your plugin, and
available in the app when your plugin is enabled.
If your plugin does not need CSS, delete this file.
*/
/* Optional CSS for the highlight toggle icon */
.highlight-toggle-icon {
cursor: pointer;
opacity: 1;
Expand Down

0 comments on commit 6f3e128

Please sign in to comment.