TiddlyWiki5 icon indicating copy to clipboard operation
TiddlyWiki5 copied to clipboard

TiddlyWiki v5.2.2 CodeMirror plugin not working in HTA mode

Open whjou opened this issue 2 years ago • 1 comments

Describe the bug

I have been using TiddlyWiki v5.1.17 as a HTA for a while and recently upgraded to TiddlyWiki v5.2.2. However I noticed that a few official plugins now throws JavaScript errors in HTA mode.

  • CodeMirror - The version in TiddlyWiki 5.1.17 used to work well in HTA mode. The version in TiddlyWiki 5.2.2 is failing with this message "Object doesn't support this action" when it's enabled.

I'd like very much to have it functioning in HTA mode: the default editor is a bit too "plain"...

Expected behavior

I'd expect to have CodeMirror plugin work when I'm editing a tiddler.

To Reproduce

  1. Start with the empty edition at https://tiddlywiki.com/empty.html
  2. Save it and rename file extension to .hta
  3. Execute on a Windows PC (e.g. Windows 10)
  4. Install the CodeMirror plugin.
  5. Save and reload
  6. See error.

Screenshots

image image

TiddlyWiki Configuration

  • Version - 5.2.2
  • Saving mechanism - HTA
  • Plugins installed - Empty edition with CodeMirror plugin

Desktop (please complete the following information):

  • OS - Wndows 10
  • Browser - n/a (HTA)
  • Version - n/a

Additional context

No response

whjou avatar May 21 '22 14:05 whjou

I tested this by mistake on TW 5.2.1 I can confirm the same problem occurring on Windows 11 otherwise the same. I installed the first codemirror plugin (with 15 subplugins)

I tried it again without installing the bundle and excluding the two HTML related plugin because I had a memory of this causing a problem but it still fails.

I may redo the test for 5.2.2 however I don't expect change, unless I could install only the core code mirror and not the addons.

Moved to 5.2.2 I can not see how to install the core plugin without the additional plugins. Which I have done in the past.

Your next step is to

AnthonyMuscio avatar May 23 '22 06:05 AnthonyMuscio

I dont take it this will be fixed any time soon? i use twexe and would love to use tiddlywiki as a real coding platform but codemirror is a must for that

shadowforce62 avatar Mar 07 '23 04:03 shadowforce62

This only happens when codemirror is installed. So it's not a TW problem. You may raise an issue at the codemirror repos. .. But I doubt that they will change anything for cm5 since they completely switched to cm6.

Microsoft stopped to update HTA documentation in 2013 and IE11 was retired June 15, 2022 ...

@Jermolene .. I think we should close this one with a "won't fix"

pmario avatar Mar 07 '23 06:03 pmario

This only happens when codemirror is installed. So it's not a TW problem. You may raise an issue at the codemirror repos. .. But I doubt that they will change anything for cm5 since they completely switched to cm6.

Microsoft stopped to update HTA documentation in 2013 and IE11 was retired June 15, 2022 ...

@Jermolene .. I think we should close this one with a "won't fix"

Yes, IE11 is dead however MSHTA is not discontinued and is a core system component according to Microsoft, the fate of mshta isn't sealed yet as it was not discontinued with IE11, however I didn't realize this was not the code mirror GitHub since I'm grasping at straws to work around this issue

shadowforce62 avatar Mar 07 '23 06:03 shadowforce62

Though the feedback is very much appreciated, thank you for taking the time.

shadowforce62 avatar Mar 07 '23 06:03 shadowforce62

The problem is, that it's not an easy fix, because there is no dev-console in the HTA window. So it's close to impossible to see where the error comes from. I did some tests and basically wasted an hour without the chance for success.

pmario avatar Mar 07 '23 08:03 pmario

i was able to dig up this error using a htaconsole javascript file image image (Found using https://github.com/jeremyben/HTAConsole)

shadowforce62 avatar Mar 07 '23 18:03 shadowforce62

For what it's worth, I was using TW5 in HTA mode/hack due to a rather locked down corporate environment when I encountered this issue while upgrading to a newer version of TW5 and the default browser saving behavior was quite vexing to use.

However, I recently came across https://github.com/slaymaker1907/TW5-browser-nativesaver which solves the saving issue cleanly (a few extra clicks a day is quite tolerable) and with this I no longer need to depend on HTA mode/hack. I'm mentioning this here even though it has no bearing on this issue, in case others find this useful in moving away from HTA mode/hack.

Also noted the error was from the embedded copy of CodeMirror rather from TW5 itself so it's not quite reasonable to request TW5 developers to fix. It's more logical to take it up with CodeMirror team to get it working in HTA (if I still need it) and have TW5 import the fixes after.

I'm okay to close this as suggested by @pmario unless @shadowforce62 would like to pursue this further?

whjou avatar May 14 '23 03:05 whjou

So, strangely enough I do not use the HTA hack for saving (Though this is a nice feature) I use it in conjunction with twexe (The plugin not the portable executable), this enables portable code execution and with the use of js-zip I can build and export scripts or even run them directly from tiddlywiki as if tiddlywiki was a full-scale development platform, the reason I wanted codemirror to work is it would be nice to have a more fleshed out editor for the program I execute all my code from. though I do understand this was not the intended feature of tiddlywiki but its not a big deal i highly doubt the CodeMirror team would bother with it as so many other plugins fail in HTA mode Aswell, it was wishfull thinking that there might be a simple solution but i think my use case is rather unique. no need to pursue it

shadowforce62 avatar May 14 '23 04:05 shadowforce62

Ok. I'll start a thread on talk.tiddlywiki.org to discuss a bit more. Not sure if I should close or let developer do that?

whjou avatar May 14 '23 08:05 whjou

Thanks @whjou @shadowforce62 I think it makes sense to close this for now.

Jermolene avatar May 14 '23 08:05 Jermolene

@whjou and others. Thanks for re-viewing open issues and to let us know that TW-nativesaver worked for you. I think it may be useful for others, that stumble upon the same problem.

pmario avatar May 14 '23 09:05 pmario

Ok. I'll start a thread on talk.tiddlywiki.org to discuss a bit more. Not sure if I should close or let developer do that?

https://talk.tiddlywiki.org/t/hta-hack-and-codemirror/7001

in case you are interested.

whjou avatar Jun 04 '23 14:06 whjou

@shadowforce62 changing

setTimeout(() => cm.display.input.focus(), 20);

to

setTimeout(function() {cm.display.input.focus();}, 20);

in the CM plugin "seems" to fix the issue, even in TW v5.2.7.

whjou avatar Jun 04 '23 18:06 whjou