Sha256: d59dded8f2fe492a6cb5716169637fbd46898a855b6e84c1d1953e0557d28bf8
Contents?: true
Size: 1.92 KB
Versions: 1
Compression:
Stored size: 1.92 KB
Contents
/*! * froala_editor v3.0.0-rc.2 (https://www.froala.com/wysiwyg-editor) * License https://froala.com/wysiwyg-editor/terms/ * Copyright 2014-2019 Froala Labs */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],e):e(t.FroalaEditor)}(this,function(u){"use strict";u=u&&u.hasOwnProperty("default")?u["default"]:u,Object.assign(u.DEFAULTS,{charCounterMax:-1,charCounterCount:!0}),u.PLUGINS.charCounter=function(n){var r,e=n.$;function o(){return(n.el.textContent||"").replace(/\u200B/g,"").length}function t(t){if(n.opts.charCounterMax<0)return!0;if(o()<n.opts.charCounterMax)return!0;var e=t.which;return!(!n.keys.ctrlKey(t)&&n.keys.isCharacter(e)||e===u.KEYCODE.IME)||(t.preventDefault(),t.stopPropagation(),n.events.trigger("charCounter.exceeded"),!1)}function a(t){return n.opts.charCounterMax<0?t:e("<div>").html(t).text().length+o()<=n.opts.charCounterMax?t:(n.events.trigger("charCounter.exceeded"),"")}function c(){if(n.opts.charCounterCount){var t=o()+(0<n.opts.charCounterMax?"/"+n.opts.charCounterMax:"");r.text("".concat(n.language.translate("Characters")," : ").concat(t)),n.opts.toolbarBottom&&r.css("margin-bottom",n.$tb.outerHeight(!0));var e=n.$wp.get(0).offsetWidth-n.$wp.get(0).clientWidth;0<=e&&("rtl"==n.opts.direction?r.css("margin-left",e):r.css("margin-right",e))}}return{_init:function(){return!!n.$wp&&!!n.opts.charCounterCount&&((r=e(document.createElement("span")).attr("class","fr-counter")).css("bottom",n.$wp.css("border-bottom-width")),n.$second_tb&&n.$second_tb.append(r),n.events.on("keydown",t,!0),n.events.on("paste.afterCleanup",a),n.events.on("keyup contentChanged input",function(){n.events.trigger("charCounter.update")}),n.events.on("charCounter.update",c),n.events.trigger("charCounter.update"),void n.events.on("destroy",function(){e(n.o_win).off("resize.char"+n.id),r.removeData().remove(),r=null}))},count:o}}});
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wysiwyg-rails-3.0.0.pre.rc.2 | app/assets/javascripts/plugins/char_counter.min.js |