editor.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // *** smc_Editor class.
  2. /*
  3. Kept for compatibility with SMF 2.0 editor
  4. */
  5. function smc_Editor(oOptions)
  6. {
  7. this.opt = oOptions;
  8. var editor = $('#' + oOptions.sUniqueId);
  9. this.sUniqueId = this.opt.sUniqueId;
  10. this.bRichTextEnabled = true;
  11. }
  12. // Return the current text.
  13. smc_Editor.prototype.getText = function(bPrepareEntities, bModeOverride)
  14. {
  15. return $('#' + this.sUniqueId).data("sceditor").getText();
  16. }
  17. // Set the HTML content to be that of the text box - if we are in wysiwyg mode.
  18. smc_Editor.prototype.doSubmit = function()
  19. {}
  20. // Populate the box with text.
  21. smc_Editor.prototype.insertText = function(sText, bClear, bForceEntityReverse, iMoveCursorBack)
  22. {
  23. $('#' + this.sUniqueId).data("sceditor").InsertText(sText.replace(/<br \/>/gi, ''), bClear);
  24. }
  25. // Start up the spellchecker!
  26. smc_Editor.prototype.spellCheckStart = function()
  27. {
  28. if (!spellCheck)
  29. return false;
  30. $('#' + this.sUniqueId).data("sceditor").storeLastState();
  31. // If we're in HTML mode we need to get the non-HTML text.
  32. $('#' + this.sUniqueId).data("sceditor").setTextMode()
  33. spellCheck(false, this.opt.sUniqueId);
  34. return true;
  35. }