Merge branch 'main' of github.com:ueberdosis/tiptap

This commit is contained in:
Hans Pagel 2021-10-27 14:04:54 +02:00
commit bb56d98982
158 changed files with 1086 additions and 309 deletions

View File

@ -18,6 +18,7 @@
border: 1px solid #000;
border-radius: 0.4rem;
padding: 0.1rem 0.3rem;
box-decoration-break: clone;
}
.character-count {

View File

@ -118,6 +118,7 @@ export default {
border: 1px solid #000;
border-radius: 0.4rem;
padding: 0.1rem 0.3rem;
box-decoration-break: clone;
}
.character-count {

View File

@ -59,20 +59,22 @@ declare module '@tiptap/core' {
}
}
export const CollaborationAnnotation = Extension.create({
export const CollaborationAnnotation = Extension.create<AnnotationOptions>({
name: 'annotation',
priority: 1000,
defaultOptions: <AnnotationOptions>{
HTMLAttributes: {
class: 'annotation',
},
onUpdate: decorations => decorations,
document: null,
field: 'annotations',
map: null,
instance: '',
addOptions() {
return {
HTMLAttributes: {
class: 'annotation',
},
onUpdate: decorations => decorations,
document: null,
field: 'annotations',
map: null,
instance: '',
}
},
onCreate() {

View File

@ -2,16 +2,17 @@ import { Extension } from '@tiptap/core'
import Suggestion from '@tiptap/suggestion'
export default Extension.create({
name: 'mention',
name: 'commands',
defaultOptions: {
suggestion: {
char: '/',
startOfLine: false,
command: ({ editor, range, props }) => {
props.command({ editor, range })
addOptions() {
return {
suggestion: {
char: '/',
command: ({ editor, range, props }) => {
props.command({ editor, range })
},
},
},
}
},
addProseMirrorPlugins() {

View File

@ -54,5 +54,6 @@ export default {
border: 1px solid #000;
border-radius: 0.4rem;
padding: 0.1rem 0.3rem;
box-decoration-break: clone;
}
</style>

View File

@ -17,8 +17,10 @@ export default Node.create<DetailsSummaryOptions>({
isolating: true,
defaultOptions: {
HTMLAttributes: {},
addOptions() {
return {
HTMLAttributes: {},
}
},
parseHTML() {

View File

@ -34,8 +34,10 @@ export default Node.create<DetailsOptions>({
// defining: true,
defaultOptions: {
HTMLAttributes: {},
addOptions() {
return {
HTMLAttributes: {},
}
},
parseHTML() {

View File

@ -18,18 +18,20 @@ declare module '@tiptap/core' {
}
}
export default Node.create({
export default Node.create<IframeOptions>({
name: 'iframe',
group: 'block',
atom: true,
defaultOptions: <IframeOptions>{
allowFullscreen: true,
HTMLAttributes: {
class: 'iframe-wrapper',
},
addOptions() {
return {
allowFullscreen: true,
HTMLAttributes: {
class: 'iframe-wrapper',
},
}
},
addAttributes() {

View File

@ -41,8 +41,10 @@ export const inputRegex = /!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/
export const Figure = Node.create<FigureOptions>({
name: 'figure',
defaultOptions: {
HTMLAttributes: {},
addOptions() {
return {
HTMLAttributes: {},
}
},
group: 'block',

View File

@ -3,8 +3,10 @@ import { Node, mergeAttributes } from '@tiptap/core'
export const Figcaption = Node.create({
name: 'figcaption',
defaultOptions: {
HTMLAttributes: {},
addOptions() {
return {
HTMLAttributes: {},
}
},
content: 'inline*',

View File

@ -4,8 +4,10 @@ import { Plugin } from 'prosemirror-state'
export const Figure = Node.create({
name: 'figure',
defaultOptions: {
HTMLAttributes: {},
addOptions() {
return {
HTMLAttributes: {},
}
},
group: 'block',

View File

@ -39,11 +39,13 @@ export interface LinterOptions {
plugins: Array<typeof LinterPlugin>,
}
export const Linter = Extension.create({
export const Linter = Extension.create<LinterOptions>({
name: 'linter',
defaultOptions: <LinterOptions>{
plugins: [],
addOptions() {
return {
plugins: [],
}
},
addProseMirrorPlugins() {

View File

@ -20,11 +20,13 @@ export interface TrailingNodeOptions {
export const TrailingNode = Extension.create<TrailingNodeOptions>({
name: 'trailingNode',
defaultOptions: {
node: 'paragraph',
notAfter: [
'paragraph',
],
addOptions() {
return {
node: 'paragraph',
notAfter: [
'paragraph',
],
}
},
addProseMirrorPlugins() {

View File

@ -63,5 +63,6 @@ export default {
border: 1px solid #000;
border-radius: 0.4rem;
padding: 0.1rem 0.3rem;
box-decoration-break: clone;
}
</style>

View File

@ -71,9 +71,11 @@ All settings can be configured through the extension anyway, but if you want to
import Heading from '@tiptap/extension-heading'
const CustomHeading = Heading.extend({
defaultOptions: {
...Heading.options,
levels: [1, 2, 3],
addOptions() {
return {
...this.parent?.(),
levels: [1, 2, 3],
}
},
})
```

View File

@ -35,7 +35,7 @@ Okay, youve got your menu. But how do you wire things up?
Youve got the editor running already and want to add your first button. You need a `<button>` HTML tag with a click handler. Depending on your setup, that can look like the following example:
```html
<button onclick="editor.chain().toggleBold().focus().run()">
<button onclick="editor.chain().focus().toggleBold().run()">
Bold
</button>
```
@ -63,7 +63,7 @@ You have already seen the `focus()` command in the above example. When you click
The editor provides an `isActive()` method to check if something is applied to the selected text already. In Vue.js you can toggle a CSS class with help of that function like that:
```html
<button :class="{ 'is-active': editor.isActive('bold') }" @click="editor.chain().toggleBold().focus().run()">
<button :class="{ 'is-active': editor.isActive('bold') }" @click="editor.chain().focus().toggleBold().run()">
Bold
</button>
```

View File

@ -26,8 +26,10 @@ export interface CustomExtensionOptions {
}
const CustomExtension = Extension.create<CustomExtensionOptions>({
defaultOptions: {
awesomeness: 100,
addOptions() {
return {
awesomeness: 100,
}
},
})
```

View File

@ -103,7 +103,7 @@ import { Node } from '@tiptap/core'
const CustomExtension = Node.create({
name: 'custom_extension',
defaultOptions: {
addOptions() {
},
addAttributes() {

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.129](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.128...@tiptap/core@2.0.0-beta.129) (2021-10-26)
**Note:** Version bump only for package @tiptap/core
# [2.0.0-beta.128](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.127...@tiptap/core@2.0.0-beta.128) (2021-10-25)

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/core",
"description": "headless rich text editor",
"version": "2.0.0-beta.128",
"version": "2.0.0-beta.129",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -36,13 +36,21 @@ declare module '@tiptap/core' {
*/
defaultOptions?: Options,
/**
* Default Options
*/
addOptions?: (this: {
name: string,
parent: Exclude<ParentConfig<ExtensionConfig<Options, Storage>>['addOptions'], undefined>,
}) => Options,
/**
* Default Storage
*/
addStorage?: (this: {
name: string,
options: Options,
parent: ParentConfig<ExtensionConfig<Options, Storage>>['addGlobalAttributes'],
parent: Exclude<ParentConfig<ExtensionConfig<Options, Storage>>['addStorage'], undefined>,
}) => Storage,
/**
@ -278,7 +286,24 @@ export class Extension<Options = any, Storage = any> {
}
this.name = this.config.name
if (config.defaultOptions) {
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`)
}
// TODO: remove `addOptions` fallback
this.options = this.config.defaultOptions
if (this.config.addOptions) {
this.options = callOrReturn(getExtensionField<AnyConfig['addOptions']>(
this,
'addOptions',
{
name: this.name,
},
))
}
this.storage = callOrReturn(getExtensionField<AnyConfig['addStorage']>(
this,
'addStorage',
@ -286,7 +311,7 @@ export class Extension<Options = any, Storage = any> {
name: this.name,
options: this.options,
},
))
)) || {}
}
static create<O = any, S = any>(config: Partial<ExtensionConfig<O, S>> = {}) {
@ -323,10 +348,25 @@ export class Extension<Options = any, Storage = any> {
? extendedConfig.name
: extension.parent.name
if (extendedConfig.defaultOptions) {
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`)
}
// TODO: remove `addOptions` fallback
extension.options = extendedConfig.defaultOptions
? extendedConfig.defaultOptions
: extension.parent.options
if (extendedConfig.addOptions) {
extension.options = callOrReturn(getExtensionField<AnyConfig['addOptions']>(
extension,
'addOptions',
{
name: extension.name,
},
))
}
extension.storage = callOrReturn(getExtensionField<AnyConfig['addStorage']>(
extension,
'addStorage',

View File

@ -42,13 +42,21 @@ declare module '@tiptap/core' {
*/
defaultOptions?: Options,
/**
* Default Options
*/
addOptions?: (this: {
name: string,
parent: Exclude<ParentConfig<MarkConfig<Options, Storage>>['addOptions'], undefined>,
}) => Options,
/**
* Default Storage
*/
addStorage?: (this: {
addStorage?: (this: {
name: string,
options: Options,
parent: ParentConfig<MarkConfig<Options, Storage>>['addGlobalAttributes'],
parent: Exclude<ParentConfig<MarkConfig<Options, Storage>>['addStorage'], undefined>,
}) => Storage,
/**
@ -392,7 +400,24 @@ export class Mark<Options = any, Storage = any> {
}
this.name = this.config.name
if (config.defaultOptions) {
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`)
}
// TODO: remove `addOptions` fallback
this.options = this.config.defaultOptions
if (this.config.addOptions) {
this.options = callOrReturn(getExtensionField<AnyConfig['addOptions']>(
this,
'addOptions',
{
name: this.name,
},
))
}
this.storage = callOrReturn(getExtensionField<AnyConfig['addStorage']>(
this,
'addStorage',
@ -400,7 +425,7 @@ export class Mark<Options = any, Storage = any> {
name: this.name,
options: this.options,
},
))
)) || {}
}
static create<O = any, S = any>(config: Partial<MarkConfig<O, S>> = {}) {
@ -437,10 +462,25 @@ export class Mark<Options = any, Storage = any> {
? extendedConfig.name
: extension.parent.name
if (extendedConfig.defaultOptions) {
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`)
}
// TODO: remove `addOptions` fallback
extension.options = extendedConfig.defaultOptions
? extendedConfig.defaultOptions
: extension.parent.options
if (extendedConfig.addOptions) {
extension.options = callOrReturn(getExtensionField<AnyConfig['addOptions']>(
extension,
'addOptions',
{
name: extension.name,
},
))
}
extension.storage = callOrReturn(getExtensionField<AnyConfig['addStorage']>(
extension,
'addStorage',

View File

@ -42,13 +42,21 @@ declare module '@tiptap/core' {
*/
defaultOptions?: Options,
/**
* Default Options
*/
addOptions?: (this: {
name: string,
parent: Exclude<ParentConfig<NodeConfig<Options, Storage>>['addOptions'], undefined>,
}) => Options,
/**
* Default Storage
*/
addStorage?: (this: {
name: string,
options: Options,
parent: ParentConfig<NodeConfig<Options, Storage>>['addGlobalAttributes'],
parent: Exclude<ParentConfig<NodeConfig<Options, Storage>>['addStorage'], undefined>,
}) => Storage,
/**
@ -472,7 +480,24 @@ export class Node<Options = any, Storage = any> {
}
this.name = this.config.name
if (config.defaultOptions) {
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`)
}
// TODO: remove `addOptions` fallback
this.options = this.config.defaultOptions
if (this.config.addOptions) {
this.options = callOrReturn(getExtensionField<AnyConfig['addOptions']>(
this,
'addOptions',
{
name: this.name,
},
))
}
this.storage = callOrReturn(getExtensionField<AnyConfig['addStorage']>(
this,
'addStorage',
@ -480,7 +505,7 @@ export class Node<Options = any, Storage = any> {
name: this.name,
options: this.options,
},
))
)) || {}
}
static create<O = any, S = any>(config: Partial<NodeConfig<O, S>> = {}) {
@ -517,10 +542,25 @@ export class Node<Options = any, Storage = any> {
? extendedConfig.name
: extension.parent.name
if (extendedConfig.defaultOptions) {
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`)
}
// TODO: remove `addOptions` fallback
extension.options = extendedConfig.defaultOptions
? extendedConfig.defaultOptions
: extension.parent.options
if (extendedConfig.addOptions) {
extension.options = callOrReturn(getExtensionField<AnyConfig['addOptions']>(
extension,
'addOptions',
{
name: extension.name,
},
))
}
extension.storage = callOrReturn(getExtensionField<AnyConfig['addStorage']>(
extension,
'addStorage',

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.20](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-blockquote@2.0.0-beta.19...@tiptap/extension-blockquote@2.0.0-beta.20) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-blockquote
# [2.0.0-beta.19](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-blockquote@2.0.0-beta.18...@tiptap/extension-blockquote@2.0.0-beta.19) (2021-10-14)
**Note:** Version bump only for package @tiptap/extension-blockquote

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-blockquote",
"description": "blockquote extension for tiptap",
"version": "2.0.0-beta.19",
"version": "2.0.0-beta.20",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -29,8 +29,10 @@ export const Blockquote = Node.create<BlockquoteOptions>({
name: 'blockquote',
defaultOptions: {
HTMLAttributes: {},
addOptions() {
return {
HTMLAttributes: {},
}
},
content: 'block*',

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.20](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bold@2.0.0-beta.19...@tiptap/extension-bold@2.0.0-beta.20) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-bold
# [2.0.0-beta.19](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bold@2.0.0-beta.18...@tiptap/extension-bold@2.0.0-beta.19) (2021-10-14)
**Note:** Version bump only for package @tiptap/extension-bold

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-bold",
"description": "bold extension for tiptap",
"version": "2.0.0-beta.19",
"version": "2.0.0-beta.20",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -36,8 +36,10 @@ export const underscorePasteRegex = /(?:^|\s)((?:__)((?:[^__]+))(?:__))/g
export const Bold = Mark.create<BoldOptions>({
name: 'bold',
defaultOptions: {
HTMLAttributes: {},
addOptions() {
return {
HTMLAttributes: {},
}
},
parseHTML() {

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.43](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bubble-menu@2.0.0-beta.42...@tiptap/extension-bubble-menu@2.0.0-beta.43) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-bubble-menu
# [2.0.0-beta.42](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bubble-menu@2.0.0-beta.41...@tiptap/extension-bubble-menu@2.0.0-beta.42) (2021-10-14)
**Note:** Version bump only for package @tiptap/extension-bubble-menu

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-bubble-menu",
"description": "bubble-menu extension for tiptap",
"version": "2.0.0-beta.42",
"version": "2.0.0-beta.43",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -8,11 +8,13 @@ export type BubbleMenuOptions = Omit<BubbleMenuPluginProps, 'editor' | 'element'
export const BubbleMenu = Extension.create<BubbleMenuOptions>({
name: 'bubbleMenu',
defaultOptions: {
element: null,
tippyOptions: {},
pluginKey: 'bubbleMenu',
shouldShow: null,
addOptions() {
return {
element: null,
tippyOptions: {},
pluginKey: 'bubbleMenu',
shouldShow: null,
}
},
addProseMirrorPlugins() {

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.19](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bullet-list@2.0.0-beta.18...@tiptap/extension-bullet-list@2.0.0-beta.19) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-bullet-list
# [2.0.0-beta.18](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bullet-list@2.0.0-beta.17...@tiptap/extension-bullet-list@2.0.0-beta.18) (2021-10-14)
**Note:** Version bump only for package @tiptap/extension-bullet-list

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-bullet-list",
"description": "bullet list extension for tiptap",
"version": "2.0.0-beta.18",
"version": "2.0.0-beta.19",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -20,8 +20,10 @@ export const inputRegex = /^\s*([-+*])\s$/
export const BulletList = Node.create<BulletListOptions>({
name: 'bulletList',
defaultOptions: {
HTMLAttributes: {},
addOptions() {
return {
HTMLAttributes: {},
}
},
group: 'block list',

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.14](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-character-count@2.0.0-beta.13...@tiptap/extension-character-count@2.0.0-beta.14) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-character-count
# [2.0.0-beta.13](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-character-count@2.0.0-beta.12...@tiptap/extension-character-count@2.0.0-beta.13) (2021-07-26)
**Note:** Version bump only for package @tiptap/extension-character-count

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-character-count",
"description": "font family extension for tiptap",
"version": "2.0.0-beta.13",
"version": "2.0.0-beta.14",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -10,8 +10,10 @@ export interface CharacterCountOptions {
export const CharacterCount = Extension.create<CharacterCountOptions>({
name: 'characterCount',
defaultOptions: {
limit: 0,
addOptions() {
return {
limit: 0,
}
},
addProseMirrorPlugins() {

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.49](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code-block-lowlight@2.0.0-beta.48...@tiptap/extension-code-block-lowlight@2.0.0-beta.49) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-code-block-lowlight
# [2.0.0-beta.48](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code-block-lowlight@2.0.0-beta.47...@tiptap/extension-code-block-lowlight@2.0.0-beta.48) (2021-10-25)
**Note:** Version bump only for package @tiptap/extension-code-block-lowlight

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-code-block-lowlight",
"description": "code block extension for tiptap",
"version": "2.0.0-beta.48",
"version": "2.0.0-beta.49",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@ -24,7 +24,7 @@
"@tiptap/core": "^2.0.0-beta.1"
},
"dependencies": {
"@tiptap/extension-code-block": "^2.0.0-beta.24",
"@tiptap/extension-code-block": "^2.0.0-beta.25",
"@types/lowlight": "^0.0.3",
"lowlight": "^1.20.0",
"prosemirror-model": "^1.15.0",

View File

@ -7,9 +7,11 @@ export interface CodeBlockLowlightOptions extends CodeBlockOptions {
}
export const CodeBlockLowlight = CodeBlock.extend<CodeBlockLowlightOptions>({
defaultOptions: {
...CodeBlock.options,
lowlight,
addOptions() {
return {
...this.parent?.(),
lowlight,
}
},
addProseMirrorPlugins() {

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.25](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code-block@2.0.0-beta.24...@tiptap/extension-code-block@2.0.0-beta.25) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-code-block
# [2.0.0-beta.24](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code-block@2.0.0-beta.23...@tiptap/extension-code-block@2.0.0-beta.24) (2021-10-14)
**Note:** Version bump only for package @tiptap/extension-code-block

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-code-block",
"description": "code block extension for tiptap",
"version": "2.0.0-beta.24",
"version": "2.0.0-beta.25",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -27,9 +27,11 @@ export const tildeInputRegex = /^~~~(?<language>[a-z]*)?[\s\n]$/
export const CodeBlock = Node.create<CodeBlockOptions>({
name: 'codeBlock',
defaultOptions: {
languageClassPrefix: 'language-',
HTMLAttributes: {},
addOptions() {
return {
languageClassPrefix: 'language-',
HTMLAttributes: {},
}
},
content: 'text*',

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.21](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code@2.0.0-beta.20...@tiptap/extension-code@2.0.0-beta.21) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-code
# [2.0.0-beta.20](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code@2.0.0-beta.19...@tiptap/extension-code@2.0.0-beta.20) (2021-10-14)
**Note:** Version bump only for package @tiptap/extension-code

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-code",
"description": "code extension for tiptap",
"version": "2.0.0-beta.20",
"version": "2.0.0-beta.21",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -34,8 +34,10 @@ export const pasteRegex = /(?:^|\s)((?:`)((?:[^`]+))(?:`))/g
export const Code = Mark.create<CodeOptions>({
name: 'code',
defaultOptions: {
HTMLAttributes: {},
addOptions() {
return {
HTMLAttributes: {},
}
},
excludes: '_',

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.26](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration-cursor@2.0.0-beta.25...@tiptap/extension-collaboration-cursor@2.0.0-beta.26) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-collaboration-cursor
# [2.0.0-beta.25](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration-cursor@2.0.0-beta.24...@tiptap/extension-collaboration-cursor@2.0.0-beta.25) (2021-10-14)
**Note:** Version bump only for package @tiptap/extension-collaboration-cursor

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-collaboration-cursor",
"description": "collaboration cursor extension for tiptap",
"version": "2.0.0-beta.25",
"version": "2.0.0-beta.26",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -31,26 +31,28 @@ const awarenessStatesToArray = (states: Map<number, Record<string, any>>) => {
export const CollaborationCursor = Extension.create<CollaborationCursorOptions>({
name: 'collaborationCursor',
defaultOptions: {
provider: null,
user: {
name: null,
color: null,
},
render: user => {
const cursor = document.createElement('span')
cursor.classList.add('collaboration-cursor__caret')
cursor.setAttribute('style', `border-color: ${user.color}`)
addOptions() {
return {
provider: null,
user: {
name: null,
color: null,
},
render: user => {
const cursor = document.createElement('span')
cursor.classList.add('collaboration-cursor__caret')
cursor.setAttribute('style', `border-color: ${user.color}`)
const label = document.createElement('div')
label.classList.add('collaboration-cursor__label')
label.setAttribute('style', `background-color: ${user.color}`)
label.insertBefore(document.createTextNode(user.name), null)
cursor.insertBefore(label, null)
const label = document.createElement('div')
label.classList.add('collaboration-cursor__label')
label.setAttribute('style', `background-color: ${user.color}`)
label.insertBefore(document.createTextNode(user.name), null)
cursor.insertBefore(label, null)
return cursor
},
onUpdate: () => null,
return cursor
},
onUpdate: () => null,
}
},
addCommands() {

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.26](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration@2.0.0-beta.25...@tiptap/extension-collaboration@2.0.0-beta.26) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-collaboration
# [2.0.0-beta.25](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration@2.0.0-beta.24...@tiptap/extension-collaboration@2.0.0-beta.25) (2021-10-14)
**Note:** Version bump only for package @tiptap/extension-collaboration

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-collaboration",
"description": "collaboration extension for tiptap",
"version": "2.0.0-beta.25",
"version": "2.0.0-beta.26",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -43,10 +43,12 @@ export const Collaboration = Extension.create<CollaborationOptions>({
priority: 1000,
defaultOptions: {
document: null,
field: 'default',
fragment: null,
addOptions() {
return {
document: null,
field: 'default',
fragment: null,
}
},
onCreate() {

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.4](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-color@2.0.0-beta.3...@tiptap/extension-color@2.0.0-beta.4) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-color
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-color@2.0.0-beta.2...@tiptap/extension-color@2.0.0-beta.3) (2021-09-08)

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-color",
"description": "text color extension for tiptap",
"version": "2.0.0-beta.3",
"version": "2.0.0-beta.4",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -23,8 +23,10 @@ declare module '@tiptap/core' {
export const Color = Extension.create<ColorOptions>({
name: 'color',
defaultOptions: {
types: ['textStyle'],
addOptions() {
return {
types: ['textStyle'],
}
},
addGlobalAttributes() {

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.20](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-dropcursor@2.0.0-beta.19...@tiptap/extension-dropcursor@2.0.0-beta.20) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-dropcursor
# [2.0.0-beta.19](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-dropcursor@2.0.0-beta.18...@tiptap/extension-dropcursor@2.0.0-beta.19) (2021-08-26)
**Note:** Version bump only for package @tiptap/extension-dropcursor

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-dropcursor",
"description": "dropcursor extension for tiptap",
"version": "2.0.0-beta.19",
"version": "2.0.0-beta.20",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -10,10 +10,12 @@ export interface DropcursorOptions {
export const Dropcursor = Extension.create<DropcursorOptions>({
name: 'dropCursor',
defaultOptions: {
color: 'currentColor',
width: 1,
class: null,
addOptions() {
return {
color: 'currentColor',
width: 1,
class: null,
}
},
addProseMirrorPlugins() {

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.37](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-floating-menu@2.0.0-beta.36...@tiptap/extension-floating-menu@2.0.0-beta.37) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-floating-menu
# [2.0.0-beta.36](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-floating-menu@2.0.0-beta.35...@tiptap/extension-floating-menu@2.0.0-beta.36) (2021-10-14)
**Note:** Version bump only for package @tiptap/extension-floating-menu

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-floating-menu",
"description": "floating-menu extension for tiptap",
"version": "2.0.0-beta.36",
"version": "2.0.0-beta.37",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -8,11 +8,13 @@ export type FloatingMenuOptions = Omit<FloatingMenuPluginProps, 'editor' | 'elem
export const FloatingMenu = Extension.create<FloatingMenuOptions>({
name: 'floatingMenu',
defaultOptions: {
element: null,
tippyOptions: {},
pluginKey: 'floatingMenu',
shouldShow: null,
addOptions() {
return {
element: null,
tippyOptions: {},
pluginKey: 'floatingMenu',
shouldShow: null,
}
},
addProseMirrorPlugins() {

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.30](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-focus@2.0.0-beta.29...@tiptap/extension-focus@2.0.0-beta.30) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-focus
# [2.0.0-beta.29](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-focus@2.0.0-beta.28...@tiptap/extension-focus@2.0.0-beta.29) (2021-10-14)
**Note:** Version bump only for package @tiptap/extension-focus

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-focus",
"description": "focus extension for tiptap",
"version": "2.0.0-beta.29",
"version": "2.0.0-beta.30",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -10,9 +10,11 @@ export interface FocusOptions {
export const FocusClasses = Extension.create<FocusOptions>({
name: 'focus',
defaultOptions: {
className: 'has-focus',
mode: 'all',
addOptions() {
return {
className: 'has-focus',
mode: 'all',
}
},
addProseMirrorPlugins() {

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.16](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-font-family@2.0.0-beta.15...@tiptap/extension-font-family@2.0.0-beta.16) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-font-family
# [2.0.0-beta.15](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-font-family@2.0.0-beta.14...@tiptap/extension-font-family@2.0.0-beta.15) (2021-09-08)

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-font-family",
"description": "font family extension for tiptap",
"version": "2.0.0-beta.15",
"version": "2.0.0-beta.16",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -23,8 +23,10 @@ declare module '@tiptap/core' {
export const FontFamily = Extension.create<FontFamilyOptions>({
name: 'fontFamily',
defaultOptions: {
types: ['textStyle'],
addOptions() {
return {
types: ['textStyle'],
}
},
addGlobalAttributes() {

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.29](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-gapcursor@2.0.0-beta.28...@tiptap/extension-gapcursor@2.0.0-beta.29) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-gapcursor
# [2.0.0-beta.28](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-gapcursor@2.0.0-beta.27...@tiptap/extension-gapcursor@2.0.0-beta.28) (2021-10-22)

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-gapcursor",
"description": "gapcursor extension for tiptap",
"version": "2.0.0-beta.28",
"version": "2.0.0-beta.29",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.25](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-hard-break@2.0.0-beta.24...@tiptap/extension-hard-break@2.0.0-beta.25) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-hard-break
# [2.0.0-beta.24](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-hard-break@2.0.0-beta.23...@tiptap/extension-hard-break@2.0.0-beta.24) (2021-10-14)
**Note:** Version bump only for package @tiptap/extension-hard-break

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-hard-break",
"description": "hard break extension for tiptap",
"version": "2.0.0-beta.24",
"version": "2.0.0-beta.25",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -19,9 +19,11 @@ declare module '@tiptap/core' {
export const HardBreak = Node.create<HardBreakOptions>({
name: 'hardBreak',
defaultOptions: {
keepMarks: true,
HTMLAttributes: {},
addOptions() {
return {
keepMarks: true,
HTMLAttributes: {},
}
},
inline: true,

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.19](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-heading@2.0.0-beta.18...@tiptap/extension-heading@2.0.0-beta.19) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-heading
# [2.0.0-beta.18](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-heading@2.0.0-beta.17...@tiptap/extension-heading@2.0.0-beta.18) (2021-10-14)
**Note:** Version bump only for package @tiptap/extension-heading

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-heading",
"description": "heading extension for tiptap",
"version": "2.0.0-beta.18",
"version": "2.0.0-beta.19",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -25,9 +25,11 @@ declare module '@tiptap/core' {
export const Heading = Node.create<HeadingOptions>({
name: 'heading',
defaultOptions: {
levels: [1, 2, 3, 4, 5, 6],
HTMLAttributes: {},
addOptions() {
return {
levels: [1, 2, 3, 4, 5, 6],
HTMLAttributes: {},
}
},
content: 'inline*',

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.26](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-highlight@2.0.0-beta.25...@tiptap/extension-highlight@2.0.0-beta.26) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-highlight
# [2.0.0-beta.25](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-highlight@2.0.0-beta.24...@tiptap/extension-highlight@2.0.0-beta.25) (2021-10-14)
**Note:** Version bump only for package @tiptap/extension-highlight

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-highlight",
"description": "highlight extension for tiptap",
"version": "2.0.0-beta.25",
"version": "2.0.0-beta.26",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -35,9 +35,11 @@ export const pasteRegex = /(?:^|\s)((?:==)((?:[^~]+))(?:==))/g
export const Highlight = Mark.create<HighlightOptions>({
name: 'highlight',
defaultOptions: {
multicolor: false,
HTMLAttributes: {},
addOptions() {
return {
multicolor: false,
HTMLAttributes: {},
}
},
addAttributes() {

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.17](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-history@2.0.0-beta.16...@tiptap/extension-history@2.0.0-beta.17) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-history
# [2.0.0-beta.16](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-history@2.0.0-beta.15...@tiptap/extension-history@2.0.0-beta.16) (2021-08-20)
**Note:** Version bump only for package @tiptap/extension-history

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-history",
"description": "history extension for tiptap",
"version": "2.0.0-beta.16",
"version": "2.0.0-beta.17",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -24,9 +24,11 @@ declare module '@tiptap/core' {
export const History = Extension.create<HistoryOptions>({
name: 'history',
defaultOptions: {
depth: 100,
newGroupDelay: 500,
addOptions() {
return {
depth: 100,
newGroupDelay: 500,
}
},
addCommands() {

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.25](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-horizontal-rule@2.0.0-beta.24...@tiptap/extension-horizontal-rule@2.0.0-beta.25) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-horizontal-rule
# [2.0.0-beta.24](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-horizontal-rule@2.0.0-beta.23...@tiptap/extension-horizontal-rule@2.0.0-beta.24) (2021-10-14)
**Note:** Version bump only for package @tiptap/extension-horizontal-rule

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-horizontal-rule",
"description": "horizontal rule extension for tiptap",
"version": "2.0.0-beta.24",
"version": "2.0.0-beta.25",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -23,8 +23,10 @@ declare module '@tiptap/core' {
export const HorizontalRule = Node.create<HorizontalRuleOptions>({
name: 'horizontalRule',
defaultOptions: {
HTMLAttributes: {},
addOptions() {
return {
HTMLAttributes: {},
}
},
group: 'block',

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.20](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-image@2.0.0-beta.19...@tiptap/extension-image@2.0.0-beta.20) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-image
# [2.0.0-beta.19](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-image@2.0.0-beta.18...@tiptap/extension-image@2.0.0-beta.19) (2021-10-14)
**Note:** Version bump only for package @tiptap/extension-image

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-image",
"description": "image extension for tiptap",
"version": "2.0.0-beta.19",
"version": "2.0.0-beta.20",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -25,9 +25,11 @@ export const inputRegex = /(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))/
export const Image = Node.create<ImageOptions>({
name: 'image',
defaultOptions: {
inline: false,
HTMLAttributes: {},
addOptions() {
return {
inline: false,
HTMLAttributes: {},
}
},
inline() {

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.20](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-italic@2.0.0-beta.19...@tiptap/extension-italic@2.0.0-beta.20) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-italic
# [2.0.0-beta.19](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-italic@2.0.0-beta.18...@tiptap/extension-italic@2.0.0-beta.19) (2021-10-14)
**Note:** Version bump only for package @tiptap/extension-italic

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-italic",
"description": "italic extension for tiptap",
"version": "2.0.0-beta.19",
"version": "2.0.0-beta.20",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -36,8 +36,10 @@ export const underscorePasteRegex = /(?:^|\s)((?:_)((?:[^_]+))(?:_))/g
export const Italic = Mark.create<ItalicOptions>({
name: 'italic',
defaultOptions: {
HTMLAttributes: {},
addOptions() {
return {
HTMLAttributes: {},
}
},
parseHTML() {

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.24](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-link@2.0.0-beta.23...@tiptap/extension-link@2.0.0-beta.24) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-link
# [2.0.0-beta.23](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-link@2.0.0-beta.22...@tiptap/extension-link@2.0.0-beta.23) (2021-10-14)
**Note:** Version bump only for package @tiptap/extension-link

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-link",
"description": "link extension for tiptap",
"version": "2.0.0-beta.23",
"version": "2.0.0-beta.24",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -47,13 +47,15 @@ export const Link = Mark.create<LinkOptions>({
inclusive: false,
defaultOptions: {
openOnClick: true,
linkOnPaste: true,
HTMLAttributes: {
target: '_blank',
rel: 'noopener noreferrer nofollow',
},
addOptions() {
return {
openOnClick: true,
linkOnPaste: true,
HTMLAttributes: {
target: '_blank',
rel: 'noopener noreferrer nofollow',
},
}
},
addAttributes() {

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.15](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-list-item@2.0.0-beta.14...@tiptap/extension-list-item@2.0.0-beta.15) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-list-item
# [2.0.0-beta.14](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-list-item@2.0.0-beta.13...@tiptap/extension-list-item@2.0.0-beta.14) (2021-07-26)
**Note:** Version bump only for package @tiptap/extension-list-item

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-list-item",
"description": "list item extension for tiptap",
"version": "2.0.0-beta.14",
"version": "2.0.0-beta.15",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -7,8 +7,10 @@ export interface ListItemOptions {
export const ListItem = Node.create<ListItemOptions>({
name: 'listItem',
defaultOptions: {
HTMLAttributes: {},
addOptions() {
return {
HTMLAttributes: {},
}
},
content: 'paragraph block*',

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.80](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-mention@2.0.0-beta.79...@tiptap/extension-mention@2.0.0-beta.80) (2021-10-26)
**Note:** Version bump only for package @tiptap/extension-mention
# [2.0.0-beta.79](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-mention@2.0.0-beta.78...@tiptap/extension-mention@2.0.0-beta.79) (2021-10-25)
**Note:** Version bump only for package @tiptap/extension-mention

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-mention",
"description": "mention extension for tiptap",
"version": "2.0.0-beta.79",
"version": "2.0.0-beta.80",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@ -24,7 +24,7 @@
"@tiptap/core": "^2.0.0-beta.1"
},
"dependencies": {
"@tiptap/suggestion": "^2.0.0-beta.75",
"@tiptap/suggestion": "^2.0.0-beta.76",
"prosemirror-model": "^1.15.0",
"prosemirror-state": "^1.3.4"
},

View File

@ -17,47 +17,49 @@ export const MentionPluginKey = new PluginKey('mention')
export const Mention = Node.create<MentionOptions>({
name: 'mention',
defaultOptions: {
HTMLAttributes: {},
renderLabel({ options, node }) {
return `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`
},
suggestion: {
char: '@',
pluginKey: MentionPluginKey,
command: ({ editor, range, props }) => {
// increase range.to by one when the next node is of type "text"
// and starts with a space character
const nodeAfter = editor.view.state.selection.$to.nodeAfter
const overrideSpace = nodeAfter?.text?.startsWith(' ')
if (overrideSpace) {
range.to += 1
}
editor
.chain()
.focus()
.insertContentAt(range, [
{
type: 'mention',
attrs: props,
},
{
type: 'text',
text: ' ',
},
])
.run()
addOptions() {
return {
HTMLAttributes: {},
renderLabel({ options, node }) {
return `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`
},
allow: ({ editor, range }) => {
const $from = editor.state.doc.resolve(range.from)
const type = editor.schema.nodes.mention
const allow = !!$from.parent.type.contentMatch.matchType(type)
suggestion: {
char: '@',
pluginKey: MentionPluginKey,
command: ({ editor, range, props }) => {
// increase range.to by one when the next node is of type "text"
// and starts with a space character
const nodeAfter = editor.view.state.selection.$to.nodeAfter
const overrideSpace = nodeAfter?.text?.startsWith(' ')
return allow
if (overrideSpace) {
range.to += 1
}
editor
.chain()
.focus()
.insertContentAt(range, [
{
type: this.name,
attrs: props,
},
{
type: 'text',
text: ' ',
},
])
.run()
},
allow: ({ editor, range }) => {
const $from = editor.state.doc.resolve(range.from)
const type = editor.schema.nodes[this.name]
const allow = !!$from.parent.type.contentMatch.matchType(type)
return allow
},
},
},
}
},
group: 'inline',

Some files were not shown because too many files have changed in this diff Show More