Re: [editing-explainer] How can sites access browser spellchecking? (#36)

Here is one idea of how to do that. @rniwa could you explain how this reveals sensitive information? The way I understand it, it should only give access to the standard dictionaries that come preinstalled with the browser. Extra user dictionaries, etc. would be created and handled by the application in question in userspace:
```
Purpose:
-- Be able to override right-click menu without losing spellchecking
-- Control autocorrect and spellchecking individually
-- Have direct control over the language used for  spellchecking from
Javascript
-- Have a way to more specifically tell the browser what makes out a
sentence for something it is to spellcheck.  So for example an editor with
a citation plugin may have something like the following:

<div cE=true>
In the book <span cE=false class="citation-title>The World according to
me</span> the sociologist <span cE=false
class="citation-author-as-subject">Émile Durkheim (1902)</span> writes a
great deal about his early childhood.
</div>

It would be good to be able to tell the browser to please spell/grammar
check a sentence such as:  "In the book SOMETITLE the sociologist AUTHOR
writes a great deal about his early childhood." in English. And this is
assuming that some internal spellcheckers may be intelligent enough to try
to guess the meaning of a word in a sentence when spellchecking, which I am
not sure they are.


> An obvious one is knowing that a spellchecker *wants* to correct a word,
> and looking in a custom dictionary. For example in various Yandex services
> we use a russian/english input method, where ghbdtn can actually be
> recognised as привет and цувтуывфн as wednesday. (This saves switching
> keyboards for simple stuff). But my spellchecker doesn't pick that up, so
> it tries to do all kinds of odd and rather annoying things instead.
>

Indeed, custom dictionaries would also make a lot of sense

Possible way to make this possible:
A simple function accessible to Javascript that takes two arguments: text
to be checked and language and which return all the possible suggestions
listed by beginning and end character number of the original string., For
example:

> spellcheck("Who's kat iz dat?",'en_US');

[
  {
    start: 0,
    end: 4,
    suggestions: ["Whose"]
  },
  {
    start: 6,
    end: 8,
    suggestions: ["cat","hat","mat"]
  },
  {
    start: 10,
    end: 11,
    suggestions: ["is"]
  },
  {
    start: 13,
    end: 15,
    suggestions: ["that"]
  },
]


Then Javascript would need to need to be used to do everything else: draw
red lines under corresponding words, create selection menus, etc. .It seems
though that this would be something that should be specified somewhere else
than in contenteditable.
 

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/editing-explainer/issues/36#issuecomment-68030530

Received on Wednesday, 24 December 2014 06:32:51 UTC