Skip to content

FR: Give list items a $link field like blocks have #176

Description

@aaandreeew

Obsidian supports linking to list items through block IDs. However, currently in Datacore, list items don't have the 'block' tag, and don't have a $link field like blocks have. However, list items do have a working $blockId field, and it's possible to get a link to a list item with it. For example:

const getListItemLink = (_val, row) => {
    const file = row.$file;
    const id = row.$blockId;
    return id
        ? dc.blockLink(file, id)
        : null;
};

const columns = [
	{ id: 'List item', value: row => row.$text },
	{ id: 'blockId', value: row => row.$blockId },
	{ id: 'Link', value: row => null, render: getListItemLink },
];

return function View() {
	const listItems = dc.useQuery('@list-item');
	return <>
		<dc.Table rows={listItems} columns={columns} />
	</>
}
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions