%PDF- %PDF-
Direktori : /home/riacommer/public_html/admin/vendor/wysihtml5/src/dom/ |
Current File : /home/riacommer/public_html/admin/vendor/wysihtml5/src/dom/simulate_placeholder.js |
/** * Simulate HTML5 placeholder attribute * * Needed since * - div[contentEditable] elements don't support it * - older browsers (such as IE8 and Firefox 3.6) don't support it at all * * @param {Object} parent Instance of main wysihtml5.Editor class * @param {Element} view Instance of wysihtml5.views.* class * @param {String} placeholderText * * @example * wysihtml.dom.simulatePlaceholder(this, composer, "Foobar"); */ (function(dom) { dom.simulatePlaceholder = function(editor, view, placeholderText) { var CLASS_NAME = "placeholder", unset = function() { if (view.hasPlaceholderSet()) { view.clear(); } dom.removeClass(view.element, CLASS_NAME); }, set = function() { if (view.isEmpty()) { view.setValue(placeholderText); dom.addClass(view.element, CLASS_NAME); } }; editor .observe("set_placeholder", set) .observe("unset_placeholder", unset) .observe("focus:composer", unset) .observe("paste:composer", unset) .observe("blur:composer", set); set(); }; })(wysihtml5.dom);