Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .envrc

This file was deleted.

7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
# vscode
.vscode
.vscode
TODONOTES.md

# Intellij
*.iml
.idea

# direnv
.direnv

# npm
node_modules

# Don't include the compiled main.js file in the repo.
# They should be uploaded to GitHub releases instead.
main.js
main.js

# Exclude sourcemaps
*.map
Expand Down
6 changes: 0 additions & 6 deletions DEV_NOTES.MD
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,3 @@ DEV_NOTES.MD
2. npm run version (updates the manifest and version file)
3. commit repo
4. npm run githubaction (commits the version number tag to the repo and pushes it, which kicks of the github action to prepare the release)

# Development environment with Nix

If you are using Nix, a Flake file is provided which can be used to setup your development environment.
To enter the environment, run `nix develop`
Alternatively, you can install the `direnv` tool, which will enter the environment automatically using the `.envrc` configuration.
61 changes: 0 additions & 61 deletions flake.lock

This file was deleted.

25 changes: 0 additions & 25 deletions flake.nix

This file was deleted.

7 changes: 4 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export default class SNWPlugin extends Plugin {
});

this.toggleStateSNWMarkdownPreview();
this.toggleStateSNWLivePreview();
this.toggleStateSNWCMEditor();
this.toggleStateSNWGutters();

this.app.workspace.onLayoutReady(async () => {
Expand Down Expand Up @@ -163,8 +163,9 @@ export default class SNWPlugin extends Plugin {
}

// Turns on and off the SNW reference counters in CM editor
toggleStateSNWLivePreview(): void {
let state = this.settings.displayInlineReferencesLivePreview;
toggleStateSNWCMEditor(): void {
// The CM editor is used for both Live Preview and Source Mode.
let state = this.settings.displayInlineReferencesLivePreview || this.settings.displayInlineReferencesInSourceMode;

if (state === true) state = this.showCountsActive;

Expand Down
2 changes: 1 addition & 1 deletion src/ui/PluginCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class PluginCommands {
msg += "Tabs may require reloading for this change to take effect.";
new Notice(msg);
this.plugin.toggleStateSNWMarkdownPreview();
this.plugin.toggleStateSNWLivePreview();
this.plugin.toggleStateSNWCMEditor();
this.plugin.toggleStateSNWGutters();
},
},
Expand Down
15 changes: 8 additions & 7 deletions src/ui/SettingsTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class SettingsTab extends PluginSettingTab {
new Setting(containerEl)
.setName("Require modifier key to activate SNW")
.setDesc(
`If enabled, SNW will only activate when the modifier key is pressed when hovering the mouse over an SNW counter.
`If enabled, SNW will only activate when the modifier key is pressed when hovering the mouse over an SNW counter.
Otherwise, SNW will activate on a mouse hover. May require reopening open files to take effect.`,
)
.addToggle((cb: ToggleComponent) => {
Expand Down Expand Up @@ -149,15 +149,15 @@ export class SettingsTab extends PluginSettingTab {
cb.setValue(this.plugin.settings.displayInlineReferencesLivePreview);
cb.onChange(async (value: boolean) => {
this.plugin.settings.displayInlineReferencesLivePreview = value;
this.plugin.toggleStateSNWLivePreview();
this.plugin.toggleStateSNWCMEditor();
await this.plugin.saveSettings();
});
});

new Setting(containerEl)
.setName("Show SNW indicators in Reading view ")
.setDesc(
"While in Reading View of a document, display inline of the text of documents all reference counts for links, blocks and embeds." +
"While in Reading View of a document, display inline of the text of documents all reference counts for links, blocks and embeds. " +
"Note: files may need to be closed and reopened for this setting to take effect.",
)
.addToggle((cb: ToggleComponent) => {
Expand All @@ -172,14 +172,15 @@ export class SettingsTab extends PluginSettingTab {
new Setting(containerEl)
.setName("Show SNW indicators in Source Mode ")
.setDesc(
"While in Source Mode of a document, display inline of the text of documents all reference counts for links, blocks and embeds." +
"While in Source Mode of a document, display inline of the text of documents all reference counts for links, blocks and embeds. " +
"By default, this is turned off since the goal of Source Mode is to see the raw markdown." +
"Note: files may need to be closed and reopened for this setting to take effect.",
)
.addToggle((cb: ToggleComponent) => {
cb.setValue(this.plugin.settings.displayInlineReferencesInSourceMode);
cb.onChange(async (value: boolean) => {
this.plugin.settings.displayInlineReferencesInSourceMode = value;
this.plugin.toggleStateSNWCMEditor();
await this.plugin.saveSettings();
});
});
Expand All @@ -188,8 +189,8 @@ export class SettingsTab extends PluginSettingTab {
.setName("Embed references in Gutter in Live Preview Mode (Desktop)")
.setDesc(
`Displays a count of references in the gutter while in live preview. This is done only in a
special scenario. It has to do with the way Obsidian renders embeds, example: ![[link]] when
they are on its own line. Strange New Worlds cannot embed the count in this scenario, so a hint is
special scenario. It has to do with the way Obsidian renders embeds, example: ![[link]] when
they are on its own line. Strange New Worlds cannot embed the count in this scenario, so a hint is
displayed in the gutter. It is a hack, but at least we get some information.`,
)
.addToggle((cb: ToggleComponent) => {
Expand Down Expand Up @@ -332,7 +333,7 @@ export class SettingsTab extends PluginSettingTab {
new Setting(containerEl)
.setName("Kanban by mgmeyers")
.setDesc(
`Enables SNW support with in the preview mode of the Kanban plugin by mgmeyers at https://github.com/mgmeyers/obsidian-kanban.
`Enables SNW support with in the preview mode of the Kanban plugin by mgmeyers at https://github.com/mgmeyers/obsidian-kanban.
SNW references will always show when editing a card. Changing this setting may require reopening files.`,
)
.addToggle((cb: ToggleComponent) => {
Expand Down