twinejs
twinejs copied to clipboard
Firefox spellchecking cannot be enabled in Twine2 online
Originally reported by: Douman (Bitbucket: DoumanAsh, GitHub: DoumanAsh)
Subj. For some reason i'm unable to enable spellchecker in passage editor
Since i suppose it might be related to the way entered text is being stored(in lots divs) it would be great somehow to allow usage of browser spellchecker.
P.s. title can be checked as it uses
- Bitbucket: https://bitbucket.org/klembot/twinejs/issue/249
Original comment by Douman (Bitbucket: DoumanAsh, GitHub: DoumanAsh):
Looked into source code. Didn't know that you were using CodeMirror to provide some nice auto-complete
I suppose then you'll need to have integrate spellcheck with CodeMirror. There are some option as to use typo.js or for example https://github.com/NextStepWebs/codemirror-spell-checker
Since Codemirror now supports spellcheck (from 5.18) is it possible to provide spellcheck in the desktop Twine, or does the app shell not provide it?
Can you provide some links on the spellcheck functionality? The biggest question I'd have is whether this supports languages other than English.
@klembot I'm just finishing my fork that will add this feature https://github.com/Prikalel/twinejs/tree/spellcheck The last thing I have to do is to add ignore list for words. I gonna open a pull request in a few days ☺️
Sounds interesting but keep in mind that right now I'm not accepting feature PRs for 2.4... for now. I have a process in mind I need to write down.
Some things I'd want to talk about:
- Could you share screenshots/sketches of what the UI changes would look like, if any?
- What's the impact on bundle size/load time? (https://bundlephobia.com can help with this)
- I see Russian and English dictionaries in your branch right now. What would the process be for someone who wants to contribute a dictionary? How would we vet that the dictionary being contributed?
- What if someone who has their locale set to English wants to edit, say, Russian text in a passage? Should the spellcheck language be decoupled from the UI locale?
Sounds interesting but keep in mind that right now I'm not accepting feature PRs for 2.4... for now. I have a process in mind I need to write down.
Some things I'd want to talk about:
- Could you share screenshots/sketches of what the UI changes would look like, if any?
- What's the impact on bundle size/load time? (https://bundlephobia.com can help with this)
- I see Russian and English dictionaries in your branch right now. What would the process be for someone who wants to contribute a dictionary? How would we vet that the dictionary being contributed?
- What if someone who has their locale set to English wants to edit, say, Russian text in a passage? Should the spellcheck language be decoupled from the UI locale?
Ok, I just finished my fork. Answering your questions:
- Here are some examples of how it showed:
Use case example:
With the right mouse button, you can add or remove the selected word to ignore list.
Also, there is a new checkbox in preferences. The settings are stored on the disk, so ignore list and spellchecking flag will be loaded in the next session.
- The size of
nodehun
folder in mynode_modules
is 9 MB. The size ofdictionaries
folder that I added is 10.7 MB. The result of runningtime
program (I always got thedbind-WARNING
on the window loaded, so I decided to use it as the signal for the timer) like so:
$ time (npm run start:electron 2&>1 | grep dbind- -m 1)
Have not given any difference in time of loading between version with and without spellchecking (real ~16s
).
- Right now, the process is simple as so:
- Download your dictionaries files from https://github.com/titoBouzout/Dictionaries
- Add them into
public/dictionaries
folder into folder<your locale>
with names<your locale>.aff/.dic
. See the hierarchy in this folder for examples. - Navigate to
src/electron/main-process/spellcheck.ts
and add your alphabet toalphabets
variable.
Your locale should be in code public/locales
uses, but the last step should be removed in the future, I guess.
- I think if you write your story in
Lang-name
then you should understandLang-name
language, that is why you can switch your locale to theLang-name
and still use the UI. That is why I decided to spellcheck for locale language. But of course, if someone wants to add this feature, they may say their opinion too. (but I think it is better to keep UI simple)
Ok, should I open PR, or it is better to wait until you will be able to accept one?
- Here are some examples of how it showed:
Use case example:
With the right mouse button, you can add or remove the selected word to ignore list.
Also, there is a new checkbox in preferences. The settings are stored on the disk, so ignore list and spellchecking flag will be loaded in the next session.
Oh, and you will receive this warning (already translated) if you try to spellcheck for your language while there are no dictionaries in Twine files:
This is stands for : "No spellcheck available for language: zh-CN".
Leaving a comment here to second the desire for spellchecking in the passage editor (something I know has been mentioned many times). Anecdotally, one of the main reasons for users composing text outside of the Twine app is to get spellchecking. As a dyslexic user, I have to spellcheck the entire game file externally (which can be a pain). I notice, as an aside, that spellchecking is working in the text dialogs (e.g. when entering a passage name in the rename dialog) even though it is not enabled in the passage editor itself.
Agreed--spell check would be a very very useful feature.