Merge branch 'main' into feature/tippy-menus
This commit is contained in:
@@ -3,6 +3,47 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix adding mark only with insertContent(), fix [#264](https://github.com/ueberdosis/tiptap-next/issues/264) ([0a63123](https://github.com/ueberdosis/tiptap-next/commit/0a6312382f38af5b8fdf7f94fc4b6c1de1a15e25))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [2.0.0-beta.28](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/core@2.0.0-beta.27...@tiptap/core@2.0.0-beta.28) (2021-04-12)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add parentConfig to extension context for more extendable extensions, fix [#259](https://github.com/ueberdosis/tiptap-next/issues/259) ([5e1ec5d](https://github.com/ueberdosis/tiptap-next/commit/5e1ec5d2a66be164f505d631f97861ab9344ba96))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [2.0.0-beta.27](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/core@2.0.0-beta.26...@tiptap/core@2.0.0-beta.27) (2021-04-09)
|
||||
|
||||
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/core",
|
||||
"description": "headless rich text editor",
|
||||
"version": "2.0.0-beta.27",
|
||||
"version": "2.0.0-beta.31",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,8 +3,9 @@ import { Command as ProseMirrorCommand } from 'prosemirror-commands'
|
||||
import { InputRule } from 'prosemirror-inputrules'
|
||||
import { Editor } from './Editor'
|
||||
import { Node } from './Node'
|
||||
import { Mark } from './Mark'
|
||||
import mergeDeep from './utilities/mergeDeep'
|
||||
import { GlobalAttributes, RawCommands } from './types'
|
||||
import { GlobalAttributes, RawCommands, ParentConfig } from './types'
|
||||
import { ExtensionConfig } from '.'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
@@ -31,6 +32,7 @@ declare module '@tiptap/core' {
|
||||
*/
|
||||
addGlobalAttributes?: (this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<ExtensionConfig<Options>>['addGlobalAttributes'],
|
||||
}) => GlobalAttributes | {},
|
||||
|
||||
/**
|
||||
@@ -39,6 +41,7 @@ declare module '@tiptap/core' {
|
||||
addCommands?: (this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
parent: ParentConfig<ExtensionConfig<Options>>['addCommands'],
|
||||
}) => Partial<RawCommands>,
|
||||
|
||||
/**
|
||||
@@ -47,6 +50,7 @@ declare module '@tiptap/core' {
|
||||
addKeyboardShortcuts?: (this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
parent: ParentConfig<ExtensionConfig<Options>>['addKeyboardShortcuts'],
|
||||
}) => {
|
||||
[key: string]: ProseMirrorCommand,
|
||||
},
|
||||
@@ -57,6 +61,7 @@ declare module '@tiptap/core' {
|
||||
addInputRules?: (this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
parent: ParentConfig<ExtensionConfig<Options>>['addInputRules'],
|
||||
}) => InputRule[],
|
||||
|
||||
/**
|
||||
@@ -65,6 +70,7 @@ declare module '@tiptap/core' {
|
||||
addPasteRules?: (this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
parent: ParentConfig<ExtensionConfig<Options>>['addPasteRules'],
|
||||
}) => Plugin[],
|
||||
|
||||
/**
|
||||
@@ -73,6 +79,7 @@ declare module '@tiptap/core' {
|
||||
addProseMirrorPlugins?: (this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
parent: ParentConfig<ExtensionConfig<Options>>['addProseMirrorPlugins'],
|
||||
}) => Plugin[],
|
||||
|
||||
/**
|
||||
@@ -81,6 +88,7 @@ declare module '@tiptap/core' {
|
||||
extendNodeSchema?: ((
|
||||
this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<ExtensionConfig<Options>>['extendNodeSchema'],
|
||||
},
|
||||
extension: Node,
|
||||
) => {
|
||||
@@ -93,8 +101,9 @@ declare module '@tiptap/core' {
|
||||
extendMarkSchema?: ((
|
||||
this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<ExtensionConfig<Options>>['extendMarkSchema'],
|
||||
},
|
||||
extension: Node,
|
||||
extension: Mark,
|
||||
) => {
|
||||
[key: string]: any,
|
||||
}) | null,
|
||||
@@ -105,6 +114,7 @@ declare module '@tiptap/core' {
|
||||
onBeforeCreate?: ((this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
parent: ParentConfig<ExtensionConfig<Options>>['onBeforeCreate'],
|
||||
}) => void) | null,
|
||||
|
||||
/**
|
||||
@@ -113,6 +123,7 @@ declare module '@tiptap/core' {
|
||||
onCreate?: ((this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
parent: ParentConfig<ExtensionConfig<Options>>['onCreate'],
|
||||
}) => void) | null,
|
||||
|
||||
/**
|
||||
@@ -121,6 +132,7 @@ declare module '@tiptap/core' {
|
||||
onUpdate?: ((this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
parent: ParentConfig<ExtensionConfig<Options>>['onUpdate'],
|
||||
}) => void) | null,
|
||||
|
||||
/**
|
||||
@@ -129,6 +141,7 @@ declare module '@tiptap/core' {
|
||||
onSelectionUpdate?: ((this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
parent: ParentConfig<ExtensionConfig<Options>>['onSelectionUpdate'],
|
||||
}) => void) | null,
|
||||
|
||||
/**
|
||||
@@ -138,6 +151,7 @@ declare module '@tiptap/core' {
|
||||
this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
parent: ParentConfig<ExtensionConfig<Options>>['onTransaction'],
|
||||
},
|
||||
props: {
|
||||
transaction: Transaction,
|
||||
@@ -151,6 +165,7 @@ declare module '@tiptap/core' {
|
||||
this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
parent: ParentConfig<ExtensionConfig<Options>>['onFocus'],
|
||||
},
|
||||
props: {
|
||||
event: FocusEvent,
|
||||
@@ -164,6 +179,7 @@ declare module '@tiptap/core' {
|
||||
this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
parent: ParentConfig<ExtensionConfig<Options>>['onBlur'],
|
||||
},
|
||||
props: {
|
||||
event: FocusEvent,
|
||||
@@ -176,6 +192,7 @@ declare module '@tiptap/core' {
|
||||
onDestroy?: ((this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
parent: ParentConfig<ExtensionConfig<Options>>['onDestroy'],
|
||||
}) => void) | null,
|
||||
}
|
||||
}
|
||||
@@ -183,43 +200,56 @@ declare module '@tiptap/core' {
|
||||
export class Extension<Options = any> {
|
||||
type = 'extension'
|
||||
|
||||
name = 'extension'
|
||||
|
||||
parent: Extension | null = null
|
||||
|
||||
child: Extension | null = null
|
||||
|
||||
options: Options
|
||||
|
||||
config: ExtensionConfig = {
|
||||
name: 'extension',
|
||||
name: this.name,
|
||||
priority: 100,
|
||||
defaultOptions: {},
|
||||
}
|
||||
|
||||
options!: Options
|
||||
|
||||
constructor(config: ExtensionConfig<Options>) {
|
||||
constructor(config: Partial<ExtensionConfig<Options>> = {}) {
|
||||
this.config = {
|
||||
...this.config,
|
||||
...config,
|
||||
}
|
||||
|
||||
this.name = this.config.name
|
||||
this.options = this.config.defaultOptions
|
||||
}
|
||||
|
||||
static create<O>(config: ExtensionConfig<O>) {
|
||||
static create<O>(config: Partial<ExtensionConfig<O>> = {}) {
|
||||
return new Extension<O>(config)
|
||||
}
|
||||
|
||||
configure(options: Partial<Options> = {}) {
|
||||
return Extension
|
||||
.create<Options>(this.config as ExtensionConfig<Options>)
|
||||
.#configure(options)
|
||||
}
|
||||
|
||||
#configure = (options: Partial<Options>) => {
|
||||
this.options = mergeDeep(this.config.defaultOptions, options) as Options
|
||||
this.options = mergeDeep(this.options, options) as Options
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
extend<ExtendedOptions = Options>(extendedConfig: Partial<ExtensionConfig<ExtendedOptions>>) {
|
||||
return new Extension<ExtendedOptions>({
|
||||
...this.config,
|
||||
...extendedConfig,
|
||||
} as ExtensionConfig<ExtendedOptions>)
|
||||
extend<ExtendedOptions = Options>(extendedConfig: Partial<ExtensionConfig<ExtendedOptions>> = {}) {
|
||||
const extension = new Extension<ExtendedOptions>(extendedConfig)
|
||||
|
||||
extension.parent = this
|
||||
|
||||
this.child = extension
|
||||
|
||||
extension.name = extendedConfig.name
|
||||
? extendedConfig.name
|
||||
: this.name
|
||||
|
||||
extension.options = {
|
||||
...extension.parent.options,
|
||||
...extension.options,
|
||||
}
|
||||
|
||||
return extension
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@ import { inputRules as inputRulesPlugin } from 'prosemirror-inputrules'
|
||||
import { EditorView, Decoration } from 'prosemirror-view'
|
||||
import { Plugin } from 'prosemirror-state'
|
||||
import { Editor } from './Editor'
|
||||
import { Extensions, NodeViewRenderer, RawCommands } from './types'
|
||||
import { Extensions, RawCommands, AnyConfig } from './types'
|
||||
import getExtensionField from './helpers/getExtensionField'
|
||||
import getSchema from './helpers/getSchema'
|
||||
import getSchemaTypeByName from './helpers/getSchemaTypeByName'
|
||||
import getNodeType from './helpers/getNodeType'
|
||||
@@ -12,6 +13,7 @@ import splitExtensions from './helpers/splitExtensions'
|
||||
import getAttributesFromExtensions from './helpers/getAttributesFromExtensions'
|
||||
import getRenderedAttributes from './helpers/getRenderedAttributes'
|
||||
import callOrReturn from './utilities/callOrReturn'
|
||||
import { NodeConfig } from '.'
|
||||
|
||||
export default class ExtensionManager {
|
||||
|
||||
@@ -32,47 +34,95 @@ export default class ExtensionManager {
|
||||
const context = {
|
||||
options: extension.options,
|
||||
editor: this.editor,
|
||||
type: getSchemaTypeByName(extension.config.name, this.schema),
|
||||
type: getSchemaTypeByName(extension.name, this.schema),
|
||||
}
|
||||
|
||||
if (extension.type === 'mark') {
|
||||
const keepOnSplit = callOrReturn(extension.config.keepOnSplit, context) ?? true
|
||||
const keepOnSplit = callOrReturn(getExtensionField(extension, 'keepOnSplit', context)) ?? true
|
||||
|
||||
if (keepOnSplit) {
|
||||
this.splittableMarks.push(extension.config.name)
|
||||
this.splittableMarks.push(extension.name)
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof extension.config.onBeforeCreate === 'function') {
|
||||
this.editor.on('beforeCreate', extension.config.onBeforeCreate.bind(context))
|
||||
const onBeforeCreate = getExtensionField<AnyConfig['onBeforeCreate']>(
|
||||
extension,
|
||||
'onBeforeCreate',
|
||||
context,
|
||||
)
|
||||
|
||||
if (onBeforeCreate) {
|
||||
this.editor.on('beforeCreate', onBeforeCreate)
|
||||
}
|
||||
|
||||
if (typeof extension.config.onCreate === 'function') {
|
||||
this.editor.on('create', extension.config.onCreate.bind(context))
|
||||
const onCreate = getExtensionField<AnyConfig['onCreate']>(
|
||||
extension,
|
||||
'onCreate',
|
||||
context,
|
||||
)
|
||||
|
||||
if (onCreate) {
|
||||
this.editor.on('create', onCreate)
|
||||
}
|
||||
|
||||
if (typeof extension.config.onUpdate === 'function') {
|
||||
this.editor.on('update', extension.config.onUpdate.bind(context))
|
||||
const onUpdate = getExtensionField<AnyConfig['onUpdate']>(
|
||||
extension,
|
||||
'onUpdate',
|
||||
context,
|
||||
)
|
||||
|
||||
if (onUpdate) {
|
||||
this.editor.on('update', onUpdate)
|
||||
}
|
||||
|
||||
if (typeof extension.config.onSelectionUpdate === 'function') {
|
||||
this.editor.on('selectionUpdate', extension.config.onSelectionUpdate.bind(context))
|
||||
const onSelectionUpdate = getExtensionField<AnyConfig['onSelectionUpdate']>(
|
||||
extension,
|
||||
'onSelectionUpdate',
|
||||
context,
|
||||
)
|
||||
|
||||
if (onSelectionUpdate) {
|
||||
this.editor.on('selectionUpdate', onSelectionUpdate)
|
||||
}
|
||||
|
||||
if (typeof extension.config.onTransaction === 'function') {
|
||||
this.editor.on('transaction', extension.config.onTransaction.bind(context))
|
||||
const onTransaction = getExtensionField<AnyConfig['onTransaction']>(
|
||||
extension,
|
||||
'onTransaction',
|
||||
context,
|
||||
)
|
||||
|
||||
if (onTransaction) {
|
||||
this.editor.on('transaction', onTransaction)
|
||||
}
|
||||
|
||||
if (typeof extension.config.onFocus === 'function') {
|
||||
this.editor.on('focus', extension.config.onFocus.bind(context))
|
||||
const onFocus = getExtensionField<AnyConfig['onFocus']>(
|
||||
extension,
|
||||
'onFocus',
|
||||
context,
|
||||
)
|
||||
|
||||
if (onFocus) {
|
||||
this.editor.on('focus', onFocus)
|
||||
}
|
||||
|
||||
if (typeof extension.config.onBlur === 'function') {
|
||||
this.editor.on('blur', extension.config.onBlur.bind(context))
|
||||
const onBlur = getExtensionField<AnyConfig['onBlur']>(
|
||||
extension,
|
||||
'onBlur',
|
||||
context,
|
||||
)
|
||||
|
||||
if (onBlur) {
|
||||
this.editor.on('blur', onBlur)
|
||||
}
|
||||
|
||||
if (typeof extension.config.onDestroy === 'function') {
|
||||
this.editor.on('destroy', extension.config.onDestroy.bind(context))
|
||||
const onDestroy = getExtensionField<AnyConfig['onDestroy']>(
|
||||
extension,
|
||||
'onDestroy',
|
||||
context,
|
||||
)
|
||||
|
||||
if (onDestroy) {
|
||||
this.editor.on('destroy', onDestroy)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -81,11 +131,14 @@ export default class ExtensionManager {
|
||||
const defaultPriority = 100
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
if ((a.config.priority || defaultPriority) < (b.config.priority || defaultPriority)) {
|
||||
if (priorityA < priorityB) {
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -98,16 +151,22 @@ export default class ExtensionManager {
|
||||
const context = {
|
||||
options: extension.options,
|
||||
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,
|
||||
...extension.config.addCommands.bind(context)(),
|
||||
...addCommands(),
|
||||
}
|
||||
}, {} as RawCommands)
|
||||
}
|
||||
@@ -119,19 +178,31 @@ export default class ExtensionManager {
|
||||
const context = {
|
||||
options: extension.options,
|
||||
editor: this.editor,
|
||||
type: getSchemaTypeByName(extension.config.name, this.schema),
|
||||
type: getSchemaTypeByName(extension.name, this.schema),
|
||||
}
|
||||
|
||||
const plugins: Plugin[] = []
|
||||
|
||||
if (extension.config.addKeyboardShortcuts) {
|
||||
const keyMapPlugin = keymap(extension.config.addKeyboardShortcuts.bind(context)())
|
||||
const addKeyboardShortcuts = getExtensionField<AnyConfig['addKeyboardShortcuts']>(
|
||||
extension,
|
||||
'addKeyboardShortcuts',
|
||||
context,
|
||||
)
|
||||
|
||||
if (addKeyboardShortcuts) {
|
||||
const keyMapPlugin = keymap(addKeyboardShortcuts())
|
||||
|
||||
plugins.push(keyMapPlugin)
|
||||
}
|
||||
|
||||
if (this.editor.options.enableInputRules && extension.config.addInputRules) {
|
||||
const inputRules = extension.config.addInputRules.bind(context)()
|
||||
const addInputRules = getExtensionField<AnyConfig['addInputRules']>(
|
||||
extension,
|
||||
'addInputRules',
|
||||
context,
|
||||
)
|
||||
|
||||
if (this.editor.options.enableInputRules && addInputRules) {
|
||||
const inputRules = addInputRules()
|
||||
const inputRulePlugins = inputRules.length
|
||||
? [inputRulesPlugin({ rules: inputRules })]
|
||||
: []
|
||||
@@ -139,14 +210,26 @@ export default class ExtensionManager {
|
||||
plugins.push(...inputRulePlugins)
|
||||
}
|
||||
|
||||
if (this.editor.options.enablePasteRules && extension.config.addPasteRules) {
|
||||
const pasteRulePlugins = extension.config.addPasteRules.bind(context)()
|
||||
const addPasteRules = getExtensionField<AnyConfig['addPasteRules']>(
|
||||
extension,
|
||||
'addPasteRules',
|
||||
context,
|
||||
)
|
||||
|
||||
if (this.editor.options.enablePasteRules && addPasteRules) {
|
||||
const pasteRulePlugins = addPasteRules()
|
||||
|
||||
plugins.push(...pasteRulePlugins)
|
||||
}
|
||||
|
||||
if (extension.config.addProseMirrorPlugins) {
|
||||
const proseMirrorPlugins = extension.config.addProseMirrorPlugins.bind(context)()
|
||||
const addProseMirrorPlugins = getExtensionField<AnyConfig['addProseMirrorPlugins']>(
|
||||
extension,
|
||||
'addProseMirrorPlugins',
|
||||
context,
|
||||
)
|
||||
|
||||
if (addProseMirrorPlugins) {
|
||||
const proseMirrorPlugins = addProseMirrorPlugins()
|
||||
|
||||
plugins.push(...proseMirrorPlugins)
|
||||
}
|
||||
@@ -165,15 +248,23 @@ export default class ExtensionManager {
|
||||
const { nodeExtensions } = splitExtensions(this.extensions)
|
||||
|
||||
return Object.fromEntries(nodeExtensions
|
||||
.filter(extension => !!extension.config.addNodeView)
|
||||
.filter(extension => !!getExtensionField(extension, 'addNodeView'))
|
||||
.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 = {
|
||||
options: extension.options,
|
||||
editor,
|
||||
type: getNodeType(extension.config.name, this.schema),
|
||||
type: getNodeType(extension.name, this.schema),
|
||||
}
|
||||
const addNodeView = getExtensionField<NodeConfig['addNodeView']>(
|
||||
extension,
|
||||
'addNodeView',
|
||||
context,
|
||||
)
|
||||
|
||||
if (!addNodeView) {
|
||||
return []
|
||||
}
|
||||
const renderer = extension.config.addNodeView?.call(context) as NodeViewRenderer
|
||||
|
||||
const nodeview = (
|
||||
node: ProsemirrorNode,
|
||||
@@ -183,7 +274,7 @@ export default class ExtensionManager {
|
||||
) => {
|
||||
const HTMLAttributes = getRenderedAttributes(node, extensionAttributes)
|
||||
|
||||
return renderer({
|
||||
return addNodeView()({
|
||||
editor,
|
||||
node,
|
||||
getPos,
|
||||
@@ -193,7 +284,7 @@ export default class ExtensionManager {
|
||||
})
|
||||
}
|
||||
|
||||
return [extension.config.name, nodeview]
|
||||
return [extension.name, nodeview]
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -202,17 +293,23 @@ export default class ExtensionManager {
|
||||
const { nodeExtensions } = splitExtensions(this.extensions)
|
||||
|
||||
return Object.fromEntries(nodeExtensions
|
||||
.filter(extension => !!extension.config.renderText)
|
||||
.filter(extension => !!getExtensionField(extension, 'renderText'))
|
||||
.map(extension => {
|
||||
const context = {
|
||||
options: extension.options,
|
||||
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]
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,13 @@ import { Plugin, Transaction } from 'prosemirror-state'
|
||||
import { Command as ProseMirrorCommand } from 'prosemirror-commands'
|
||||
import { InputRule } from 'prosemirror-inputrules'
|
||||
import mergeDeep from './utilities/mergeDeep'
|
||||
import { Attributes, RawCommands, GlobalAttributes } from './types'
|
||||
import {
|
||||
Attributes,
|
||||
RawCommands,
|
||||
GlobalAttributes,
|
||||
ParentConfig,
|
||||
} from './types'
|
||||
import { Node } from './Node'
|
||||
import { MarkConfig } from '.'
|
||||
import { Editor } from './Editor'
|
||||
|
||||
@@ -36,6 +42,7 @@ declare module '@tiptap/core' {
|
||||
*/
|
||||
addGlobalAttributes?: (this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<MarkConfig<Options>>['addGlobalAttributes'],
|
||||
}) => GlobalAttributes | {},
|
||||
|
||||
/**
|
||||
@@ -45,6 +52,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: MarkType,
|
||||
parent: ParentConfig<MarkConfig<Options>>['addCommands'],
|
||||
}) => Partial<RawCommands>,
|
||||
|
||||
/**
|
||||
@@ -54,6 +62,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: MarkType,
|
||||
parent: ParentConfig<MarkConfig<Options>>['addKeyboardShortcuts'],
|
||||
}) => {
|
||||
[key: string]: ProseMirrorCommand,
|
||||
},
|
||||
@@ -65,6 +74,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: MarkType,
|
||||
parent: ParentConfig<MarkConfig<Options>>['addInputRules'],
|
||||
}) => InputRule[],
|
||||
|
||||
/**
|
||||
@@ -74,6 +84,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: MarkType,
|
||||
parent: ParentConfig<MarkConfig<Options>>['addPasteRules'],
|
||||
}) => Plugin[],
|
||||
|
||||
/**
|
||||
@@ -83,6 +94,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: MarkType,
|
||||
parent: ParentConfig<MarkConfig<Options>>['addProseMirrorPlugins'],
|
||||
}) => Plugin[],
|
||||
|
||||
/**
|
||||
@@ -91,6 +103,7 @@ declare module '@tiptap/core' {
|
||||
extendNodeSchema?: ((
|
||||
this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<MarkConfig<Options>>['extendNodeSchema'],
|
||||
},
|
||||
extension: Node,
|
||||
) => {
|
||||
@@ -103,8 +116,9 @@ declare module '@tiptap/core' {
|
||||
extendMarkSchema?: ((
|
||||
this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<MarkConfig<Options>>['extendMarkSchema'],
|
||||
},
|
||||
extension: Node,
|
||||
extension: Mark,
|
||||
) => {
|
||||
[key: string]: any,
|
||||
}) | null,
|
||||
@@ -112,10 +126,11 @@ declare module '@tiptap/core' {
|
||||
/**
|
||||
* The editor is not ready yet.
|
||||
*/
|
||||
onBeforeCreate?: ((this: {
|
||||
onBeforeCreate?: ((this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: MarkType,
|
||||
parent: ParentConfig<MarkConfig<Options>>['onBeforeCreate'],
|
||||
}) => void) | null,
|
||||
|
||||
/**
|
||||
@@ -125,6 +140,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: MarkType,
|
||||
parent: ParentConfig<MarkConfig<Options>>['onCreate'],
|
||||
}) => void) | null,
|
||||
|
||||
/**
|
||||
@@ -134,6 +150,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: MarkType,
|
||||
parent: ParentConfig<MarkConfig<Options>>['onUpdate'],
|
||||
}) => void) | null,
|
||||
|
||||
/**
|
||||
@@ -143,6 +160,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: MarkType,
|
||||
parent: ParentConfig<MarkConfig<Options>>['onSelectionUpdate'],
|
||||
}) => void) | null,
|
||||
|
||||
/**
|
||||
@@ -153,6 +171,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: MarkType,
|
||||
parent: ParentConfig<MarkConfig<Options>>['onTransaction'],
|
||||
},
|
||||
props: {
|
||||
transaction: Transaction,
|
||||
@@ -167,6 +186,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: MarkType,
|
||||
parent: ParentConfig<MarkConfig<Options>>['onFocus'],
|
||||
},
|
||||
props: {
|
||||
event: FocusEvent,
|
||||
@@ -181,6 +201,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: MarkType,
|
||||
parent: ParentConfig<MarkConfig<Options>>['onBlur'],
|
||||
},
|
||||
props: {
|
||||
event: FocusEvent,
|
||||
@@ -194,6 +215,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: MarkType,
|
||||
parent: ParentConfig<MarkConfig<Options>>['onDestroy'],
|
||||
}) => void) | null,
|
||||
|
||||
/**
|
||||
@@ -204,22 +226,34 @@ declare module '@tiptap/core' {
|
||||
/**
|
||||
* Inclusive
|
||||
*/
|
||||
inclusive?: MarkSpec['inclusive'] | ((this: { options: Options }) => MarkSpec['inclusive']),
|
||||
inclusive?: MarkSpec['inclusive'] | ((this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<MarkConfig<Options>>['inclusive'],
|
||||
}) => MarkSpec['inclusive']),
|
||||
|
||||
/**
|
||||
* Excludes
|
||||
*/
|
||||
excludes?: MarkSpec['excludes'] | ((this: { options: Options }) => MarkSpec['excludes']),
|
||||
excludes?: MarkSpec['excludes'] | ((this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<MarkConfig<Options>>['excludes'],
|
||||
}) => MarkSpec['excludes']),
|
||||
|
||||
/**
|
||||
* Group
|
||||
*/
|
||||
group?: MarkSpec['group'] | ((this: { options: Options }) => MarkSpec['group']),
|
||||
group?: MarkSpec['group'] | ((this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<MarkConfig<Options>>['group'],
|
||||
}) => MarkSpec['group']),
|
||||
|
||||
/**
|
||||
* Spanning
|
||||
*/
|
||||
spanning?: MarkSpec['spanning'] | ((this: { options: Options }) => MarkSpec['spanning']),
|
||||
spanning?: MarkSpec['spanning'] | ((this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<MarkConfig<Options>>['spanning'],
|
||||
}) => MarkSpec['spanning']),
|
||||
|
||||
/**
|
||||
* Parse HTML
|
||||
@@ -227,6 +261,7 @@ declare module '@tiptap/core' {
|
||||
parseHTML?: (
|
||||
this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<MarkConfig<Options>>['parseHTML'],
|
||||
},
|
||||
) => MarkSpec['parseDOM'],
|
||||
|
||||
@@ -236,11 +271,12 @@ declare module '@tiptap/core' {
|
||||
renderHTML?: ((
|
||||
this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<MarkConfig<Options>>['renderHTML'],
|
||||
},
|
||||
props: {
|
||||
mark: ProseMirrorMark,
|
||||
HTMLAttributes: { [key: string]: any },
|
||||
}
|
||||
},
|
||||
) => DOMOutputSpec) | null,
|
||||
|
||||
/**
|
||||
@@ -249,6 +285,7 @@ declare module '@tiptap/core' {
|
||||
addAttributes?: (
|
||||
this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<MarkConfig<Options>>['addAttributes'],
|
||||
},
|
||||
) => Attributes | {},
|
||||
}
|
||||
@@ -257,43 +294,56 @@ declare module '@tiptap/core' {
|
||||
export class Mark<Options = any> {
|
||||
type = 'mark'
|
||||
|
||||
name = 'mark'
|
||||
|
||||
parent: Mark | null = null
|
||||
|
||||
child: Mark | null = null
|
||||
|
||||
options: Options
|
||||
|
||||
config: MarkConfig = {
|
||||
name: 'mark',
|
||||
name: this.name,
|
||||
priority: 100,
|
||||
defaultOptions: {},
|
||||
}
|
||||
|
||||
options!: Options
|
||||
|
||||
constructor(config: MarkConfig<Options>) {
|
||||
constructor(config: Partial<MarkConfig<Options>> = {}) {
|
||||
this.config = {
|
||||
...this.config,
|
||||
...config,
|
||||
}
|
||||
|
||||
this.name = this.config.name
|
||||
this.options = this.config.defaultOptions
|
||||
}
|
||||
|
||||
static create<O>(config: MarkConfig<O>) {
|
||||
static create<O>(config: Partial<MarkConfig<O>> = {}) {
|
||||
return new Mark<O>(config)
|
||||
}
|
||||
|
||||
configure(options: Partial<Options> = {}) {
|
||||
return Mark
|
||||
.create<Options>(this.config as MarkConfig<Options>)
|
||||
.#configure(options)
|
||||
}
|
||||
|
||||
#configure = (options: Partial<Options>) => {
|
||||
this.options = mergeDeep(this.config.defaultOptions, options) as Options
|
||||
this.options = mergeDeep(this.options, options) as Options
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
extend<ExtendedOptions = Options>(extendedConfig: Partial<MarkConfig<ExtendedOptions>>) {
|
||||
return new Mark<ExtendedOptions>({
|
||||
...this.config,
|
||||
...extendedConfig,
|
||||
} as MarkConfig<ExtendedOptions>)
|
||||
extend<ExtendedOptions = Options>(extendedConfig: Partial<MarkConfig<ExtendedOptions>> = {}) {
|
||||
const extension = new Mark<ExtendedOptions>(extendedConfig)
|
||||
|
||||
extension.parent = this
|
||||
|
||||
this.child = extension
|
||||
|
||||
extension.name = extendedConfig.name
|
||||
? extendedConfig.name
|
||||
: this.name
|
||||
|
||||
extension.options = {
|
||||
...extension.parent.options,
|
||||
...extension.options,
|
||||
}
|
||||
|
||||
return extension
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
NodeViewRenderer,
|
||||
GlobalAttributes,
|
||||
RawCommands,
|
||||
ParentConfig,
|
||||
} from './types'
|
||||
import { NodeConfig } from '.'
|
||||
import { Editor } from './Editor'
|
||||
@@ -41,6 +42,7 @@ declare module '@tiptap/core' {
|
||||
*/
|
||||
addGlobalAttributes?: (this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<NodeConfig<Options>>['addGlobalAttributes'],
|
||||
}) => GlobalAttributes | {},
|
||||
|
||||
/**
|
||||
@@ -50,6 +52,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType,
|
||||
parent: ParentConfig<NodeConfig<Options>>['addCommands'],
|
||||
}) => Partial<RawCommands>,
|
||||
|
||||
/**
|
||||
@@ -59,6 +62,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType,
|
||||
parent: ParentConfig<NodeConfig<Options>>['addKeyboardShortcuts'],
|
||||
}) => {
|
||||
[key: string]: ProseMirrorCommand,
|
||||
},
|
||||
@@ -70,6 +74,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType,
|
||||
parent: ParentConfig<NodeConfig<Options>>['addInputRules'],
|
||||
}) => InputRule[],
|
||||
|
||||
/**
|
||||
@@ -79,6 +84,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType,
|
||||
parent: ParentConfig<NodeConfig<Options>>['addPasteRules'],
|
||||
}) => Plugin[],
|
||||
|
||||
/**
|
||||
@@ -88,6 +94,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType,
|
||||
parent: ParentConfig<NodeConfig<Options>>['addProseMirrorPlugins'],
|
||||
}) => Plugin[],
|
||||
|
||||
/**
|
||||
@@ -96,6 +103,7 @@ declare module '@tiptap/core' {
|
||||
extendNodeSchema?: ((
|
||||
this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<NodeConfig<Options>>['extendNodeSchema'],
|
||||
},
|
||||
extension: Node,
|
||||
) => {
|
||||
@@ -108,6 +116,7 @@ declare module '@tiptap/core' {
|
||||
extendMarkSchema?: ((
|
||||
this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<NodeConfig<Options>>['extendMarkSchema'],
|
||||
},
|
||||
extension: Node,
|
||||
) => {
|
||||
@@ -121,6 +130,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType,
|
||||
parent: ParentConfig<NodeConfig<Options>>['onBeforeCreate'],
|
||||
}) => void) | null,
|
||||
|
||||
/**
|
||||
@@ -130,6 +140,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType,
|
||||
parent: ParentConfig<NodeConfig<Options>>['onCreate'],
|
||||
}) => void) | null,
|
||||
|
||||
/**
|
||||
@@ -139,6 +150,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType,
|
||||
parent: ParentConfig<NodeConfig<Options>>['onUpdate'],
|
||||
}) => void) | null,
|
||||
|
||||
/**
|
||||
@@ -148,6 +160,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType,
|
||||
parent: ParentConfig<NodeConfig<Options>>['onSelectionUpdate'],
|
||||
}) => void) | null,
|
||||
|
||||
/**
|
||||
@@ -158,6 +171,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType,
|
||||
parent: ParentConfig<NodeConfig<Options>>['onTransaction'],
|
||||
},
|
||||
props: {
|
||||
transaction: Transaction,
|
||||
@@ -172,6 +186,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType,
|
||||
parent: ParentConfig<NodeConfig<Options>>['onFocus'],
|
||||
},
|
||||
props: {
|
||||
event: FocusEvent,
|
||||
@@ -186,6 +201,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType,
|
||||
parent: ParentConfig<NodeConfig<Options>>['onBlur'],
|
||||
},
|
||||
props: {
|
||||
event: FocusEvent,
|
||||
@@ -199,6 +215,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType,
|
||||
parent: ParentConfig<NodeConfig<Options>>['onDestroy'],
|
||||
}) => void) | null,
|
||||
|
||||
/**
|
||||
@@ -208,6 +225,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType,
|
||||
parent: ParentConfig<NodeConfig<Options>>['addNodeView'],
|
||||
}) => NodeViewRenderer) | null,
|
||||
|
||||
/**
|
||||
@@ -218,52 +236,82 @@ declare module '@tiptap/core' {
|
||||
/**
|
||||
* Content
|
||||
*/
|
||||
content?: NodeSpec['content'] | ((this: { options: Options }) => NodeSpec['content']),
|
||||
content?: NodeSpec['content'] | ((this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<NodeConfig<Options>>['content'],
|
||||
}) => NodeSpec['content']),
|
||||
|
||||
/**
|
||||
* Marks
|
||||
*/
|
||||
marks?: NodeSpec['marks'] | ((this: { options: Options }) => NodeSpec['marks']),
|
||||
marks?: NodeSpec['marks'] | ((this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<NodeConfig<Options>>['marks'],
|
||||
}) => NodeSpec['marks']),
|
||||
|
||||
/**
|
||||
* Group
|
||||
*/
|
||||
group?: NodeSpec['group'] | ((this: { options: Options }) => NodeSpec['group']),
|
||||
group?: NodeSpec['group'] | ((this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<NodeConfig<Options>>['group'],
|
||||
}) => NodeSpec['group']),
|
||||
|
||||
/**
|
||||
* Inline
|
||||
*/
|
||||
inline?: NodeSpec['inline'] | ((this: { options: Options }) => NodeSpec['inline']),
|
||||
inline?: NodeSpec['inline'] | ((this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<NodeConfig<Options>>['inline'],
|
||||
}) => NodeSpec['inline']),
|
||||
|
||||
/**
|
||||
* Atom
|
||||
*/
|
||||
atom?: NodeSpec['atom'] | ((this: { options: Options }) => NodeSpec['atom']),
|
||||
atom?: NodeSpec['atom'] | ((this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<NodeConfig<Options>>['atom'],
|
||||
}) => NodeSpec['atom']),
|
||||
|
||||
/**
|
||||
* Selectable
|
||||
*/
|
||||
selectable?: NodeSpec['selectable'] | ((this: { options: Options }) => NodeSpec['selectable']),
|
||||
selectable?: NodeSpec['selectable'] | ((this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<NodeConfig<Options>>['selectable'],
|
||||
}) => NodeSpec['selectable']),
|
||||
|
||||
/**
|
||||
* Draggable
|
||||
*/
|
||||
draggable?: NodeSpec['draggable'] | ((this: { options: Options }) => NodeSpec['draggable']),
|
||||
draggable?: NodeSpec['draggable'] | ((this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<NodeConfig<Options>>['draggable'],
|
||||
}) => NodeSpec['draggable']),
|
||||
|
||||
/**
|
||||
* Code
|
||||
*/
|
||||
code?: NodeSpec['code'] | ((this: { options: Options }) => NodeSpec['code']),
|
||||
code?: NodeSpec['code'] | ((this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<NodeConfig<Options>>['code'],
|
||||
}) => NodeSpec['code']),
|
||||
|
||||
/**
|
||||
* Defining
|
||||
*/
|
||||
defining?: NodeSpec['defining'] | ((this: { options: Options }) => NodeSpec['defining']),
|
||||
defining?: NodeSpec['defining'] | ((this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<NodeConfig<Options>>['defining'],
|
||||
}) => NodeSpec['defining']),
|
||||
|
||||
/**
|
||||
* Isolating
|
||||
*/
|
||||
isolating?: NodeSpec['isolating'] | ((this: { options: Options }) => NodeSpec['isolating']),
|
||||
isolating?: NodeSpec['isolating'] | ((this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<NodeConfig<Options>>['isolating'],
|
||||
}) => NodeSpec['isolating']),
|
||||
|
||||
/**
|
||||
* Parse HTML
|
||||
@@ -271,6 +319,7 @@ declare module '@tiptap/core' {
|
||||
parseHTML?: (
|
||||
this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<NodeConfig<Options>>['parseHTML'],
|
||||
},
|
||||
) => NodeSpec['parseDOM'],
|
||||
|
||||
@@ -280,6 +329,7 @@ declare module '@tiptap/core' {
|
||||
renderHTML?: ((
|
||||
this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<NodeConfig<Options>>['renderHTML'],
|
||||
},
|
||||
props: {
|
||||
node: ProseMirrorNode,
|
||||
@@ -295,6 +345,7 @@ declare module '@tiptap/core' {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType,
|
||||
parent: ParentConfig<NodeConfig<Options>>['renderText'],
|
||||
},
|
||||
props: {
|
||||
node: ProseMirrorNode,
|
||||
@@ -307,6 +358,7 @@ declare module '@tiptap/core' {
|
||||
addAttributes?: (
|
||||
this: {
|
||||
options: Options,
|
||||
parent: ParentConfig<NodeConfig<Options>>['addAttributes'],
|
||||
},
|
||||
) => Attributes | {},
|
||||
}
|
||||
@@ -315,43 +367,56 @@ declare module '@tiptap/core' {
|
||||
export class Node<Options = any> {
|
||||
type = 'node'
|
||||
|
||||
name = 'node'
|
||||
|
||||
parent: Node | null = null
|
||||
|
||||
child: Node | null = null
|
||||
|
||||
options: Options
|
||||
|
||||
config: NodeConfig = {
|
||||
name: 'node',
|
||||
name: this.name,
|
||||
priority: 100,
|
||||
defaultOptions: {},
|
||||
}
|
||||
|
||||
options!: Options
|
||||
|
||||
constructor(config: NodeConfig<Options>) {
|
||||
constructor(config: Partial<NodeConfig<Options>> = {}) {
|
||||
this.config = {
|
||||
...this.config,
|
||||
...config,
|
||||
}
|
||||
|
||||
this.name = this.config.name
|
||||
this.options = this.config.defaultOptions
|
||||
}
|
||||
|
||||
static create<O>(config: NodeConfig<O>) {
|
||||
static create<O>(config: Partial<NodeConfig<O>> = {}) {
|
||||
return new Node<O>(config)
|
||||
}
|
||||
|
||||
configure(options: Partial<Options> = {}) {
|
||||
return Node
|
||||
.create<Options>(this.config as NodeConfig<Options>)
|
||||
.#configure(options)
|
||||
}
|
||||
|
||||
#configure = (options: Partial<Options>) => {
|
||||
this.options = mergeDeep(this.config.defaultOptions, options) as Options
|
||||
this.options = mergeDeep(this.options, options) as Options
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
extend<ExtendedOptions = Options>(extendedConfig: Partial<NodeConfig<ExtendedOptions>>) {
|
||||
return new Node<ExtendedOptions>({
|
||||
...this.config,
|
||||
...extendedConfig,
|
||||
} as NodeConfig<ExtendedOptions>)
|
||||
extend<ExtendedOptions = Options>(extendedConfig: Partial<NodeConfig<ExtendedOptions>> = {}) {
|
||||
const extension = new Node<ExtendedOptions>(extendedConfig)
|
||||
|
||||
extension.parent = this
|
||||
|
||||
this.child = extension
|
||||
|
||||
extension.name = extendedConfig.name
|
||||
? extendedConfig.name
|
||||
: this.name
|
||||
|
||||
extension.options = {
|
||||
...extension.parent.options,
|
||||
...extension.options,
|
||||
}
|
||||
|
||||
return extension
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ declare module '@tiptap/core' {
|
||||
/**
|
||||
* Clear the whole document.
|
||||
*/
|
||||
clearContent: (emitUpdate: Boolean) => Command,
|
||||
clearContent: (emitUpdate?: Boolean) => Command,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import splitExtensions from './splitExtensions'
|
||||
import getExtensionField from './getExtensionField'
|
||||
import {
|
||||
Extensions,
|
||||
GlobalAttributes,
|
||||
Attributes,
|
||||
Attribute,
|
||||
ExtensionAttribute,
|
||||
AnyConfig,
|
||||
} from '../types'
|
||||
import { NodeConfig, MarkConfig } from '..'
|
||||
|
||||
/**
|
||||
* Get a list of all extension attributes defined in `addAttribute` and `addGlobalAttribute`.
|
||||
@@ -28,11 +31,18 @@ export default function getAttributesFromExtensions(extensions: Extensions): Ext
|
||||
options: extension.options,
|
||||
}
|
||||
|
||||
if (!extension.config.addGlobalAttributes) {
|
||||
const addGlobalAttributes = getExtensionField<AnyConfig['addGlobalAttributes']>(
|
||||
extension,
|
||||
'addGlobalAttributes',
|
||||
context,
|
||||
)
|
||||
|
||||
if (!addGlobalAttributes) {
|
||||
return
|
||||
}
|
||||
|
||||
const globalAttributes = extension.config.addGlobalAttributes.bind(context)() as GlobalAttributes
|
||||
// TODO: remove `as GlobalAttributes`
|
||||
const globalAttributes = addGlobalAttributes() as GlobalAttributes
|
||||
|
||||
globalAttributes.forEach(globalAttribute => {
|
||||
globalAttribute.types.forEach(type => {
|
||||
@@ -57,17 +67,24 @@ export default function getAttributesFromExtensions(extensions: Extensions): Ext
|
||||
options: extension.options,
|
||||
}
|
||||
|
||||
if (!extension.config.addAttributes) {
|
||||
const addAttributes = getExtensionField<NodeConfig['addAttributes'] | MarkConfig['addAttributes']>(
|
||||
extension,
|
||||
'addAttributes',
|
||||
context,
|
||||
)
|
||||
|
||||
if (!addAttributes) {
|
||||
return
|
||||
}
|
||||
|
||||
const attributes = extension.config.addAttributes.bind(context)() as Attributes
|
||||
// TODO: remove `as Attributes`
|
||||
const attributes = addAttributes() as Attributes
|
||||
|
||||
Object
|
||||
.entries(attributes)
|
||||
.forEach(([name, attribute]) => {
|
||||
extensionAttributes.push({
|
||||
type: extension.config.name,
|
||||
type: extension.name,
|
||||
name,
|
||||
attribute: {
|
||||
...defaultAttribute,
|
||||
|
||||
25
packages/core/src/helpers/getExtensionField.ts
Normal file
25
packages/core/src/helpers/getExtensionField.ts
Normal 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]
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
import { NodeSpec, MarkSpec, Schema } from 'prosemirror-model'
|
||||
import { Extensions } from '../types'
|
||||
import { ExtensionConfig, NodeConfig, MarkConfig } from '..'
|
||||
import { AnyConfig, Extensions } from '../types'
|
||||
import { NodeConfig, MarkConfig } from '..'
|
||||
import splitExtensions from './splitExtensions'
|
||||
import getAttributesFromExtensions from './getAttributesFromExtensions'
|
||||
import getRenderedAttributes from './getRenderedAttributes'
|
||||
import isEmptyObject from '../utilities/isEmptyObject'
|
||||
import injectExtensionAttributesToParseRule from './injectExtensionAttributesToParseRule'
|
||||
import callOrReturn from '../utilities/callOrReturn'
|
||||
import getExtensionField from './getExtensionField'
|
||||
|
||||
function cleanUpSchemaItem<T>(data: T) {
|
||||
return Object.fromEntries(Object.entries(data).filter(([key, value]) => {
|
||||
@@ -21,112 +22,110 @@ function cleanUpSchemaItem<T>(data: T) {
|
||||
export default function getSchema(extensions: Extensions): Schema {
|
||||
const allAttributes = getAttributesFromExtensions(extensions)
|
||||
const { nodeExtensions, markExtensions } = splitExtensions(extensions)
|
||||
const topNode = nodeExtensions.find(extension => extension.config.topNode)?.config.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 topNode = nodeExtensions.find(extension => getExtensionField(extension, 'topNode'))?.name
|
||||
|
||||
const nodes = Object.fromEntries(nodeExtensions.map(extension => {
|
||||
const extensionAttributes = allAttributes.filter(attribute => attribute.type === extension.config.name)
|
||||
const context = { options: extension.options }
|
||||
const extensionAttributes = allAttributes.filter(attribute => attribute.type === extension.name)
|
||||
const context = {
|
||||
options: extension.options,
|
||||
}
|
||||
|
||||
const extraNodeFields = nodeSchemaExtenders.reduce((fields, nodeSchemaExtender) => {
|
||||
const extraFields = callOrReturn(nodeSchemaExtender, context, extension)
|
||||
const extraNodeFields = extensions.reduce((fields, e) => {
|
||||
const extendNodeSchema = getExtensionField<AnyConfig['extendNodeSchema']>(
|
||||
e,
|
||||
'extendNodeSchema',
|
||||
context,
|
||||
)
|
||||
|
||||
return {
|
||||
...fields,
|
||||
...extraFields,
|
||||
...(extendNodeSchema ? extendNodeSchema(extension) : {}),
|
||||
}
|
||||
}, {})
|
||||
|
||||
const schema: NodeSpec = cleanUpSchemaItem({
|
||||
...extraNodeFields,
|
||||
content: callOrReturn(extension.config.content, context),
|
||||
marks: callOrReturn(extension.config.marks, context),
|
||||
group: callOrReturn(extension.config.group, context),
|
||||
inline: callOrReturn(extension.config.inline, context),
|
||||
atom: callOrReturn(extension.config.atom, context),
|
||||
selectable: callOrReturn(extension.config.selectable, context),
|
||||
draggable: callOrReturn(extension.config.draggable, context),
|
||||
code: callOrReturn(extension.config.code, context),
|
||||
defining: callOrReturn(extension.config.defining, context),
|
||||
isolating: callOrReturn(extension.config.isolating, context),
|
||||
content: callOrReturn(getExtensionField<NodeConfig['content']>(extension, 'content', context)),
|
||||
marks: callOrReturn(getExtensionField<NodeConfig['marks']>(extension, 'marks', context)),
|
||||
group: callOrReturn(getExtensionField<NodeConfig['group']>(extension, 'group', context)),
|
||||
inline: callOrReturn(getExtensionField<NodeConfig['inline']>(extension, 'inline', context)),
|
||||
atom: callOrReturn(getExtensionField<NodeConfig['atom']>(extension, 'atom', context)),
|
||||
selectable: callOrReturn(getExtensionField<NodeConfig['selectable']>(extension, 'selectable', context)),
|
||||
draggable: callOrReturn(getExtensionField<NodeConfig['draggable']>(extension, 'draggable', context)),
|
||||
code: callOrReturn(getExtensionField<NodeConfig['code']>(extension, 'code', context)),
|
||||
defining: callOrReturn(getExtensionField<NodeConfig['defining']>(extension, 'defining', context)),
|
||||
isolating: callOrReturn(getExtensionField<NodeConfig['isolating']>(extension, 'isolating', context)),
|
||||
attrs: Object.fromEntries(extensionAttributes.map(extensionAttribute => {
|
||||
return [extensionAttribute.name, { default: extensionAttribute?.attribute?.default }]
|
||||
})),
|
||||
})
|
||||
|
||||
if (extension.config.parseHTML) {
|
||||
schema.parseDOM = extension.config.parseHTML
|
||||
.bind(context)()
|
||||
?.map(parseRule => injectExtensionAttributesToParseRule(parseRule, extensionAttributes))
|
||||
const parseHTML = callOrReturn(getExtensionField<NodeConfig['parseHTML']>(extension, 'parseHTML', context))
|
||||
|
||||
if (parseHTML) {
|
||||
schema.parseDOM = parseHTML
|
||||
.map(parseRule => injectExtensionAttributesToParseRule(parseRule, extensionAttributes))
|
||||
}
|
||||
|
||||
if (extension.config.renderHTML) {
|
||||
schema.toDOM = node => (extension.config.renderHTML as Function)?.bind(context)({
|
||||
const renderHTML = getExtensionField<NodeConfig['renderHTML']>(extension, 'renderHTML', context)
|
||||
|
||||
if (renderHTML) {
|
||||
schema.toDOM = node => renderHTML({
|
||||
node,
|
||||
HTMLAttributes: getRenderedAttributes(node, extensionAttributes),
|
||||
})
|
||||
}
|
||||
|
||||
return [extension.config.name, schema]
|
||||
return [extension.name, schema]
|
||||
}))
|
||||
|
||||
const marks = Object.fromEntries(markExtensions.map(extension => {
|
||||
const extensionAttributes = allAttributes.filter(attribute => attribute.type === extension.config.name)
|
||||
const context = { options: extension.options }
|
||||
const extensionAttributes = allAttributes.filter(attribute => attribute.type === extension.name)
|
||||
const context = {
|
||||
options: extension.options,
|
||||
}
|
||||
|
||||
const extraMarkFields = markSchemaExtenders.reduce((fields, markSchemaExtender) => {
|
||||
const extraFields = callOrReturn(markSchemaExtender, context, extension)
|
||||
const extraMarkFields = extensions.reduce((fields, e) => {
|
||||
const extendMarkSchema = getExtensionField<AnyConfig['extendMarkSchema']>(
|
||||
e,
|
||||
'extendMarkSchema',
|
||||
context,
|
||||
)
|
||||
|
||||
return {
|
||||
...fields,
|
||||
...extraFields,
|
||||
...(extendMarkSchema ? extendMarkSchema(extension) : {}),
|
||||
}
|
||||
}, {})
|
||||
|
||||
const schema: MarkSpec = cleanUpSchemaItem({
|
||||
...extraMarkFields,
|
||||
inclusive: callOrReturn(extension.config.inclusive, context),
|
||||
excludes: callOrReturn(extension.config.excludes, context),
|
||||
group: callOrReturn(extension.config.group, context),
|
||||
spanning: callOrReturn(extension.config.spanning, context),
|
||||
inclusive: callOrReturn(getExtensionField<NodeConfig['inclusive']>(extension, 'inclusive', context)),
|
||||
excludes: callOrReturn(getExtensionField<NodeConfig['excludes']>(extension, 'excludes', context)),
|
||||
group: callOrReturn(getExtensionField<NodeConfig['group']>(extension, 'group', context)),
|
||||
spanning: callOrReturn(getExtensionField<NodeConfig['spanning']>(extension, 'spanning', context)),
|
||||
attrs: Object.fromEntries(extensionAttributes.map(extensionAttribute => {
|
||||
return [extensionAttribute.name, { default: extensionAttribute?.attribute?.default }]
|
||||
})),
|
||||
})
|
||||
|
||||
if (extension.config.parseHTML) {
|
||||
schema.parseDOM = extension.config.parseHTML
|
||||
.bind(context)()
|
||||
?.map(parseRule => injectExtensionAttributesToParseRule(parseRule, extensionAttributes))
|
||||
const parseHTML = callOrReturn(getExtensionField<MarkConfig['parseHTML']>(extension, 'parseHTML', context))
|
||||
|
||||
if (parseHTML) {
|
||||
schema.parseDOM = parseHTML
|
||||
.map(parseRule => injectExtensionAttributesToParseRule(parseRule, extensionAttributes))
|
||||
}
|
||||
|
||||
if (extension.config.renderHTML) {
|
||||
schema.toDOM = mark => (extension.config.renderHTML as Function)?.bind(context)({
|
||||
const renderHTML = getExtensionField<MarkConfig['renderHTML']>(extension, 'renderHTML', context)
|
||||
|
||||
if (renderHTML) {
|
||||
schema.toDOM = mark => renderHTML({
|
||||
mark,
|
||||
HTMLAttributes: getRenderedAttributes(mark, extensionAttributes),
|
||||
})
|
||||
}
|
||||
|
||||
return [extension.config.name, schema]
|
||||
return [extension.name, schema]
|
||||
}))
|
||||
|
||||
return new Schema({
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
import { Extensions } from '../types'
|
||||
import { NodeConfig } from '..'
|
||||
import splitExtensions from './splitExtensions'
|
||||
import callOrReturn from '../utilities/callOrReturn'
|
||||
import getExtensionField from '../helpers/getExtensionField'
|
||||
|
||||
export default function isList(name: string, extensions: Extensions): boolean {
|
||||
const { nodeExtensions } = splitExtensions(extensions)
|
||||
const extension = nodeExtensions.find(item => item.config.name === name)
|
||||
const extension = nodeExtensions.find(item => item.name === name)
|
||||
|
||||
if (!extension) {
|
||||
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 groups.split(' ').includes('list')
|
||||
return group.split(' ').includes('list')
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ export { default as markPasteRule } from './pasteRules/markPasteRule'
|
||||
export { default as callOrReturn } from './utilities/callOrReturn'
|
||||
export { default as mergeAttributes } from './utilities/mergeAttributes'
|
||||
|
||||
export { default as getExtensionField } from './helpers/getExtensionField'
|
||||
export { default as findChildren } from './helpers/findChildren'
|
||||
export { default as findParentNode } from './helpers/findParentNode'
|
||||
export { default as findParentNodeClosestToPos } from './helpers/findParentNodeClosestToPos'
|
||||
|
||||
@@ -14,9 +14,30 @@ import { Extension } from './Extension'
|
||||
import { Node } from './Node'
|
||||
import { Mark } from './Mark'
|
||||
import { Editor } from './Editor'
|
||||
import { Commands } from '.'
|
||||
import {
|
||||
Commands,
|
||||
ExtensionConfig,
|
||||
NodeConfig,
|
||||
MarkConfig,
|
||||
} from '.'
|
||||
|
||||
export type Extensions = (Extension | Node | Mark)[]
|
||||
export type AnyConfig = ExtensionConfig | NodeConfig | MarkConfig
|
||||
export type AnyExtension = Extension | Node | Mark
|
||||
export type Extensions = AnyExtension[]
|
||||
|
||||
export type ParentConfig<T> = Partial<{
|
||||
[P in keyof T]: Required<T>[P] extends (...args: any) => any
|
||||
? (...args: Parameters<Required<T>[P]>) => ReturnType<Required<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 {
|
||||
element: Element,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { MaybeReturnType } from '../types'
|
||||
|
||||
/**
|
||||
* Optionally calls `value` as a function.
|
||||
* Otherwise it is returned directly.
|
||||
@@ -5,7 +7,7 @@
|
||||
* @param context Optional context to bind 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 (context) {
|
||||
return value.bind(context)(...props)
|
||||
@@ -14,5 +16,5 @@ export default function callOrReturn(value: any, context: any = undefined, ...pr
|
||||
return value(...props)
|
||||
}
|
||||
|
||||
return value
|
||||
return value as MaybeReturnType<T>
|
||||
}
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
export default function elementFromString(value: string): HTMLElement {
|
||||
const htmlString = `<div>${value}</div>`
|
||||
const parser = new window.DOMParser()
|
||||
const element = parser.parseFromString(htmlString, 'text/html').body
|
||||
|
||||
return element
|
||||
return new window.DOMParser().parseFromString(value, 'text/html').body
|
||||
}
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-blockquote
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-blockquote",
|
||||
"description": "blockquote extension for tiptap",
|
||||
"version": "2.0.0-beta.1",
|
||||
"version": "2.0.0-beta.2",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-bold
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-bold",
|
||||
"description": "bold extension for tiptap",
|
||||
"version": "2.0.0-beta.1",
|
||||
"version": "2.0.0-beta.2",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-bubble-menu
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-bubble-menu",
|
||||
"description": "bubble-menu extension for tiptap",
|
||||
"version": "2.0.0-beta.5",
|
||||
"version": "2.0.0-beta.6",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-bullet-list
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-bullet-list",
|
||||
"description": "bullet list extension for tiptap",
|
||||
"version": "2.0.0-beta.1",
|
||||
"version": "2.0.0-beta.2",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-character-count
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-character-count",
|
||||
"description": "font family extension for tiptap",
|
||||
"version": "2.0.0-beta.1",
|
||||
"version": "2.0.0-beta.2",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,52 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-code-block-lowlight
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [2.0.0-beta.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code-block-lowlight@2.0.0-beta.3...@tiptap/extension-code-block-lowlight@2.0.0-beta.4) (2021-04-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix lowlight decorations for vue 3 ([daa5dc0](https://github.com/ueberdosis/tiptap-next/commit/daa5dc0fb1ec2db6889565fc9c091f3dbdbbda6d))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code-block-lowlight@2.0.0-beta.2...@tiptap/extension-code-block-lowlight@2.0.0-beta.3) (2021-04-12)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add parentConfig to extension context for more extendable extensions, fix [#259](https://github.com/ueberdosis/tiptap-next/issues/259) ([5e1ec5d](https://github.com/ueberdosis/tiptap-next/commit/5e1ec5d2a66be164f505d631f97861ab9344ba96))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code-block-lowlight@2.0.0-beta.1...@tiptap/extension-code-block-lowlight@2.0.0-beta.2) (2021-04-11)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-code-block-lowlight
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 2.0.0-beta.1 (2021-04-08)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-code-block-lowlight
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-code-block-lowlight",
|
||||
"description": "code block extension for tiptap",
|
||||
"version": "2.0.0-beta.1",
|
||||
"version": "2.0.0-beta.7",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
@@ -25,7 +25,7 @@
|
||||
"@tiptap/core": "^2.0.0-beta.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tiptap/extension-code-block": "^2.0.0-beta.1",
|
||||
"@tiptap/extension-code-block": "^2.0.0-beta.4",
|
||||
"@types/lowlight": "^0.0.1",
|
||||
"lowlight": "^1.20.0",
|
||||
"prosemirror-model": "^1.14.0",
|
||||
|
||||
@@ -1,10 +1,24 @@
|
||||
import CodeBlock from '@tiptap/extension-code-block'
|
||||
import lowlight from 'lowlight/lib/core'
|
||||
import CodeBlock, { CodeBlockOptions } from '@tiptap/extension-code-block'
|
||||
import { LowlightPlugin } from './lowlight-plugin'
|
||||
|
||||
export const CodeBlockLowlight = CodeBlock.extend({
|
||||
export interface CodeBlockLowlightOptions extends CodeBlockOptions {
|
||||
lowlight: any,
|
||||
}
|
||||
|
||||
export const CodeBlockLowlight = CodeBlock.extend<CodeBlockLowlightOptions>({
|
||||
defaultOptions: {
|
||||
...CodeBlock.options,
|
||||
lowlight,
|
||||
},
|
||||
|
||||
addProseMirrorPlugins() {
|
||||
return [
|
||||
LowlightPlugin({ name: 'codeBlock' }),
|
||||
...this.parent?.() || [],
|
||||
LowlightPlugin({
|
||||
name: 'codeBlock',
|
||||
lowlight: this.options.lowlight,
|
||||
}),
|
||||
]
|
||||
},
|
||||
})
|
||||
|
||||
@@ -2,7 +2,6 @@ import { Plugin, PluginKey } from 'prosemirror-state'
|
||||
import { Decoration, DecorationSet } from 'prosemirror-view'
|
||||
import { Node as ProsemirrorNode } from 'prosemirror-model'
|
||||
import { findChildren } from '@tiptap/core'
|
||||
import lowlight from 'lowlight/lib/core'
|
||||
|
||||
function parseNodes(nodes: any[], className: string[] = []): { text: string, classes: string[] }[] {
|
||||
return nodes
|
||||
@@ -26,7 +25,7 @@ function parseNodes(nodes: any[], className: string[] = []): { text: string, cla
|
||||
.flat()
|
||||
}
|
||||
|
||||
function getDecorations({ doc, name }: { doc: ProsemirrorNode, name: string}) {
|
||||
function getDecorations({ doc, name, lowlight }: { doc: ProsemirrorNode, name: string, lowlight: any }) {
|
||||
const decorations: Decoration[] = []
|
||||
|
||||
findChildren(doc, node => node.type.name === name)
|
||||
@@ -58,12 +57,12 @@ function getDecorations({ doc, name }: { doc: ProsemirrorNode, name: string}) {
|
||||
return DecorationSet.create(doc, decorations)
|
||||
}
|
||||
|
||||
export function LowlightPlugin({ name }: { name: string }) {
|
||||
export function LowlightPlugin({ name, lowlight }: { name: string, lowlight: any }) {
|
||||
return new Plugin({
|
||||
key: new PluginKey('lowlight'),
|
||||
|
||||
state: {
|
||||
init: (_, { doc }) => getDecorations({ doc, name }),
|
||||
init: (_, { doc }) => getDecorations({ doc, name, lowlight }),
|
||||
apply: (transaction, decorationSet, oldState, newState) => {
|
||||
const oldNodeName = oldState.selection.$head.parent.type.name
|
||||
const newNodeName = newState.selection.$head.parent.type.name
|
||||
@@ -95,7 +94,7 @@ export function LowlightPlugin({ name }: { name: string }) {
|
||||
})
|
||||
)
|
||||
) {
|
||||
return getDecorations({ doc: transaction.doc, name })
|
||||
return getDecorations({ doc: transaction.doc, name, lowlight })
|
||||
}
|
||||
|
||||
return decorationSet.map(transaction.mapping, transaction.doc)
|
||||
|
||||
@@ -3,6 +3,25 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.4](https://github.com/ueberdosis/tiptap-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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove codeblock when at start of document, fix [#262](https://github.com/ueberdosis/tiptap-next/issues/262) ([92f6ea2](https://github.com/ueberdosis/tiptap-next/commit/92f6ea25cc7623d0bd34f5a2342be6f5aae951aa))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code-block@2.0.0-beta.1...@tiptap/extension-code-block@2.0.0-beta.2) (2021-04-02)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-code-block
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-code-block",
|
||||
"description": "code block extension for tiptap",
|
||||
"version": "2.0.0-beta.2",
|
||||
"version": "2.0.0-beta.4",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -101,6 +101,22 @@ export const CodeBlock = Node.create<CodeBlockOptions>({
|
||||
addKeyboardShortcuts() {
|
||||
return {
|
||||
'Mod-Alt-c': () => this.editor.commands.toggleCodeBlock(),
|
||||
|
||||
// remove code block when at start of document or code block is empty
|
||||
Backspace: state => {
|
||||
const { empty, $anchor } = state.selection
|
||||
const isAtStart = $anchor.pos === 1
|
||||
|
||||
if (!empty || $anchor.parent.type.name !== 'codeBlock') {
|
||||
return false
|
||||
}
|
||||
|
||||
if (isAtStart || !$anchor.parent.textContent.length) {
|
||||
return this.editor.commands.clearNodes()
|
||||
}
|
||||
|
||||
return false
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-code
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-code",
|
||||
"description": "code extension for tiptap",
|
||||
"version": "2.0.0-beta.1",
|
||||
"version": "2.0.0-beta.2",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-collaboration-cursor",
|
||||
"description": "collaboration cursor extension for tiptap",
|
||||
"version": "2.0.0-beta.5",
|
||||
"version": "2.0.0-beta.6",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-collaboration
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-collaboration",
|
||||
"description": "collaboration extension for tiptap",
|
||||
"version": "2.0.0-beta.4",
|
||||
"version": "2.0.0-beta.5",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-document
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-document",
|
||||
"description": "document extension for tiptap",
|
||||
"version": "2.0.0-beta.1",
|
||||
"version": "2.0.0-beta.2",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-dropcursor
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-dropcursor",
|
||||
"description": "dropcursor extension for tiptap",
|
||||
"version": "2.0.0-beta.2",
|
||||
"version": "2.0.0-beta.3",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-floating-menu
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-floating-menu",
|
||||
"description": "floating-menu extension for tiptap",
|
||||
"version": "2.0.0-beta.2",
|
||||
"version": "2.0.0-beta.3",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-focus
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-focus",
|
||||
"description": "focus extension for tiptap",
|
||||
"version": "2.0.0-beta.6",
|
||||
"version": "2.0.0-beta.7",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-font-family
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-font-family",
|
||||
"description": "font family extension for tiptap",
|
||||
"version": "2.0.0-beta.1",
|
||||
"version": "2.0.0-beta.2",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,25 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add parentConfig to extension context for more extendable extensions, fix [#259](https://github.com/ueberdosis/tiptap-next/issues/259) ([5e1ec5d](https://github.com/ueberdosis/tiptap-next/commit/5e1ec5d2a66be164f505d631f97861ab9344ba96))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [2.0.0-beta.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-gapcursor@2.0.0-beta.3...@tiptap/extension-gapcursor@2.0.0-beta.4) (2021-03-16)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-gapcursor
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-gapcursor",
|
||||
"description": "gapcursor extension for tiptap",
|
||||
"version": "2.0.0-beta.4",
|
||||
"version": "2.0.0-beta.6",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { Extension, callOrReturn } from '@tiptap/core'
|
||||
import {
|
||||
Extension,
|
||||
callOrReturn,
|
||||
getExtensionField,
|
||||
ParentConfig,
|
||||
} from '@tiptap/core'
|
||||
import { gapCursor } from 'prosemirror-gapcursor'
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
@@ -9,7 +14,10 @@ declare module '@tiptap/core' {
|
||||
allowGapCursor?:
|
||||
| boolean
|
||||
| null
|
||||
| ((this: { options: Options }) => boolean | null),
|
||||
| ((this: {
|
||||
options: Options,
|
||||
parentConfig: ParentConfig<NodeConfig<Options>>,
|
||||
}) => boolean | null),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,10 +31,12 @@ export const Gapcursor = Extension.create({
|
||||
},
|
||||
|
||||
extendNodeSchema(extension) {
|
||||
const context = { options: extension.options }
|
||||
const context = {
|
||||
options: extension.options,
|
||||
}
|
||||
|
||||
return {
|
||||
allowGapCursor: callOrReturn(extension.config.allowGapCursor, context) ?? null,
|
||||
allowGapCursor: callOrReturn(getExtensionField(extension, 'allowGapCursor', context)) ?? null,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-hard-break
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-hard-break",
|
||||
"description": "hard break extension for tiptap",
|
||||
"version": "2.0.0-beta.1",
|
||||
"version": "2.0.0-beta.2",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-heading
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-heading",
|
||||
"description": "heading extension for tiptap",
|
||||
"version": "2.0.0-beta.1",
|
||||
"version": "2.0.0-beta.2",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-highlight
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-highlight",
|
||||
"description": "highlight extension for tiptap",
|
||||
"version": "2.0.0-beta.1",
|
||||
"version": "2.0.0-beta.2",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-history
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-history",
|
||||
"description": "history extension for tiptap",
|
||||
"version": "2.0.0-beta.1",
|
||||
"version": "2.0.0-beta.2",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-horizontal-rule",
|
||||
"description": "horizontal rule extension for tiptap",
|
||||
"version": "2.0.0-beta.2",
|
||||
"version": "2.0.0-beta.3",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-image
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-image",
|
||||
"description": "image extension for tiptap",
|
||||
"version": "2.0.0-beta.1",
|
||||
"version": "2.0.0-beta.2",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-italic
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-italic",
|
||||
"description": "italic extension for tiptap",
|
||||
"version": "2.0.0-beta.1",
|
||||
"version": "2.0.0-beta.2",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,25 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.4](https://github.com/ueberdosis/tiptap-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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix a bug in link click handler, where we can’t click on text selections. fix [#263](https://github.com/ueberdosis/tiptap-next/issues/263) ([33c30c0](https://github.com/ueberdosis/tiptap-next/commit/33c30c0d6df66190fd1d5073ccc43b1020b517f9))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-link@2.0.0-beta.1...@tiptap/extension-link@2.0.0-beta.2) (2021-04-07)
|
||||
|
||||
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-link",
|
||||
"description": "link extension for tiptap",
|
||||
"version": "2.0.0-beta.2",
|
||||
"version": "2.0.0-beta.4",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -103,14 +103,15 @@ export const Link = Mark.create<LinkOptions>({
|
||||
props: {
|
||||
handleClick: (view, pos, event) => {
|
||||
const attrs = this.editor.getMarkAttributes('link')
|
||||
const link = (event.target as HTMLElement)?.closest('a')
|
||||
|
||||
if (attrs.href && event.target instanceof HTMLAnchorElement) {
|
||||
if (link && attrs.href) {
|
||||
window.open(attrs.href, attrs.target)
|
||||
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
return false
|
||||
},
|
||||
},
|
||||
}),
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-list-item
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-list-item",
|
||||
"description": "list item extension for tiptap",
|
||||
"version": "2.0.0-beta.1",
|
||||
"version": "2.0.0-beta.2",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
||||
@@ -3,6 +3,38 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-mention
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [2.0.0-beta.28](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-mention@2.0.0-beta.27...@tiptap/extension-mention@2.0.0-beta.28) (2021-04-12)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-mention
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [2.0.0-beta.27](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-mention@2.0.0-beta.26...@tiptap/extension-mention@2.0.0-beta.27) (2021-04-09)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-mention
|
||||
|
||||
@@ -11,4 +11,4 @@ tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a
|
||||
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
||||
|
||||
## License
|
||||
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-mention",
|
||||
"description": "mention extension for tiptap",
|
||||
"version": "2.0.0-beta.27",
|
||||
"version": "2.0.0-beta.31",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
@@ -25,6 +25,6 @@
|
||||
"@tiptap/core": "^2.0.0-beta.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tiptap/suggestion": "^2.0.0-beta.27"
|
||||
"@tiptap/suggestion": "^2.0.0-beta.31"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-beta.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-ordered-list
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user