Bases: Readonly Mode

Use case or problem

It’s currently very easy to accidentally hit the “X” next to a list item in a Base, and without an Undo feature, this can make it kind of anxiety-inducing to even have a Base open. Doubly so on mobile, where an undo feature would be hard to access.

Proposed solution

Like with normal pages, I would love to just toggle on a “Reading view”. And embedded Bases could inherit this property from the page they’re embedded into.

2 Likes

As the Obsidian team has said this feature isn’t currently planned, here’s how to do it with CSS.

Read-only base

Prevent edits while still being able to click on links:

/* All your base are belong to you
	- Prevents editing items in base rows but allows link clicking
	- Allows using views, filters, properties, and sorting */
 
.bases-tbody {
	pointer-events: none;
	
	& :is(a, .metadata-link, .mod-date + .clickable-icon, .internal-link .multi-select-pill-content) {
		pointer-events: auto;
	}
}

Customize your own

Total lockdown:

/* All your base are belong to read-only
	- Locks down all base rows
	- Allows using views, filters, properties, and sorting */

.bases-tbody {
	pointer-events: none;
}

Lockdown with exceptions:

/* Somebody set up us the bomb
	- Locks down base rows but with the exceptions listed in `is()`
	- Allows using views, filters, properties, and sorting */

.bases-tbody {
	pointer-events: none;
	
	& :is() {
		pointer-events: auto;
	}
}

Specified read-only items:

/* Make your time
	- Prevents editing base items that are listed in `is()` */

.bases-tbody :is() {
	pointer-events: none;
}

Selectors you can add:

Selector Bases item
.metadata-input-checkbox checkboxes
.metadata-input-longtext text
.multi-select-container lists (includes tags)
.multi-select-container .multi-select-pill-content tags: click to search for tag (but also edit the values in list entries)
.mod-date dates (includes links to “open daily note”)
.mod-date + .clickable-icon link to “open daily note” beside a date (“Daily notes” core plugin)
a link to row’s main note
.metadata-link link in text
.internal-link .multi-select-pill-content link in lists
2 Likes

Quick overview, I have a table displaying customer data (names, addresses, etc) which I don’t want to modify from within bases/table view, I only want to view. When displaying a list within the table, each list item has an X to remove it, which means it could be possible to accidentality delete list entries by mistake.

I want to be able to prevent this happening, some ideas:

  • Being able to view in source/preview, same as notes, can only modify in source mode.
  • Being able to “lock” columns to prevent changes

Apologies if I’ve missed that this is already a function

1 Like