You've already forked obsidian-visualiser
Fix comrpessing bug on null buffers, make pinned floaters resizable and optimize a few things here and there
This commit is contained in:
@@ -41,7 +41,7 @@ export const a: Prose = {
|
||||
{
|
||||
const canvas = new Canvas((_content as LocalContent<'canvas'>).content);
|
||||
queueMicrotask(() => canvas.mount());
|
||||
return dom('div', { class: 'w-[600px] h-[600px] relative' }, [canvas.container]);
|
||||
return dom('div', { class: 'w-[600px] h-[600px] group-data-[pinned]:h-full group-data-[pinned]:w-full h-[600px] relative w-[600px] relative' }, [canvas.container]);
|
||||
}
|
||||
return div('');
|
||||
})).current], { position: 'bottom-start', pinned: false }) : element;
|
||||
@@ -55,41 +55,32 @@ export const preview: Prose = {
|
||||
|
||||
const overview = Content.getFromPath(pathname === '' && hash.length > 0 ? unifySlug(router.currentRoute.value.params.path ?? '') : pathname);
|
||||
|
||||
const el = dom('span', { class: ['cursor-pointer text-accent-blue inline-flex items-center', properties?.class] }, [
|
||||
const element = dom('span', { class: ['cursor-pointer text-accent-blue inline-flex items-center', properties?.class] }, [
|
||||
...(children ?? []),
|
||||
overview && overview.type !== 'markdown' ? icon(iconByType[overview.type], { class: 'w-4 h-4 inline-block', inline: true }) : undefined
|
||||
]);
|
||||
|
||||
const magicKeys = useMagicKeys();
|
||||
return overview ? popper(el, {
|
||||
arrow: true,
|
||||
delay: 150,
|
||||
offset: 12,
|
||||
cover: "height",
|
||||
placement: 'bottom-start',
|
||||
class: ['data-[side=bottom]:animate-slideUpAndFade data-[side=right]:animate-slideLeftAndFade data-[side=left]:animate-slideRightAndFade data-[side=top]:animate-slideDownAndFade w-[300px] bg-light-10 dark:bg-dark-10 border border-light-35 dark:border-dark-35 data-[state=open]:transition-transform text-light-100 dark:text-dark-100 w-full z-[45]',
|
||||
{ 'min-w-[200px] min-h-[150px] max-w-[600px] max-h-[600px]': !properties?.size || properties.size === 'large', 'max-w-[400px] max-h-[250px]': properties.size === 'small' }
|
||||
],
|
||||
content: () => {
|
||||
return [async('large', Content.getContent(overview.id).then((_content) => {
|
||||
if(_content?.type === 'markdown')
|
||||
{
|
||||
return render((_content as LocalContent<'markdown'>).content ?? '', hash.length > 0 ? hash.substring(1) : undefined, { class: 'w-full max-h-full overflow-auto py-4 px-6' });
|
||||
}
|
||||
if(_content?.type === 'canvas')
|
||||
{
|
||||
const canvas = new Canvas((_content as LocalContent<'canvas'>).content);
|
||||
queueMicrotask(() => canvas.mount());
|
||||
return dom('div', { class: 'w-[600px] h-[600px] relative' }, [canvas.container]);
|
||||
}
|
||||
return div('');
|
||||
})).current];
|
||||
},
|
||||
onShow() {
|
||||
if(!magicKeys.current.has('control') || magicKeys.current.has('meta'))
|
||||
return false;
|
||||
},
|
||||
}).container : el;
|
||||
return !!overview ? floater(element, () => [async('large', Content.getContent(overview.id).then((_content) => {
|
||||
if(_content?.type === 'markdown')
|
||||
{
|
||||
return render((_content as LocalContent<'markdown'>).content ?? '', hash.length > 0 ? hash.substring(1) : undefined, { class: 'w-full max-h-full overflow-auto py-4 px-6' });
|
||||
}
|
||||
if(_content?.type === 'canvas')
|
||||
{
|
||||
const canvas = new Canvas((_content as LocalContent<'canvas'>).content);
|
||||
queueMicrotask(() => canvas.mount());
|
||||
return dom('div', { class: 'w-[600px] h-[600px] group-data-[pinned]:h-full group-data-[pinned]:w-full h-[600px] relative w-[600px] relative' }, [canvas.container]);
|
||||
}
|
||||
return div('');
|
||||
})).current], { position: 'bottom-start', pinned: false,
|
||||
events: {
|
||||
show: ['mouseenter', 'mousemove'],
|
||||
hide: ['mouseleave'],
|
||||
onshow() {
|
||||
return !magicKeys.current.has('control') || !magicKeys.current.has('meta');
|
||||
}
|
||||
}, }) : element;
|
||||
}
|
||||
}
|
||||
export const callout: Prose = {
|
||||
|
||||
Reference in New Issue
Block a user