Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@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.
FAQs
suggestion plugin for tiptap
The npm package @tiptap/suggestion receives a total of 182,982 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.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.