Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@tiptap/extension-bubble-menu
Advanced tools
@tiptap/extension-bubble-menu is an extension for the Tiptap editor that provides a contextual menu (bubble menu) that appears when you select text. This menu can be customized to include various formatting options and actions, making it a powerful tool for enhancing the user experience in rich text editing.
Basic Bubble Menu
This code sets up a basic bubble menu that appears when text is selected. The menu is linked to a DOM element with the class 'bubble-menu'.
import { BubbleMenu } from '@tiptap/extension-bubble-menu';
import { Editor } from '@tiptap/core';
import StarterKit from '@tiptap/starter-kit';
const editor = new Editor({
extensions: [
StarterKit,
BubbleMenu.configure({
element: document.querySelector('.bubble-menu'),
}),
],
});
Custom Bubble Menu
This code configures a custom bubble menu with additional Tippy.js options, such as setting the duration of the menu's appearance animation.
import { BubbleMenu } from '@tiptap/extension-bubble-menu';
import { Editor } from '@tiptap/core';
import StarterKit from '@tiptap/starter-kit';
const editor = new Editor({
extensions: [
StarterKit,
BubbleMenu.configure({
element: document.querySelector('.custom-bubble-menu'),
tippyOptions: {
duration: 100,
},
}),
],
});
Conditional Bubble Menu
This code sets up a bubble menu that only appears when there is a text selection (i.e., the selection is not empty).
import { BubbleMenu } from '@tiptap/extension-bubble-menu';
import { Editor } from '@tiptap/core';
import StarterKit from '@tiptap/starter-kit';
const editor = new Editor({
extensions: [
StarterKit,
BubbleMenu.configure({
element: document.querySelector('.conditional-bubble-menu'),
shouldShow: ({ state }) => {
return state.selection.empty === false;
},
}),
],
});
ProseMirror-menu is a menu system for the ProseMirror editor. It provides a way to create and manage menus that can be attached to the editor. Compared to @tiptap/extension-bubble-menu, ProseMirror-menu is more generic and requires more manual setup for contextual menus.
Slate-react is a set of React components for the Slate editor. It allows for the creation of custom toolbars and menus, including bubble menus. While it offers similar functionality, it is designed specifically for use with the Slate editor and requires React.
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
bubble-menu extension for tiptap
We found that @tiptap/extension-bubble-menu 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.