@tiptap/extension-heading
Advanced tools
Comparing version 1.0.0-alpha.2 to 2.0.0-alpha.1
@@ -6,2 +6,10 @@ # Change Log | ||
# [2.0.0-alpha.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-heading@1.0.0-alpha.2...@tiptap/extension-heading@2.0.0-alpha.1) (2020-11-18) | ||
**Note:** Version bump only for package @tiptap/extension-heading | ||
# [1.0.0-alpha.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-heading@1.0.0-alpha.1...@tiptap/extension-heading@1.0.0-alpha.2) (2020-11-16) | ||
@@ -8,0 +16,0 @@ |
@@ -11,5 +11,11 @@ import { Command, Node } from '@tiptap/core'; | ||
/** | ||
* Set a heading node | ||
*/ | ||
setHeading: (attributes: { | ||
level: Level; | ||
}) => Command; | ||
/** | ||
* Toggle a heading node | ||
*/ | ||
heading: (options: { | ||
toggleHeading: (attributes: { | ||
level: Level; | ||
@@ -16,0 +22,0 @@ }) => Command; |
@@ -40,9 +40,18 @@ 'use strict'; | ||
/** | ||
* Set a heading node | ||
*/ | ||
setHeading: (attributes) => ({ commands }) => { | ||
if (!this.options.levels.includes(attributes.level)) { | ||
return false; | ||
} | ||
return commands.setBlockType('heading', attributes); | ||
}, | ||
/** | ||
* Toggle a heading node | ||
*/ | ||
heading: (options) => ({ commands }) => { | ||
if (!this.options.levels.includes(options.level)) { | ||
toggleHeading: (attributes) => ({ commands }) => { | ||
if (!this.options.levels.includes(attributes.level)) { | ||
return false; | ||
} | ||
return commands.toggleBlockType('heading', 'paragraph', options); | ||
return commands.toggleBlockType('heading', 'paragraph', attributes); | ||
}, | ||
@@ -55,3 +64,3 @@ }; | ||
...{ | ||
[`Mod-Alt-${level}`]: () => this.editor.commands.setBlockType('heading', { level }), | ||
[`Mod-Alt-${level}`]: () => this.editor.commands.toggleHeading({ level }), | ||
}, | ||
@@ -58,0 +67,0 @@ }), {}); |
@@ -38,9 +38,18 @@ import { Node } from '@tiptap/core'; | ||
/** | ||
* Set a heading node | ||
*/ | ||
setHeading: (attributes) => ({ commands }) => { | ||
if (!this.options.levels.includes(attributes.level)) { | ||
return false; | ||
} | ||
return commands.setBlockType('heading', attributes); | ||
}, | ||
/** | ||
* Toggle a heading node | ||
*/ | ||
heading: (options) => ({ commands }) => { | ||
if (!this.options.levels.includes(options.level)) { | ||
toggleHeading: (attributes) => ({ commands }) => { | ||
if (!this.options.levels.includes(attributes.level)) { | ||
return false; | ||
} | ||
return commands.toggleBlockType('heading', 'paragraph', options); | ||
return commands.toggleBlockType('heading', 'paragraph', attributes); | ||
}, | ||
@@ -53,3 +62,3 @@ }; | ||
...{ | ||
[`Mod-Alt-${level}`]: () => this.editor.commands.setBlockType('heading', { level }), | ||
[`Mod-Alt-${level}`]: () => this.editor.commands.toggleHeading({ level }), | ||
}, | ||
@@ -56,0 +65,0 @@ }), {}); |
@@ -41,9 +41,18 @@ (function (global, factory) { | ||
/** | ||
* Set a heading node | ||
*/ | ||
setHeading: (attributes) => ({ commands }) => { | ||
if (!this.options.levels.includes(attributes.level)) { | ||
return false; | ||
} | ||
return commands.setBlockType('heading', attributes); | ||
}, | ||
/** | ||
* Toggle a heading node | ||
*/ | ||
heading: (options) => ({ commands }) => { | ||
if (!this.options.levels.includes(options.level)) { | ||
toggleHeading: (attributes) => ({ commands }) => { | ||
if (!this.options.levels.includes(attributes.level)) { | ||
return false; | ||
} | ||
return commands.toggleBlockType('heading', 'paragraph', options); | ||
return commands.toggleBlockType('heading', 'paragraph', attributes); | ||
}, | ||
@@ -56,3 +65,3 @@ }; | ||
...{ | ||
[`Mod-Alt-${level}`]: () => this.editor.commands.setBlockType('heading', { level }), | ||
[`Mod-Alt-${level}`]: () => this.editor.commands.toggleHeading({ level }), | ||
}, | ||
@@ -59,0 +68,0 @@ }), {}); |
{ | ||
"name": "@tiptap/extension-heading", | ||
"version": "1.0.0-alpha.2", | ||
"version": "2.0.0-alpha.1", | ||
"homepage": "https://tiptap.dev", | ||
@@ -24,3 +24,3 @@ "keywords": [ | ||
"peerDependencies": { | ||
"@tiptap/core": "2.0.0-alpha.3" | ||
"@tiptap/core": "^2.0.0-alpha.0" | ||
}, | ||
@@ -31,3 +31,3 @@ "dependencies": { | ||
}, | ||
"gitHead": "a8a578edb78db7763e2eda83960c25b02e8488c5" | ||
"gitHead": "276118e48eef313fb435088dee3dc58b91363109" | ||
} |
@@ -8,3 +8,3 @@ # @tiptap/extension-heading | ||
## 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*. | ||
@@ -11,0 +11,0 @@ ## Offical Documentation |
@@ -56,10 +56,20 @@ import { Command, Node } from '@tiptap/core' | ||
/** | ||
* Set a heading node | ||
*/ | ||
setHeading: (attributes: { level: Level }): Command => ({ commands }) => { | ||
if (!this.options.levels.includes(attributes.level)) { | ||
return false | ||
} | ||
return commands.setBlockType('heading', attributes) | ||
}, | ||
/** | ||
* Toggle a heading node | ||
*/ | ||
heading: (options: { level: Level }): Command => ({ commands }) => { | ||
if (!this.options.levels.includes(options.level)) { | ||
toggleHeading: (attributes: { level: Level }): Command => ({ commands }) => { | ||
if (!this.options.levels.includes(attributes.level)) { | ||
return false | ||
} | ||
return commands.toggleBlockType('heading', 'paragraph', options) | ||
return commands.toggleBlockType('heading', 'paragraph', attributes) | ||
}, | ||
@@ -73,3 +83,3 @@ } | ||
...{ | ||
[`Mod-Alt-${level}`]: () => this.editor.commands.setBlockType('heading', { level }), | ||
[`Mod-Alt-${level}`]: () => this.editor.commands.toggleHeading({ level }), | ||
}, | ||
@@ -76,0 +86,0 @@ }), {}) |
Sorry, the diff of this file is too big to display
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
461356
651