🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@tiptap/extension-heading

Package Overview
Dependencies
Maintainers
6
Versions
225
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tiptap/extension-heading - npm Package Compare versions

Comparing version

to
3.0.0-next.4

LICENSE.md

19

dist/index.js

@@ -50,8 +50,11 @@ // src/heading.ts

addKeyboardShortcuts() {
return this.options.levels.reduce((items, level) => ({
...items,
...{
[`Mod-Alt-${level}`]: () => this.editor.commands.toggleHeading({ level })
}
}), {});
return this.options.levels.reduce(
(items, level) => ({
...items,
...{
[`Mod-Alt-${level}`]: () => this.editor.commands.toggleHeading({ level })
}
}),
{}
);
},

@@ -72,7 +75,7 @@ addInputRules() {

// src/index.ts
var src_default = Heading;
var index_default = Heading;
export {
Heading,
src_default as default
index_default as default
};
//# sourceMappingURL=index.js.map
{
"name": "@tiptap/extension-heading",
"description": "heading extension for tiptap",
"version": "3.0.0-next.3",
"version": "3.0.0-next.4",
"homepage": "https://tiptap.dev",

@@ -18,3 +18,6 @@ "keywords": [

".": {
"types": "./dist/index.d.ts",
"types": {
"import": "./dist/index.d.ts",
"require": "./dist/index.d.cts"
},
"import": "./dist/index.js",

@@ -32,3 +35,3 @@ "require": "./dist/index.cjs"

"devDependencies": {
"@tiptap/core": "^3.0.0-next.3"
"@tiptap/core": "^3.0.0-next.4"
},

@@ -44,4 +47,5 @@ "peerDependencies": {

"scripts": {
"build": "tsup"
"build": "tsup",
"lint": "prettier ./src/ --check && eslint --cache --quiet --no-error-on-unmatched-pattern ./src/"
}
}
}
# @tiptap/extension-heading
[![Version](https://img.shields.io/npm/v/@tiptap/extension-heading.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-heading)

@@ -8,8 +9,11 @@ [![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-heading.svg)](https://npmcharts.com/compare/tiptap?minimal=true)

## Introduction
Tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – 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*.
Tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – 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_.
## Official Documentation
Documentation can be found on the [Tiptap website](https://tiptap.dev).
## License
Tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).

@@ -14,3 +14,3 @@ import { mergeAttributes, Node, textblockTypeInputRule } from '@tiptap/core'

*/
levels: Level[],
levels: Level[]

@@ -22,3 +22,3 @@ /**

*/
HTMLAttributes: Record<string, any>,
HTMLAttributes: Record<string, any>
}

@@ -34,3 +34,3 @@

*/
setHeading: (attributes: { level: Level }) => ReturnType,
setHeading: (attributes: { level: Level }) => ReturnType
/**

@@ -41,3 +41,3 @@ * Toggle a heading node

*/
toggleHeading: (attributes: { level: Level }) => ReturnType,
toggleHeading: (attributes: { level: Level }) => ReturnType
}

@@ -77,7 +77,6 @@ }

parseHTML() {
return this.options.levels
.map((level: Level) => ({
tag: `h${level}`,
attrs: { level },
}))
return this.options.levels.map((level: Level) => ({
tag: `h${level}`,
attrs: { level },
}))
},

@@ -87,5 +86,3 @@

const hasLevel = this.options.levels.includes(node.attrs.level)
const level = hasLevel
? node.attrs.level
: this.options.levels[0]
const level = hasLevel ? node.attrs.level : this.options.levels[0]

@@ -97,16 +94,20 @@ return [`h${level}`, mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]

return {
setHeading: attributes => ({ commands }) => {
if (!this.options.levels.includes(attributes.level)) {
return false
}
setHeading:
attributes =>
({ commands }) => {
if (!this.options.levels.includes(attributes.level)) {
return false
}
return commands.setNode(this.name, attributes)
},
toggleHeading: attributes => ({ commands }) => {
if (!this.options.levels.includes(attributes.level)) {
return false
}
return commands.setNode(this.name, attributes)
},
toggleHeading:
attributes =>
({ commands }) => {
if (!this.options.levels.includes(attributes.level)) {
return false
}
return commands.toggleNode(this.name, 'paragraph', attributes)
},
return commands.toggleNode(this.name, 'paragraph', attributes)
},
}

@@ -116,8 +117,11 @@ },

addKeyboardShortcuts() {
return this.options.levels.reduce((items, level) => ({
...items,
...{
[`Mod-Alt-${level}`]: () => this.editor.commands.toggleHeading({ level }),
},
}), {})
return this.options.levels.reduce(
(items, level) => ({
...items,
...{
[`Mod-Alt-${level}`]: () => this.editor.commands.toggleHeading({ level }),
},
}),
{},
)
},

@@ -124,0 +128,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet