Merge pull request #25 from farconada/main

Fix compatibility with latest obsidian-smart-connections
This commit is contained in:
Evan's Oasis 2026-01-03 10:56:50 -05:00 committed by GitHub
commit 3ba508cab5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1046 additions and 5 deletions

View file

@ -1509,7 +1509,9 @@ class ScGraphItemView extends ItemView {
return true; // return all connections
} else {
// If connectionType is block, return true if connection is a SmartBlock, otherwise return false
return (this.connectionType === 'block') === (connection.item instanceof this.env.item_types.SmartBlock);
// Use collection_key to check type (compatible with new smart-connections API)
const isBlock = connection.item?.collection_key === 'smart_blocks';
return (this.connectionType === 'block') === isBlock;
}
}); // console.log('Filtered connections:', filteredConnections);
@ -1533,15 +1535,16 @@ class ScGraphItemView extends ItemView {
addConnectionNode(connectionId: any, connection: any) {
if (!this.nodes.some((node: { id: string; }) => node.id === connectionId)) {
const isBlock = connection.item?.collection_key === 'smart_blocks';
this.nodes.push({
id: connectionId,
name: connectionId,
group: (connection.item instanceof this.env.item_types.SmartBlock) ? 'block' : 'note',
group: isBlock ? 'block' : 'note',
x: Math.random() * 1000,
y: Math.random() * 1000,
fx: null,
fy: null,
fill: (connection.item instanceof this.env.item_types.SmartBlock) ? this.blockFillColor : this.noteFillColor,
fill: isBlock ? this.blockFillColor : this.noteFillColor,
selected: false,
highlighted: false
});

1042
package-lock.json generated

File diff suppressed because it is too large Load diff