@tiptap/suggestion
Advanced tools
Comparing version 2.0.0-beta.84 to 2.0.0-beta.85
@@ -62,2 +62,3 @@ 'use strict'; | ||
function Suggestion({ pluginKey = SuggestionPluginKey, editor, char = '@', allowSpaces = false, prefixSpace = true, startOfLine = false, decorationTag = 'span', decorationClass = 'suggestion', command = () => null, items = () => [], render = () => ({}), allow = () => true, }) { | ||
let props; | ||
const renderer = render === null || render === void 0 ? void 0 : render(); | ||
@@ -88,3 +89,3 @@ return new prosemirrorState.Plugin({ | ||
const decorationNode = document.querySelector(`[data-decoration-id="${state.decorationId}"]`); | ||
const props = { | ||
props = { | ||
editor, | ||
@@ -131,2 +132,9 @@ range: state.range, | ||
}, | ||
destroy: () => { | ||
var _a; | ||
if (!props) { | ||
return; | ||
} | ||
(_a = renderer === null || renderer === void 0 ? void 0 : renderer.onExit) === null || _a === void 0 ? void 0 : _a.call(renderer, props); | ||
}, | ||
}; | ||
@@ -133,0 +141,0 @@ }, |
@@ -58,2 +58,3 @@ import { PluginKey, Plugin } from 'prosemirror-state'; | ||
function Suggestion({ pluginKey = SuggestionPluginKey, editor, char = '@', allowSpaces = false, prefixSpace = true, startOfLine = false, decorationTag = 'span', decorationClass = 'suggestion', command = () => null, items = () => [], render = () => ({}), allow = () => true, }) { | ||
let props; | ||
const renderer = render === null || render === void 0 ? void 0 : render(); | ||
@@ -84,3 +85,3 @@ return new Plugin({ | ||
const decorationNode = document.querySelector(`[data-decoration-id="${state.decorationId}"]`); | ||
const props = { | ||
props = { | ||
editor, | ||
@@ -127,2 +128,9 @@ range: state.range, | ||
}, | ||
destroy: () => { | ||
var _a; | ||
if (!props) { | ||
return; | ||
} | ||
(_a = renderer === null || renderer === void 0 ? void 0 : renderer.onExit) === null || _a === void 0 ? void 0 : _a.call(renderer, props); | ||
}, | ||
}; | ||
@@ -129,0 +137,0 @@ }, |
@@ -61,2 +61,3 @@ (function (global, factory) { | ||
function Suggestion({ pluginKey = SuggestionPluginKey, editor, char = '@', allowSpaces = false, prefixSpace = true, startOfLine = false, decorationTag = 'span', decorationClass = 'suggestion', command = () => null, items = () => [], render = () => ({}), allow = () => true, }) { | ||
let props; | ||
const renderer = render === null || render === void 0 ? void 0 : render(); | ||
@@ -87,3 +88,3 @@ return new prosemirrorState.Plugin({ | ||
const decorationNode = document.querySelector(`[data-decoration-id="${state.decorationId}"]`); | ||
const props = { | ||
props = { | ||
editor, | ||
@@ -130,2 +131,9 @@ range: state.range, | ||
}, | ||
destroy: () => { | ||
var _a; | ||
if (!props) { | ||
return; | ||
} | ||
(_a = renderer === null || renderer === void 0 ? void 0 : renderer.onExit) === null || _a === void 0 ? void 0 : _a.call(renderer, props); | ||
}, | ||
}; | ||
@@ -132,0 +140,0 @@ }, |
{ | ||
"name": "@tiptap/suggestion", | ||
"description": "suggestion plugin for tiptap", | ||
"version": "2.0.0-beta.84", | ||
"version": "2.0.0-beta.85", | ||
"homepage": "https://tiptap.dev", | ||
@@ -36,3 +36,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "6360278660d9c1e256975699d911a55dfa943d5d" | ||
"gitHead": "8347f58167e3dc9a78bf6b834af999f86d3bc5bd" | ||
} |
@@ -70,2 +70,3 @@ import { Editor, Range } from '@tiptap/core' | ||
let props: SuggestionProps | undefined | ||
const renderer = render?.() | ||
@@ -100,3 +101,4 @@ | ||
const decorationNode = document.querySelector(`[data-decoration-id="${state.decorationId}"]`) | ||
const props: SuggestionProps = { | ||
props = { | ||
editor, | ||
@@ -146,2 +148,10 @@ range: state.range, | ||
}, | ||
destroy: () => { | ||
if (!props) { | ||
return | ||
} | ||
renderer?.onExit?.(props) | ||
}, | ||
} | ||
@@ -148,0 +158,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
98055
1046