Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.