Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handleDragStart = (event: React.DragEvent) => {
const {node} = this.props
this.setState({isDragging: true})
this.addDragHandlers()
const element = ReactDOM.findDOMNode(this._previewContainer) // eslint-disable-line react/no-find-dom-node
if (element && element instanceof HTMLElement) {
const encoded = Base64.serializeNode(node, {preserveKeys: true})
setEventTransfer(event, 'node', encoded)
event.dataTransfer.effectAllowed = 'move'
event.dataTransfer.setDragImage(element, element.clientWidth / 2, -10)
}
this.props.editor.moveToEndOfNode(this.props.node).focus()
}
// Remove the drop target if we leave the editors nodes
handleDragStart = (event: React.DragEvent) => {
const {node, readOnly} = this.props
if (readOnly) {
event.preventDefault()
return
}
this.setState({isDragging: true})
this.addDragHandlers()
const encoded = Base64.serializeNode(node, {
preserveKeys: true,
preserveData: true
})
setEventTransfer(event, 'node', encoded)
event.dataTransfer.effectAllowed = 'move'
// Specify dragImage so that single elements in the preview will not be the drag image,
// but always the whole block thing itself.
// Also clone it so that it will not be visually clipped by scroll-containers etc.
const element: HTMLElement = event.currentTarget
if (element) {
this._dragGhost = element.cloneNode(true) as HTMLElement
this._dragGhost.style.width = `${element.clientWidth}px`
this._dragGhost.style.height = `${element.clientHeight}px`
this._dragGhost.style.position = 'absolute'
this._dragGhost.style.top = '-99999px'
this._dragGhost.style.left = '-99999px'
if (document.body) {
document.body.appendChild(this._dragGhost)
// eslint-disable-next-line max-depth
if (this._dragGhost) {
const handleCopy = async (event, editor) => {
event.persist();
const markdown = slateToMarkdown(editor.value.fragment.toJS());
const html = await markdownToHtml(markdown, { getAsset, resolveWidget });
setEventTransfer(event, 'text', markdown);
setEventTransfer(event, 'html', html);
setEventTransfer(event, 'fragment', base64.serializeNode(editor.value.fragment));
event.preventDefault();
};
const handleCopy = async (event, editor) => {
event.persist();
const markdown = slateToMarkdown(editor.value.fragment.toJS());
const html = await markdownToHtml(markdown, { getAsset, resolveWidget });
setEventTransfer(event, 'text', markdown);
setEventTransfer(event, 'html', html);
setEventTransfer(event, 'fragment', base64.serializeNode(editor.value.fragment));
event.preventDefault();
};
handleCopy = async (event, editor) => {
event.persist();
const { getAsset, resolveWidget } = this.props;
const markdown = Plain.serialize(editor.value);
const html = await markdownToHtml(markdown, { getAsset, resolveWidget });
setEventTransfer(event, 'text', markdown);
setEventTransfer(event, 'html', html);
event.preventDefault();
};
const handleCopy = async (event, editor) => {
event.persist();
const markdown = slateToMarkdown(editor.value.fragment.toJS());
const html = await markdownToHtml(markdown, { getAsset, resolveWidget });
setEventTransfer(event, 'text', markdown);
setEventTransfer(event, 'html', html);
setEventTransfer(event, 'fragment', base64.serializeNode(editor.value.fragment));
event.preventDefault();
};
handleCopy = async (event, editor) => {
event.persist();
const { getAsset, resolveWidget } = this.props;
const markdown = Plain.serialize(editor.value);
const html = await markdownToHtml(markdown, { getAsset, resolveWidget });
setEventTransfer(event, 'text', markdown);
setEventTransfer(event, 'html', html);
event.preventDefault();
};