Minor changes for the 1.6.0 release (#27)

* Check that file isn't null when calling modify API

* Update image embed extensions

* Switch to using the 1.1.0 setIcon API
This commit is contained in:
Andre Perunicic 2023-11-12 22:55:51 -05:00 committed by GitHub
parent e55ea5918f
commit e9eb91bb30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View file

@ -2,7 +2,7 @@
"id": "repeat-plugin",
"name": "Repeat",
"version": "1.5.4",
"minAppVersion": "1.0.0",
"minAppVersion": "1.1.0",
"description": "Review notes using periodic or spaced repetition.",
"author": "Andre Perunicic",
"authorUrl": "https://github.com/prncc/obsidian-repeat-plugin/",

View file

@ -129,7 +129,7 @@ export default class RepeatPlugin extends Plugin {
checkCallback: (checking: boolean) => {
const markdownView = this.app.workspace.getActiveViewOfType(MarkdownView);
const onSubmit = (result: Repetition) => {
if (!markdownView) {
if (!markdownView || !markdownView.file) {
return;
}
const { editor, file } = markdownView;
@ -173,7 +173,7 @@ export default class RepeatPlugin extends Plugin {
name: `Repeat this note every ${unit}`,
checkCallback: (checking: boolean) => {
const markdownView = this.app.workspace.getActiveViewOfType(MarkdownView);
if (markdownView) {
if (markdownView && !!markdownView.file) {
if (!checking) {
const { editor, file } = markdownView;
const content = editor.getValue();

View file

@ -9,9 +9,9 @@ enum EmbedType {
Unknown = 'Unknown',
}
// https://help.obsidian.md/Advanced+topics/Accepted+file+formats
// https://help.obsidian.md/Files+and+folders/Accepted+file+formats
const embedTypeToAcceptedExtensions = {
[EmbedType.Image]: ['png', 'jpg', 'jpeg', 'gif', 'bmp', 'svg'],
[EmbedType.Image]: ['png', 'webp', 'jpg', 'jpeg', 'gif', 'bmp', 'svg'],
[EmbedType.Audio]: ['mp3', 'webm', 'wav', 'm4a', 'ogg', '3gp', 'flac'],
[EmbedType.Video]: ['mp4', 'webm', 'ogv', 'mov', 'mkv'],
[EmbedType.PDF]: ['pdf'],
@ -251,7 +251,7 @@ export async function renderTitleElement(
// to open the note more complicated. So, we use a simple link.
const embedLink = createEl('a', { cls: 'markdown-embed-link' });
embedLink.href = getNoteUri(vault, file.path);
setIcon(embedLink, 'link', 20);
setIcon(embedLink, 'link');
container.appendChild(embedTitle);
container.appendChild(embedLink);