Spell checking
RichTextEditor does not bundle WProofreader or any dictionary.It gives you two things instead: the browser’s own checker, switched on by default and costing nothing to run, and a single hook for connecting whichever service you have licensed.
Layer 1 — the browser’s checker
The editable is marked spellcheck="true", so misspellings get the usual red underline with no server, no dictionary and no licence.
// Layer 1 — the browser's own checker, no infrastructure at all.
// On by default; turn it off per editor:
new RichTextEditor("#div_editor1", { spellCheckEnabled: false });Layer 2 — bring your own service
This editor is wired to a small local dictionary that knows three misspellings, so the integration point is demonstrable without calling anyone. Press the button to open the review panel and correct them.
// Any service, behind one function. Return an array of issues.
new RichTextEditor("#div_editor1", {
spellCheckResolver: function (text) {
return fetch("https://your-wproofreader-host/check?t=" + encodeURIComponent(text))
.then(function (r) { return r.json(); })
.then(function (data) {
return data.issues.map(function (i) {
return { word: i.word, offset: i.offset, length: i.length,
suggestions: i.suggestions };
});
});
}
});
// Then open the review panel:
editor.execCommand("spellcheck");A real resolver differs only in where the issues come from. The editor never talks to a spelling service itself — it calls your function — so your credentials, endpoint and data-residency rules stay yours.