Skip to content

Commit

Permalink
Fixing obsidian target and getting mobile closer to full functinality
Browse files Browse the repository at this point in the history
  • Loading branch information
TomNCatz committed Aug 27, 2023
1 parent e98f997 commit 69b5d9f
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 33 deletions.
109 changes: 86 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"canvas": "^2.11.2",
"codemirror": "^5.0.1",
"extract-colors": "^3.0.0",
"obsidian": "obsidianmd/obsidian-api#master",
"obsidian": "latest",
"rollup-plugin-copy": "^3.4.0",
"svelte": "^4.2.0",
"svelte-grid": "^5.1.1",
Expand Down
13 changes: 6 additions & 7 deletions src/block.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Vault, MetadataCache } from 'obsidian'
import { MarkdownRenderer, TFile, getAllTags } from 'obsidian'
import { MarkdownRenderer, TFile, getAllTags, Platform } from 'obsidian'
import { extractColors } from '../node_modules/extract-colors'
import type { GalleryBlockArgs, InfoBlockArgs } from './utils'
import
Expand All @@ -14,6 +14,7 @@ import type GalleryPlugin from './main'
import ImageGrid from './svelte/ImageGrid.svelte'
import Gallery from './svelte/Gallery.svelte'
import GalleryInfo from './svelte/GalleryInfo.svelte'
import { platform } from 'os'

export class GalleryProcessor
{
Expand Down Expand Up @@ -237,7 +238,10 @@ export class GalleryProcessor
} else
{
measureEl = new Image()
colors = await extractColors(imgURL, EXTRACT_COLORS_OPTIONS)
if(Platform.isDesktopApp)
{
colors = await extractColors(imgURL, EXTRACT_COLORS_OPTIONS)
}
isVideo = false
}

Expand All @@ -247,11 +251,6 @@ export class GalleryProcessor
const imgInfo = await getImgInfo(imgTFile.path, vault, metadata, plugin, false)
let imgTags = null

// if (!imgInfo) {
// MarkdownRenderer.renderMarkdown(GALLERY_INFO_USAGE, elCanvas, '/', plugin);
// return;
// }

let imgInfoCache = null
if (imgInfo)
{
Expand Down
4 changes: 2 additions & 2 deletions src/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class GalleryView extends ItemView
this.viewEl.style.setProperty('overflow', 'hidden')
// Add action button to hide / show filter panel
const searchPanel = this.containerEl.querySelector('.view-actions').createEl('a', { cls: 'view-action', attr: { 'aria-label': 'Search' } })
setIcon(searchPanel, 'fa-search', 17)
setIcon(searchPanel, 'fa-search')
// Create Search Control Element
this.filterEl = this.viewEl.createDiv({ cls: 'ob-gallery-filter', attr: { style: 'display: none;' } })
searchPanel.onClickEvent(() =>
Expand Down Expand Up @@ -375,7 +375,7 @@ export class GalleryInfoView extends ItemView
cls: 'view-action image-info-edit',
attr: { 'aria-label': 'Edit' }
})
setIcon(changeMode, 'pencil', 17)
setIcon(changeMode, 'pencil')

const openInfo = this.viewEl.createEl('a',
{
Expand Down

0 comments on commit 69b5d9f

Please sign in to comment.