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

This commit is contained in:
Hans Pagel
2021-04-16 19:15:59 +02:00
144 changed files with 1861 additions and 813 deletions

View File

@@ -0,0 +1,43 @@
<template>
<g-link :class="`banner-message banner-message--${color}`" :to="to">
<slot />
</g-link>
</template>
<script>
export default {
props: {
to: {
type: String,
required: true,
},
color: {
type: String,
default: 'black',
},
},
}
</script>
<style lang="scss" scoped>
.banner-message {
display: flex;
align-items: center;
justify-content: center;
flex: 0 0 auto;
padding: 0.65rem 1rem;
font-size: 0.85rem;
font-weight: 500;
&--black {
background-color: $colorBlack;
color: $colorWhite;
}
&--yellow {
background-color: $colorYellow;
color: $colorBlack;
}
}
</style>

View File

@@ -17,7 +17,6 @@
<script> <script>
import { NodeViewWrapper, NodeViewContent, nodeViewProps } from '@tiptap/vue-2' import { NodeViewWrapper, NodeViewContent, nodeViewProps } from '@tiptap/vue-2'
import lowlight from 'lowlight/lib/core'
export default { export default {
components: { components: {
@@ -29,7 +28,7 @@ export default {
data() { data() {
return { return {
languages: lowlight.listLanguages(), languages: this.extension.options.lowlight.listLanguages(),
} }
}, },

View File

@@ -70,7 +70,7 @@ export default {
this.editor = new Editor({ this.editor = new Editor({
extensions: [ extensions: [
...defaultExtensions().filter(extension => extension.config.name !== 'history'), ...defaultExtensions().filter(extension => extension.name !== 'history'),
Highlight, Highlight,
TaskList, TaskList,
TaskItem, TaskItem,

View File

@@ -24,8 +24,8 @@ export default () => {
}) })
return ( return (
<div style={{ position: 'relative' }}> <>
{editor && <BubbleMenu className="bubble-menu" editor={editor}> {editor && <BubbleMenu className="bubble-menu" tippyOptions={{ duration: 100 }} editor={editor}>
<button <button
onClick={() => editor.chain().focus().toggleBold().run()} onClick={() => editor.chain().focus().toggleBold().run()}
className={editor.isActive('bold') ? 'is-active' : ''} className={editor.isActive('bold') ? 'is-active' : ''}
@@ -46,7 +46,7 @@ export default () => {
</button> </button>
</BubbleMenu>} </BubbleMenu>}
{editor && <FloatingMenu className="floating-menu" editor={editor}> {editor && <FloatingMenu className="floating-menu" tippyOptions={{ duration: 100 }} editor={editor}>
<button <button
onClick={() => editor.chain().focus().toggleHeading({ level: 1 }).run()} onClick={() => editor.chain().focus().toggleHeading({ level: 1 }).run()}
className={editor.isActive('heading', { level: 1 }) ? 'is-active' : ''} className={editor.isActive('heading', { level: 1 }) ? 'is-active' : ''}
@@ -68,6 +68,6 @@ export default () => {
</FloatingMenu>} </FloatingMenu>}
<EditorContent editor={editor} /> <EditorContent editor={editor} />
</div> </>
) )
} }

View File

@@ -14,7 +14,6 @@
background-color: #0D0D0D; background-color: #0D0D0D;
padding: 0.2rem; padding: 0.2rem;
border-radius: 0.5rem; border-radius: 0.5rem;
transition: visibility 0.1s ease, opacity 0.1s ease;
button { button {
border: none; border: none;
@@ -37,9 +36,6 @@
background-color: #0D0D0D10; background-color: #0D0D0D10;
padding: 0.2rem; padding: 0.2rem;
border-radius: 0.5rem; border-radius: 0.5rem;
margin-top: -0.25rem;
margin-left: 0.25rem;
transition: visibility 0.1s ease, opacity 0.1s ease;
button { button {
border: none; border: none;

View File

@@ -1,6 +1,11 @@
<template> <template>
<div style="position: relative"> <div>
<bubble-menu class="bubble-menu" :editor="editor" v-if="editor"> <bubble-menu
class="bubble-menu"
:tippy-options="{ duration: 100 }"
:editor="editor"
v-if="editor"
>
<button @click="editor.chain().focus().toggleBold().run()" :class="{ 'is-active': editor.isActive('bold') }"> <button @click="editor.chain().focus().toggleBold().run()" :class="{ 'is-active': editor.isActive('bold') }">
Bold Bold
</button> </button>
@@ -12,7 +17,12 @@
</button> </button>
</bubble-menu> </bubble-menu>
<floating-menu class="floating-menu" :editor="editor" v-if="editor"> <floating-menu
class="floating-menu"
:tippy-options="{ duration: 100 }"
:editor="editor"
v-if="editor"
>
<button @click="editor.chain().focus().toggleHeading({ level: 1 }).run()" :class="{ 'is-active': editor.isActive('heading', { level: 1 }) }"> <button @click="editor.chain().focus().toggleHeading({ level: 1 }).run()" :class="{ 'is-active': editor.isActive('heading', { level: 1 }) }">
H1 H1
</button> </button>
@@ -95,7 +105,6 @@ export default {
background-color: #0D0D0D; background-color: #0D0D0D;
padding: 0.2rem; padding: 0.2rem;
border-radius: 0.5rem; border-radius: 0.5rem;
transition: visibility 0.1s ease, opacity 0.1s ease;
button { button {
border: none; border: none;
@@ -118,9 +127,6 @@ export default {
background-color: #0D0D0D10; background-color: #0D0D0D10;
padding: 0.2rem; padding: 0.2rem;
border-radius: 0.5rem; border-radius: 0.5rem;
margin-top: -0.25rem;
margin-left: 0.25rem;
transition: visibility 0.1s ease, opacity 0.1s ease;
button { button {
border: none; border: none;

View File

@@ -16,7 +16,7 @@ export default () => {
}) })
return ( return (
<div style={{ position: 'relative' }}> <>
{editor && <BubbleMenu editor={editor}> {editor && <BubbleMenu editor={editor}>
<button <button
onClick={() => editor.chain().focus().toggleBold().run()} onClick={() => editor.chain().focus().toggleBold().run()}
@@ -38,6 +38,6 @@ export default () => {
</button> </button>
</BubbleMenu>} </BubbleMenu>}
<EditorContent editor={editor} /> <EditorContent editor={editor} />
</div> </>
) )
} }

View File

@@ -1,5 +1,5 @@
<template> <template>
<div style="position: relative"> <div>
<bubble-menu :editor="editor" v-if="editor"> <bubble-menu :editor="editor" v-if="editor">
<button @click="editor.chain().focus().toggleBold().run()" :class="{ 'is-active': editor.isActive('bold') }"> <button @click="editor.chain().focus().toggleBold().run()" :class="{ 'is-active': editor.isActive('bold') }">
bold bold

View File

@@ -17,7 +17,7 @@ export default () => {
}) })
return ( return (
<div style={{ position: 'relative' }}> <>
{editor && <FloatingMenu editor={editor}> {editor && <FloatingMenu editor={editor}>
<button <button
onClick={() => editor.chain().focus().toggleHeading({ level: 1 }).run()} onClick={() => editor.chain().focus().toggleHeading({ level: 1 }).run()}
@@ -39,6 +39,6 @@ export default () => {
</button> </button>
</FloatingMenu>} </FloatingMenu>}
<EditorContent editor={editor} /> <EditorContent editor={editor} />
</div> </>
) )
} }

View File

@@ -1,5 +1,5 @@
<template> <template>
<div style="position: relative"> <div>
<floating-menu :editor="editor" v-if="editor"> <floating-menu :editor="editor" v-if="editor">
<button @click="editor.chain().focus().toggleHeading({ level: 1 }).run()" :class="{ 'is-active': editor.isActive('heading', { level: 1 }) }"> <button @click="editor.chain().focus().toggleHeading({ level: 1 }).run()" :class="{ 'is-active': editor.isActive('heading', { level: 1 }) }">
h1 h1

View File

@@ -28,9 +28,6 @@ const editor = new Editor({
onBlur({ editor, event }) { onBlur({ editor, event }) {
// The editor isnt focused anymore. // The editor isnt focused anymore.
}, },
onResize({ editor, event }) {
// The editor view has resized.
},
onDestroy() { onDestroy() {
// The editor is being destroyed. // The editor is being destroyed.
}, },
@@ -66,10 +63,6 @@ editor.on('blur', ({ editor, event }) => {
// The editor isnt focused anymore. // The editor isnt focused anymore.
} }
editor.on('resize', ({ editor, event }) => {
// The editor view has resized.
}
editor.on('destroy', () => { editor.on('destroy', () => {
// The editor is being destroyed. // The editor is being destroyed.
} }
@@ -115,9 +108,6 @@ const CustomExtension = Extension.create({
onBlur({ editor, event }) { onBlur({ editor, event }) {
// The editor isnt focused anymore. // The editor isnt focused anymore.
}, },
onResize({ editor, event }) {
// The editor view has resized.
},
onDestroy() { onDestroy() {
// The editor is being destroyed. // The editor is being destroyed.
}, },

View File

@@ -15,10 +15,10 @@ yarn add @tiptap/extension-bubble-menu
``` ```
## Settings ## Settings
| Option | Type | Default | Description | | Option | Type | Default | Description |
| ------------ | ------------- | ------- | -------------------------------------------------------------------- | | ------------ | ------------- | ------- | ----------------------------------------------------------------------- |
| element | `HTMLElement` | `null` | The DOM element that contains your menu. | | element | `HTMLElement` | `null` | The DOM element that contains your menu. |
| keepInBounds | `Boolean` | `true` | When enabled, its rendered inside the bounding box of the document. | | tippyOptions | `Object` | `{}` | [Options for tippy.js](https://atomiks.github.io/tippyjs/v6/all-props/) |
## Source code ## Source code
[packages/extension-bubble-menu/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-bubble-menu/) [packages/extension-bubble-menu/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-bubble-menu/)

View File

@@ -13,9 +13,10 @@ yarn add @tiptap/extension-floating-menu
``` ```
## Settings ## Settings
| Option | Type | Default | Description | | Option | Type | Default | Description |
| ------------ | ------------- | --------- | ----------------------------- | | ------------ | ------------- | ------- | ----------------------------------------------------------------------- |
| element | `HTMLElement` | `null` | The DOM element of your menu. | | element | `HTMLElement` | `null` | The DOM element of your menu. |
| tippyOptions | `Object` | `{}` | [Options for tippy.js](https://atomiks.github.io/tippyjs/v6/all-props/) |
## Source code ## Source code
[packages/extension-floating-menu/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-floating-menu/) [packages/extension-floating-menu/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-floating-menu/)

View File

@@ -127,7 +127,7 @@ import { Editor, defaultExtensions } from '@tiptap/starter-kit'
new Editor({ new Editor({
extensions: [ extensions: [
...defaultExtensions().filter(extension => extension.config.name !== 'history'), ...defaultExtensions().filter(extension => extension.name !== 'history'),
], ],
}) })
``` ```

View File

@@ -1,6 +1,14 @@
<template> <template>
<div class="app"> <div class="app">
<div class="app__navigation"> <div class="app__navigation">
<banner-message
to="https://www.tiptap.dev/"
v-if="$route.name === 'home'"
color="black"
>
Youre browsing the documentation for v2.x. Click here for v1.x documentation
</banner-message>
<div class="app__top-bar"> <div class="app__top-bar">
<g-link class="app__logo" to="/"> <g-link class="app__logo" to="/">
<img src="~@/assets/images/logo.svg"> <img src="~@/assets/images/logo.svg">
@@ -54,7 +62,7 @@
</g-link> </g-link>
</portal> </portal>
<portal :to="sidebarPortal" v-if="showSidebar"> <portal :to="sidebarPortal">
<nav class="app__sidebar-menu"> <nav class="app__sidebar-menu">
<div class="app__link-group" v-for="(linkGroup, i) in linkGroups" :key="i"> <div class="app__link-group" v-for="(linkGroup, i) in linkGroups" :key="i">
<template v-if="linkGroup.link && !linkGroup.items"> <template v-if="linkGroup.link && !linkGroup.items">
@@ -124,6 +132,7 @@ query {
import linkGroups from '@/links.yaml' import linkGroups from '@/links.yaml'
import Icon from '@/components/Icon' import Icon from '@/components/Icon'
import PageFooter from '@/components/PageFooter' import PageFooter from '@/components/PageFooter'
import BannerMessage from '@/components/BannerMessage'
// import GithubButton from 'vue-github-button' // import GithubButton from 'vue-github-button'
export default { export default {
@@ -137,6 +146,7 @@ export default {
components: { components: {
Icon, Icon,
PageFooter, PageFooter,
BannerMessage,
// GithubButton, // GithubButton,
}, },

View File

@@ -26,10 +26,10 @@
}, },
"devDependencies": { "devDependencies": {
"@atomico/rollup-plugin-sizes": "^1.1.4", "@atomico/rollup-plugin-sizes": "^1.1.4",
"@babel/core": "^7.13.14", "@babel/core": "^7.13.15",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.0", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.0",
"@babel/plugin-proposal-optional-chaining": "^7.13.12", "@babel/plugin-proposal-optional-chaining": "^7.13.12",
"@babel/preset-env": "^7.13.12", "@babel/preset-env": "^7.13.15",
"@babel/preset-react": "^7.13.13", "@babel/preset-react": "^7.13.13",
"@lerna/batch-packages": "^3.16.0", "@lerna/batch-packages": "^3.16.0",
"@lerna/filter-packages": "^3.18.0", "@lerna/filter-packages": "^3.18.0",
@@ -54,7 +54,7 @@
"rollup-plugin-terser": "^7.0.2", "rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0", "rollup-plugin-typescript2": "^0.30.0",
"rollup-plugin-vue": "5", "rollup-plugin-vue": "5",
"typescript": "^4.2.2", "typescript": "^4.2.4",
"vue": "^2.6.12" "vue": "^2.6.12"
} }
} }

View File

@@ -3,6 +3,37 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.32](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/core@2.0.0-beta.31...@tiptap/core@2.0.0-beta.32) (2021-04-16)
### Features
* add coordsAtPos and posToClientRect helper methods ([8dab614](https://github.com/ueberdosis/tiptap-next/commit/8dab6144a661e4c90f33d9d2f300882009eadd46))
* remove resize event handler ([9f64015](https://github.com/ueberdosis/tiptap-next/commit/9f64015157a83032d0d80bc0353efb529b56a342))
# [2.0.0-beta.31](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/core@2.0.0-beta.30...@tiptap/core@2.0.0-beta.31) (2021-04-15)
### Bug Fixes
* fix type for emitUpdate, fix [#276](https://github.com/ueberdosis/tiptap-next/issues/276) ([4137e00](https://github.com/ueberdosis/tiptap-next/commit/4137e00d987c152b883022525056df94ad033be7))
# [2.0.0-beta.30](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/core@2.0.0-beta.29...@tiptap/core@2.0.0-beta.30) (2021-04-15)
**Note:** Version bump only for package @tiptap/core
# [2.0.0-beta.29](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/core@2.0.0-beta.28...@tiptap/core@2.0.0-beta.29) (2021-04-12) # [2.0.0-beta.29](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/core@2.0.0-beta.28...@tiptap/core@2.0.0-beta.29) (2021-04-12)

View File

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

View File

@@ -44,8 +44,6 @@ export class Editor extends EventEmitter {
public isFocused = false public isFocused = false
private resizeObserver!: ResizeObserver
public options: EditorOptions = { public options: EditorOptions = {
element: document.createElement('div'), element: document.createElement('div'),
content: '', content: '',
@@ -64,7 +62,6 @@ export class Editor extends EventEmitter {
onTransaction: () => null, onTransaction: () => null,
onFocus: () => null, onFocus: () => null,
onBlur: () => null, onBlur: () => null,
onResize: () => null,
onDestroy: () => null, onDestroy: () => null,
} }
@@ -89,13 +86,6 @@ export class Editor extends EventEmitter {
window.setTimeout(() => { window.setTimeout(() => {
this.commands.focus(this.options.autofocus) this.commands.focus(this.options.autofocus)
this.emit('create', { editor: this }) this.emit('create', { editor: this })
if (window.ResizeObserver) {
this.resizeObserver = new ResizeObserver(() => {
this.emit('resize', { editor: this })
})
this.resizeObserver.observe(this.view.dom)
}
}, 0) }, 0)
} }
@@ -416,8 +406,6 @@ export class Editor extends EventEmitter {
* Destroy the editor. * Destroy the editor.
*/ */
public destroy(): void { public destroy(): void {
this.resizeObserver?.unobserve(this.view.dom)
this.emit('destroy') this.emit('destroy')
if (this.view) { if (this.view) {

View File

@@ -3,6 +3,7 @@ import { Command as ProseMirrorCommand } from 'prosemirror-commands'
import { InputRule } from 'prosemirror-inputrules' import { InputRule } from 'prosemirror-inputrules'
import { Editor } from './Editor' import { Editor } from './Editor'
import { Node } from './Node' import { Node } from './Node'
import { Mark } from './Mark'
import mergeDeep from './utilities/mergeDeep' import mergeDeep from './utilities/mergeDeep'
import { GlobalAttributes, RawCommands, ParentConfig } from './types' import { GlobalAttributes, RawCommands, ParentConfig } from './types'
import { ExtensionConfig } from '.' import { ExtensionConfig } from '.'
@@ -31,7 +32,7 @@ declare module '@tiptap/core' {
*/ */
addGlobalAttributes?: (this: { addGlobalAttributes?: (this: {
options: Options, options: Options,
parentConfig: ParentConfig<ExtensionConfig<Options>>, parent: ParentConfig<ExtensionConfig<Options>>['addGlobalAttributes'],
}) => GlobalAttributes | {}, }) => GlobalAttributes | {},
/** /**
@@ -40,7 +41,7 @@ declare module '@tiptap/core' {
addCommands?: (this: { addCommands?: (this: {
options: Options, options: Options,
editor: Editor, editor: Editor,
parentConfig: ParentConfig<ExtensionConfig<Options>>, parent: ParentConfig<ExtensionConfig<Options>>['addCommands'],
}) => Partial<RawCommands>, }) => Partial<RawCommands>,
/** /**
@@ -49,7 +50,7 @@ declare module '@tiptap/core' {
addKeyboardShortcuts?: (this: { addKeyboardShortcuts?: (this: {
options: Options, options: Options,
editor: Editor, editor: Editor,
parentConfig: ParentConfig<ExtensionConfig<Options>>, parent: ParentConfig<ExtensionConfig<Options>>['addKeyboardShortcuts'],
}) => { }) => {
[key: string]: ProseMirrorCommand, [key: string]: ProseMirrorCommand,
}, },
@@ -60,7 +61,7 @@ declare module '@tiptap/core' {
addInputRules?: (this: { addInputRules?: (this: {
options: Options, options: Options,
editor: Editor, editor: Editor,
parentConfig: ParentConfig<ExtensionConfig<Options>>, parent: ParentConfig<ExtensionConfig<Options>>['addInputRules'],
}) => InputRule[], }) => InputRule[],
/** /**
@@ -69,7 +70,7 @@ declare module '@tiptap/core' {
addPasteRules?: (this: { addPasteRules?: (this: {
options: Options, options: Options,
editor: Editor, editor: Editor,
parentConfig: ParentConfig<ExtensionConfig<Options>>, parent: ParentConfig<ExtensionConfig<Options>>['addPasteRules'],
}) => Plugin[], }) => Plugin[],
/** /**
@@ -78,7 +79,7 @@ declare module '@tiptap/core' {
addProseMirrorPlugins?: (this: { addProseMirrorPlugins?: (this: {
options: Options, options: Options,
editor: Editor, editor: Editor,
parentConfig: ParentConfig<ExtensionConfig<Options>>, parent: ParentConfig<ExtensionConfig<Options>>['addProseMirrorPlugins'],
}) => Plugin[], }) => Plugin[],
/** /**
@@ -87,7 +88,7 @@ declare module '@tiptap/core' {
extendNodeSchema?: (( extendNodeSchema?: ((
this: { this: {
options: Options, options: Options,
parentConfig: ParentConfig<ExtensionConfig<Options>>, parent: ParentConfig<ExtensionConfig<Options>>['extendNodeSchema'],
}, },
extension: Node, extension: Node,
) => { ) => {
@@ -100,9 +101,9 @@ declare module '@tiptap/core' {
extendMarkSchema?: (( extendMarkSchema?: ((
this: { this: {
options: Options, options: Options,
parentConfig: ParentConfig<ExtensionConfig<Options>>, parent: ParentConfig<ExtensionConfig<Options>>['extendMarkSchema'],
}, },
extension: Node, extension: Mark,
) => { ) => {
[key: string]: any, [key: string]: any,
}) | null, }) | null,
@@ -113,7 +114,7 @@ declare module '@tiptap/core' {
onBeforeCreate?: ((this: { onBeforeCreate?: ((this: {
options: Options, options: Options,
editor: Editor, editor: Editor,
parentConfig: ParentConfig<ExtensionConfig<Options>>, parent: ParentConfig<ExtensionConfig<Options>>['onBeforeCreate'],
}) => void) | null, }) => void) | null,
/** /**
@@ -122,7 +123,7 @@ declare module '@tiptap/core' {
onCreate?: ((this: { onCreate?: ((this: {
options: Options, options: Options,
editor: Editor, editor: Editor,
parentConfig: ParentConfig<ExtensionConfig<Options>>, parent: ParentConfig<ExtensionConfig<Options>>['onCreate'],
}) => void) | null, }) => void) | null,
/** /**
@@ -131,7 +132,7 @@ declare module '@tiptap/core' {
onUpdate?: ((this: { onUpdate?: ((this: {
options: Options, options: Options,
editor: Editor, editor: Editor,
parentConfig: ParentConfig<ExtensionConfig<Options>>, parent: ParentConfig<ExtensionConfig<Options>>['onUpdate'],
}) => void) | null, }) => void) | null,
/** /**
@@ -140,7 +141,7 @@ declare module '@tiptap/core' {
onSelectionUpdate?: ((this: { onSelectionUpdate?: ((this: {
options: Options, options: Options,
editor: Editor, editor: Editor,
parentConfig: ParentConfig<ExtensionConfig<Options>>, parent: ParentConfig<ExtensionConfig<Options>>['onSelectionUpdate'],
}) => void) | null, }) => void) | null,
/** /**
@@ -150,7 +151,7 @@ declare module '@tiptap/core' {
this: { this: {
options: Options, options: Options,
editor: Editor, editor: Editor,
parentConfig: ParentConfig<ExtensionConfig<Options>>, parent: ParentConfig<ExtensionConfig<Options>>['onTransaction'],
}, },
props: { props: {
transaction: Transaction, transaction: Transaction,
@@ -164,7 +165,7 @@ declare module '@tiptap/core' {
this: { this: {
options: Options, options: Options,
editor: Editor, editor: Editor,
parentConfig: ParentConfig<ExtensionConfig<Options>>, parent: ParentConfig<ExtensionConfig<Options>>['onFocus'],
}, },
props: { props: {
event: FocusEvent, event: FocusEvent,
@@ -178,7 +179,7 @@ declare module '@tiptap/core' {
this: { this: {
options: Options, options: Options,
editor: Editor, editor: Editor,
parentConfig: ParentConfig<ExtensionConfig<Options>>, parent: ParentConfig<ExtensionConfig<Options>>['onBlur'],
}, },
props: { props: {
event: FocusEvent, event: FocusEvent,
@@ -191,7 +192,7 @@ declare module '@tiptap/core' {
onDestroy?: ((this: { onDestroy?: ((this: {
options: Options, options: Options,
editor: Editor, editor: Editor,
parentConfig: ParentConfig<ExtensionConfig<Options>>, parent: ParentConfig<ExtensionConfig<Options>>['onDestroy'],
}) => void) | null, }) => void) | null,
} }
} }
@@ -199,48 +200,55 @@ declare module '@tiptap/core' {
export class Extension<Options = any> { export class Extension<Options = any> {
type = 'extension' type = 'extension'
name = 'extension'
parent: Extension | null = null
child: Extension | null = null
options: Options
config: ExtensionConfig = { config: ExtensionConfig = {
name: 'extension', name: this.name,
priority: 100, priority: 100,
defaultOptions: {}, defaultOptions: {},
} }
parentConfig: Partial<ExtensionConfig> = {} constructor(config: Partial<ExtensionConfig<Options>> = {}) {
options!: Options
constructor(config: ExtensionConfig<Options>) {
this.config = { this.config = {
...this.config, ...this.config,
...config, ...config,
} }
this.name = this.config.name
this.options = this.config.defaultOptions this.options = this.config.defaultOptions
} }
static create<O>(config: ExtensionConfig<O>) { static create<O>(config: Partial<ExtensionConfig<O>> = {}) {
return new Extension<O>(config) return new Extension<O>(config)
} }
configure(options: Partial<Options> = {}) { configure(options: Partial<Options> = {}) {
return Extension this.options = mergeDeep(this.options, options) as Options
.create<Options>(this.config as ExtensionConfig<Options>)
.#configure(options)
}
#configure = (options: Partial<Options>) => {
this.options = mergeDeep(this.config.defaultOptions, options) as Options
return this return this
} }
extend<ExtendedOptions = Options>(extendedConfig: Partial<ExtensionConfig<ExtendedOptions>>) { extend<ExtendedOptions = Options>(extendedConfig: Partial<ExtensionConfig<ExtendedOptions>> = {}) {
const extension = new Extension<ExtendedOptions>({ const extension = new Extension<ExtendedOptions>(extendedConfig)
...this.config,
...extendedConfig,
} as ExtensionConfig<ExtendedOptions>)
extension.parentConfig = this.config extension.parent = this
this.child = extension
extension.name = extendedConfig.name
? extendedConfig.name
: this.name
extension.options = {
...extension.parent.options,
...extension.options,
}
return extension return extension
} }

View File

@@ -4,8 +4,8 @@ import { inputRules as inputRulesPlugin } from 'prosemirror-inputrules'
import { EditorView, Decoration } from 'prosemirror-view' import { EditorView, Decoration } from 'prosemirror-view'
import { Plugin } from 'prosemirror-state' import { Plugin } from 'prosemirror-state'
import { Editor } from './Editor' import { Editor } from './Editor'
import { Extensions, NodeViewRenderer, RawCommands } from './types' import { Extensions, RawCommands, AnyConfig } from './types'
import createExtensionContext from './helpers/createExtensionContext' import getExtensionField from './helpers/getExtensionField'
import getSchema from './helpers/getSchema' import getSchema from './helpers/getSchema'
import getSchemaTypeByName from './helpers/getSchemaTypeByName' import getSchemaTypeByName from './helpers/getSchemaTypeByName'
import getNodeType from './helpers/getNodeType' import getNodeType from './helpers/getNodeType'
@@ -13,6 +13,7 @@ import splitExtensions from './helpers/splitExtensions'
import getAttributesFromExtensions from './helpers/getAttributesFromExtensions' import getAttributesFromExtensions from './helpers/getAttributesFromExtensions'
import getRenderedAttributes from './helpers/getRenderedAttributes' import getRenderedAttributes from './helpers/getRenderedAttributes'
import callOrReturn from './utilities/callOrReturn' import callOrReturn from './utilities/callOrReturn'
import { NodeConfig } from '.'
export default class ExtensionManager { export default class ExtensionManager {
@@ -30,50 +31,98 @@ export default class ExtensionManager {
this.schema = getSchema(this.extensions) this.schema = getSchema(this.extensions)
this.extensions.forEach(extension => { this.extensions.forEach(extension => {
const context = createExtensionContext(extension, { const context = {
options: extension.options, options: extension.options,
editor: this.editor, editor: this.editor,
type: getSchemaTypeByName(extension.config.name, this.schema), type: getSchemaTypeByName(extension.name, this.schema),
}) }
if (extension.type === 'mark') { if (extension.type === 'mark') {
const keepOnSplit = callOrReturn(extension.config.keepOnSplit, context) ?? true const keepOnSplit = callOrReturn(getExtensionField(extension, 'keepOnSplit', context)) ?? true
if (keepOnSplit) { if (keepOnSplit) {
this.splittableMarks.push(extension.config.name) this.splittableMarks.push(extension.name)
} }
} }
if (typeof extension.config.onBeforeCreate === 'function') { const onBeforeCreate = getExtensionField<AnyConfig['onBeforeCreate']>(
this.editor.on('beforeCreate', extension.config.onBeforeCreate.bind(context)) extension,
'onBeforeCreate',
context,
)
if (onBeforeCreate) {
this.editor.on('beforeCreate', onBeforeCreate)
} }
if (typeof extension.config.onCreate === 'function') { const onCreate = getExtensionField<AnyConfig['onCreate']>(
this.editor.on('create', extension.config.onCreate.bind(context)) extension,
'onCreate',
context,
)
if (onCreate) {
this.editor.on('create', onCreate)
} }
if (typeof extension.config.onUpdate === 'function') { const onUpdate = getExtensionField<AnyConfig['onUpdate']>(
this.editor.on('update', extension.config.onUpdate.bind(context)) extension,
'onUpdate',
context,
)
if (onUpdate) {
this.editor.on('update', onUpdate)
} }
if (typeof extension.config.onSelectionUpdate === 'function') { const onSelectionUpdate = getExtensionField<AnyConfig['onSelectionUpdate']>(
this.editor.on('selectionUpdate', extension.config.onSelectionUpdate.bind(context)) extension,
'onSelectionUpdate',
context,
)
if (onSelectionUpdate) {
this.editor.on('selectionUpdate', onSelectionUpdate)
} }
if (typeof extension.config.onTransaction === 'function') { const onTransaction = getExtensionField<AnyConfig['onTransaction']>(
this.editor.on('transaction', extension.config.onTransaction.bind(context)) extension,
'onTransaction',
context,
)
if (onTransaction) {
this.editor.on('transaction', onTransaction)
} }
if (typeof extension.config.onFocus === 'function') { const onFocus = getExtensionField<AnyConfig['onFocus']>(
this.editor.on('focus', extension.config.onFocus.bind(context)) extension,
'onFocus',
context,
)
if (onFocus) {
this.editor.on('focus', onFocus)
} }
if (typeof extension.config.onBlur === 'function') { const onBlur = getExtensionField<AnyConfig['onBlur']>(
this.editor.on('blur', extension.config.onBlur.bind(context)) extension,
'onBlur',
context,
)
if (onBlur) {
this.editor.on('blur', onBlur)
} }
if (typeof extension.config.onDestroy === 'function') { const onDestroy = getExtensionField<AnyConfig['onDestroy']>(
this.editor.on('destroy', extension.config.onDestroy.bind(context)) extension,
'onDestroy',
context,
)
if (onDestroy) {
this.editor.on('destroy', onDestroy)
} }
}) })
} }
@@ -82,11 +131,14 @@ export default class ExtensionManager {
const defaultPriority = 100 const defaultPriority = 100
return extensions.sort((a, b) => { return extensions.sort((a, b) => {
if ((a.config.priority || defaultPriority) > (b.config.priority || defaultPriority)) { const priorityA = getExtensionField<AnyConfig['priority']>(a, 'priority') || defaultPriority
const priorityB = getExtensionField<AnyConfig['priority']>(b, 'priority') || defaultPriority
if (priorityA > priorityB) {
return -1 return -1
} }
if ((a.config.priority || defaultPriority) < (b.config.priority || defaultPriority)) { if (priorityA < priorityB) {
return 1 return 1
} }
@@ -96,19 +148,25 @@ export default class ExtensionManager {
get commands(): RawCommands { get commands(): RawCommands {
return this.extensions.reduce((commands, extension) => { return this.extensions.reduce((commands, extension) => {
const context = createExtensionContext(extension, { const context = {
options: extension.options, options: extension.options,
editor: this.editor, editor: this.editor,
type: getSchemaTypeByName(extension.config.name, this.schema), type: getSchemaTypeByName(extension.name, this.schema),
}) }
if (!extension.config.addCommands) { const addCommands = getExtensionField<AnyConfig['addCommands']>(
extension,
'addCommands',
context,
)
if (!addCommands) {
return commands return commands
} }
return { return {
...commands, ...commands,
...extension.config.addCommands.bind(context)(), ...addCommands(),
} }
}, {} as RawCommands) }, {} as RawCommands)
} }
@@ -117,22 +175,34 @@ export default class ExtensionManager {
return [...this.extensions] return [...this.extensions]
.reverse() .reverse()
.map(extension => { .map(extension => {
const context = createExtensionContext(extension, { const context = {
options: extension.options, options: extension.options,
editor: this.editor, editor: this.editor,
type: getSchemaTypeByName(extension.config.name, this.schema), type: getSchemaTypeByName(extension.name, this.schema),
}) }
const plugins: Plugin[] = [] const plugins: Plugin[] = []
if (extension.config.addKeyboardShortcuts) { const addKeyboardShortcuts = getExtensionField<AnyConfig['addKeyboardShortcuts']>(
const keyMapPlugin = keymap(extension.config.addKeyboardShortcuts.bind(context)()) extension,
'addKeyboardShortcuts',
context,
)
if (addKeyboardShortcuts) {
const keyMapPlugin = keymap(addKeyboardShortcuts())
plugins.push(keyMapPlugin) plugins.push(keyMapPlugin)
} }
if (this.editor.options.enableInputRules && extension.config.addInputRules) { const addInputRules = getExtensionField<AnyConfig['addInputRules']>(
const inputRules = extension.config.addInputRules.bind(context)() extension,
'addInputRules',
context,
)
if (this.editor.options.enableInputRules && addInputRules) {
const inputRules = addInputRules()
const inputRulePlugins = inputRules.length const inputRulePlugins = inputRules.length
? [inputRulesPlugin({ rules: inputRules })] ? [inputRulesPlugin({ rules: inputRules })]
: [] : []
@@ -140,14 +210,26 @@ export default class ExtensionManager {
plugins.push(...inputRulePlugins) plugins.push(...inputRulePlugins)
} }
if (this.editor.options.enablePasteRules && extension.config.addPasteRules) { const addPasteRules = getExtensionField<AnyConfig['addPasteRules']>(
const pasteRulePlugins = extension.config.addPasteRules.bind(context)() extension,
'addPasteRules',
context,
)
if (this.editor.options.enablePasteRules && addPasteRules) {
const pasteRulePlugins = addPasteRules()
plugins.push(...pasteRulePlugins) plugins.push(...pasteRulePlugins)
} }
if (extension.config.addProseMirrorPlugins) { const addProseMirrorPlugins = getExtensionField<AnyConfig['addProseMirrorPlugins']>(
const proseMirrorPlugins = extension.config.addProseMirrorPlugins.bind(context)() extension,
'addProseMirrorPlugins',
context,
)
if (addProseMirrorPlugins) {
const proseMirrorPlugins = addProseMirrorPlugins()
plugins.push(...proseMirrorPlugins) plugins.push(...proseMirrorPlugins)
} }
@@ -166,15 +248,23 @@ export default class ExtensionManager {
const { nodeExtensions } = splitExtensions(this.extensions) const { nodeExtensions } = splitExtensions(this.extensions)
return Object.fromEntries(nodeExtensions return Object.fromEntries(nodeExtensions
.filter(extension => !!extension.config.addNodeView) .filter(extension => !!getExtensionField(extension, 'addNodeView'))
.map(extension => { .map(extension => {
const extensionAttributes = this.attributes.filter(attribute => attribute.type === extension.config.name) const extensionAttributes = this.attributes.filter(attribute => attribute.type === extension.name)
const context = createExtensionContext(extension, { const context = {
options: extension.options, options: extension.options,
editor, editor,
type: getNodeType(extension.config.name, this.schema), type: getNodeType(extension.name, this.schema),
}) }
const renderer = extension.config.addNodeView?.call(context) as NodeViewRenderer const addNodeView = getExtensionField<NodeConfig['addNodeView']>(
extension,
'addNodeView',
context,
)
if (!addNodeView) {
return []
}
const nodeview = ( const nodeview = (
node: ProsemirrorNode, node: ProsemirrorNode,
@@ -184,7 +274,7 @@ export default class ExtensionManager {
) => { ) => {
const HTMLAttributes = getRenderedAttributes(node, extensionAttributes) const HTMLAttributes = getRenderedAttributes(node, extensionAttributes)
return renderer({ return addNodeView()({
editor, editor,
node, node,
getPos, getPos,
@@ -194,7 +284,7 @@ export default class ExtensionManager {
}) })
} }
return [extension.config.name, nodeview] return [extension.name, nodeview]
})) }))
} }
@@ -203,17 +293,23 @@ export default class ExtensionManager {
const { nodeExtensions } = splitExtensions(this.extensions) const { nodeExtensions } = splitExtensions(this.extensions)
return Object.fromEntries(nodeExtensions return Object.fromEntries(nodeExtensions
.filter(extension => !!extension.config.renderText) .filter(extension => !!getExtensionField(extension, 'renderText'))
.map(extension => { .map(extension => {
const context = createExtensionContext(extension, { const context = {
options: extension.options, options: extension.options,
editor, editor,
type: getNodeType(extension.config.name, this.schema), type: getNodeType(extension.name, this.schema),
}) }
const textSerializer = (props: { node: ProsemirrorNode }) => extension.config.renderText?.call(context, props) const renderText = getExtensionField<NodeConfig['renderText']>(extension, 'renderText', context)
return [extension.config.name, textSerializer] if (!renderText) {
return []
}
const textSerializer = (props: { node: ProsemirrorNode }) => renderText(props)
return [extension.name, textSerializer]
})) }))
} }

View File

@@ -14,6 +14,7 @@ import {
GlobalAttributes, GlobalAttributes,
ParentConfig, ParentConfig,
} from './types' } from './types'
import { Node } from './Node'
import { MarkConfig } from '.' import { MarkConfig } from '.'
import { Editor } from './Editor' import { Editor } from './Editor'
@@ -41,7 +42,7 @@ declare module '@tiptap/core' {
*/ */
addGlobalAttributes?: (this: { addGlobalAttributes?: (this: {
options: Options, options: Options,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['addGlobalAttributes'],
}) => GlobalAttributes | {}, }) => GlobalAttributes | {},
/** /**
@@ -51,7 +52,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: MarkType, type: MarkType,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['addCommands'],
}) => Partial<RawCommands>, }) => Partial<RawCommands>,
/** /**
@@ -61,7 +62,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: MarkType, type: MarkType,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['addKeyboardShortcuts'],
}) => { }) => {
[key: string]: ProseMirrorCommand, [key: string]: ProseMirrorCommand,
}, },
@@ -73,7 +74,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: MarkType, type: MarkType,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['addInputRules'],
}) => InputRule[], }) => InputRule[],
/** /**
@@ -83,7 +84,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: MarkType, type: MarkType,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['addPasteRules'],
}) => Plugin[], }) => Plugin[],
/** /**
@@ -93,7 +94,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: MarkType, type: MarkType,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['addProseMirrorPlugins'],
}) => Plugin[], }) => Plugin[],
/** /**
@@ -102,7 +103,7 @@ declare module '@tiptap/core' {
extendNodeSchema?: (( extendNodeSchema?: ((
this: { this: {
options: Options, options: Options,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['extendNodeSchema'],
}, },
extension: Node, extension: Node,
) => { ) => {
@@ -115,9 +116,9 @@ declare module '@tiptap/core' {
extendMarkSchema?: (( extendMarkSchema?: ((
this: { this: {
options: Options, options: Options,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['extendMarkSchema'],
}, },
extension: Node, extension: Mark,
) => { ) => {
[key: string]: any, [key: string]: any,
}) | null, }) | null,
@@ -125,11 +126,11 @@ declare module '@tiptap/core' {
/** /**
* The editor is not ready yet. * The editor is not ready yet.
*/ */
onBeforeCreate?: ((this: { onBeforeCreate?: ((this: {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: MarkType, type: MarkType,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['onBeforeCreate'],
}) => void) | null, }) => void) | null,
/** /**
@@ -139,7 +140,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: MarkType, type: MarkType,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['onCreate'],
}) => void) | null, }) => void) | null,
/** /**
@@ -149,7 +150,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: MarkType, type: MarkType,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['onUpdate'],
}) => void) | null, }) => void) | null,
/** /**
@@ -159,7 +160,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: MarkType, type: MarkType,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['onSelectionUpdate'],
}) => void) | null, }) => void) | null,
/** /**
@@ -170,7 +171,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: MarkType, type: MarkType,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['onTransaction'],
}, },
props: { props: {
transaction: Transaction, transaction: Transaction,
@@ -185,7 +186,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: MarkType, type: MarkType,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['onFocus'],
}, },
props: { props: {
event: FocusEvent, event: FocusEvent,
@@ -200,7 +201,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: MarkType, type: MarkType,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['onBlur'],
}, },
props: { props: {
event: FocusEvent, event: FocusEvent,
@@ -214,7 +215,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: MarkType, type: MarkType,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['onDestroy'],
}) => void) | null, }) => void) | null,
/** /**
@@ -227,7 +228,7 @@ declare module '@tiptap/core' {
*/ */
inclusive?: MarkSpec['inclusive'] | ((this: { inclusive?: MarkSpec['inclusive'] | ((this: {
options: Options, options: Options,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['inclusive'],
}) => MarkSpec['inclusive']), }) => MarkSpec['inclusive']),
/** /**
@@ -235,7 +236,7 @@ declare module '@tiptap/core' {
*/ */
excludes?: MarkSpec['excludes'] | ((this: { excludes?: MarkSpec['excludes'] | ((this: {
options: Options, options: Options,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['excludes'],
}) => MarkSpec['excludes']), }) => MarkSpec['excludes']),
/** /**
@@ -243,7 +244,7 @@ declare module '@tiptap/core' {
*/ */
group?: MarkSpec['group'] | ((this: { group?: MarkSpec['group'] | ((this: {
options: Options, options: Options,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['group'],
}) => MarkSpec['group']), }) => MarkSpec['group']),
/** /**
@@ -251,7 +252,7 @@ declare module '@tiptap/core' {
*/ */
spanning?: MarkSpec['spanning'] | ((this: { spanning?: MarkSpec['spanning'] | ((this: {
options: Options, options: Options,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['spanning'],
}) => MarkSpec['spanning']), }) => MarkSpec['spanning']),
/** /**
@@ -260,7 +261,7 @@ declare module '@tiptap/core' {
parseHTML?: ( parseHTML?: (
this: { this: {
options: Options, options: Options,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['parseHTML'],
}, },
) => MarkSpec['parseDOM'], ) => MarkSpec['parseDOM'],
@@ -270,12 +271,12 @@ declare module '@tiptap/core' {
renderHTML?: (( renderHTML?: ((
this: { this: {
options: Options, options: Options,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['renderHTML'],
}, },
props: { props: {
mark: ProseMirrorMark, mark: ProseMirrorMark,
HTMLAttributes: { [key: string]: any }, HTMLAttributes: { [key: string]: any },
} },
) => DOMOutputSpec) | null, ) => DOMOutputSpec) | null,
/** /**
@@ -284,7 +285,7 @@ declare module '@tiptap/core' {
addAttributes?: ( addAttributes?: (
this: { this: {
options: Options, options: Options,
parentConfig: ParentConfig<MarkConfig<Options>>, parent: ParentConfig<MarkConfig<Options>>['addAttributes'],
}, },
) => Attributes | {}, ) => Attributes | {},
} }
@@ -293,48 +294,55 @@ declare module '@tiptap/core' {
export class Mark<Options = any> { export class Mark<Options = any> {
type = 'mark' type = 'mark'
name = 'mark'
parent: Mark | null = null
child: Mark | null = null
options: Options
config: MarkConfig = { config: MarkConfig = {
name: 'mark', name: this.name,
priority: 100, priority: 100,
defaultOptions: {}, defaultOptions: {},
} }
parentConfig: Partial<MarkConfig> = {} constructor(config: Partial<MarkConfig<Options>> = {}) {
options!: Options
constructor(config: MarkConfig<Options>) {
this.config = { this.config = {
...this.config, ...this.config,
...config, ...config,
} }
this.name = this.config.name
this.options = this.config.defaultOptions this.options = this.config.defaultOptions
} }
static create<O>(config: MarkConfig<O>) { static create<O>(config: Partial<MarkConfig<O>> = {}) {
return new Mark<O>(config) return new Mark<O>(config)
} }
configure(options: Partial<Options> = {}) { configure(options: Partial<Options> = {}) {
return Mark this.options = mergeDeep(this.options, options) as Options
.create<Options>(this.config as MarkConfig<Options>)
.#configure(options)
}
#configure = (options: Partial<Options>) => {
this.options = mergeDeep(this.config.defaultOptions, options) as Options
return this return this
} }
extend<ExtendedOptions = Options>(extendedConfig: Partial<MarkConfig<ExtendedOptions>>) { extend<ExtendedOptions = Options>(extendedConfig: Partial<MarkConfig<ExtendedOptions>> = {}) {
const extension = new Mark<ExtendedOptions>({ const extension = new Mark<ExtendedOptions>(extendedConfig)
...this.config,
...extendedConfig,
} as MarkConfig<ExtendedOptions>)
extension.parentConfig = this.config extension.parent = this
this.child = extension
extension.name = extendedConfig.name
? extendedConfig.name
: this.name
extension.options = {
...extension.parent.options,
...extension.options,
}
return extension return extension
} }

View File

@@ -42,7 +42,7 @@ declare module '@tiptap/core' {
*/ */
addGlobalAttributes?: (this: { addGlobalAttributes?: (this: {
options: Options, options: Options,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['addGlobalAttributes'],
}) => GlobalAttributes | {}, }) => GlobalAttributes | {},
/** /**
@@ -52,7 +52,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: NodeType, type: NodeType,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['addCommands'],
}) => Partial<RawCommands>, }) => Partial<RawCommands>,
/** /**
@@ -62,7 +62,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: NodeType, type: NodeType,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['addKeyboardShortcuts'],
}) => { }) => {
[key: string]: ProseMirrorCommand, [key: string]: ProseMirrorCommand,
}, },
@@ -74,7 +74,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: NodeType, type: NodeType,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['addInputRules'],
}) => InputRule[], }) => InputRule[],
/** /**
@@ -84,7 +84,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: NodeType, type: NodeType,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['addPasteRules'],
}) => Plugin[], }) => Plugin[],
/** /**
@@ -94,7 +94,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: NodeType, type: NodeType,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['addProseMirrorPlugins'],
}) => Plugin[], }) => Plugin[],
/** /**
@@ -103,7 +103,7 @@ declare module '@tiptap/core' {
extendNodeSchema?: (( extendNodeSchema?: ((
this: { this: {
options: Options, options: Options,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['extendNodeSchema'],
}, },
extension: Node, extension: Node,
) => { ) => {
@@ -116,7 +116,7 @@ declare module '@tiptap/core' {
extendMarkSchema?: (( extendMarkSchema?: ((
this: { this: {
options: Options, options: Options,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['extendMarkSchema'],
}, },
extension: Node, extension: Node,
) => { ) => {
@@ -130,7 +130,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: NodeType, type: NodeType,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['onBeforeCreate'],
}) => void) | null, }) => void) | null,
/** /**
@@ -140,7 +140,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: NodeType, type: NodeType,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['onCreate'],
}) => void) | null, }) => void) | null,
/** /**
@@ -150,7 +150,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: NodeType, type: NodeType,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['onUpdate'],
}) => void) | null, }) => void) | null,
/** /**
@@ -160,7 +160,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: NodeType, type: NodeType,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['onSelectionUpdate'],
}) => void) | null, }) => void) | null,
/** /**
@@ -171,7 +171,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: NodeType, type: NodeType,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['onTransaction'],
}, },
props: { props: {
transaction: Transaction, transaction: Transaction,
@@ -186,7 +186,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: NodeType, type: NodeType,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['onFocus'],
}, },
props: { props: {
event: FocusEvent, event: FocusEvent,
@@ -201,7 +201,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: NodeType, type: NodeType,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['onBlur'],
}, },
props: { props: {
event: FocusEvent, event: FocusEvent,
@@ -215,7 +215,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: NodeType, type: NodeType,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['onDestroy'],
}) => void) | null, }) => void) | null,
/** /**
@@ -225,7 +225,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: NodeType, type: NodeType,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['addNodeView'],
}) => NodeViewRenderer) | null, }) => NodeViewRenderer) | null,
/** /**
@@ -238,7 +238,7 @@ declare module '@tiptap/core' {
*/ */
content?: NodeSpec['content'] | ((this: { content?: NodeSpec['content'] | ((this: {
options: Options, options: Options,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['content'],
}) => NodeSpec['content']), }) => NodeSpec['content']),
/** /**
@@ -246,7 +246,7 @@ declare module '@tiptap/core' {
*/ */
marks?: NodeSpec['marks'] | ((this: { marks?: NodeSpec['marks'] | ((this: {
options: Options, options: Options,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['marks'],
}) => NodeSpec['marks']), }) => NodeSpec['marks']),
/** /**
@@ -254,7 +254,7 @@ declare module '@tiptap/core' {
*/ */
group?: NodeSpec['group'] | ((this: { group?: NodeSpec['group'] | ((this: {
options: Options, options: Options,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['group'],
}) => NodeSpec['group']), }) => NodeSpec['group']),
/** /**
@@ -262,7 +262,7 @@ declare module '@tiptap/core' {
*/ */
inline?: NodeSpec['inline'] | ((this: { inline?: NodeSpec['inline'] | ((this: {
options: Options, options: Options,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['inline'],
}) => NodeSpec['inline']), }) => NodeSpec['inline']),
/** /**
@@ -270,7 +270,7 @@ declare module '@tiptap/core' {
*/ */
atom?: NodeSpec['atom'] | ((this: { atom?: NodeSpec['atom'] | ((this: {
options: Options, options: Options,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['atom'],
}) => NodeSpec['atom']), }) => NodeSpec['atom']),
/** /**
@@ -278,7 +278,7 @@ declare module '@tiptap/core' {
*/ */
selectable?: NodeSpec['selectable'] | ((this: { selectable?: NodeSpec['selectable'] | ((this: {
options: Options, options: Options,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['selectable'],
}) => NodeSpec['selectable']), }) => NodeSpec['selectable']),
/** /**
@@ -286,7 +286,7 @@ declare module '@tiptap/core' {
*/ */
draggable?: NodeSpec['draggable'] | ((this: { draggable?: NodeSpec['draggable'] | ((this: {
options: Options, options: Options,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['draggable'],
}) => NodeSpec['draggable']), }) => NodeSpec['draggable']),
/** /**
@@ -294,7 +294,7 @@ declare module '@tiptap/core' {
*/ */
code?: NodeSpec['code'] | ((this: { code?: NodeSpec['code'] | ((this: {
options: Options, options: Options,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['code'],
}) => NodeSpec['code']), }) => NodeSpec['code']),
/** /**
@@ -302,7 +302,7 @@ declare module '@tiptap/core' {
*/ */
defining?: NodeSpec['defining'] | ((this: { defining?: NodeSpec['defining'] | ((this: {
options: Options, options: Options,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['defining'],
}) => NodeSpec['defining']), }) => NodeSpec['defining']),
/** /**
@@ -310,7 +310,7 @@ declare module '@tiptap/core' {
*/ */
isolating?: NodeSpec['isolating'] | ((this: { isolating?: NodeSpec['isolating'] | ((this: {
options: Options, options: Options,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['isolating'],
}) => NodeSpec['isolating']), }) => NodeSpec['isolating']),
/** /**
@@ -319,7 +319,7 @@ declare module '@tiptap/core' {
parseHTML?: ( parseHTML?: (
this: { this: {
options: Options, options: Options,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['parseHTML'],
}, },
) => NodeSpec['parseDOM'], ) => NodeSpec['parseDOM'],
@@ -329,7 +329,7 @@ declare module '@tiptap/core' {
renderHTML?: (( renderHTML?: ((
this: { this: {
options: Options, options: Options,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['renderHTML'],
}, },
props: { props: {
node: ProseMirrorNode, node: ProseMirrorNode,
@@ -345,7 +345,7 @@ declare module '@tiptap/core' {
options: Options, options: Options,
editor: Editor, editor: Editor,
type: NodeType, type: NodeType,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['renderText'],
}, },
props: { props: {
node: ProseMirrorNode, node: ProseMirrorNode,
@@ -358,7 +358,7 @@ declare module '@tiptap/core' {
addAttributes?: ( addAttributes?: (
this: { this: {
options: Options, options: Options,
parentConfig: ParentConfig<NodeConfig<Options>>, parent: ParentConfig<NodeConfig<Options>>['addAttributes'],
}, },
) => Attributes | {}, ) => Attributes | {},
} }
@@ -367,48 +367,55 @@ declare module '@tiptap/core' {
export class Node<Options = any> { export class Node<Options = any> {
type = 'node' type = 'node'
name = 'node'
parent: Node | null = null
child: Node | null = null
options: Options
config: NodeConfig = { config: NodeConfig = {
name: 'node', name: this.name,
priority: 100, priority: 100,
defaultOptions: {}, defaultOptions: {},
} }
parentConfig: Partial<NodeConfig> = {} constructor(config: Partial<NodeConfig<Options>> = {}) {
options!: Options
constructor(config: NodeConfig<Options>) {
this.config = { this.config = {
...this.config, ...this.config,
...config, ...config,
} }
this.name = this.config.name
this.options = this.config.defaultOptions this.options = this.config.defaultOptions
} }
static create<O>(config: NodeConfig<O>) { static create<O>(config: Partial<NodeConfig<O>> = {}) {
return new Node<O>(config) return new Node<O>(config)
} }
configure(options: Partial<Options> = {}) { configure(options: Partial<Options> = {}) {
return Node this.options = mergeDeep(this.options, options) as Options
.create<Options>(this.config as NodeConfig<Options>)
.#configure(options)
}
#configure = (options: Partial<Options>) => {
this.options = mergeDeep(this.config.defaultOptions, options) as Options
return this return this
} }
extend<ExtendedOptions = Options>(extendedConfig: Partial<NodeConfig<ExtendedOptions>>) { extend<ExtendedOptions = Options>(extendedConfig: Partial<NodeConfig<ExtendedOptions>> = {}) {
const extension = new Node<ExtendedOptions>({ const extension = new Node<ExtendedOptions>(extendedConfig)
...this.config,
...extendedConfig,
} as NodeConfig<ExtendedOptions>)
extension.parentConfig = this.config extension.parent = this
this.child = extension
extension.name = extendedConfig.name
? extendedConfig.name
: this.name
extension.options = {
...extension.parent.options,
...extension.options,
}
return extension return extension
} }

View File

@@ -6,7 +6,7 @@ declare module '@tiptap/core' {
/** /**
* Clear the whole document. * Clear the whole document.
*/ */
clearContent: (emitUpdate: Boolean) => Command, clearContent: (emitUpdate?: Boolean) => Command,
} }
} }
} }

View File

@@ -17,7 +17,7 @@ function singleRect(object: Range | Element, bias: number) {
: rects[bias < 0 ? 0 : rects.length - 1] : rects[bias < 0 ? 0 : rects.length - 1]
} }
export function coordsAtPos(view: EditorView, pos: number, end = false) { export default function coordsAtPos(view: EditorView, pos: number, end = false) {
const { node, offset } = view.domAtPos(pos) // view.docView.domFromPos(pos); const { node, offset } = view.domAtPos(pos) // view.docView.domFromPos(pos);
let side: DOMRectSide | null = null let side: DOMRectSide | null = null
let rect: DOMRect | null = null let rect: DOMRect | null = null

View File

@@ -1,21 +0,0 @@
import { AnyExtension, AnyObject } from '../types'
export default function createExtensionContext<T>(
extension: AnyExtension,
data: T,
): T & { parentConfig: AnyObject } {
const context = {
...data,
get parentConfig() {
return Object.fromEntries(Object.entries(extension.parentConfig).map(([key, value]) => {
if (typeof value !== 'function') {
return [key, value]
}
return [key, value.bind(context)]
}))
},
}
return context
}

View File

@@ -1,12 +1,14 @@
import createExtensionContext from './createExtensionContext'
import splitExtensions from './splitExtensions' import splitExtensions from './splitExtensions'
import getExtensionField from './getExtensionField'
import { import {
Extensions, Extensions,
GlobalAttributes, GlobalAttributes,
Attributes, Attributes,
Attribute, Attribute,
ExtensionAttribute, ExtensionAttribute,
AnyConfig,
} from '../types' } from '../types'
import { NodeConfig, MarkConfig } from '..'
/** /**
* Get a list of all extension attributes defined in `addAttribute` and `addGlobalAttribute`. * Get a list of all extension attributes defined in `addAttribute` and `addGlobalAttribute`.
@@ -25,15 +27,22 @@ export default function getAttributesFromExtensions(extensions: Extensions): Ext
} }
extensions.forEach(extension => { extensions.forEach(extension => {
const context = createExtensionContext(extension, { const context = {
options: extension.options, options: extension.options,
}) }
if (!extension.config.addGlobalAttributes) { const addGlobalAttributes = getExtensionField<AnyConfig['addGlobalAttributes']>(
extension,
'addGlobalAttributes',
context,
)
if (!addGlobalAttributes) {
return return
} }
const globalAttributes = extension.config.addGlobalAttributes.bind(context)() as GlobalAttributes // TODO: remove `as GlobalAttributes`
const globalAttributes = addGlobalAttributes() as GlobalAttributes
globalAttributes.forEach(globalAttribute => { globalAttributes.forEach(globalAttribute => {
globalAttribute.types.forEach(type => { globalAttribute.types.forEach(type => {
@@ -54,21 +63,28 @@ export default function getAttributesFromExtensions(extensions: Extensions): Ext
}) })
nodeAndMarkExtensions.forEach(extension => { nodeAndMarkExtensions.forEach(extension => {
const context = createExtensionContext(extension, { const context = {
options: extension.options, options: extension.options,
}) }
if (!extension.config.addAttributes) { const addAttributes = getExtensionField<NodeConfig['addAttributes'] | MarkConfig['addAttributes']>(
extension,
'addAttributes',
context,
)
if (!addAttributes) {
return return
} }
const attributes = extension.config.addAttributes.bind(context)() as Attributes // TODO: remove `as Attributes`
const attributes = addAttributes() as Attributes
Object Object
.entries(attributes) .entries(attributes)
.forEach(([name, attribute]) => { .forEach(([name, attribute]) => {
extensionAttributes.push({ extensionAttributes.push({
type: extension.config.name, type: extension.name,
name, name,
attribute: { attribute: {
...defaultAttribute, ...defaultAttribute,

View File

@@ -0,0 +1,25 @@
import { AnyExtension, AnyObject, RemoveThis } from '../types'
export default function getExtensionField<T = any>(
extension: AnyExtension,
field: string,
context: AnyObject = {},
): RemoveThis<T> {
if (extension.config[field] === undefined && extension.parent) {
return getExtensionField(extension.parent, field, context)
}
if (typeof extension.config[field] === 'function') {
const value = extension.config[field].bind({
...context,
parent: extension.parent
? getExtensionField(extension.parent, field, context)
: null,
})
return value
}
return extension.config[field]
}

View File

@@ -1,13 +1,13 @@
import { NodeSpec, MarkSpec, Schema } from 'prosemirror-model' import { NodeSpec, MarkSpec, Schema } from 'prosemirror-model'
import { Extensions } from '../types' import { AnyConfig, Extensions } from '../types'
import { ExtensionConfig, NodeConfig, MarkConfig } from '..' import { NodeConfig, MarkConfig } from '..'
import createExtensionContext from './createExtensionContext'
import splitExtensions from './splitExtensions' import splitExtensions from './splitExtensions'
import getAttributesFromExtensions from './getAttributesFromExtensions' import getAttributesFromExtensions from './getAttributesFromExtensions'
import getRenderedAttributes from './getRenderedAttributes' import getRenderedAttributes from './getRenderedAttributes'
import isEmptyObject from '../utilities/isEmptyObject' import isEmptyObject from '../utilities/isEmptyObject'
import injectExtensionAttributesToParseRule from './injectExtensionAttributesToParseRule' import injectExtensionAttributesToParseRule from './injectExtensionAttributesToParseRule'
import callOrReturn from '../utilities/callOrReturn' import callOrReturn from '../utilities/callOrReturn'
import getExtensionField from './getExtensionField'
function cleanUpSchemaItem<T>(data: T) { function cleanUpSchemaItem<T>(data: T) {
return Object.fromEntries(Object.entries(data).filter(([key, value]) => { return Object.fromEntries(Object.entries(data).filter(([key, value]) => {
@@ -22,116 +22,110 @@ function cleanUpSchemaItem<T>(data: T) {
export default function getSchema(extensions: Extensions): Schema { export default function getSchema(extensions: Extensions): Schema {
const allAttributes = getAttributesFromExtensions(extensions) const allAttributes = getAttributesFromExtensions(extensions)
const { nodeExtensions, markExtensions } = splitExtensions(extensions) const { nodeExtensions, markExtensions } = splitExtensions(extensions)
const topNode = nodeExtensions.find(extension => extension.config.topNode)?.config.name const topNode = nodeExtensions.find(extension => getExtensionField(extension, 'topNode'))?.name
const nodeSchemaExtenders: (
| ExtensionConfig['extendNodeSchema']
| NodeConfig['extendNodeSchema']
| MarkConfig['extendNodeSchema']
)[] = []
const markSchemaExtenders: (
| ExtensionConfig['extendNodeSchema']
| NodeConfig['extendNodeSchema']
| MarkConfig['extendNodeSchema']
)[] = []
extensions.forEach(extension => {
if (typeof extension.config.extendNodeSchema === 'function') {
nodeSchemaExtenders.push(extension.config.extendNodeSchema)
}
if (typeof extension.config.extendMarkSchema === 'function') {
markSchemaExtenders.push(extension.config.extendMarkSchema)
}
})
const nodes = Object.fromEntries(nodeExtensions.map(extension => { const nodes = Object.fromEntries(nodeExtensions.map(extension => {
const extensionAttributes = allAttributes.filter(attribute => attribute.type === extension.config.name) const extensionAttributes = allAttributes.filter(attribute => attribute.type === extension.name)
const context = createExtensionContext(extension, { const context = {
options: extension.options, options: extension.options,
}) }
const extraNodeFields = nodeSchemaExtenders.reduce((fields, nodeSchemaExtender) => { const extraNodeFields = extensions.reduce((fields, e) => {
const extraFields = callOrReturn(nodeSchemaExtender, context, extension) const extendNodeSchema = getExtensionField<AnyConfig['extendNodeSchema']>(
e,
'extendNodeSchema',
context,
)
return { return {
...fields, ...fields,
...extraFields, ...(extendNodeSchema ? extendNodeSchema(extension) : {}),
} }
}, {}) }, {})
const schema: NodeSpec = cleanUpSchemaItem({ const schema: NodeSpec = cleanUpSchemaItem({
...extraNodeFields, ...extraNodeFields,
content: callOrReturn(extension.config.content, context), content: callOrReturn(getExtensionField<NodeConfig['content']>(extension, 'content', context)),
marks: callOrReturn(extension.config.marks, context), marks: callOrReturn(getExtensionField<NodeConfig['marks']>(extension, 'marks', context)),
group: callOrReturn(extension.config.group, context), group: callOrReturn(getExtensionField<NodeConfig['group']>(extension, 'group', context)),
inline: callOrReturn(extension.config.inline, context), inline: callOrReturn(getExtensionField<NodeConfig['inline']>(extension, 'inline', context)),
atom: callOrReturn(extension.config.atom, context), atom: callOrReturn(getExtensionField<NodeConfig['atom']>(extension, 'atom', context)),
selectable: callOrReturn(extension.config.selectable, context), selectable: callOrReturn(getExtensionField<NodeConfig['selectable']>(extension, 'selectable', context)),
draggable: callOrReturn(extension.config.draggable, context), draggable: callOrReturn(getExtensionField<NodeConfig['draggable']>(extension, 'draggable', context)),
code: callOrReturn(extension.config.code, context), code: callOrReturn(getExtensionField<NodeConfig['code']>(extension, 'code', context)),
defining: callOrReturn(extension.config.defining, context), defining: callOrReturn(getExtensionField<NodeConfig['defining']>(extension, 'defining', context)),
isolating: callOrReturn(extension.config.isolating, context), isolating: callOrReturn(getExtensionField<NodeConfig['isolating']>(extension, 'isolating', context)),
attrs: Object.fromEntries(extensionAttributes.map(extensionAttribute => { attrs: Object.fromEntries(extensionAttributes.map(extensionAttribute => {
return [extensionAttribute.name, { default: extensionAttribute?.attribute?.default }] return [extensionAttribute.name, { default: extensionAttribute?.attribute?.default }]
})), })),
}) })
if (extension.config.parseHTML) { const parseHTML = callOrReturn(getExtensionField<NodeConfig['parseHTML']>(extension, 'parseHTML', context))
schema.parseDOM = extension.config.parseHTML
.bind(context)() if (parseHTML) {
?.map(parseRule => injectExtensionAttributesToParseRule(parseRule, extensionAttributes)) schema.parseDOM = parseHTML
.map(parseRule => injectExtensionAttributesToParseRule(parseRule, extensionAttributes))
} }
if (extension.config.renderHTML) { const renderHTML = getExtensionField<NodeConfig['renderHTML']>(extension, 'renderHTML', context)
schema.toDOM = node => (extension.config.renderHTML as Function)?.bind(context)({
if (renderHTML) {
schema.toDOM = node => renderHTML({
node, node,
HTMLAttributes: getRenderedAttributes(node, extensionAttributes), HTMLAttributes: getRenderedAttributes(node, extensionAttributes),
}) })
} }
return [extension.config.name, schema] return [extension.name, schema]
})) }))
const marks = Object.fromEntries(markExtensions.map(extension => { const marks = Object.fromEntries(markExtensions.map(extension => {
const extensionAttributes = allAttributes.filter(attribute => attribute.type === extension.config.name) const extensionAttributes = allAttributes.filter(attribute => attribute.type === extension.name)
const context = createExtensionContext(extension, { const context = {
options: extension.options, options: extension.options,
}) }
const extraMarkFields = markSchemaExtenders.reduce((fields, markSchemaExtender) => { const extraMarkFields = extensions.reduce((fields, e) => {
const extraFields = callOrReturn(markSchemaExtender, context, extension) const extendMarkSchema = getExtensionField<AnyConfig['extendMarkSchema']>(
e,
'extendMarkSchema',
context,
)
return { return {
...fields, ...fields,
...extraFields, ...(extendMarkSchema ? extendMarkSchema(extension) : {}),
} }
}, {}) }, {})
const schema: MarkSpec = cleanUpSchemaItem({ const schema: MarkSpec = cleanUpSchemaItem({
...extraMarkFields, ...extraMarkFields,
inclusive: callOrReturn(extension.config.inclusive, context), inclusive: callOrReturn(getExtensionField<NodeConfig['inclusive']>(extension, 'inclusive', context)),
excludes: callOrReturn(extension.config.excludes, context), excludes: callOrReturn(getExtensionField<NodeConfig['excludes']>(extension, 'excludes', context)),
group: callOrReturn(extension.config.group, context), group: callOrReturn(getExtensionField<NodeConfig['group']>(extension, 'group', context)),
spanning: callOrReturn(extension.config.spanning, context), spanning: callOrReturn(getExtensionField<NodeConfig['spanning']>(extension, 'spanning', context)),
attrs: Object.fromEntries(extensionAttributes.map(extensionAttribute => { attrs: Object.fromEntries(extensionAttributes.map(extensionAttribute => {
return [extensionAttribute.name, { default: extensionAttribute?.attribute?.default }] return [extensionAttribute.name, { default: extensionAttribute?.attribute?.default }]
})), })),
}) })
if (extension.config.parseHTML) { const parseHTML = callOrReturn(getExtensionField<MarkConfig['parseHTML']>(extension, 'parseHTML', context))
schema.parseDOM = extension.config.parseHTML
.bind(context)() if (parseHTML) {
?.map(parseRule => injectExtensionAttributesToParseRule(parseRule, extensionAttributes)) schema.parseDOM = parseHTML
.map(parseRule => injectExtensionAttributesToParseRule(parseRule, extensionAttributes))
} }
if (extension.config.renderHTML) { const renderHTML = getExtensionField<MarkConfig['renderHTML']>(extension, 'renderHTML', context)
schema.toDOM = mark => (extension.config.renderHTML as Function)?.bind(context)({
if (renderHTML) {
schema.toDOM = mark => renderHTML({
mark, mark,
HTMLAttributes: getRenderedAttributes(mark, extensionAttributes), HTMLAttributes: getRenderedAttributes(mark, extensionAttributes),
}) })
} }
return [extension.config.name, schema] return [extension.name, schema]
})) }))
return new Schema({ return new Schema({

View File

@@ -1,20 +1,23 @@
import { Extensions } from '../types' import { Extensions } from '../types'
import { NodeConfig } from '..'
import splitExtensions from './splitExtensions' import splitExtensions from './splitExtensions'
import callOrReturn from '../utilities/callOrReturn' import callOrReturn from '../utilities/callOrReturn'
import getExtensionField from '../helpers/getExtensionField'
export default function isList(name: string, extensions: Extensions): boolean { export default function isList(name: string, extensions: Extensions): boolean {
const { nodeExtensions } = splitExtensions(extensions) const { nodeExtensions } = splitExtensions(extensions)
const extension = nodeExtensions.find(item => item.config.name === name) const extension = nodeExtensions.find(item => item.name === name)
if (!extension) { if (!extension) {
return false return false
} }
const groups = callOrReturn(extension.config.group, { options: extension.options }) const context = { options: extension.options }
const group = callOrReturn(getExtensionField<NodeConfig['group']>(extension, 'group', context))
if (typeof groups !== 'string') { if (typeof group !== 'string') {
return false return false
} }
return groups.split(' ').includes('list') return group.split(' ').includes('list')
} }

View File

@@ -0,0 +1,30 @@
import { EditorView } from 'prosemirror-view'
import coordsAtPos from './coordsAtPos'
export default function posToDOMRect(view: EditorView, from: number, to: number): DOMRect {
const start = coordsAtPos(view, from)
const end = coordsAtPos(view, to, true)
const top = Math.min(start.top, end.top)
const bottom = Math.max(start.bottom, end.bottom)
const left = Math.min(start.left, end.left)
const right = Math.max(start.right, end.right)
const width = right - left
const height = bottom - top
const x = left
const y = top
const data = {
top,
bottom,
left,
right,
width,
height,
x,
y,
}
return {
...data,
toJSON: () => data,
}
}

View File

@@ -12,7 +12,8 @@ export { default as markPasteRule } from './pasteRules/markPasteRule'
export { default as callOrReturn } from './utilities/callOrReturn' export { default as callOrReturn } from './utilities/callOrReturn'
export { default as mergeAttributes } from './utilities/mergeAttributes' export { default as mergeAttributes } from './utilities/mergeAttributes'
export { default as createExtensionContext } from './helpers/createExtensionContext' export { default as coordsAtPos } from './helpers/coordsAtPos'
export { default as getExtensionField } from './helpers/getExtensionField'
export { default as findChildren } from './helpers/findChildren' export { default as findChildren } from './helpers/findChildren'
export { default as findParentNode } from './helpers/findParentNode' export { default as findParentNode } from './helpers/findParentNode'
export { default as findParentNodeClosestToPos } from './helpers/findParentNodeClosestToPos' export { default as findParentNodeClosestToPos } from './helpers/findParentNodeClosestToPos'
@@ -26,6 +27,7 @@ export { default as isNodeActive } from './helpers/isNodeActive'
export { default as isNodeEmpty } from './helpers/isNodeEmpty' export { default as isNodeEmpty } from './helpers/isNodeEmpty'
export { default as isNodeSelection } from './helpers/isNodeSelection' export { default as isNodeSelection } from './helpers/isNodeSelection'
export { default as isTextSelection } from './helpers/isTextSelection' export { default as isTextSelection } from './helpers/isTextSelection'
export { default as posToDOMRect } from './helpers/posToDOMRect'
export interface Commands {} export interface Commands {}

View File

@@ -57,6 +57,10 @@ const style = `.ProseMirror {
.ProseMirror-focused .ProseMirror-gapcursor { .ProseMirror-focused .ProseMirror-gapcursor {
display: block; display: block;
}
.tippy-box[data-animation=fade][data-state=hidden] {
opacity: 0
}` }`
export default style export default style

View File

@@ -14,17 +14,31 @@ import { Extension } from './Extension'
import { Node } from './Node' import { Node } from './Node'
import { Mark } from './Mark' import { Mark } from './Mark'
import { Editor } from './Editor' import { Editor } from './Editor'
import { Commands } from '.' import {
Commands,
ExtensionConfig,
NodeConfig,
MarkConfig,
} from '.'
export type AnyConfig = ExtensionConfig | NodeConfig | MarkConfig
export type AnyExtension = Extension | Node | Mark export type AnyExtension = Extension | Node | Mark
export type Extensions = AnyExtension[] export type Extensions = AnyExtension[]
export type ParentConfig<T> = Partial<{ export type ParentConfig<T> = Partial<{
[P in keyof T]: Required<T>[P] extends () => any [P in keyof T]: Required<T>[P] extends (...args: any) => any
? (...args: Parameters<Required<T>[P]>) => ReturnType<Required<T>[P]> ? (...args: Parameters<Required<T>[P]>) => ReturnType<Required<T>[P]>
: T[P] : T[P]
}> }>
export type RemoveThis<T> = T extends (...args: any) => any
? (...args: Parameters<T>) => ReturnType<T>
: T
export type MaybeReturnType<T> = T extends (...args: any) => any
? ReturnType<T>
: T
export interface EditorOptions { export interface EditorOptions {
element: Element, element: Element,
content: Content, content: Content,
@@ -43,7 +57,6 @@ export interface EditorOptions {
onTransaction: (props: { editor: Editor, transaction: Transaction }) => void, onTransaction: (props: { editor: Editor, transaction: Transaction }) => void,
onFocus: (props: { editor: Editor, event: FocusEvent }) => void, onFocus: (props: { editor: Editor, event: FocusEvent }) => void,
onBlur: (props: { editor: Editor, event: FocusEvent }) => void, onBlur: (props: { editor: Editor, event: FocusEvent }) => void,
onResize: (props: { editor: Editor }) => void,
onDestroy: () => void, onDestroy: () => void,
} }

View File

@@ -1,3 +1,5 @@
import { MaybeReturnType } from '../types'
/** /**
* Optionally calls `value` as a function. * Optionally calls `value` as a function.
* Otherwise it is returned directly. * Otherwise it is returned directly.
@@ -5,7 +7,7 @@
* @param context Optional context to bind to function. * @param context Optional context to bind to function.
* @param props Optional props to pass to function. * @param props Optional props to pass to function.
*/ */
export default function callOrReturn(value: any, context: any = undefined, ...props: any[]): any { export default function callOrReturn<T>(value: T, context: any = undefined, ...props: any[]): MaybeReturnType<T> {
if (typeof value === 'function') { if (typeof value === 'function') {
if (context) { if (context) {
return value.bind(context)(...props) return value.bind(context)(...props)
@@ -14,5 +16,5 @@ export default function callOrReturn(value: any, context: any = undefined, ...pr
return value(...props) return value(...props)
} }
return value return value as MaybeReturnType<T>
} }

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-blockquote@2.0.0-beta.2...@tiptap/extension-blockquote@2.0.0-beta.3) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-blockquote
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-blockquote@2.0.0-beta.1...@tiptap/extension-blockquote@2.0.0-beta.2) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-blockquote
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-blockquote@2.0.0-alpha.11...@tiptap/extension-blockquote@2.0.0-beta.1) (2021-03-05) # [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-blockquote@2.0.0-alpha.11...@tiptap/extension-blockquote@2.0.0-beta.1) (2021-03-05)
**Note:** Version bump only for package @tiptap/extension-blockquote **Note:** Version bump only for package @tiptap/extension-blockquote

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-bold@2.0.0-beta.2...@tiptap/extension-bold@2.0.0-beta.3) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-bold
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-bold@2.0.0-beta.1...@tiptap/extension-bold@2.0.0-beta.2) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-bold
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-bold@2.0.0-alpha.11...@tiptap/extension-bold@2.0.0-beta.1) (2021-03-05) # [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-bold@2.0.0-alpha.11...@tiptap/extension-bold@2.0.0-beta.1) (2021-03-05)
**Note:** Version bump only for package @tiptap/extension-bold **Note:** Version bump only for package @tiptap/extension-bold

View File

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

View File

@@ -3,6 +3,32 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.7](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-bubble-menu@2.0.0-beta.6...@tiptap/extension-bubble-menu@2.0.0-beta.7) (2021-04-16)
### Bug Fixes
* fix tippy for react ([398fc7f](https://github.com/ueberdosis/tiptap-next/commit/398fc7f210b9d5449cbb00543ddf4af768552b9c))
### Features
* add coordsAtPos and posToClientRect helper methods ([8dab614](https://github.com/ueberdosis/tiptap-next/commit/8dab6144a661e4c90f33d9d2f300882009eadd46))
* add tippyOptions prop ([9a56f66](https://github.com/ueberdosis/tiptap-next/commit/9a56f666a118ca7c59a6f1f67f40e6490e20d3b8))
* remove keepInBounds ([d7282f1](https://github.com/ueberdosis/tiptap-next/commit/d7282f168bc6cfae4e1630d14bb8462bc135b254))
# [2.0.0-beta.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-bubble-menu@2.0.0-beta.5...@tiptap/extension-bubble-menu@2.0.0-beta.6) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-bubble-menu
# [2.0.0-beta.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-bubble-menu@2.0.0-beta.4...@tiptap/extension-bubble-menu@2.0.0-beta.5) (2021-04-01) # [2.0.0-beta.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-bubble-menu@2.0.0-beta.4...@tiptap/extension-bubble-menu@2.0.0-beta.5) (2021-04-01)
**Note:** Version bump only for package @tiptap/extension-bubble-menu **Note:** Version bump only for package @tiptap/extension-bubble-menu

View File

@@ -1,7 +1,7 @@
{ {
"name": "@tiptap/extension-bubble-menu", "name": "@tiptap/extension-bubble-menu",
"description": "bubble-menu extension for tiptap", "description": "bubble-menu extension for tiptap",
"version": "2.0.0-beta.5", "version": "2.0.0-beta.7",
"homepage": "https://tiptap.dev", "homepage": "https://tiptap.dev",
"keywords": [ "keywords": [
"tiptap", "tiptap",
@@ -26,6 +26,7 @@
}, },
"dependencies": { "dependencies": {
"prosemirror-state": "^1.3.4", "prosemirror-state": "^1.3.4",
"prosemirror-view": "^1.18.2" "prosemirror-view": "^1.18.2",
"tippy.js": "^6.3.1"
} }
} }

View File

@@ -1,12 +1,12 @@
import { Editor } from '@tiptap/core' import { Editor, posToDOMRect } from '@tiptap/core'
import { EditorState, Plugin, PluginKey } from 'prosemirror-state' import { EditorState, Plugin, PluginKey } from 'prosemirror-state'
import { EditorView } from 'prosemirror-view' import { EditorView } from 'prosemirror-view'
import { coordsAtPos } from './helpers' import tippy, { Instance, Props } from 'tippy.js'
export interface BubbleMenuPluginProps { export interface BubbleMenuPluginProps {
editor: Editor, editor: Editor,
element: HTMLElement, element: HTMLElement,
keepInBounds: boolean, tippyOptions?: Partial<Props>,
} }
export type BubbleMenuViewProps = BubbleMenuPluginProps & { export type BubbleMenuViewProps = BubbleMenuPluginProps & {
@@ -18,35 +18,26 @@ export class BubbleMenuView {
public element: HTMLElement public element: HTMLElement
public keepInBounds = true
public view: EditorView public view: EditorView
public isActive = false
public top = 0
public bottom = 0
public left = 0
public preventHide = false public preventHide = false
public tippy!: Instance
constructor({ constructor({
editor, editor,
element, element,
keepInBounds,
view, view,
tippyOptions,
}: BubbleMenuViewProps) { }: BubbleMenuViewProps) {
this.editor = editor this.editor = editor
this.element = element this.element = element
this.keepInBounds = keepInBounds
this.view = view this.view = view
this.element.addEventListener('mousedown', this.mousedownHandler, { capture: true }) this.element.addEventListener('mousedown', this.mousedownHandler, { capture: true })
this.editor.on('focus', this.focusHandler) this.editor.on('focus', this.focusHandler)
this.editor.on('blur', this.blurHandler) this.editor.on('blur', this.blurHandler)
this.editor.on('resize', this.resizeHandler) this.createTooltip(tippyOptions)
this.render() this.element.style.visibility = 'visible'
} }
mousedownHandler = () => { mousedownHandler = () => {
@@ -58,12 +49,6 @@ export class BubbleMenuView {
setTimeout(() => this.update(this.editor.view)) setTimeout(() => this.update(this.editor.view))
} }
resizeHandler = () => {
if (this.isActive) {
this.update(this.editor.view)
}
}
blurHandler = ({ event }: { event: FocusEvent }) => { blurHandler = ({ event }: { event: FocusEvent }) => {
if (this.preventHide) { if (this.preventHide) {
this.preventHide = false this.preventHide = false
@@ -81,6 +66,19 @@ export class BubbleMenuView {
this.hide() this.hide()
} }
createTooltip(options: Partial<Props> = {}) {
this.tippy = tippy(this.view.dom, {
duration: 0,
getReferenceClientRect: null,
content: this.element,
interactive: true,
trigger: 'manual',
placement: 'top',
hideOnClick: 'toggle',
...options,
})
}
update(view: EditorView, oldState?: EditorState) { update(view: EditorView, oldState?: EditorState) {
const { state, composing } = view const { state, composing } = view
const { doc, selection } = state const { doc, selection } = state
@@ -91,60 +89,33 @@ export class BubbleMenuView {
} }
const { from, to, empty } = selection const { from, to, empty } = selection
const parent = this.element.offsetParent
if (empty || !parent) { if (empty) {
this.hide() this.hide()
return return
} }
const start = coordsAtPos(view, from) this.tippy.setProps({
const end = coordsAtPos(view, to, true) getReferenceClientRect: () => posToDOMRect(view, from, to),
const parentBox = parent.getBoundingClientRect() })
const box = this.element.getBoundingClientRect()
const left = (start.left + end.left) / 2 - parentBox.left - box.width / 2
this.isActive = true this.show()
this.top = Math.round(end.bottom - parentBox.top)
this.bottom = Math.round(parentBox.bottom - start.top)
this.left = Math.round(
this.keepInBounds
? Math.min(
parentBox.width - box.width,
Math.max(
left,
0,
),
)
: left,
)
this.render()
} }
render() { show() {
Object.assign(this.element.style, { this.tippy.show()
position: 'absolute',
zIndex: 1,
visibility: this.isActive ? 'visible' : 'hidden',
opacity: this.isActive ? 1 : 0,
left: `${this.left}px`,
// top: `${this.top}px`,
bottom: `${this.bottom}px`,
})
} }
hide() { hide() {
this.isActive = false this.tippy.hide()
this.render()
} }
destroy() { destroy() {
this.tippy.destroy()
this.element.removeEventListener('mousedown', this.mousedownHandler) this.element.removeEventListener('mousedown', this.mousedownHandler)
this.editor.off('focus', this.focusHandler) this.editor.off('focus', this.focusHandler)
this.editor.off('blur', this.blurHandler) this.editor.off('blur', this.blurHandler)
this.editor.off('resize', this.resizeHandler)
} }
} }

View File

@@ -10,7 +10,7 @@ export const BubbleMenu = Extension.create<BubbleMenuOptions>({
defaultOptions: { defaultOptions: {
element: null, element: null,
keepInBounds: true, tippyOptions: {},
}, },
addProseMirrorPlugins() { addProseMirrorPlugins() {
@@ -22,7 +22,7 @@ export const BubbleMenu = Extension.create<BubbleMenuOptions>({
BubbleMenuPlugin({ BubbleMenuPlugin({
editor: this.editor, editor: this.editor,
element: this.options.element, element: this.options.element,
keepInBounds: this.options.keepInBounds, tippyOptions: this.options.tippyOptions,
}), }),
] ]
}, },

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-bullet-list@2.0.0-beta.2...@tiptap/extension-bullet-list@2.0.0-beta.3) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-bullet-list
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-bullet-list@2.0.0-beta.1...@tiptap/extension-bullet-list@2.0.0-beta.2) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-bullet-list
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-bullet-list@2.0.0-alpha.11...@tiptap/extension-bullet-list@2.0.0-beta.1) (2021-03-05) # [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-bullet-list@2.0.0-alpha.11...@tiptap/extension-bullet-list@2.0.0-beta.1) (2021-03-05)
**Note:** Version bump only for package @tiptap/extension-bullet-list **Note:** Version bump only for package @tiptap/extension-bullet-list

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-character-count@2.0.0-beta.2...@tiptap/extension-character-count@2.0.0-beta.3) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-character-count
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-character-count@2.0.0-beta.1...@tiptap/extension-character-count@2.0.0-beta.2) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-character-count
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-character-count@2.0.0-alpha.11...@tiptap/extension-character-count@2.0.0-beta.1) (2021-03-05) # [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-character-count@2.0.0-alpha.11...@tiptap/extension-character-count@2.0.0-beta.1) (2021-03-05)
**Note:** Version bump only for package @tiptap/extension-character-count **Note:** Version bump only for package @tiptap/extension-character-count

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.8](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code-block-lowlight@2.0.0-beta.7...@tiptap/extension-code-block-lowlight@2.0.0-beta.8) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-code-block-lowlight
# [2.0.0-beta.7](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code-block-lowlight@2.0.0-beta.6...@tiptap/extension-code-block-lowlight@2.0.0-beta.7) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-code-block-lowlight
# [2.0.0-beta.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code-block-lowlight@2.0.0-beta.4...@tiptap/extension-code-block-lowlight@2.0.0-beta.6) (2021-04-14) # [2.0.0-beta.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code-block-lowlight@2.0.0-beta.4...@tiptap/extension-code-block-lowlight@2.0.0-beta.6) (2021-04-14)
**Note:** Version bump only for package @tiptap/extension-code-block-lowlight **Note:** Version bump only for package @tiptap/extension-code-block-lowlight

View File

@@ -1,7 +1,7 @@
{ {
"name": "@tiptap/extension-code-block-lowlight", "name": "@tiptap/extension-code-block-lowlight",
"description": "code block extension for tiptap", "description": "code block extension for tiptap",
"version": "2.0.0-beta.6", "version": "2.0.0-beta.8",
"homepage": "https://tiptap.dev", "homepage": "https://tiptap.dev",
"keywords": [ "keywords": [
"tiptap", "tiptap",
@@ -25,7 +25,7 @@
"@tiptap/core": "^2.0.0-beta.1" "@tiptap/core": "^2.0.0-beta.1"
}, },
"dependencies": { "dependencies": {
"@tiptap/extension-code-block": "^2.0.0-beta.3", "@tiptap/extension-code-block": "^2.0.0-beta.5",
"@types/lowlight": "^0.0.1", "@types/lowlight": "^0.0.1",
"lowlight": "^1.20.0", "lowlight": "^1.20.0",
"prosemirror-model": "^1.14.0", "prosemirror-model": "^1.14.0",

View File

@@ -8,14 +8,13 @@ export interface CodeBlockLowlightOptions extends CodeBlockOptions {
export const CodeBlockLowlight = CodeBlock.extend<CodeBlockLowlightOptions>({ export const CodeBlockLowlight = CodeBlock.extend<CodeBlockLowlightOptions>({
defaultOptions: { defaultOptions: {
...CodeBlock.config.defaultOptions, ...CodeBlock.options,
lowlight, lowlight,
}, },
addProseMirrorPlugins() { addProseMirrorPlugins() {
return [ return [
// disable for now, see: https://github.com/ueberdosis/tiptap-next/issues/259#issuecomment-817954835 ...this.parent?.() || [],
// ...this.parentConfig.addProseMirrorPlugins?.() || [],
LowlightPlugin({ LowlightPlugin({
name: 'codeBlock', name: 'codeBlock',
lowlight: this.options.lowlight, lowlight: this.options.lowlight,

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code-block@2.0.0-beta.4...@tiptap/extension-code-block@2.0.0-beta.5) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-code-block
# [2.0.0-beta.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code-block@2.0.0-beta.3...@tiptap/extension-code-block@2.0.0-beta.4) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-code-block
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code-block@2.0.0-beta.2...@tiptap/extension-code-block@2.0.0-beta.3) (2021-04-11) # [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code-block@2.0.0-beta.2...@tiptap/extension-code-block@2.0.0-beta.3) (2021-04-11)

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code@2.0.0-beta.2...@tiptap/extension-code@2.0.0-beta.3) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-code
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code@2.0.0-beta.1...@tiptap/extension-code@2.0.0-beta.2) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-code
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code@2.0.0-alpha.11...@tiptap/extension-code@2.0.0-beta.1) (2021-03-05) # [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code@2.0.0-alpha.11...@tiptap/extension-code@2.0.0-beta.1) (2021-03-05)
**Note:** Version bump only for package @tiptap/extension-code **Note:** Version bump only for package @tiptap/extension-code

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.7](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-collaboration-cursor@2.0.0-beta.6...@tiptap/extension-collaboration-cursor@2.0.0-beta.7) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-collaboration-cursor
# [2.0.0-beta.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-collaboration-cursor@2.0.0-beta.5...@tiptap/extension-collaboration-cursor@2.0.0-beta.6) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-collaboration-cursor
# [2.0.0-beta.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-collaboration-cursor@2.0.0-beta.4...@tiptap/extension-collaboration-cursor@2.0.0-beta.5) (2021-04-07) # [2.0.0-beta.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-collaboration-cursor@2.0.0-beta.4...@tiptap/extension-collaboration-cursor@2.0.0-beta.5) (2021-04-07)

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-collaboration@2.0.0-beta.5...@tiptap/extension-collaboration@2.0.0-beta.6) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-collaboration
# [2.0.0-beta.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-collaboration@2.0.0-beta.4...@tiptap/extension-collaboration@2.0.0-beta.5) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-collaboration
# [2.0.0-beta.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-collaboration@2.0.0-beta.3...@tiptap/extension-collaboration@2.0.0-beta.4) (2021-03-16) # [2.0.0-beta.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-collaboration@2.0.0-beta.3...@tiptap/extension-collaboration@2.0.0-beta.4) (2021-03-16)
**Note:** Version bump only for package @tiptap/extension-collaboration **Note:** Version bump only for package @tiptap/extension-collaboration

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-document@2.0.0-beta.2...@tiptap/extension-document@2.0.0-beta.3) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-document
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-document@2.0.0-beta.1...@tiptap/extension-document@2.0.0-beta.2) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-document
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-document@2.0.0-alpha.11...@tiptap/extension-document@2.0.0-beta.1) (2021-03-05) # [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-document@2.0.0-alpha.11...@tiptap/extension-document@2.0.0-beta.1) (2021-03-05)
**Note:** Version bump only for package @tiptap/extension-document **Note:** Version bump only for package @tiptap/extension-document

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-dropcursor@2.0.0-beta.3...@tiptap/extension-dropcursor@2.0.0-beta.4) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-dropcursor
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-dropcursor@2.0.0-beta.2...@tiptap/extension-dropcursor@2.0.0-beta.3) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-dropcursor
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-dropcursor@2.0.0-beta.1...@tiptap/extension-dropcursor@2.0.0-beta.2) (2021-04-06) # [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-dropcursor@2.0.0-beta.1...@tiptap/extension-dropcursor@2.0.0-beta.2) (2021-04-06)
**Note:** Version bump only for package @tiptap/extension-dropcursor **Note:** Version bump only for package @tiptap/extension-dropcursor

View File

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

View File

@@ -3,6 +3,31 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-floating-menu@2.0.0-beta.3...@tiptap/extension-floating-menu@2.0.0-beta.4) (2021-04-16)
### Bug Fixes
* fix tippy for react ([398fc7f](https://github.com/ueberdosis/tiptap-next/commit/398fc7f210b9d5449cbb00543ddf4af768552b9c))
### Features
* add tippyOptions prop ([9a56f66](https://github.com/ueberdosis/tiptap-next/commit/9a56f666a118ca7c59a6f1f67f40e6490e20d3b8))
* use tippy for floating menu ([54df2ce](https://github.com/ueberdosis/tiptap-next/commit/54df2ce077a4bac09c3f1d1eab8c68a09d8f8fa9))
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-floating-menu@2.0.0-beta.2...@tiptap/extension-floating-menu@2.0.0-beta.3) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-floating-menu
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-floating-menu@2.0.0-beta.1...@tiptap/extension-floating-menu@2.0.0-beta.2) (2021-04-01) # [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-floating-menu@2.0.0-beta.1...@tiptap/extension-floating-menu@2.0.0-beta.2) (2021-04-01)
**Note:** Version bump only for package @tiptap/extension-floating-menu **Note:** Version bump only for package @tiptap/extension-floating-menu

View File

@@ -1,7 +1,7 @@
{ {
"name": "@tiptap/extension-floating-menu", "name": "@tiptap/extension-floating-menu",
"description": "floating-menu extension for tiptap", "description": "floating-menu extension for tiptap",
"version": "2.0.0-beta.2", "version": "2.0.0-beta.4",
"homepage": "https://tiptap.dev", "homepage": "https://tiptap.dev",
"keywords": [ "keywords": [
"tiptap", "tiptap",
@@ -26,6 +26,7 @@
}, },
"dependencies": { "dependencies": {
"prosemirror-state": "^1.3.4", "prosemirror-state": "^1.3.4",
"prosemirror-view": "^1.18.2" "prosemirror-view": "^1.18.2",
"tippy.js": "^6.3.1"
} }
} }

View File

@@ -1,10 +1,12 @@
import { Editor, isNodeEmpty } from '@tiptap/core' import { Editor, isNodeEmpty, posToDOMRect } from '@tiptap/core'
import { EditorState, Plugin, PluginKey } from 'prosemirror-state' import { EditorState, Plugin, PluginKey } from 'prosemirror-state'
import { EditorView } from 'prosemirror-view' import { EditorView } from 'prosemirror-view'
import tippy, { Instance, Props } from 'tippy.js'
export interface FloatingMenuPluginProps { export interface FloatingMenuPluginProps {
editor: Editor, editor: Editor,
element: HTMLElement, element: HTMLElement,
tippyOptions?: Partial<Props>,
} }
export type FloatingMenuViewProps = FloatingMenuPluginProps & { export type FloatingMenuViewProps = FloatingMenuPluginProps & {
@@ -18,18 +20,15 @@ export class FloatingMenuView {
public view: EditorView public view: EditorView
public isActive = false
public top = 0
public left = 0
public preventHide = false public preventHide = false
public tippy!: Instance
constructor({ constructor({
editor, editor,
element, element,
view, view,
tippyOptions,
}: FloatingMenuViewProps) { }: FloatingMenuViewProps) {
this.editor = editor this.editor = editor
this.element = element this.element = element
@@ -37,8 +36,8 @@ export class FloatingMenuView {
this.element.addEventListener('mousedown', this.mousedownHandler, { capture: true }) this.element.addEventListener('mousedown', this.mousedownHandler, { capture: true })
this.editor.on('focus', this.focusHandler) this.editor.on('focus', this.focusHandler)
this.editor.on('blur', this.blurHandler) this.editor.on('blur', this.blurHandler)
this.editor.on('resize', this.resizeHandler) this.createTooltip(tippyOptions)
this.render() this.element.style.visibility = 'visible'
} }
mousedownHandler = () => { mousedownHandler = () => {
@@ -50,12 +49,6 @@ export class FloatingMenuView {
setTimeout(() => this.update(this.editor.view)) setTimeout(() => this.update(this.editor.view))
} }
resizeHandler = () => {
if (this.isActive) {
this.update(this.editor.view)
}
}
blurHandler = ({ event }: { event: FocusEvent }) => { blurHandler = ({ event }: { event: FocusEvent }) => {
if (this.preventHide) { if (this.preventHide) {
this.preventHide = false this.preventHide = false
@@ -73,6 +66,19 @@ export class FloatingMenuView {
this.hide() this.hide()
} }
createTooltip(options: Partial<Props> = {}) {
this.tippy = tippy(this.view.dom, {
duration: 0,
getReferenceClientRect: null,
content: this.element,
interactive: true,
trigger: 'manual',
placement: 'right',
hideOnClick: 'toggle',
...options,
})
}
update(view: EditorView, oldState?: EditorState) { update(view: EditorView, oldState?: EditorState) {
const { state, composing } = view const { state, composing } = view
const { doc, selection } = state const { doc, selection } = state
@@ -82,52 +88,43 @@ export class FloatingMenuView {
return return
} }
const { $anchor, anchor, empty } = selection const {
const parent = this.element.offsetParent $anchor,
empty,
from,
to,
} = selection
const isRootDepth = $anchor.depth === 1 const isRootDepth = $anchor.depth === 1
const isDefaultNodeType = $anchor.parent.type === state.doc.type.contentMatch.defaultType const isDefaultNodeType = $anchor.parent.type === state.doc.type.contentMatch.defaultType
const isDefaultNodeEmpty = isNodeEmpty(selection.$anchor.parent) const isDefaultNodeEmpty = isNodeEmpty(selection.$anchor.parent)
const isActive = isRootDepth && isDefaultNodeType && isDefaultNodeEmpty const isActive = isRootDepth && isDefaultNodeType && isDefaultNodeEmpty
if (!empty || !parent || !isActive) { if (!empty || !isActive) {
this.hide() this.hide()
return return
} }
const parentBox = parent.getBoundingClientRect() this.tippy.setProps({
const cursorCoords = view.coordsAtPos(anchor) getReferenceClientRect: () => posToDOMRect(view, from, to),
const top = cursorCoords.top - parentBox.top })
const left = cursorCoords.left - parentBox.left
this.isActive = true this.show()
this.top = top
this.left = left
this.render()
} }
render() { show() {
Object.assign(this.element.style, { this.tippy.show()
position: 'absolute',
zIndex: 1,
visibility: this.isActive ? 'visible' : 'hidden',
opacity: this.isActive ? 1 : 0,
left: `${this.left}px`,
top: `${this.top}px`,
})
} }
hide() { hide() {
this.isActive = false this.tippy.hide()
this.render()
} }
destroy() { destroy() {
this.tippy.destroy()
this.element.removeEventListener('mousedown', this.mousedownHandler) this.element.removeEventListener('mousedown', this.mousedownHandler)
this.editor.off('focus', this.focusHandler) this.editor.off('focus', this.focusHandler)
this.editor.off('blur', this.blurHandler) this.editor.off('blur', this.blurHandler)
this.editor.off('resize', this.resizeHandler)
} }
} }

View File

@@ -10,6 +10,7 @@ export const FloatingMenu = Extension.create<FloatingMenuOptions>({
defaultOptions: { defaultOptions: {
element: null, element: null,
tippyOptions: {},
}, },
addProseMirrorPlugins() { addProseMirrorPlugins() {
@@ -21,6 +22,7 @@ export const FloatingMenu = Extension.create<FloatingMenuOptions>({
FloatingMenuPlugin({ FloatingMenuPlugin({
editor: this.editor, editor: this.editor,
element: this.options.element, element: this.options.element,
tippyOptions: this.options.tippyOptions,
}), }),
] ]
}, },

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.8](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-focus@2.0.0-beta.7...@tiptap/extension-focus@2.0.0-beta.8) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-focus
# [2.0.0-beta.7](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-focus@2.0.0-beta.6...@tiptap/extension-focus@2.0.0-beta.7) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-focus
# [2.0.0-beta.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-focus@2.0.0-beta.5...@tiptap/extension-focus@2.0.0-beta.6) (2021-03-31) # [2.0.0-beta.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-focus@2.0.0-beta.5...@tiptap/extension-focus@2.0.0-beta.6) (2021-03-31)
**Note:** Version bump only for package @tiptap/extension-focus **Note:** Version bump only for package @tiptap/extension-focus

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-font-family@2.0.0-beta.2...@tiptap/extension-font-family@2.0.0-beta.3) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-font-family
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-font-family@2.0.0-beta.1...@tiptap/extension-font-family@2.0.0-beta.2) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-font-family
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-font-family@2.0.0-alpha.11...@tiptap/extension-font-family@2.0.0-beta.1) (2021-03-05) # [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-font-family@2.0.0-alpha.11...@tiptap/extension-font-family@2.0.0-beta.1) (2021-03-05)
**Note:** Version bump only for package @tiptap/extension-font-family **Note:** Version bump only for package @tiptap/extension-font-family

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.7](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-gapcursor@2.0.0-beta.6...@tiptap/extension-gapcursor@2.0.0-beta.7) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-gapcursor
# [2.0.0-beta.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-gapcursor@2.0.0-beta.5...@tiptap/extension-gapcursor@2.0.0-beta.6) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-gapcursor
# [2.0.0-beta.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-gapcursor@2.0.0-beta.4...@tiptap/extension-gapcursor@2.0.0-beta.5) (2021-04-12) # [2.0.0-beta.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-gapcursor@2.0.0-beta.4...@tiptap/extension-gapcursor@2.0.0-beta.5) (2021-04-12)

View File

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

View File

@@ -1,7 +1,7 @@
import { import {
Extension, Extension,
callOrReturn, callOrReturn,
createExtensionContext, getExtensionField,
ParentConfig, ParentConfig,
} from '@tiptap/core' } from '@tiptap/core'
import { gapCursor } from 'prosemirror-gapcursor' import { gapCursor } from 'prosemirror-gapcursor'
@@ -31,12 +31,12 @@ export const Gapcursor = Extension.create({
}, },
extendNodeSchema(extension) { extendNodeSchema(extension) {
const context = createExtensionContext(extension, { const context = {
options: extension.options, options: extension.options,
}) }
return { return {
allowGapCursor: callOrReturn(extension.config.allowGapCursor, context) ?? null, allowGapCursor: callOrReturn(getExtensionField(extension, 'allowGapCursor', context)) ?? null,
} }
}, },
}) })

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-hard-break@2.0.0-beta.2...@tiptap/extension-hard-break@2.0.0-beta.3) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-hard-break
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-hard-break@2.0.0-beta.1...@tiptap/extension-hard-break@2.0.0-beta.2) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-hard-break
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-hard-break@2.0.0-alpha.11...@tiptap/extension-hard-break@2.0.0-beta.1) (2021-03-05) # [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-hard-break@2.0.0-alpha.11...@tiptap/extension-hard-break@2.0.0-beta.1) (2021-03-05)
**Note:** Version bump only for package @tiptap/extension-hard-break **Note:** Version bump only for package @tiptap/extension-hard-break

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-heading@2.0.0-beta.2...@tiptap/extension-heading@2.0.0-beta.3) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-heading
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-heading@2.0.0-beta.1...@tiptap/extension-heading@2.0.0-beta.2) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-heading
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-heading@2.0.0-alpha.11...@tiptap/extension-heading@2.0.0-beta.1) (2021-03-05) # [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-heading@2.0.0-alpha.11...@tiptap/extension-heading@2.0.0-beta.1) (2021-03-05)
**Note:** Version bump only for package @tiptap/extension-heading **Note:** Version bump only for package @tiptap/extension-heading

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-highlight@2.0.0-beta.2...@tiptap/extension-highlight@2.0.0-beta.3) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-highlight
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-highlight@2.0.0-beta.1...@tiptap/extension-highlight@2.0.0-beta.2) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-highlight
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-highlight@2.0.0-alpha.11...@tiptap/extension-highlight@2.0.0-beta.1) (2021-03-05) # [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-highlight@2.0.0-alpha.11...@tiptap/extension-highlight@2.0.0-beta.1) (2021-03-05)
**Note:** Version bump only for package @tiptap/extension-highlight **Note:** Version bump only for package @tiptap/extension-highlight

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-history@2.0.0-beta.2...@tiptap/extension-history@2.0.0-beta.3) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-history
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-history@2.0.0-beta.1...@tiptap/extension-history@2.0.0-beta.2) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-history
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-history@2.0.0-alpha.11...@tiptap/extension-history@2.0.0-beta.1) (2021-03-05) # [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-history@2.0.0-alpha.11...@tiptap/extension-history@2.0.0-beta.1) (2021-03-05)
**Note:** Version bump only for package @tiptap/extension-history **Note:** Version bump only for package @tiptap/extension-history

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-horizontal-rule@2.0.0-beta.3...@tiptap/extension-horizontal-rule@2.0.0-beta.4) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-horizontal-rule
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-horizontal-rule@2.0.0-beta.2...@tiptap/extension-horizontal-rule@2.0.0-beta.3) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-horizontal-rule
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-horizontal-rule@2.0.0-beta.1...@tiptap/extension-horizontal-rule@2.0.0-beta.2) (2021-04-07) # [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-horizontal-rule@2.0.0-beta.1...@tiptap/extension-horizontal-rule@2.0.0-beta.2) (2021-04-07)

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-image@2.0.0-beta.2...@tiptap/extension-image@2.0.0-beta.3) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-image
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-image@2.0.0-beta.1...@tiptap/extension-image@2.0.0-beta.2) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-image
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-image@2.0.0-alpha.11...@tiptap/extension-image@2.0.0-beta.1) (2021-03-05) # [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-image@2.0.0-alpha.11...@tiptap/extension-image@2.0.0-beta.1) (2021-03-05)
**Note:** Version bump only for package @tiptap/extension-image **Note:** Version bump only for package @tiptap/extension-image

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-italic@2.0.0-beta.2...@tiptap/extension-italic@2.0.0-beta.3) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-italic
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-italic@2.0.0-beta.1...@tiptap/extension-italic@2.0.0-beta.2) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-italic
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-italic@2.0.0-alpha.11...@tiptap/extension-italic@2.0.0-beta.1) (2021-03-05) # [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-italic@2.0.0-alpha.11...@tiptap/extension-italic@2.0.0-beta.1) (2021-03-05)
**Note:** Version bump only for package @tiptap/extension-italic **Note:** Version bump only for package @tiptap/extension-italic

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-link@2.0.0-beta.4...@tiptap/extension-link@2.0.0-beta.5) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-link
# [2.0.0-beta.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-link@2.0.0-beta.3...@tiptap/extension-link@2.0.0-beta.4) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-link
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-link@2.0.0-beta.2...@tiptap/extension-link@2.0.0-beta.3) (2021-04-11) # [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-link@2.0.0-beta.2...@tiptap/extension-link@2.0.0-beta.3) (2021-04-11)

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-list-item@2.0.0-beta.2...@tiptap/extension-list-item@2.0.0-beta.3) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-list-item
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-list-item@2.0.0-beta.1...@tiptap/extension-list-item@2.0.0-beta.2) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-list-item
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-list-item@2.0.0-alpha.11...@tiptap/extension-list-item@2.0.0-beta.1) (2021-03-05) # [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-list-item@2.0.0-alpha.11...@tiptap/extension-list-item@2.0.0-beta.1) (2021-03-05)
**Note:** Version bump only for package @tiptap/extension-list-item **Note:** Version bump only for package @tiptap/extension-list-item

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
{ {
"name": "@tiptap/extension-mention", "name": "@tiptap/extension-mention",
"description": "mention extension for tiptap", "description": "mention extension for tiptap",
"version": "2.0.0-beta.29", "version": "2.0.0-beta.32",
"homepage": "https://tiptap.dev", "homepage": "https://tiptap.dev",
"keywords": [ "keywords": [
"tiptap", "tiptap",
@@ -25,6 +25,6 @@
"@tiptap/core": "^2.0.0-beta.1" "@tiptap/core": "^2.0.0-beta.1"
}, },
"dependencies": { "dependencies": {
"@tiptap/suggestion": "^2.0.0-beta.29" "@tiptap/suggestion": "^2.0.0-beta.32"
} }
} }

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-ordered-list@2.0.0-beta.2...@tiptap/extension-ordered-list@2.0.0-beta.3) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-ordered-list
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-ordered-list@2.0.0-beta.1...@tiptap/extension-ordered-list@2.0.0-beta.2) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-ordered-list
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-ordered-list@2.0.0-alpha.11...@tiptap/extension-ordered-list@2.0.0-beta.1) (2021-03-05) # [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-ordered-list@2.0.0-alpha.11...@tiptap/extension-ordered-list@2.0.0-beta.1) (2021-03-05)
**Note:** Version bump only for package @tiptap/extension-ordered-list **Note:** Version bump only for package @tiptap/extension-ordered-list

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-paragraph@2.0.0-beta.3...@tiptap/extension-paragraph@2.0.0-beta.4) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-paragraph
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-paragraph@2.0.0-beta.2...@tiptap/extension-paragraph@2.0.0-beta.3) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-paragraph
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-paragraph@2.0.0-beta.1...@tiptap/extension-paragraph@2.0.0-beta.2) (2021-04-07) # [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-paragraph@2.0.0-beta.1...@tiptap/extension-paragraph@2.0.0-beta.2) (2021-04-07)

View File

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

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-placeholder@2.0.0-beta.5...@tiptap/extension-placeholder@2.0.0-beta.6) (2021-04-16)
**Note:** Version bump only for package @tiptap/extension-placeholder
# [2.0.0-beta.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-placeholder@2.0.0-beta.4...@tiptap/extension-placeholder@2.0.0-beta.5) (2021-04-15)
**Note:** Version bump only for package @tiptap/extension-placeholder
# [2.0.0-beta.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-placeholder@2.0.0-beta.3...@tiptap/extension-placeholder@2.0.0-beta.4) (2021-04-06) # [2.0.0-beta.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-placeholder@2.0.0-beta.3...@tiptap/extension-placeholder@2.0.0-beta.4) (2021-04-06)
**Note:** Version bump only for package @tiptap/extension-placeholder **Note:** Version bump only for package @tiptap/extension-placeholder

View File

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

View File

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

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