/*! * froala_editor v4.2.0 (https://www.froala.com/wysiwyg-editor) * License https://froala.com/wysiwyg-editor/terms/ * Copyright 2014-2024 Froala Labs */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(s){"use strict";s=s&&s.hasOwnProperty("default")?s["default"]:s,Object.assign(s.DEFAULTS,{wordCounterMax:-1,wordCounterCount:!0}),s.PLUGINS.wordCounter=function(o){var r,t=o.$;function n(){var e=o.el.innerText.toString();e=(e=(e=(e=(e=(e=(e=(e=e.replace(/(^\s*)|(\s*$)/gi," ")).replace(/\u00a0/g," ")).replace(/[ ]{2,}/gi," ")).replace(/\n /,"\n")).replace(/[\u200A\u200C-\u200D\uFEFF\u202F\u2000-\u2009\u205F\u3000\u1680\u00A0\u0020]/g," ")).replace(/[\u200B]/g,"")).replace(/\t+/g," ")).split(" ").join("\n");var t=o.$el.find(".fr-pagebreak"),r=e.split(/\r?\n/),n=0;return r.forEach(function(e){0<(e=e.replace(/\s/g,"")).length&&n++}),n-2*t.length}function e(e){if(o.opts.wordCounterMax<0)return!0;if(n()").html(e).text().split(" ").length+n()<=o.opts.wordCounterMax?e:(o.events.trigger("wordCounter.exceeded"),"")}return{_init:function i(){return!!o.$wp&&!!o.opts.wordCounterCount&&((r=t(document.createElement("span")).attr("class","fr-counter fr-wCounter")).css("bottom",o.$wp.css("border-bottom-width")),o.$second_tb?o.$second_tb.append(r):o.$wp.append(r),o.events.on("keydown",e,!0),o.events.on("paste.afterCleanup",a),o.events.on("keyup contentChanged input",function(){o.events.trigger("wordCounter.update")}),o.events.on("wordCounter.update",u),o.events.trigger("wordCounter.update"),void o.events.on("destroy",function(){t(o.o_win).off("resize.char".concat(o.id)),r.removeData().remove(),r=null}))},wordCount:n}}});