Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@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
The npm package @tiptap/extension-bubble-menu receives a total of 666,290 weekly downloads. As such, @tiptap/extension-bubble-menu popularity was classified as popular.
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
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.