obsidian-dev-tools icon indicating copy to clipboard operation
obsidian-dev-tools copied to clipboard

Feature Request: Add a command to toggle the mobile UI (code snippet in comment)

Open YousufSSyed opened this issue 2 years ago • 0 comments

I have my own mobile theme that I may want to work on sometimes, the only way I've found to change Obsidian to the mobile ui on desktop is entering this snippet in the console:

this.app.emulateMobile(!this.app.isMobile);

I looked at the Obsidian Sample Plugin, and while I'm not very familiar with the Obsidian API, came up with this command to toggle it on and off:

    this.addCommand({
      id: "toggle-mobile-view",
      name: "Toggle Mobile View",
      callback: () => {
        this.app.emulateMobile(!this.app.isMobile);
      }
    });

YousufSSyed avatar Mar 30 '23 22:03 YousufSSyed