Skip to content

Commit

Permalink
WIP: a few more elements are now targetable by css classes
Browse files Browse the repository at this point in the history
  • Loading branch information
joethei committed Dec 30, 2022
1 parent 8376cb7 commit 0603db6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
normalizePath,
Notice,
TextComponent,
MarkdownPreviewRenderer, moment
MarkdownPreviewRenderer, moment, View, TextFileView
} from "obsidian";
import {TextInputPrompt} from "./modals/TextInputPrompt";
import {FILE_NAME_REGEX} from "./consts";
Expand All @@ -13,6 +13,7 @@ import t from "./l10n/locale";
import {Item} from "./providers/Item";

export async function createNewNote(plugin: RssReaderPlugin, item: Item): Promise<void> {
console.log("creating new note");
const activeFile = plugin.app.workspace.getActiveFile();
let dir = plugin.app.fileManager.getNewFileParent(activeFile ? activeFile.path : "").path;

Expand Down Expand Up @@ -81,6 +82,7 @@ export async function pasteToNote(plugin: RssReaderPlugin, item: Item): Promise<
}

const view = plugin.app.workspace.getActiveViewOfType(MarkdownView);
console.log(view);
if (view) {
const appliedTemplate = applyTemplate(plugin, item, plugin.settings.pasteTemplate);

Expand All @@ -94,6 +96,8 @@ export async function pasteToNote(plugin: RssReaderPlugin, item: Item): Promise<
});

new Notice(t("RSS_Reader") + t("inserted_article"));
}else {
new Notice("No view available");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/modals/BaseModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class BaseModal extends Modal {
"has-invalid-message",
"unset-align-items"
]);
input.inputEl.parentElement.parentElement.addClass(
input.inputEl.parentElement.addClass(
".unset-align-items"
);
let mDiv = input.inputEl.parentElement.querySelector(
Expand Down
4 changes: 2 additions & 2 deletions src/modals/ItemModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export class ItemModal extends Modal {
.setIcon(action.icon)
.setTooltip(action.name)
.onClick(async () => {
//await action.processor(this.plugin, this.item);
await action.processor(this.plugin, this.item);
});
button.buttonEl.setAttribute("tabindex", "-1");
button.buttonEl.addClass("rss-button");
Expand Down Expand Up @@ -227,7 +227,7 @@ export class ItemModal extends Modal {
});
nextButton.buttonEl.addClass("rss-button");

const title = contentEl.createEl('h1', {cls: ["rss-title", "rss-selectable"], text: this.item.title()});
contentEl.createEl('h1', {cls: ["rss-title", "rss-selectable"], text: this.item.title()});

const subtitle = contentEl.createEl("h3", "rss-subtitle");
subtitle.addClass("rss-selectable");
Expand Down
3 changes: 3 additions & 0 deletions src/style/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ input.is-invalid {

.rss-scrollable-content {
overflow: auto;
}

.rss-content {
height: 60vh;
}

Expand Down
2 changes: 1 addition & 1 deletion src/view/ViewLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class ViewLoader extends View {
this.navigationEl = this.containerEl.createDiv('nav-header');
this.navigationButtonsEl = this.navigationEl.createDiv('nav-buttons-container');

this.contentContainer = this.containerEl.createDiv('content');
this.contentContainer = this.containerEl.createDiv({cls: 'content rss-scrollable-content'});
}

getDisplayText(): string {
Expand Down

0 comments on commit 0603db6

Please sign in to comment.