@tiptap/suggestion
Advanced tools
Comparing version 2.0.0-alpha.6 to 2.0.0-alpha.7
@@ -6,2 +6,10 @@ # Change Log | ||
# [2.0.0-alpha.7](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-alpha.6...@tiptap/suggestion@2.0.0-alpha.7) (2021-02-16) | ||
**Note:** Version bump only for package @tiptap/suggestion | ||
# [2.0.0-alpha.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/suggestion@2.0.0-alpha.5...@tiptap/suggestion@2.0.0-alpha.6) (2021-02-07) | ||
@@ -8,0 +16,0 @@ |
@@ -23,2 +23,6 @@ import { Editor, Range } from '@tiptap/core'; | ||
}; | ||
allow?: (props: { | ||
editor: Editor; | ||
range: Range; | ||
}) => boolean; | ||
} | ||
@@ -40,2 +44,2 @@ export interface SuggestionProps { | ||
} | ||
export declare function Suggestion({ editor, char, allowSpaces, startOfLine, decorationTag, decorationClass, command, items, render, }: SuggestionOptions): Plugin<any, any>; | ||
export declare function Suggestion({ editor, char, allowSpaces, startOfLine, decorationTag, decorationClass, command, items, render, allow, }: SuggestionOptions): Plugin<any, any>; |
@@ -57,3 +57,3 @@ 'use strict'; | ||
function Suggestion({ editor, char = '@', allowSpaces = false, startOfLine = false, decorationTag = 'span', decorationClass = 'suggestion', command = () => null, items = () => [], render = () => ({}), }) { | ||
function Suggestion({ editor, char = '@', allowSpaces = false, startOfLine = false, decorationTag = 'span', decorationClass = 'suggestion', command = () => null, items = () => [], render = () => ({}), allow = () => true, }) { | ||
const renderer = render === null || render === void 0 ? void 0 : render(); | ||
@@ -143,3 +143,3 @@ return new prosemirrorState.Plugin({ | ||
// If we found a match, update the current state to show it | ||
if (match) { | ||
if (match && allow({ editor, range: match.range })) { | ||
next.active = true; | ||
@@ -146,0 +146,0 @@ next.decorationId = prev.decorationId ? prev.decorationId : decorationId; |
@@ -53,3 +53,3 @@ import { Plugin, PluginKey } from 'prosemirror-state'; | ||
function Suggestion({ editor, char = '@', allowSpaces = false, startOfLine = false, decorationTag = 'span', decorationClass = 'suggestion', command = () => null, items = () => [], render = () => ({}), }) { | ||
function Suggestion({ editor, char = '@', allowSpaces = false, startOfLine = false, decorationTag = 'span', decorationClass = 'suggestion', command = () => null, items = () => [], render = () => ({}), allow = () => true, }) { | ||
const renderer = render === null || render === void 0 ? void 0 : render(); | ||
@@ -139,3 +139,3 @@ return new Plugin({ | ||
// If we found a match, update the current state to show it | ||
if (match) { | ||
if (match && allow({ editor, range: match.range })) { | ||
next.active = true; | ||
@@ -142,0 +142,0 @@ next.decorationId = prev.decorationId ? prev.decorationId : decorationId; |
@@ -56,3 +56,3 @@ (function (global, factory) { | ||
function Suggestion({ editor, char = '@', allowSpaces = false, startOfLine = false, decorationTag = 'span', decorationClass = 'suggestion', command = () => null, items = () => [], render = () => ({}), }) { | ||
function Suggestion({ editor, char = '@', allowSpaces = false, startOfLine = false, decorationTag = 'span', decorationClass = 'suggestion', command = () => null, items = () => [], render = () => ({}), allow = () => true, }) { | ||
const renderer = render === null || render === void 0 ? void 0 : render(); | ||
@@ -142,3 +142,3 @@ return new prosemirrorState.Plugin({ | ||
// If we found a match, update the current state to show it | ||
if (match) { | ||
if (match && allow({ editor, range: match.range })) { | ||
next.active = true; | ||
@@ -145,0 +145,0 @@ next.decorationId = prev.decorationId ? prev.decorationId : decorationId; |
{ | ||
"name": "@tiptap/suggestion", | ||
"description": "suggestion plugin for tiptap", | ||
"version": "2.0.0-alpha.6", | ||
"version": "2.0.0-alpha.7", | ||
"homepage": "https://tiptap.dev", | ||
@@ -25,8 +25,8 @@ "keywords": [ | ||
"dependencies": { | ||
"@tiptap/core": "^2.0.0-alpha.16", | ||
"@tiptap/core": "^2.0.0-alpha.17", | ||
"prosemirror-model": "^1.13.3", | ||
"prosemirror-state": "^1.3.4", | ||
"prosemirror-view": "^1.17.5" | ||
"prosemirror-view": "^1.17.6" | ||
}, | ||
"gitHead": "6bdeb4615c7b6afba4a2fcac4e3c35d7a7c0030a" | ||
"gitHead": "71d8fbbcb1eacd664bb6992e0086a589e4684e69" | ||
} |
@@ -25,2 +25,6 @@ import { Editor, Range } from '@tiptap/core' | ||
}, | ||
allow?: (props: { | ||
editor: Editor, | ||
range: Range, | ||
}) => boolean, | ||
} | ||
@@ -55,2 +59,3 @@ | ||
render = () => ({}), | ||
allow = () => true, | ||
}: SuggestionOptions) { | ||
@@ -154,3 +159,3 @@ | ||
// If we found a match, update the current state to show it | ||
if (match) { | ||
if (match && allow({ editor, range: match.range })) { | ||
next.active = true | ||
@@ -157,0 +162,0 @@ next.decorationId = prev.decorationId ? prev.decorationId : decorationId |
Sorry, the diff of this file is too big to display
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
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
944059
1551
Updated@tiptap/core@^2.0.0-alpha.17
Updatedprosemirror-view@^1.17.6