mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-03 19:19:01 +08:00
revert: remove 'whenNotEditable' as option for openOnClick" (#5040)
This reverts commit 0f41e389b3
.
Co-authored-by: Nick Perez <nicholas.perez@tiptap.dev>
This commit is contained in:
parent
e95140c889
commit
ef635db6c0
@ -65,14 +65,6 @@ Link.configure({
|
||||
})
|
||||
```
|
||||
|
||||
If set to `'whenNotEditable'`, links will be opened on click only when editor is not editable.
|
||||
|
||||
```js
|
||||
Link.configure({
|
||||
openOnClick: 'whenNotEditable',
|
||||
})
|
||||
```
|
||||
|
||||
### linkOnPaste
|
||||
Adds a link to the current selection if the pasted content only contains an url.
|
||||
|
||||
|
@ -3,8 +3,7 @@ import { MarkType } from '@tiptap/pm/model'
|
||||
import { Plugin, PluginKey } from '@tiptap/pm/state'
|
||||
|
||||
type ClickHandlerOptions = {
|
||||
type: MarkType,
|
||||
whenNotEditable: boolean,
|
||||
type: MarkType
|
||||
}
|
||||
|
||||
export function clickHandler(options: ClickHandlerOptions): Plugin {
|
||||
@ -12,9 +11,6 @@ export function clickHandler(options: ClickHandlerOptions): Plugin {
|
||||
key: new PluginKey('handleClickLink'),
|
||||
props: {
|
||||
handleClick: (view, pos, event) => {
|
||||
if (options.whenNotEditable && view.editable) {
|
||||
return false
|
||||
}
|
||||
if (event.button !== 0) {
|
||||
return false
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ export interface LinkOptions {
|
||||
* @example false
|
||||
* @example 'whenNotEditable'
|
||||
*/
|
||||
openOnClick: boolean | 'whenNotEditable'
|
||||
openOnClick: boolean
|
||||
/**
|
||||
* Adds a link to the current selection if the pasted content only contains an url.
|
||||
* @default true
|
||||
@ -264,7 +264,6 @@ export const Link = Mark.create<LinkOptions>({
|
||||
plugins.push(
|
||||
clickHandler({
|
||||
type: this.type,
|
||||
whenNotEditable: this.options.openOnClick === 'whenNotEditable',
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user