Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
prosemirror-dropcursor
Advanced tools
The prosemirror-dropcursor package is a plugin for ProseMirror, a toolkit for building rich-text editors. This plugin adds a drop cursor to the editor, which is a visual indicator that shows where content will be inserted when it is dragged and dropped.
Adding a Drop Cursor
This code sample demonstrates how to add a drop cursor to a ProseMirror editor. The DropCursor plugin is instantiated and added to the editor's state plugins. When content is dragged and dropped into the editor, the drop cursor will indicate the insertion point.
const { DropCursor } = require('prosemirror-dropcursor');
const { EditorState } = require('prosemirror-state');
const { EditorView } = require('prosemirror-view');
const { schema } = require('prosemirror-schema-basic');
const { DOMParser } = require('prosemirror-model');
const dropCursor = new DropCursor();
const state = EditorState.create({
doc: DOMParser.fromSchema(schema).parse(document.querySelector('#content')),
plugins: [dropCursor]
});
const view = new EditorView(document.querySelector('#editor'), {
state
});
The prosemirror-gapcursor package provides a similar visual indicator for gaps between blocks in a ProseMirror editor. Unlike prosemirror-dropcursor, which shows where content will be inserted during a drag-and-drop operation, prosemirror-gapcursor shows a cursor in places where the regular text cursor cannot go, such as between two block elements.
The prosemirror-menu package offers a set of UI components for building menus in a ProseMirror editor. While it does not provide a drop cursor, it enhances the editor's functionality by adding menu items for various editing actions. This package complements prosemirror-dropcursor by providing additional user interface elements.
[ WEBSITE | ISSUES | FORUM | CHANGELOG ]
This is a non-core example module for ProseMirror. ProseMirror is a well-behaved rich semantic content editor based on contentEditable, with support for collaborative editing and custom document schemas.
This module implements a plugin that shows a drop cursor for ProseMirror.
The project page has more information, a number of examples and the documentation.
This code is released under an MIT license. There's a forum for general discussion and support requests, and the Github bug tracker is the place to report issues.
We aim to be an inclusive, welcoming community. To make that explicit, we have a code of conduct that applies to communication around the project.
dropCursor
(options?: interface = {}) → Plugin
Create a plugin that, when added to a ProseMirror instance,
causes a decoration to show up at the drop position when something
is dragged over the editor.
Nodes may add a disableDropCursor
property to their spec to
control the showing of a drop cursor inside them. This may be a
boolean or a function, which will be called with a view, a
position, and the DragEvent, and should return a boolean.
options
color
?: string
The color of the cursor. Defaults to black
.
width
?: number
The precise width of the cursor in pixels. Defaults to 1.
class
?: string
A CSS class name to add to the cursor element.
1.8.1 (2023-05-17)
Include CommonJS type declarations in the package to please new TypeScript resolution settings.
FAQs
Drop cursor plugin for ProseMirror
The npm package prosemirror-dropcursor receives a total of 661,052 weekly downloads. As such, prosemirror-dropcursor popularity was classified as popular.
We found that prosemirror-dropcursor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.