New CodeMirror 6 TiddlyWiki5 plugin

Hello,

Is it possible to have CM6 only defined as the text editor for tiddlers text fields and not all text inputs?

Would it be be possible to have a generic “User Snippet” that would be based on a dictionary data tiddler?
A key with the keyword to search for and the value with the text to insert.

BR,

Eskha

1 Like

I 2nd the desire for some kind of mechanism for user-defined autoconplete “searchterm:inserted string” pairs, especially if we can also define the final cursor position

How to use a widget to invoke zen mode? I noticed the code just triggers an action, but I can’t implement similar functionality with a button. I want to create a layout that opens in zen mode, with the tiddler behind it being the current date. This way I can quickly input all the thoughts I have for the day.

The code below didn’t work, not sure what is missing.

<$let targetTiddler="00123">
	<$button >
	<$action-sendmessage $message="tm-cm6-zen-mode" tiddler=<<targetTiddler>> />
	000
</$button>
</$let>

Also, how to enable heading and list collapsing in zen mode seems like an important feature as well. My understanding of zen mode is that it allows users to focus on editing, while also needing other editing-related functions. For example, I think an editing button bar could be added to zen mode, along with line number display. Of course, these could all be made configurable options, letting users decide whether to show line numbers, whether to collapse headings and lists, and whether to have the editing bar mentioned above.

For me, it mostly comes up when copying meeting invites from Outlook at work. It turns bullet points into unicode characters. I want to remove them and turn them into * so I normally paste into Notepad++ to turn them into *. I do this using rectangle selection as there are sometimes multiple levels.

It is important to note though that most text editors combine rectangle selection with multiple cursors. I don’t think it would be so useful if CM6 does not turn a rectangle selection into a series of cursors.

Hello yan,

For your use case, you can try the attached solution that adds a “Convert bullets from outside text inside WikiText bullets” in the editor toolbar. (Working with or without CM6).

To test this solution, you can drop the attached json to TiddlyWiki site

BR,

Eskha

convert-from-office-to-wikitext.json (3.4 KB)

3 Likes

Thanks @Eskha !

I’ve always been irritated at wrangling these incoming • bullets into parsable ul items.

FYI: A short user story that may infludence codemirror-6 plugin settings OR help someone get out of a tangle.

I wanted to avoid using CodeMirror6 0.0.35 for the streams editor.

I disabled the plugin "$:/plugins/tiddlywiki/codemirror-6 " - just the editor one and got this error;

uncaught exception: Cannot find module named ‘$:/plugins/tiddlywiki/codemirror-6/lib/core.js’ required by module ‘$:/plugins/tiddlywiki/codemirror-6/plugins/lang-cpp/register.js’, resolved to $:/plugins/tiddlywiki/codemirror-6/lib/core.js

  • The wiki then just remained on the splash screen

I opened the html file and found $:/config/Plugins/Disabled/$:/plugins/tiddlywiki/codemirror-6 and changed the text from yes to no.

There is no option in CPanel > Settings > Codemirrror either to disable the whole suite, or just the “line” text editor which is used in streams.

In the editor plugin I found edit-text SimpleEngine — CodeMirror for input fields and textareas

  • And then found the subplugin $:/plugins/tiddlywiki/codemirror-6/plugins/edit-text and disabled that - now the default streams editor is not codemirror-6
1 Like

Hi @TW_Tones I’m sorry for the trouble! I’ll add more safeguards so that this doesn’t happen!

1 Like

No problem @BurningTreeC just reporting observations and it was easily fixed.

I’m a big streams user and I’m interested in incorporating codemirror6 in my wiki, but I haven’t started playing around with it yet.

Curious as to why you /wouldn’t/ want to use it codemirror as the node editor? Is it not compatible yet or is there some other lost functionality?

Nothing of importance, I was working on something different and complex and was just trying to reduce complexity at the time.

I suggest experimenting to see.

1 Like

Few unusual things I noticed while playing with this again - looking forward to it moving out of “experimental” stage!! Some of it may be my confusion on intended dependency.

  1. Auto Close Tags: This seems to work with just the editor and “TiddlyWiki Language”
    1. And also with just the editor and not the TiddlyWiki language, doesn’t seem to work
  2. The readme for lang-tiddlywiki seems to be more comprehensive than the individual plugin
    1. Maybe this is before you split into individual plugins?
    2. The text gets garbled after the snippet area
  3. When you’re editing and you put on the preview (alt-p) the background is “gray” instead of white
  4. When you have a line like .mystyle2 {color:red;} and hit enter, it indents when it shouldn’t

On “Snippets” which are really cool - how do I get the tab to actually move between placeholders, it just keeps indenting the line?