obsidian-latex-suite icon indicating copy to clipboard operation
obsidian-latex-suite copied to clipboard

Mobile support does not seem to work

Open Deadbush225 opened this issue 1 year ago • 50 comments

The support for mobile (android) doesn't seem to work.

Recording

I tried it on both of my android devices but neither of them worked. I checked if other plug-ins caused that, so I made a fresh obsidian installation but it still has no effect.

Additional Details:

  • Live Preview editor is enabled
  • Lastest version is installed
  • Android version: 12

Deadbush225 avatar Sep 10 '22 02:09 Deadbush225

I don't have an Android device so I can't easily debug this.

  • Can you paste your debug info here? (Command palette -> Show debug info)
  • Do other features of the plugin work (conceal, color matching brackets)?
  • Does an older version of the plugin work? Try v1.3.0, it's the earliest version that is compatible with Obsidian v0.15 and newer. You can install older versions of the plugin using BRAT.

artisticat1 avatar Sep 10 '22 10:09 artisticat1

Sure, can do that.

This is the debug info:

SYSTEM INFO:
	Operating system: android 12 (vivo V2038)
	Obsidian version: 1.3.1 (65)
	API version: v0.15.9
	Login status: not logged in
	Live preview: on
	Legacy editor: off
	Base theme: dark
	Community theme: none
	Snippets enabled: 0
	Restricted mode: off
	Plugins installed: 1
	Plugins enabled: 1
		1: Latex Suite v1.4.3

RECOMMENDATIONS:
	Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.

Next, I can confirm that the conceal and color matching brackets are working. Screenshot_2022_0910_202751

Lastly, The v1.3.0 didn't work, even the v1.4.0 to v1.4.2 had no luck.

Trying v1.3.0:

Deadbush225 avatar Sep 10 '22 12:09 Deadbush225

I see. The fact that the conceal and color matching brackets features are working means that the plugin is loading correctly, and CodeMirror extensions are working.

  • Do the auto-fraction, matrix shortcuts, and tabout features work?
  • Are you using the default snippets?
  • Could you install this dev tools plugin (https://github.com/KjellConnelly/obsidian-dev-tools) with BRAT? This will give us access to a console on mobile. After enabling the plugin, open a console using the Command palette. Then let me know whether you see any errors in the console when you enable Latex Suite, and when you try typing snippets.

artisticat1 avatar Sep 11 '22 08:09 artisticat1

Yes, I'm using the default snippets. In fact, I just discovered it then I found this issue. Unfortunately, I'm afraid auto-fraction, matrix shortcuts, and tabout features are not working.

Trying the said features with the dev tools console opened. Screenrecording_20220911_170346

As you can see, I received no error while testing the features. Please let me know if you need further testing.

Deadbush225 avatar Sep 11 '22 09:09 Deadbush225

Hmm I see. Do you get any errors when you first enable the Latex Suite plugin?

It does seem strange that you get no errors. Please give me some time to put together a debug build and get back to you!

artisticat1 avatar Sep 11 '22 22:09 artisticat1

Do you get any errors when you first enable the Latex Suite plugin?

Sorry for the late reply. It sure was strange but I just double checked it, and I really didn't saw any errors after I enabled the Latex suite plug-in.

Deadbush225 avatar Sep 14 '22 08:09 Deadbush225

@eliazar-sll Have you noticed the underline on what you typed? I think this is a problem about your input method . When you are typing , the input method actually hold the letters without passing it to obsidian . Only after you select a word or press something like space will it pass the letters you typed all at the same time to obsidian, and the underline disaopears . You can try using some input methods that directly pass your input to the target app ,hacker's keyboard etc.

proItheus avatar Oct 01 '22 14:10 proItheus

Your suggestion sounds very promising so I tried it with 2 different keyboards, each disabled their autocomplete functionalities

Hacker's Keyboard: Record-2022-10-02-07-09-29.GIF

Simple Keyboard: Record-2022-10-02-07-17-36.GIF

And as you can see, the underline disappeared but the problem still persists. Do you have any thoughts about this?

Deadbush225 avatar Oct 01 '22 23:10 Deadbush225

Ah, It's a bit strange. I tried it by myself, and find almost all input methods on android won't work with latex suite... However, trime does work for me. I have no clue about why they work or not work though. Maybe something about input key event?

proItheus avatar Oct 02 '22 03:10 proItheus

I've put together this debug build. It prints some console.log statements whenever the plugin detects a keypress.

obsidian-latex-suite-1.6.0-debug.zip

Can any android users test this build and upload a video of what appears in the console? It would be helpful if you did this using the different keyboards that do/do not work, described by @proItheus above.

artisticat1 avatar Oct 15 '22 12:10 artisticat1

Sorry but how can I enable the console on obsidian android?

proItheus avatar Oct 15 '22 12:10 proItheus

@proItheus Quoting from @artisticat1, I think this is the process of enabling console on obsidian

Could you install this dev tools plugin (https://github.com/KjellConnelly/obsidian-dev-tools) with BRAT? This will give us access to a console on mobile.

  • After enabling the plugin, open a console using the Command palette. Then let me know whether you see any errors in the console when you enable Latex Suite, and when you try typing snippets.

Deadbush225 avatar Oct 15 '22 13:10 Deadbush225

@artisticat1, I just tried the debug build and it logs The "Unidentified" key was pressed every time I press a key

Keyboard: Microsoft G-swift video_20221015_212115_edit

Deadbush225 avatar Oct 15 '22 13:10 Deadbush225

Confirmed that the plugin logs keydown normally for the trime keyboard mentioned above, while loging Unidentified key as @eliazar-sll finds for keyboards not working , that is , almost all other keyboards I can find for android ...

proItheus avatar Oct 15 '22 14:10 proItheus

Thank you both! It appears that keypresses are not being transferred to the plugin correctly. I'll try to investigate this further.

artisticat1 avatar Oct 15 '22 14:10 artisticat1

Can you visit https://codemirror.net/try/ and paste the following code into the editor on the left hand side?

import {minimalSetup, EditorView} from "codemirror"
import {Prec} from "@codemirror/state";

const onKeydownExtension = Prec.highest(EditorView.domEventHandlers({
    "keydown": (event, view) => {
      console.log("The " + event.key + " key was pressed.");
    }
}));

new EditorView({
  doc: "...",
  extensions: [minimalSetup, onKeydownExtension],
  parent: document.body
})

(Erase the code contained in the editor by default.)

This code will set up a test editor with a debug statement that prints out keypresses the editor detects. Press the "Run" button after pasting in the code in order to initialise the test editor (which sits on the right hand side).

Then, in the editor on the right, type in some text. Then switch to the "Log" tab and let me know what it says.

artisticat1 avatar Oct 30 '22 15:10 artisticat1

Just tried it and this is the screen recording. Record_2022-10-31-17-14-10.gif

And these are the logs, I noticed that it only detects the backspace and numerical keys.

The Unidentified key was pressed.
The Backspace key was pressed.
The Unidentified key was pressed.
The Backspace key was pressed.
The Unidentified key was pressed.
The Backspace key was pressed.
The Unidentified key was pressed.
The Unidentified key was pressed.
The Unidentified key was pressed.
The Unidentified key was pressed.
The Unidentified key was pressed.
The Unidentified key was pressed.
The Unidentified key was pressed.
The Unidentified key was pressed.
The Unidentified key was pressed.
The Backspace key was pressed.
The Unidentified key was pressed.
The Backspace key was pressed.
The Unidentified key was pressed.
The Backspace key was pressed.
The Unidentified key was pressed.
The Backspace key was pressed.
The Unidentified key was pressed.
The Backspace key was pressed.
The Unidentified key was pressed.
The Backspace key was pressed.
The Unidentified key was pressed.
The Backspace key was pressed.
The 4 key was pressed.
The 8 key was pressed.
The 7 key was pressed.
The 4 key was pressed.
The 6 key was pressed.
The Unidentified key was pressed.
The Backspace key was pressed.
The Unidentified key was pressed.
The Backspace key was pressed.
The Unidentified key was pressed.
The Backspace key was pressed.
The Unidentified key was pressed.
The Backspace key was pressed.
The Unidentified key was pressed.
The Backspace key was pressed.
The Unidentified key was pressed.
The Unidentified key was pressed.
The Unidentified key was pressed.
The Backspace key was pressed.
The Unidentified key was pressed.
The Backspace key was pressed.
The Unidentified key was pressed.
The Unidentified key was pressed.
The Unidentified key was pressed.
The Backspace key was pressed.
The Unidentified key was pressed.
The Backspace key was pressed.

Deadbush225 avatar Oct 31 '22 09:10 Deadbush225

try using some input methods that directly pass your input to the target app ,hacker's keyboard etc.

LaTex suite seems to work in android with an external keyboard. Yet it doesn't work at all in other circumstances.

L0L1P0P1 avatar Nov 07 '22 20:11 L0L1P0P1

Hi @artisticat1, has there been any further investigation about this?

awsharif avatar Jan 22 '23 21:01 awsharif

Hi @artisticat1, has there been any further investigation about this?

I think it's some sort of issue with CodeMirror not receiving key-press events from Android keyboards.

I don't think there's much I can do on my side, except possibly look for a workaround.

artisticat1 avatar Feb 11 '23 15:02 artisticat1

Hi @Deadbush225 ,I found a solution. When a key on the keyboard is clicked , the Obsidian can't detect key exactly because of IME (means Input-Method Editor) which almost every common keyboard app has. (See event.key = Unidentified, event.keyCode = 229 #14512 for more information) Only when we use some unusual keyboard apps without IME can the obsidian detect the exact key, the only one I know of which is "Game Keyboard+", but this one can't be used to type any letter, so we need a physical keyboard to do it.

Specific methods are as follows:

  1. Download ,install and start "Game Keyboard+" app on mobile.
  2. Follow the instruction Step 1 2 and 3.
  3. Click "Custom & Test" and delete all keys because we don't need them.
  4. Connect the physical keyboard to the mobile.
  5. Go to Obsidian and have a try. Screenrecorder

(This solution will be better if someone found a common keyboard without IME) I'm a novice in writing English sentences and using Obsidian, any suggestions are welcome.

oldkingOK avatar Mar 04 '23 06:03 oldkingOK

Has anybody found a workaround to this?

pikatwinky avatar Mar 31 '23 17:03 pikatwinky

@pikatwinky it is kinda working for me. I'm using codeboard. I believe the problem was partly solved when obsidian migrated to codemirror6 but I'm wildly guessing.
However, some snippets I'm not able to get to work. For example "x/y [tab key]" doesn't replace it with \frac{x}{y} but simply inserts a tab or tabs out of the equation. It seems that codemirror still reports Unidentified for special keys like / due to the IME.

edit: actually, it reports correctly now as /, yet it still doesn't work in obsidian.

TomBPotochek avatar Aug 30 '23 09:08 TomBPotochek

@oldkingOK have you tried using codeboard keyboard? It almost works perfectly but I haven't had any luck with autofractions for example. Codemirror seems to correctly identify the keypresses like / and Tab key despite it not working (I tried it in codemirror.net/try).

TomBPotochek avatar Aug 31 '23 01:08 TomBPotochek

latex suite is a great plugin, but unfortunately it doesn't work on mobile. Are you considering adding mobile support when using IME input methods such as Gboard. Thank you very much. @artisticat1

henusys avatar Sep 07 '23 02:09 henusys

@TomBPotochek Sorry for the late reply. I just try it. It's quite strange that the physical keyboard works well with autofractions while the codeboard doesn't work. The reason might be the symbol "/" on the codeboard can be customized, which probably means that only symbols on codeboard use IME. I have forked gazlaws-dev/codeboard and plan to working on it for a few days. Thank you very much!

oldkingOK avatar Sep 08 '23 14:09 oldkingOK

@TomBPotochek Finished, click here to download and have a try. Screenrecorder-2023-09-09-15-26-56-111.gif

oldkingOK avatar Sep 09 '23 07:09 oldkingOK

@oldkingOK great, it's working! I see it was a fairly simple change. I would not have known.

Now this just needs to be done for the other symbols and the problem is solved completely (eg. << expand to \ll, a snippet I use that expands a*b to a \cdot b, etc).
I might add it to your repo as a PR ...If I can figure out how to build an android app in my computer 😵

One small thing I've noticed is that now the _ underscore snippet doesn't expand to _{} that for whatever reason did work with the original codeBoard keyboard.

TomBPotochek avatar Sep 09 '23 08:09 TomBPotochek

@TomBPotochek you're a lifesaver, thanks for the suggestion about using codeboard.

@oldkingOK Thank you so much for sharing that build of the app

It's such a shame that that keyboard doesn´t recieve support anymore, i hope it doesn't break very soon.

pikatwinky avatar Sep 12 '23 17:09 pikatwinky

It should be possible to handle IME input - for reference, here's how the vim CM6 plugin handles it. Any PRs for this would be welcome.

artisticat1 avatar Sep 15 '23 21:09 artisticat1