Update Codemirror

192 views
Skip to first unread message

George Rutter

unread,
Mar 9, 2020, 11:02:13 AM3/9/20
to tiddl...@googlegroups.com
Hi folks,

Maybe I missed the documentation on how to update Codemirror for Tiddlywiki. The one in the official repo looks pretty out of date, but also looks like some decent work went into porting it. What's the easiest way to update it?

-George

PMario

unread,
Mar 9, 2020, 3:58:48 PM3/9/20
to TiddlyWiki
Hi George,

On Monday, March 9, 2020 at 4:02:13 PM UTC+1, bluespire wrote:
...
Maybe I missed the documentation on how to update Codemirror for Tiddlywiki.

It has to be done by one of the plugin maintainers. Most of the time the cm-libraries that are part of the files directory, have to be updated _AND_ tested. Codemirror is "ultra modular". So each functionality is separated into 1 js module. Most of the time such a module is only 1 part of a new function. eg: autocomplete.

In TW codemirror.js is the main plugin, that you always have to use. It basically contains the main library and a minimal set of CM addOns that are needed.

eg: codemirror-autocomplete contains several other cm-modules like: anyword-hint.js, css-hint.js, html-hint.js .... and so on. PLUS CSS and some configuration, that is needed within TW.

codemirror-closebrackets contains closebrackets.js and matchbrackets.js ... + config.

As you can see, there is quite some manual work needed, to create a new version for TW. Since the maintainer has to test every feature separately and in combination with other tw-cm-plugins installed.

Especially the configurations have to be right, to create a plug-and-play experience for newbie users.
 
The one in the official repo looks pretty out of date, but also looks like some decent work went into porting it. What's the easiest way to update it?

You are right. There has been much energy put into the system, to make it easy to use. Especially the "autoconfig" feature needed much attention. ...  TW 5.1.21 uses codemirror elements based on cm V5.37.0

I did have a look at the github release history. ... Most of the fixes between 5.52.0 which is the latest version and the version we use is mode updates (most of them not part of the TW distro atm.) and some edge case fixes.

So is there major function, that you miss in the current TW version, which makes it impossible for you to use it.

Or is it just the need to "have to use the latest and greatest" ...

have fun!
mario

TonyM

unread,
Mar 10, 2020, 12:54:56 AM3/10/20
to TiddlyWiki
An observation

If I include the codemirror plugins relating to HTML I get a Red Javascript error.

This needs to be considered if upgrading, but codemirror is superior to the default editor.

Regards
Tony

Mohammad

unread,
Mar 10, 2020, 2:29:32 AM3/10/20
to tiddl...@googlegroups.com
bluespire,
 I think BTC (Simon) is the plugin maintainer. I will ask in GitHuB to have a look!


--Mohammad

PMario

unread,
Mar 10, 2020, 3:06:55 AM3/10/20
to TiddlyWiki


On Tuesday, March 10, 2020 at 5:54:56 AM UTC+1, TonyM wrote:
 
If I include the codemirror plugins relating to HTML I get a Red Javascript error.

hi,
Can you be more precise, so we can fix the problem. An attachment here will be ok.
-m

George Rutter

unread,
Mar 11, 2020, 1:23:55 PM3/11/20
to tiddl...@googlegroups.com
Wow, didn't realize "bluespire" was visible anywhere. That's a super old pseudonym for me.

Do I want the latest and greatest? Yes.

Tangent: I have always loved the idea of TW from Classic to TW5. In fact, I have tons of work documentation on a TWC that was heavily customized. Back then I had one of the WYSIWYG editors working. I understand the need to update the internal mechanisms, and I love the changes, but it's never really been the same for me. I have always wanted TW to be able to replace all my note-taking, but I've always felt it's only half-there in any use-case. If all these external systems were basically just plug-n-play, then I could hack it up myself, but I don't have the time to re-port every integration I want. I would use CodeMirror as my main editor and tweak away, if I knew I was still getting updates to the editor itself, and could use all of its plugins. That's enough of a tangent. Sorry for venting.

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/8fd45843-98e8-4d5f-a391-34de068faa83%40googlegroups.com.

TonyM

unread,
Mar 11, 2020, 6:53:45 PM3/11/20
to TiddlyWiki
Mario,

Here is how to reproduce this;

  • Download empty from Tiddlywiki.com
  • Ctrl Panel Plugins, Get more plugins
  • Install all codemirror plugins EXCEPT the Following
CodeMirror Mode: Embedded-HTML Highlighting
$:/plugins/tiddlywiki/codemirror-mode-htmlembedded


CodeMirror Mode: HTML Highlighting
$:/plugins/tiddlywiki/codemirror-mode-htmlmixed

  • Save and reload and use codemirror in edit text, all OK
  • Ctrl Panel Plugins, Get more plugins
  • Install ONLY CodeMirror Mode: Embedded-HTML Highlighting
  • Save and Reload

Internal JavaScript Error

Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser
Error executing boot module $:/plugins/tiddlywiki/codemirror/mode/htmlembedded/htmlembedded.js: "Cannot find module named '../htmlmixed/htmlmixed' required by module '$:/plugins/tiddlywiki/codemirror/mode/htmlembedded/htmlembedded.js', resolved to $:/plugins/tiddlywiki/codemirror/mode/htmlmixed/htmlmixed"

This now continues to occur on reload. The Red message is not wholly visible and no scroll is available, and disappears on "new tiddler."

2020-03-12_9-51-12.jpg


Regards
Tony

PMario

unread,
Mar 12, 2020, 6:40:24 AM3/12/20
to TiddlyWiki
On Wednesday, March 11, 2020 at 11:53:45 PM UTC+1, TonyM wrote:
...
  • Install ONLY CodeMirror Mode: Embedded-HTML Highlighting
  • Save and Reload

Internal JavaScript Error

Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser
Error executing boot module $:/plugins/tiddlywiki/codemirror/mode/htmlembedded/htmlembedded.js: "Cannot find module named '../htmlmixed/htmlmixed' required by module '$:/plugins/tiddlywiki/codemirror/mode/htmlembedded/htmlembedded.js', resolved to $:/plugins/tiddlywiki/codemirror/mode/htmlmixed/htmlmixed"

Did you read the error message. It says "Cannot find module htmlmixed" ... So it obviously needs the mixed module ... You need to install it.

TW plugin system, doesn't contain a dependency resolution system atm

htmlmixed also needs xml, javascript and css ... If you install all of them, you are good to go.

-mario

TonyM

unread,
Mar 13, 2020, 7:55:23 AM3/13/20
to TiddlyWiki
Mario

I see the gap in my argument yet I recall installing everything and getting this message until I disabled the two html components.

I am not in a position to replicate now.

Tony

PMario

unread,
Mar 13, 2020, 11:39:24 AM3/13/20
to TiddlyWiki
On Friday, March 13, 2020 at 12:55:23 PM UTC+1, TonyM wrote:
I see the gap in my argument yet I recall installing everything and getting this message until I disabled the two html components.

Hi Tony, .. I could replicate the problem. A "normal" user would need to install 1 by 1, which can be frustrating. ... But that's the only way atm.

I'll create a proposal at github to split CodeMirror into its own library plugins/codemirror5. There is a CMnext on the way which will be codemirror6. So it is part of the core, but not part of the plugins/tiddlywiki path.

This should also help us, to keep the plugins UI simple. TWprerelease is a mess, if you want to install CM modules. I'm sure 99% of the users won't find the modules. And if the find them, they will do it wrong.
 
I know TW and CM and I did have problems resolving the dependencies with the modified UI for the prerelease.

-mario

TonyM

unread,
Mar 14, 2020, 3:17:39 AM3/14/20
to TiddlyWiki
Mario

Thanks I am glad your are on the case.

Codemirror really is a good addition to tiddlywiki. Line numbers tabs and other features help me every day.

Regards
Tony

Reply all
Reply to author
Forward
0 new messages