Liferay.Loader.define("journal-web$codemirror@5.65.2/addon/display/placeholder",["module","exports","require","../../lib/codemirror"],(function(e,o,r){var t,l=void 0;window;t=function(e){function clearPlaceholder(e){e.state.placeholder&&(e.state.placeholder.parentNode.removeChild(e.state.placeholder),e.state.placeholder=null)}function setPlaceholder(e){clearPlaceholder(e);var o=e.state.placeholder=document.createElement("pre");o.style.cssText="height: 0; overflow: visible",o.style.direction=e.getOption("direction"),o.className="CodeMirror-placeholder CodeMirror-line-like";var r=e.getOption("placeholder");"string"==typeof r&&(r=document.createTextNode(r)),o.appendChild(r),e.display.lineSpace.insertBefore(o,e.display.lineSpace.firstChild)}function onBlur(e){isEmpty(e)&&setPlaceholder(e)}function onChange(e){var o=e.getWrapperElement(),r=isEmpty(e);o.className=o.className.replace(" CodeMirror-empty","")+(r?" CodeMirror-empty":""),r?setPlaceholder(e):clearPlaceholder(e)}function isEmpty(e){return 1===e.lineCount()&&""===e.getLine(0)}e.defineOption("placeholder","",(function(o,r,t){var l=t&&t!=e.Init;if(r&&!l)o.on("blur",onBlur),o.on("change",onChange),o.on("swapDoc",onChange),e.on(o.getInputField(),"compositionupdate",o.state.placeholderCompose=function(){!function onComposition(e){setTimeout((function(){var o=!1;if(1==e.lineCount()){var r=e.getInputField();o="TEXTAREA"==r.nodeName?!e.getLine(0).length:!/[^\u200b]/.test(r.querySelector(".CodeMirror-line").textContent)}o?setPlaceholder(e):clearPlaceholder(e)}),20)}(o)}),onChange(o);else if(!r&&l){o.off("blur",onBlur),o.off("change",onChange),o.off("swapDoc",onChange),e.off(o.getInputField(),"compositionupdate",o.state.placeholderCompose),clearPlaceholder(o);var n=o.getWrapperElement();n.className=n.className.replace(" CodeMirror-empty","")}r&&!o.hasFocus()&&onBlur(o)}))},"object"==typeof o&&"object"==typeof e?t(r("../../lib/codemirror")):"function"==typeof l&&l.amd?l(["../../lib/codemirror"],t):t(CodeMirror)}));
//# sourceMappingURL=placeholder.js.map