Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
prosemirror-splittable
Advanced tools
Extends ProseMirror's AttributeSpec to allow for splittable
property. splittable
is a boolean that, when true
, enables the inheritance of the attribute when splitting a node using the splitSplittableBlock
command.
In the schema defined below, the textAlign
attribute is defined as splittable
for both paragraph
and heading
nodes.
import { Schema } from 'prosemirror-model'
const schema = new Schema({
nodes: {
text: {},
paragraph: {
content: 'text*',
group: 'block',
attrs: {
textAlign: { default: 'left', splittable: true },
},
toDOM(node) {
return ['p', { style: `text-align: ${node.attrs.textAlign};` }, 0]
},
},
heading: {
content: 'text*',
group: 'block',
attrs: {
textAlign: { default: 'left', splittable: true },
},
toDOM(node) {
return ['h1', { style: `text-align: ${node.attrs.textAlign};` }, 0]
},
},
doc: { content: 'block*' },
},
})
Later, we can use the keymap
plugin to bind the Enter
key to the splitSplittableBlock
command.
import { splitSplittableBlock } from 'prosemirror-splittable'
import { keymap } from 'prosemirror-keymap'
import {
baseKeymap,
chainCommands,
createParagraphNear,
liftEmptyBlock,
newlineInCode,
} from 'prosemirror-commands'
const customBaseKeymap = {
...baseKeymap,
Enter: chainCommands(
newlineInCode,
createParagraphNear,
liftEmptyBlock,
splitSplittableBlock,
),
}
const plugin = keymap(customBaseKeymap)
MIT
FAQs
Inherit ProseMirror node attributes when splitting nodes.
The npm package prosemirror-splittable receives a total of 2,904 weekly downloads. As such, prosemirror-splittable popularity was classified as popular.
We found that prosemirror-splittable demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.