Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Enable spellcheck by default or provide option to enable it #89

Open
1 task
bverkron opened this issue Jan 2, 2024 · 9 comments
Open
1 task
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@bverkron
Copy link

bverkron commented Jan 2, 2024

Describe the feature

Spellcheck is disabled by default and there seems to be no 'clean' way to enable it except for mapping the /scripts directory to the host and modifying the setting. That's not ideal since any future changes to those scripts in the project would need to be manually updated / merged.

It would be great to either have spellcheck enabled by default or have an option (either global or in the editor) to enable spellcheck.

Having it enable by default seems logical being that a wiki is typically used for writing notes / documents / articles, etc which are mostly medium to long form text for which spellcheck would be beneficial.

Is your feature request related to a problem? (optional)

I did not notice that spellcheck was disabled and now have a lot of wiki pages with spelling errors I have to go back and manually correct by copy / pasting into a spell check enabled editor and back again.

Screenshots (optional)

Screenshot 2024-01-02 at 2 19 00 PM

Extra fields

  • I'd like to work on this feature
@bverkron bverkron added the enhancement New feature or request label Jan 2, 2024
@bverkron bverkron changed the title Enable spellcheck by default or provide option to enable it [Feature Request] Enable spellcheck by default or provide option to enable it Jan 2, 2024
@Zavy86
Copy link
Owner

Zavy86 commented Jan 3, 2024

you need to understand how to integrate it and if it works with all languages.

Is anyone an expert in this area?

@Zavy86 Zavy86 added the help wanted Extra attention is needed label Jan 3, 2024
@bverkron
Copy link
Author

bverkron commented Jan 3, 2024

AFAIK this just enables the browser spell check feature on the client side. At least that’s what it did for me in Safari on macOS when I manually changed it to true by editing the HTML. I don’t believe it’s a server side feature.

In my earlier testing the browser would not detect any spelling errors event when I manually asked it to “Check spelling now” on the page. After I enable spellcheck in the HTML of the page the browser was able to find the spelling errors.

I can try to check later in other browsers and in other OSs to confirm.

@bverkron
Copy link
Author

bverkron commented Jan 3, 2024

I just revisited the doc about it and I think my interpretation is correct.

This attribute is merely a hint for the browser: browsers are not required to check for spelling errors...

https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck

and here ...

It tells the browser if it should spellcheck an area or not.

https://dev.to/dailydevtips1/html-spellcheck-attribute-4341

Browser support seems very good with the most recently added one (according to the Mozilla doc) being Firefox on Android back in 2017. All other browsers added support for it earlier than that and Chrome was way back in 2011.

image

I'm pretty certain this is just enabling the standard browser spellchecking we see in many other instances in textarea fields, but I can do additional testing later today when I'm back at my main system(s).

@Zavy86
Copy link
Owner

Zavy86 commented Jan 3, 2024

ok I wait for your tests.
if it is sufficient to set the spellcheck parameter to true the job is soon done!

@bverkron
Copy link
Author

bverkron commented Jan 3, 2024

Here are some results from Brave (basically Chrome) on macOS and Safari as well.

It just highlights the misspelled words and you can right-click to correct them (much like the w3schools screenshot below)

brave

safari

It was a bit buggy trying to "hack" this setting on via the browser developer tools for WikiDocs but you can see the same attribute at work in the w3schools example where none of the EasyMDE code exists so that helps rule out EasyMDE or any other special server side or client side code enabling the spellchecking.

Screenshot 2024-01-03 at 1 56 56 PM

Not sure what other testing to do. I think that shows pretty well it's a simple browser feature via the standard a HTML tag.

I tried modifying the scripts/editor.js file and setting spellcheck to true and reloading the container but it did not change in my browser even after clearing my cache, it stayed false. I'm not familiar with the EasyMDE framework though so maybe something else is required to get the page code to change.

@bverkron
Copy link
Author

bverkron commented Jan 3, 2024

One follow up to say that the right-click to correct spelling does not seem to work in Brave or Safari for WikiDocs, though it does work in the w3schools example.

When right-clicking on a misspelled word I only get the normal options but not one to correct the world. Not sure if this is due to something EasyMDE is doing or what. It's a minor issue that could probably be looked at separately. For now at least having the misspelled words highlighted is a big step forward IMO.

image

@bverkron
Copy link
Author

bverkron commented Jan 3, 2024

Ok final comment for now. Sorry I'm kind of discovering things in real-time and documenting as I go so I don't lose track of things.

It seems this might actually be the codemirror spell checker based on the way it highlights the words (solid red background instead of red underline). https://github.com/sparksuite/codemirror-spell-checker

image

Might partially explain why the HTML tag attribute of spellchecker= did not get updated to try when I set spellchecker:true in editor.js? But it does not explain why me manually changing the HTML attribute to true caused the highlighting to appear... hmmmm...

I believe there was an assumption on my part earlier on that setting spellchecker:true in editor.js would set the HTML attribute spellchecker=true but that might not be the case.

Maybe you're able to do some further testing / investigation to verify?

@bverkron
Copy link
Author

bverkron commented Jan 3, 2024

Looks like what I have been seeing is a combination of the CodeMirror spell checker (maybe?) and the browser spell checker.

If I enable spellchecker:true in editor.js it will highlight the misspelled words in red. But I will only get the ability to right-click and correct the spelling if I manually force the HTML attribute to spellchecker=true in the browser (which does not appear to be done via the editor.js setting).

Apologies for not catching this earlier. This means that the issues is maybe more complex than originally thought and that it may or may not work in all languages since I don't know anything about the CodeMirror spell checker in that regard. Maybe it is not as simple (or possible at all?) to enable the client side, native browser spell checking... 🤔

@Zavy86 Zavy86 added the question Further information is requested label Jan 4, 2024
@bverkron
Copy link
Author

bverkron commented Jan 5, 2024

Further indication that the spell check feature is not browser side and probably should not be enabled by default...

It looks like it does not adhere to the browser localization as it's marking British / Canadian spellings of words as incorrect. I am in Canada and my OS / browser accept Canadian spellings as correct and those show as correct when using the spellcheck HTML attribute

Screenshot 2024-01-05 at 1 01 15 PM Screenshot 2024-01-05 at 12 59 45 PM

Unless there is a way to turn on the actual HTML spellcheck tag I think that at best WikiDocs could provide a cleaner mechanism to turn on the EasyMDE spell checker with the caveat that it's not localized necessarily and it would be up to the
user to accept that. I still find a lot of valid in having it turned on, even if it's not 100% localized for me. Helps me catch and manually correct words.

Maybe further digging will reveal a way to enable the browser side spellchecker HTML tag...

Sorry for the long winded thread @Zavy86, you were right in the beginning and I made assumptions!

@Zavy86 Zavy86 removed the question Further information is requested label Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants