ryjjin / Obsidian-shortcuts-extender

Plugin for Obsidian: Use shortcuts for input special symbols and changing level of headings without language switching
69 stars 6 forks source link

Not working since native WYSIWYG insider release #13

Closed ryadaj closed 2 years ago

ryadaj commented 2 years ago

Since native WYSIWYG insider release, I can no longer use my hotkeys to change a selection into a header or a list

Thanks for an amazing plugin! Have loved using it.

that0n3guy commented 2 years ago

I can verify this. Probably because of codemirror update?

ryadaj commented 2 years ago

Yes I think so

Le 12 nov. 2021 à 16:58, that0n3guy @.***> a écrit :

 I can verify this. Probably because of codemirror update?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

ryjjin commented 2 years ago

Hi! Thanks for information, I have not tried this function yet. I will think about whether I can fix it on my own, maybe will hiring a developer for fixes

ryadaj commented 2 years ago

Thanks for a great plugin and for all your hard work!

Le 14 nov. 2021 à 03:05, ryjjin @.***> a écrit :

 Hi! Thanks for information, I have not tried this function yet. I will think about whether I can fix it on my own, maybe will hiring a developer for fixes

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

claremacrae commented 2 years ago

I've asked in #plugin-dev on the Obsidian Members Group Discord to see if anyone has any tips on the kinds of changes required, to update and work with Live Preview mode, whilst still working on previous versions too.

ryadaj commented 2 years ago

Awesome, thank you ☺️

Le 21 nov. 2021 à 14:03, Clare Macrae @.***> a écrit :

 I've asked in #plugin-dev on the Obsidian Members Group Discord to see if anyone has any tips on the kinds of changes required, to update and work with Live Preview mode, whilst still working on previous versions too.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

claremacrae commented 2 years ago

You're welcome - there were some good tips - I'll write them up soon...

(@ryadaj in case you don't know, GitHub is including you phone number in all your emailed comments?)

ryadaj commented 2 years ago

Wow, you are a kind one! Thank you so much, I've gone through and updated my comments to remove that info!

that0n3guy commented 2 years ago

Just a heads up... https://github.com/argenos/nldates-obsidian just updated their plugin to work w/ "live preview" Maybe you can see what they did for a quick reference point... Here is a quick link that might help: https://github.com/argenos/nldates-obsidian/pull/57

ryadaj commented 2 years ago

Awesome thank you ☺️🙏

Le 23 nov. 2021 à 16:38, that0n3guy @.***> a écrit :

 Just a heads up... https://github.com/argenos/nldates-obsidian just updated their plugin to work w/ "live preview" Maybe you can see what they did for a quick reference point... Here is a quick link that might help: argenos/nldates-obsidian#57

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

claremacrae commented 2 years ago

I've asked in #plugin-dev on the Obsidian Members Group Discord to see if anyone has any tips on the kinds of changes required, to update and work with Live Preview mode, whilst still working on previous versions too.

So the initial conclusion was to change uses like this:

let editor = activeLeaf.view.sourceMode.cmEditor;

To this:

let editor = activeLeaf.view.editor;

However, this was followed by a statement that:

You shouldn’t assume the active leaf is a markdown editor. You should do getActiveViewOfType

and

Yes, but you should also make sure that there actually is a markdown view (as in, get the view, check to make sure it’s not null, then get the editor)

So after further discussion, this sort of thing - taken from code in another plugin, was the recommended approach:

    let editor = app.workspace.getActiveViewOfType(MarkdownView)?.editor;
    if (editor == null) {
      return;
    }

There was also a recommendation to first create a function like getEditor() that would return app.workspace.getActiveViewOfType(MarkdownView)?.editor; - so that if the logic needs to be refined in future, it is only in one place...

This code is expected to work on CM5 and CM6 - including with the new Live Preview/WYSIWYG...

claremacrae commented 2 years ago

For anyone reading this who is in the Obsidian Discord, the discussion starts here, in #plugin-dev.

that0n3guy commented 2 years ago

I started messing with this a little: https://github.com/ryjjin/Obsidian-shortcuts-extender/pull/14

ryjjin commented 2 years ago

Thanks for your support and great work. As I said in the commit branch, most likely, I myself would not have coped with it (or at least it would have taken a whole carriage of time).

Everything works for me too, checked on Windows and Mac. The new package has been released, the updated version can be installed via Obsidian.

And the most amazing thing is that now the plugin began to work on iOS devices (previously, heading levels did not change when using shortcuts on an iPad)

claremacrae commented 2 years ago

Oh wow - that's tremendous news - thank you!