UNPKG

graphdb-workbench

Version:
2 lines 1.22 kB
export const __webpack_esm_id__=3909;export const __webpack_esm_ids__=[3909];export const __webpack_esm_modules__={3909(){function e(){return{restrict:"E",require:"ngModel",scope:{ngModel:"=",ngDisabled:"=",placeholder:"@"},templateUrl:"js/angular/core/templates/editable-content/editable-content.html",link:function(e,t,n,o){const a=t.find("div"),l=()=>{e.ngDisabled||e.$apply(()=>{a.html().length&&!a.text().trim().length&&a.empty(),o.$setViewValue(a[0].innerText)})};o.$render=()=>{a.html(o.$viewValue||"")};const r=e=>{e.preventDefault();const t=(e.originalEvent||e).clipboardData.getData("text/plain"),n=window.getSelection();if(!n.rangeCount)return;n.deleteFromDocument();const o=n.getRangeAt(0),a=document.createDocumentFragment(),l=t.split("\n");l.forEach((e,t)=>{a.appendChild(document.createTextNode(e)),t<l.length-1&&a.appendChild(document.createElement("br"))}),o.insertNode(a),n.collapseToEnd()};e.$on("$destroy",()=>{a.off("blur keyup change input",l),a.off("paste",r)}),a.on("blur keyup change input",l),a.on("paste",r)}}}angular.module("graphdb.framework.core.directives.editable-content",[]).directive("editableContent",e),e.$inject=[]}}; //# sourceMappingURL=3909.a852a12cc0e3ccbabf67.bundle.js.map