Code Monkey home page Code Monkey logo

Comments (5)

valentine195 avatar valentine195 commented on September 24, 2024 1

Aha, good find. I’ll probably end up making a new class for this (ListItemRoller) and allow the ability to specify a block id like for Table Rolling as well.

from dice-roller.

valentine195 avatar valentine195 commented on September 24, 2024 1

Thanks for the protip, this has been added in 6.5.1.

from dice-roller.

valentine195 avatar valentine195 commented on September 24, 2024

Someone else mentioned this, so I’m not sure it’s actually possible unfortunately.

Once I’m back at my computer I’ll look and see if these are exposed

from dice-roller.

mure avatar mure commented on September 24, 2024

I think it should be possible - there's a separate cache for list items:
https://github.com/obsidianmd/obsidian-api/blob/5af3ef982328a2dd0a2f5242f3c74e2f45e07896/obsidian.d.ts#L378

from dice-roller.

mure avatar mure commented on September 24, 2024

Maybe something like:

async getOptions() {
        this.cache = this.plugin.app.metadataCache.getFileCache(this.file);
        console.log(this.cache);
        if (!this.cache || !this.cache.sections) {
            throw new Error("Could not read file cache.");
        }
        this.content = await this.plugin.app.vault.cachedRead(this.file);
        this.options = this.cache.sections.filter(({ type }) =>
            this.types
                ? this.types.includes(type)
                : !["yaml", "thematicBreak"].includes(type)
        );
        // ** Add this **
        if (this.types.includes("listItem")) {
            this.options.push(...this.cache.listItems);
        }
        this.loaded = true;
        this.trigger("loaded");
    }

In the SectionRoller class. And you'll have to fix up the types to accept both SectionCache and ListItemCache

from dice-roller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.