Turn on/off Spellcheck? Standard and codemirror editors

@pmario This is the direction I was heading if it turned out to be possible.

I would go with a global per-wiki setting rather than a per-tiddler setting. Isn’t that how the preview toggle works in the edit template? There would need to be an indicator above or below the textarea, and maybe in the Settings also.

100% agree.   

Of course the alternative approach is to have an additional dictionary to which you add terms found in macros so they are no longer highlighted as misspellings. Such dictionaries can be toggled on/off in the browser and can be used simultaneously with other dictionaries.

Perhaps one day in the future we could add custom addon dictionaries to tiddlywiki itself?, but until then looking at the code highlighting options may offer some relief, especially when previewing code.

I’m pretty sure, that the FireFox dictionary can’t add new terms. … Buf I’ve had a look, how to create custom browser dictionaries. Most browsers seem to use the “hunspell” library, which needs a “special” format that uses 2 different files. 1 file with the “word list” and 1 file with some “grammer rules”. …

The tricky part is, to create those 2 files in a convenient way. eg: Have a maintainable, human readable source structure PLUS a “build stack” that turns this structure into the requested result.

I posted a demo to enable/disable spellchecking here: https://amreus.tiddlyhost.com

The toggle affects any text-edit widget. It is possible the feature will be added officially soon.

It requires the 3 modified core tiddlers as listed. The state is saved with the wiki. There is no ControlPanel or other user interface other than the checkbox in the Customizations tiddler.

Questions? Issues?

1 Like

Can you document its effect when using codemirror please?

In short I can not answer that because I don’t know at this time.

I briefly looked at the codemirror plugin this morning and it looks to me like codemirror replaces the piece of tiddlywiki that makes the textarea, and so I think the changes I made will have no effect when used with codemirror. Put another way, the codemirror plugin would need to be modified to use the spellchecking toggle.

I think it more likely we need to;

  • Modify the spell check to cope with code mirror edit fields.
  • Just allow an option to view the same tiddler in a standard edit view for spell check.
  • Create a custom preview which is in fact the classic editor in which spell check can occur.

Create a custom preview which is in fact the classic editor in which spell check can occur.

edit-template-spell-check preview.json (621 Bytes)

You could make an alternate edit template that does the same thing.

Here I created a new editor preview that uses a simple edit text area, if using code mirror select preview “Spell check default editor” and click inside and you can use the standard browser spell checker. I also recommend ## Hidden Setting: Show Edit Preview per Tiddler

Is it possible to have spellcheck in the preview window on while it is off in the main editor window?

In my example with the special preview, the spell check is not operating on the codemirror editor, but does in the preview window, so gives you this result.

Hi Tony
I use the default TW editor and your solution does not work for me! Is there anything wrong in my side?

I did not come at it from this perspective, you can tun off spell check provided by the browser altogether to stop it on the TW Editor.

Incidentally spell checkers often don’t work on codemirror - so if you use codemirror then you must use the preview that uses the default editor (text area) to spell check. Which can be viewed simultaneously with the codemirror editor, thus the default editor allowed spell check.

The OT asked could it be selectively turned off, my suggestions was use code mirror, which does not use the spell checker and selectively use the special preview to enable spellcheck. Which is kind of reverse solution.

I think what you are asking for is a reverse of a reverse, an in this case two reverses don’t make a forward.

Perhaps restate your requirement in full and we try and find a solution for that.

Folks, just to have a place to store this otherwise I may lose it. As per this link, you can turn on (or off) spell check changing the package.json file of TW adding
“chromium-args”: “–enable-spell-checking”, and I just found that you can also do:

chrome.settingsPrivate.setPref(‘browser.enable_spellchecking’, true) // false to disable
chrome.settingsPrivate.setPref(‘spellcheck.dictionaries’, [“en-US”, “de-DE”,“pt-BR”], “null”, ()=>{}) // set

in the TW desktop browser console (pressing F12, going to console and typing (or copy/paste) for those who are not used to a console). In the case you are enabling it, if you didn’t have the dictionary, it will be downloaded to the dictionaries’ folder (on Linux: ~/.config/TiddlyDesktop/Dictionaries/ )

These settings can be enabled via a JS file, but I don’t know exactly which one I could use right now, so I did it through the console, as I’m a little bit out of time to make more tests. Maybe it could help to find a solution to enable it via control panel. Rgds…

2 Likes

I have already created this preview to use for spell checking when codemirror is installed, because browser spell checkers don’t work with code mirror, and share it here;

  • In a tiddler you are editing in code mirror, select the preview “Spell Check Default Editor” click into the preview and spell check works in there.
  • By installing code mirror you effectively disable spell check unless you use this work around.
    • There may be in browser tools that work with codemirror.

edit-template-spell-check preview.json (621 Bytes)

1 Like

I may have hoped it was now possible to use the browser spell checker in code mirror, but it appears not to be so.

I can make use of my preview alternative above to access the standard tiddlywiki editor but I reply here to see if there has being any advance for code mirror. I have renamed the title to make it more obviouse.

Not that I’m aware of. I have a checkbox that flips between CodeMirror and a regular textarea. When CodeMirror is enabled, I don’t run the spellchecker. When it’s disabled, the regular browser spellchecker kicks in. Not ideal, but it works for the time being.

Thanks @CodaCoder may I ask how you implemented the invocation of the standard editor with code mirror running, last time I looked it’s got its tenticals through the core.

only if it’s trivial because it’s most likely similar to my above approach.

I am using tiddlywiki to write a book and the idea that spell check, the editor toobar and line numbers for example don’t work together is quite disappointing.

It’s part of my TiddlyBook. Put as simply as possible, the editor is either an $edit-text set to tag=textarea, or an $edit, bound to CodeMirror (in Control Panel).

Spellchecker:

CodeMirror:

Yes, I expected you used the same approach to me, unfortunatly it is difficult to reinstate the full text editor with code mirror installed and enabled, because the editor tool bar is not easy to restore.

  • Thanks for your answer, even if it supports the argument there reains a gap.
  • I may undertake another attempt to resolve this or submit a GITHub request against codeMirror.

Thanks again
Tones