Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@tiptap/extension-hard-break
Advanced tools
@tiptap/extension-hard-break is an extension for the Tiptap editor that allows users to insert hard line breaks (similar to pressing Shift+Enter in a traditional text editor). This is useful for creating new lines within a paragraph without starting a new paragraph.
Insert Hard Break
This feature allows users to insert a hard break into the text. The code sample demonstrates how to import the HardBreak extension and use the setHardBreak command to insert a hard break at the current cursor position.
import { HardBreak } from '@tiptap/extension-hard-break';
const editor = new Editor({
extensions: [
HardBreak,
],
});
// Use the command to insert a hard break
editor.commands.setHardBreak();
Custom Key Bindings
This feature allows users to configure custom key bindings for inserting hard breaks. The code sample shows how to configure the HardBreak extension to insert a hard break when the user presses 'Mod-Enter' (Cmd-Enter on Mac or Ctrl-Enter on Windows).
import { HardBreak } from '@tiptap/extension-hard-break';
const editor = new Editor({
extensions: [
HardBreak.configure({
keymap: {
'Mod-Enter': () => editor.commands.setHardBreak(),
},
}),
],
});
The prosemirror-schema-basic package provides a basic schema for ProseMirror, including support for hard breaks. It is more general-purpose compared to @tiptap/extension-hard-break, which is specifically designed for Tiptap.
Draft.js is a rich text editor framework for React that includes support for hard breaks. While it offers similar functionality, it is a more comprehensive solution for building rich text editors and is not specifically tailored to Tiptap.
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
hard break extension for tiptap
The npm package @tiptap/extension-hard-break receives a total of 801,086 weekly downloads. As such, @tiptap/extension-hard-break popularity was classified as popular.
We found that @tiptap/extension-hard-break 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.