Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

As of release 5.4.0.x preceding products based on the SpellCheckAsYouType (SCAYT) core as well as WProofreader use the special markup mechanism for underling spelling and grammar errors. This markup mechanism adds <span> elements with special classes, e.g. class="wsc-spelling-problem", which without preliminary cleaning might got to database and then prepopulated to the text.

...

Until then, if you have such a problem, we recommend you to implement a mechanism that on your end that will clean extra <spans> before saving the information to a database. Below you can find an example that uses the removeMarkupFromString command. 

Code Block
languagejs
themeEmacs
<script>
var wscInstance; // You will be able to call WProofreader API using this variable

window.WEBSPELLCHECKER_CONFIG = {
    ...
    onLoad: function(instance) {
        wscInstance = instance; // Here you make WProofreader instance available from your code
    }
}
</script>

After that you can use it as follows to clean unnecessary spans that have been added by WProofreader:

Code Block
languagejs
themeEmacs
wscInstance.removeMarkupFromString('<p>Example <span class="wsc-spelling-problem" data-spelling-word="texxt" data-wsc-lang="en_US">texxt</span>.</p>'); // It will return'<p>Example texxt.</p>'

...