prosemirror-dropcursor
Advanced tools
Comparing version 1.7.1 to 1.8.0
@@ -0,1 +1,7 @@ | ||
## 1.8.0 (2023-03-27) | ||
### New features | ||
If the `color` option is set to `false`, the library will not assign an explicit color to the cursor. | ||
## 1.7.1 (2023-03-02) | ||
@@ -2,0 +8,0 @@ |
@@ -5,5 +5,5 @@ import { Plugin } from 'prosemirror-state'; | ||
/** | ||
The color of the cursor. Defaults to `black`. | ||
The color of the cursor. Defaults to `black`. Use `false` to apply no color and rely only on class. | ||
*/ | ||
color?: string; | ||
color?: string | false; | ||
/** | ||
@@ -10,0 +10,0 @@ The precise width of the cursor in pixels. Defaults to 1. |
@@ -21,2 +21,3 @@ import { Plugin } from 'prosemirror-state'; | ||
constructor(editorView, options) { | ||
var _a; | ||
this.editorView = editorView; | ||
@@ -26,4 +27,4 @@ this.cursorPos = null; | ||
this.timeout = -1; | ||
this.width = options.width || 1; | ||
this.color = options.color || "black"; | ||
this.width = (_a = options.width) !== null && _a !== void 0 ? _a : 1; | ||
this.color = options.color === false ? undefined : (options.color || "black"); | ||
this.class = options.class; | ||
@@ -84,3 +85,6 @@ this.handlers = ["dragover", "dragend", "drop", "dragleave"].map(name => { | ||
this.element.className = this.class; | ||
this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none; background-color: " + this.color; | ||
this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none;"; | ||
if (this.color) { | ||
this.element.style.backgroundColor = this.color; | ||
} | ||
} | ||
@@ -87,0 +91,0 @@ this.element.classList.toggle("prosemirror-dropcursor-block", isBlock); |
{ | ||
"name": "prosemirror-dropcursor", | ||
"version": "1.7.1", | ||
"version": "1.8.0", | ||
"description": "Drop cursor plugin for ProseMirror", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -6,4 +6,4 @@ import {Plugin, EditorState} from "prosemirror-state" | ||
interface DropCursorOptions { | ||
/// The color of the cursor. Defaults to `black`. | ||
color?: string | ||
/// The color of the cursor. Defaults to `black`. Use `false` to apply no color and rely only on class. | ||
color?: string | false | ||
@@ -33,3 +33,3 @@ /// The precise width of the cursor in pixels. Defaults to 1. | ||
width: number | ||
color: string | ||
color: string | undefined | ||
class: string | undefined | ||
@@ -42,4 +42,4 @@ cursorPos: number | null = null | ||
constructor(readonly editorView: EditorView, options: DropCursorOptions) { | ||
this.width = options.width || 1 | ||
this.color = options.color || "black" | ||
this.width = options.width ?? 1 | ||
this.color = options.color === false ? undefined : (options.color || "black") | ||
this.class = options.class | ||
@@ -101,3 +101,6 @@ | ||
if (this.class) this.element.className = this.class | ||
this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none; background-color: " + this.color | ||
this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none;" | ||
if (this.color) { | ||
this.element.style.backgroundColor = this.color | ||
} | ||
} | ||
@@ -104,0 +107,0 @@ this.element.classList.toggle("prosemirror-dropcursor-block", isBlock) |
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
29826
477