Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@tiptap/suggestion
Advanced tools
@tiptap/suggestion is a plugin for the Tiptap editor that provides a way to add suggestions to your editor. This can be used for implementing features like mentions, hashtags, or any other type of inline suggestions.
Basic Suggestion Setup
This code sets up a basic suggestion plugin that triggers on the '@' character. When a suggestion is selected, it inserts a mention node at the current position.
import { Suggestion } from '@tiptap/suggestion';
const suggestion = Suggestion({
char: '@',
startOfLine: false,
command: ({ editor, range, props }) => {
editor.chain().focus().insertContentAt(range, [
{
type: 'mention',
attrs: props,
},
{
type: 'text',
text: ' ',
},
]).run();
},
});
Customizing Suggestion Menu
This code customizes the suggestion menu to trigger on the '#' character and filter items based on the query. It uses Vue and Tippy.js to render and manage the suggestion list.
import { Suggestion } from '@tiptap/suggestion';
const suggestion = Suggestion({
char: '#',
startOfLine: false,
items: ({ query }) => {
return [
{ title: 'JavaScript', id: 1 },
{ title: 'TypeScript', id: 2 },
{ title: 'React', id: 3 },
].filter(item => item.title.toLowerCase().includes(query.toLowerCase()));
},
render: () => {
let component;
let popup;
return {
onStart: props => {
component = new Vue({
render: h => h(SuggestionList, { props }),
}).$mount();
popup = tippy('body', {
getReferenceClientRect: props.clientRect,
appendTo: () => document.body,
content: component.$el,
showOnCreate: true,
});
},
onUpdate: props => {
component.$props = props;
popup[0].setProps({
getReferenceClientRect: props.clientRect,
});
},
onExit: () => {
popup[0].destroy();
component.$destroy();
},
};
},
});
prosemirror-suggest is a plugin for ProseMirror that provides similar functionality to @tiptap/suggestion. It allows you to create suggestions for mentions, hashtags, and other inline elements. Compared to @tiptap/suggestion, it is more tightly integrated with ProseMirror and may require more setup.
Tribute.js is a lightweight, vanilla JavaScript library for adding autocomplete/suggestions to input fields and textareas. It is not specifically designed for rich text editors like Tiptap but can be adapted for use with them. It offers a flexible API and is easy to integrate.
quill-mention is a module for the Quill rich text editor that provides mention suggestions. It is similar to @tiptap/suggestion but is designed specifically for Quill. It offers a straightforward way to add mention functionality to Quill editors.
Tiptap is a headless wrapper around ProseMirror – a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as New York Times, The Guardian or Atlassian.
Documentation can be found on the Tiptap website.
Tiptap is open sourced software licensed under the MIT license.
2.0.0 (2023-03-29)
i
in defaultBlockAt
by @andreavaccari in https://github.com/ueberdosis/tiptap/pull/1315Color
extension to set the text color by @hanspagel in https://github.com/ueberdosis/tiptap/pull/1744this.value
to value
in the vue examples with v-model by @MiloLug in https://github.com/ueberdosis/tiptap/pull/1813ReactRenderer
types by @rfgamaral in https://github.com/ueberdosis/tiptap/pull/2011editor
dependency when registering BubbleMenuPlugin
by @ValentaTomas in https://github.com/ueberdosis/tiptap/pull/2018defaultOptions
with addOptions
by @philippkuehn in https://github.com/ueberdosis/tiptap/pull/2088CollaborationCursor
extension by @hanspagel in https://github.com/ueberdosis/tiptap/pull/2096enableInputRules
and enablePasteRules
by @aguingand in https://github.com/ueberdosis/tiptap/pull/2119setEditable
to the Editor documentation by @floriankrueger in https://github.com/ueberdosis/tiptap/pull/2199as
option and pass through to ReactRenderer by @jessicalc in https://github.com/ueberdosis/tiptap/pull/2213createView
by @BrianHung in https://github.com/ueberdosis/tiptap/pull/2212type="context"
tag by @duruer in https://github.com/ueberdosis/tiptap/pull/2240CharacterCount
extension by @philippkuehn in https://github.com/ueberdosis/tiptap/pull/2256element.current
from useEffect
in BubbleMenu
and FloatingMenu
by @ValentaTomas in https://github.com/ueberdosis/tiptap/pull/2297Level
for external use by @webri in https://github.com/ueberdosis/tiptap/pull/2354@tiptap/react
and @tiptap/core
as side effect free by @dcastil in https://github.com/ueberdosis/tiptap/pull/2361javascript:
pseudo-protocol by @phenax in https://github.com/ueberdosis/tiptap/pull/2646onBeforeStart
and onBeforeUpdate
handlers to the render function by @rfgamaral in https://github.com/ueberdosis/tiptap/pull/2628getTextSerializersFromSchema
helper, and fix typo in its name by @sjdemartini in https://github.com/ueberdosis/tiptap/pull/2750className
option and pass through to ReactRenderer by @anton-liubushkin in https://github.com/ueberdosis/tiptap/pull/2794Avoid mutating a prop directly
error message to reproduce by @HondryTravis in https://github.com/ueberdosis/tiptap/pull/2834@tiptap/extension-code-block-lowlight
by @enriquecastl in https://github.com/ueberdosis/tiptap/pull/2625whiteSpace
style for NodeViewWrapper
& NodeViewContent
by @EvitanRelta in https://github.com/ueberdosis/tiptap/pull/2884nodeInputRule
by @ahhshm in https://github.com/ueberdosis/tiptap/pull/2954flushSync
to microtask by @sampi in https://github.com/ueberdosis/tiptap/pull/3188editor.setEditable
to omit updates by @ZaymonFC in https://github.com/ueberdosis/tiptap/pull/3301nodePasteRule
find
type to most generic PasteRuleFinder
by @jiegillet in https://github.com/ueberdosis/tiptap/pull/3759createNodeFromContent
and other missing helpers by @jacksleight in https://github.com/ueberdosis/tiptap/pull/3558documentClear
plugin by @thecodrr in https://github.com/ueberdosis/tiptap/pull/3778FAQs
suggestion plugin for tiptap
The npm package @tiptap/suggestion receives a total of 334,018 weekly downloads. As such, @tiptap/suggestion popularity was classified as popular.
We found that @tiptap/suggestion demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.