prosemirror-dropcursor
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -0,1 +1,7 @@ | ||
## 1.2.0 (2019-10-08) | ||
### New features | ||
`dropCursor` now takes a new option, `class`, to set the CSS class name of the cursor element. Add class option to in-code docs | ||
## 1.1.2 (2019-09-05) | ||
@@ -2,0 +8,0 @@ |
@@ -15,7 +15,10 @@ 'use strict'; | ||
// | ||
// color::? string | ||
// color:: ?string | ||
// The color of the cursor. Defaults to `black`. | ||
// | ||
// width::? number | ||
// 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. | ||
function dropCursor(options) { | ||
@@ -35,2 +38,3 @@ if ( options === void 0 ) options = {}; | ||
this.color = options.color || "black"; | ||
this.class = options.class; | ||
this.cursorPos = null; | ||
@@ -93,2 +97,3 @@ this.element = null; | ||
this.element = parent.appendChild(document.createElement("div")); | ||
if (this.class) { this.element.className = this.class; } | ||
this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none; background-color: " + this.color; | ||
@@ -95,0 +100,0 @@ } |
{ | ||
"name": "prosemirror-dropcursor", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Drop cursor plugin for ProseMirror", | ||
@@ -5,0 +5,0 @@ "main": "dist/dropcursor.js", |
@@ -37,3 +37,7 @@ # prosemirror-dropcursor | ||
Supports two options: `color` to set the color of the cursor (defaults | ||
to black) and `width` to set its with in pixels (defaults to 1). | ||
- **`options`**`: ?Object` | ||
- **`color`**`: ?string (default: black)` | ||
- **`width`**`: ?number (default: 1)` | ||
- **`class`**`: ?string`\ | ||
Adds a class to the cursor.\ | ||
*Layout overrides such as `width` are not recommended* |
@@ -11,7 +11,10 @@ import {Plugin} from "prosemirror-state" | ||
// | ||
// color::? string | ||
// color:: ?string | ||
// The color of the cursor. Defaults to `black`. | ||
// | ||
// width::? number | ||
// 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. | ||
export function dropCursor(options = {}) { | ||
@@ -28,2 +31,3 @@ return new Plugin({ | ||
this.color = options.color || "black" | ||
this.class = options.class | ||
this.cursorPos = null | ||
@@ -79,2 +83,3 @@ this.element = null | ||
this.element = parent.appendChild(document.createElement("div")) | ||
if (this.class) this.element.className = this.class | ||
this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none; background-color: " + this.color | ||
@@ -81,0 +86,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27080
237
43