froala-editor
Version:
The next generation Javascript WYSIWYG HTML rich text editor made by devs for devs. High performance and modern design make it easy to use for developers and loved by users.
7 lines (6 loc) • 3.5 kB
JavaScript
/*!
* froala_editor v5.1.0 (https://www.froala.com/wysiwyg-editor)
* License https://froala.com/wysiwyg-editor/terms/
* Copyright 2014-2026 Froala Labs
*/
!function(e,s){"object"==typeof exports&&"undefined"!=typeof module?s(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],s):s(("undefined"!=typeof globalThis?globalThis:e||self).FroalaEditor)}(this,function(r){"use strict";r.DEFAULT_SCAYT_OPTIONS={enableOnTouchDevices:!1,disableOptionsStorage:["all"],localization:"en",extraModules:"ui",DefaultSelection:"American English",spellcheckLang:"en_US",contextMenuSections:"suggest|moresuggest",serviceProtocol:"https",servicePort:"80",serviceHost:"svc.webspellchecker.net",servicePath:"spellcheck/script/ssrv.cgi",contextMenuForMisspelledOnly:!0,scriptPath:"https://svc.webspellchecker.net/spellcheck31/wscbundle/wscbundle.js"},Object.assign(r.DEFAULTS,{scaytAutoload:!1,scaytCustomerId:"1:ldogw1-MSDuT3-slyfO-0YJgB1-Wx7262-HIT741-MAMDv4-10qfb3-A4LDP-c60m3-hSQgd2-az2",scaytOptions:{}}),r.PLUGINS.spellChecker=function(t){var l;function e(e){var s;l&&l.isDisabled&&(s=!l.isDisabled(),e.toggleClass("fr-active",s).attr("aria-pressed",s),t.$el.attr("spellcheck",t.opts.spellcheck&&!s))}function s(e){l&&l.isDisabled&&!l.isDisabled()&&0<=["bold","italic","underline","strikeThrough","subscript","superscript","fontFamily","fontSize","html"].indexOf(e)&&l.removeMarkupInSelectionNode({removeInside:!0})}function o(e){l&&l.isDisabled&&!l.isDisabled()&&0<=["bold","italic","underline","strikeThrough","subscript","superscript","fontFamily","fontSize","html"].indexOf(e)&&l.reloadMarkup()}function i(e){l&&l.isDisabled&&!l.isDisabled()&&e.which==r.KEYCODE.ENTER&&setTimeout(l.reloadMarkup,0)}function a(e){if(e&&e.getAttribute&&e.getAttribute("data-scayt-word"))e.outerHTML=e.innerHTML;else if(e&&e.nodeType==Node.ELEMENT_NODE)for(var s=e.querySelectorAll("[data-scayt-word], [data-spelling-word]"),t=0;t<s.length;t++)s[t].outerHTML=s[t].innerHTML}function n(){t.events.on("commands.before",s),t.events.on("commands.after",o),t.events.on("keydown",i,!0),t.events.on("html.processGet",a),e(t.$tb.find('[data-cmd="spellChecker"]'))}function c(){var e=t.opts.scaytOptions;e.customerId=t.opts.scaytCustomerId,e.container=(t.$iframe||t.$el).get(0),e.autoStartup=t.opts.scaytAutoload,e.onLoad=n,null!==t.opts.language&&(t.opts.spellCheckerLanguage=t.opts.language),!0===t.opts.scaytAutoload&&(t.opts.spellcheck=!1),l=new SCAYT.CUSTOMSCAYT(e)}return{_init:function(){if(!t.$wp)return!1;var e;t.opts.scaytOptions=Object.assign({},r.DEFAULT_SCAYT_OPTIONS,t.opts.scaytOptions),"undefined"!=typeof SCAYT?c():(t.shared.spellCheckerLoaded||(t.shared.spellCheckerCallbacks=[]),t.shared.spellCheckerCallbacks.push(c),t.shared.spellCheckerLoaded||(t.shared.spellCheckerLoaded=!0,(e=document.createElement("script")).type="text/javascript",e.src=t.opts.scaytOptions.scriptPath,e.innerText="",e.onload=function(){for(var e=0;e<t.shared.spellCheckerCallbacks.length;e++)t.shared.spellCheckerCallbacks[e]()},document.getElementsByTagName("head")[0].appendChild(e)))},refresh:e,toggle:function(){l&&l.isDisabled&&l.setDisabled(!l.isDisabled())}}},r.DefineIcon("spellChecker",{NAME:"keyboard-o",FA5NAME:"keyboard",SVG_KEY:"spellcheck"}),r.RegisterCommand("spellChecker",{title:"Spell Checker",undo:!1,focus:!1,accessibilityFocus:!0,forcedRefresh:!0,toggle:!0,callback:function(){this.spellChecker.toggle()},refresh:function(e){this.spellChecker.refresh(e)},plugin:"spellChecker"})});