@tiptap/suggestion
Advanced tools
Comparing version 2.5.0-beta.2 to 2.5.0-beta.3
@@ -74,5 +74,5 @@ import { PluginKey, Plugin } from '@tiptap/pm/state'; | ||
const changed = !started && !stopped && prev.query !== next.query; | ||
const handleStart = started || moved; | ||
const handleChange = changed && !moved; | ||
const handleExit = stopped || moved; | ||
const handleStart = started; | ||
const handleChange = changed || moved; | ||
const handleExit = stopped; | ||
// Cancel when suggestion isn't active | ||
@@ -182,3 +182,5 @@ if (!handleStart && !handleChange && !handleExit) { | ||
// If we found a match, update the current state to show it | ||
if (match && allow({ editor, state, range: match.range })) { | ||
if (match && allow({ | ||
editor, state, range: match.range, isActive: prev.active, | ||
})) { | ||
next.active = true; | ||
@@ -185,0 +187,0 @@ next.decorationId = prev.decorationId ? prev.decorationId : decorationId; |
@@ -76,5 +76,5 @@ (function (global, factory) { | ||
const changed = !started && !stopped && prev.query !== next.query; | ||
const handleStart = started || moved; | ||
const handleChange = changed && !moved; | ||
const handleExit = stopped || moved; | ||
const handleStart = started; | ||
const handleChange = changed || moved; | ||
const handleExit = stopped; | ||
// Cancel when suggestion isn't active | ||
@@ -184,3 +184,5 @@ if (!handleStart && !handleChange && !handleExit) { | ||
// If we found a match, update the current state to show it | ||
if (match && allow({ editor, state, range: match.range })) { | ||
if (match && allow({ | ||
editor, state, range: match.range, isActive: prev.active, | ||
})) { | ||
next.active = true; | ||
@@ -240,3 +242,3 @@ next.decorationId = prev.decorationId ? prev.decorationId : decorationId; | ||
exports.SuggestionPluginKey = SuggestionPluginKey; | ||
exports["default"] = Suggestion; | ||
exports.default = Suggestion; | ||
exports.findSuggestionMatch = findSuggestionMatch; | ||
@@ -243,0 +245,0 @@ |
@@ -10,3 +10,3 @@ import { Range } from '@tiptap/core'; | ||
} | ||
export declare type SuggestionMatch = { | ||
export type SuggestionMatch = { | ||
range: Range; | ||
@@ -13,0 +13,0 @@ query: string; |
@@ -0,0 +0,0 @@ import { Suggestion } from './suggestion.js'; |
@@ -100,2 +100,3 @@ import { Editor, Range } from '@tiptap/core'; | ||
range: Range; | ||
isActive?: boolean; | ||
}) => boolean; | ||
@@ -102,0 +103,0 @@ findSuggestionMatch?: typeof defaultFindSuggestionMatch; |
{ | ||
"name": "@tiptap/suggestion", | ||
"description": "suggestion plugin for tiptap", | ||
"version": "2.5.0-beta.2", | ||
"version": "2.5.0-beta.3", | ||
"homepage": "https://tiptap.dev", | ||
@@ -32,4 +32,4 @@ "keywords": [ | ||
"devDependencies": { | ||
"@tiptap/core": "^2.5.0-beta.2", | ||
"@tiptap/pm": "^2.5.0-beta.2" | ||
"@tiptap/core": "^2.5.0-beta.3", | ||
"@tiptap/pm": "^2.5.0-beta.3" | ||
}, | ||
@@ -36,0 +36,0 @@ "peerDependencies": { |
@@ -102,3 +102,3 @@ import { Editor, Range } from '@tiptap/core' | ||
*/ | ||
allow?: (props: { editor: Editor; state: EditorState; range: Range }) => boolean | ||
allow?: (props: { editor: Editor; state: EditorState; range: Range, isActive?: boolean }) => boolean | ||
findSuggestionMatch?: typeof defaultFindSuggestionMatch | ||
@@ -198,6 +198,7 @@ } | ||
const changed = !started && !stopped && prev.query !== next.query | ||
const handleStart = started || moved | ||
const handleChange = changed && !moved | ||
const handleExit = stopped || moved | ||
const handleStart = started | ||
const handleChange = changed || moved | ||
const handleExit = stopped | ||
// Cancel when suggestion isn't active | ||
@@ -334,3 +335,5 @@ if (!handleStart && !handleChange && !handleExit) { | ||
// If we found a match, update the current state to show it | ||
if (match && allow({ editor, state, range: match.range })) { | ||
if (match && allow({ | ||
editor, state, range: match.range, isActive: prev.active, | ||
})) { | ||
next.active = true | ||
@@ -337,0 +340,0 @@ next.decorationId = prev.decorationId ? prev.decorationId : decorationId |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
262393
175
5022
1