Giter VIP home page Giter VIP logo

Comments (9)

dy-sh avatar dy-sh commented on June 28, 2024 2

Hi, I'll think about it.

from obsidian-remember-cursor-position.

dy-sh avatar dy-sh commented on June 28, 2024 2

I will try to find the time

from obsidian-remember-cursor-position.

markNZed avatar markNZed commented on June 28, 2024

Any further thoughts on this? I am new to Obsidian but perhaps I can help somehow. In getEphemeralState does this.app.workspace.getActiveViewOfType(MarkdownView)?.currentMode? refer to the edit/preview mode?

Googling I came across: MarkdownView.setState() calls setMode() to switch the mode

from obsidian-remember-cursor-position.

dy-sh avatar dy-sh commented on June 28, 2024

Haven't found a way to do this yet.

from obsidian-remember-cursor-position.

markNZed avatar markNZed commented on June 28, 2024

If you let me know what the blocking point is I could try to do some research for you. Can you read the current state?

from obsidian-remember-cursor-position.

dy-sh avatar dy-sh commented on June 28, 2024

You can try to console.log(this.app) and try to find the function to read and set current mode. It will be simple to add this state to the file where the cursor position is saved, read it and restore current mode.

from obsidian-remember-cursor-position.

markNZed avatar markNZed commented on June 28, 2024

app.workspace.activeLeaf.view.getMode()
app.workspace.activeLeaf.view.previewButtonEl.click()
app.workspace.activeLeaf.view.editButtonEl.click()

That is probably not the right way to set the mode. But it does work

from obsidian-remember-cursor-position.

dy-sh avatar dy-sh commented on June 28, 2024

I think, it might work. Do you have the opportunity to try to add this functionality? You need to add the "mode" field to the interface EphemeralState (line 14), get it in the function getEphemeralState (line 212) and restore it in the setEphemeralState (line 239). Next you can make this function optional (add option to settings).

from obsidian-remember-cursor-position.

markNZed avatar markNZed commented on June 28, 2024

I don't know the development flow etc. It would be quite a lot of time to understand all that. I can buy you a coffee ;)

from obsidian-remember-cursor-position.

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.