SlRvb / Obsidian--ITS-Theme

Theme designed with readability and customizability in mind. Change it easily to your liking with the Style Settings plugin installed.
https://publish.obsidian.md/slrvb-docs/ITS+Theme/ITS+Theme
GNU General Public License v2.0
521 stars 113 forks source link

[FR] Disable checkbox changes for alternate checkboxes #228

Closed matthewturk closed 11 months ago

matthewturk commented 11 months ago

Is your feature request related to a problem? Please describe.

I occasionally will accidentally click a checkbox that I've used something like [d] or other alternate checkbox icon in.

Describe the solution you'd like

I think it should be possible to disable checking them. Looking at how snippetor does it, it supplies these CSS attributes:

pointer-events: none;
cursor: not-allowed;

to any input[type=checkbox]:checked that matches [data-task=] where data-task is the custom checkbox.

Describe alternatives you've considered

I've tried doing this myself with snippets, but I couldn't get them to propagate.

matthewturk commented 11 months ago

Actually, I was able to do this with a CSS snippet, and so I'll go ahead and close this.

/* @settings

name: Disable Alternate Checkbox Clicking
id: disable-alt-checkbox-clicking
settings:
    - 
        title: Disable Checkbox Clicking
        description: Disable clicking on checkboxes
        id: check-click
        type: class-toggle

*/

.check-click {
    .markdown-source-view.mod-cm6 .HyperMD-task-line[data-task]:not([data-task=" "],[data-task="x"]),
    :is(ul, ol) > li[data-task]:not([data-task=" "],[data-task="x"]).task-list-item.is-checked
    {pointer-events: none;}
}