PageSourceSearch

https://agrihub-app.herokuapp.com/assets/prosemirror-dropcursor-fe…45010cd3f2123460eefc40ad475aae075ded5601.js

js agrihub-app.herokuapp.com collected 2026-10-03 14:46:35 UTC 3,346 bytes, 4 lines download raw bytes

1// [email protected] downloaded from https://ga.jspm.io/npm:[email protected]/dist/index.js
2
3import{Plugin as e}from"prosemirror-state";import{dropPoint as t}from"prosemirror-transform";function i(t={}){return new e({view(e){return new DropCursorView(e,t)}})}class DropCursorView{constructor(e,t){var i;this.editorView=e;this.cursorPos=null;this.element=null;this.timeout=-1;this.width=(i=t.width)!==null&&i!==void 0?i:1;this.color=t.color===false?void 0:t.color||"black";this.class=t.class;this.handlers=["dragover","dragend","drop","dragleave"].map((t=>{let i=e=>{this[t](e)};e.dom.addEventListener(t,i);return{name:t,handler:i}}))}destroy(){this.handlers.forEach((({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t)))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){if(e!=this.cursorPos){this.cursorPos=e;if(e==null){this.element.parentNode.removeChild(this.element);this.element=null}else this.updateOverlay()}}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos);let t,i=!e.parent.inlineContent;let o=this.editorView.dom,s=o.getBoundingClientRect();let r=s.width/o.offsetWidth,l=s.height/o.offsetHeight;if(i){let i=e.nodeBefore,o=e.nodeAfter;if(i||o){let e=this.editorView.nodeDOM(this.cursorPos-(i?i.nodeSize:0));if(e){let s=e.getBoundingClientRect();let r=i?s.bottom:s.top;i&&o&&(r=(r+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let n=this.width/2*l;t={left:s.left,right:s.right,top:r-n,bottom:r+n}}}}if(!t){let e=this.editorView.coordsAtPos(this.cursorPos);let i=this.width/2*r;t={left:e.left-i,right:e.left+i,top:e.top,bottom:e.bottom}}let n=this.editorView.dom.offsetParent;if(!this.element){this.element=n.appendChild(document.createElement("div"));this.class&&(this.element.className=this.class);this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;";this.color&&(this.element.style.backgroundColor=this.color)}this.element.classList.toggle("prosemirror-dropcursor-block",i);this.element.classList.toggle("prosemirror-dropcursor-inline",!i);let d,h;if(!n||n==document.body&&getComputedStyle(n).position=="static"){d=-pageXOffset;h=-pageYOffset}else{let e=n.getBoundingClientRect();let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;d=e.left-n.scrollLeft*t;h=e.top-n.scrollTop*i}this.element.style.left=(t.left-d)/r+"px";this.element.style.top=(t.top-h)/l+"px";this.element.style.width=(t.right-t.left)/r+"px";this.element.style.height=(t.bottom-t.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout);this.timeout=setTimeout((()=>this.setCursor(null)),e)}dragover(e){if(!this.editorView.editable)return;let i=this.editorView.posAtCoords({left:e.clientX,top:e.clientY});let o=i&&i.inside>=0&&this.editorView.state.doc.nodeAt(i.inside);let s=o&&o.type.spec.disableDropCursor;let r=typeof s=="function"?s(this.editorView,i,e):s;if(i&&!r){let e=i.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let i=t(this.editorView.state.doc,e,this.editorView.dragging.slice);i!=null&&(e=i)}this.setCursor(e);this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}export{i as dropCursor};
4

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.