@tiptap/extension-link
Advanced tools
Comparing version 2.0.0-beta.34 to 2.0.0-beta.35
@@ -15,3 +15,4 @@ 'use strict'; | ||
&& !oldState.doc.eq(newState.doc); | ||
if (!docChanges) { | ||
const preventAutolink = transactions.some(transaction => transaction.getMeta('preventAutolink')); | ||
if (!docChanges || preventAutolink) { | ||
return; | ||
@@ -170,10 +171,19 @@ } | ||
return { | ||
setLink: attributes => ({ commands }) => { | ||
return commands.setMark(this.name, attributes); | ||
setLink: attributes => ({ chain }) => { | ||
return chain() | ||
.setMark(this.name, attributes) | ||
.setMeta('preventAutolink', true) | ||
.run(); | ||
}, | ||
toggleLink: attributes => ({ commands }) => { | ||
return commands.toggleMark(this.name, attributes, { extendEmptyMarkRange: true }); | ||
toggleLink: attributes => ({ chain }) => { | ||
return chain() | ||
.toggleMark(this.name, attributes, { extendEmptyMarkRange: true }) | ||
.setMeta('preventAutolink', true) | ||
.run(); | ||
}, | ||
unsetLink: () => ({ commands }) => { | ||
return commands.unsetMark(this.name, { extendEmptyMarkRange: true }); | ||
unsetLink: () => ({ chain }) => { | ||
return chain() | ||
.unsetMark(this.name, { extendEmptyMarkRange: true }) | ||
.setMeta('preventAutolink', true) | ||
.run(); | ||
}, | ||
@@ -180,0 +190,0 @@ }; |
@@ -11,3 +11,4 @@ import { combineTransactionSteps, getChangedRanges, getMarksBetween, findChildrenInRange, getAttributes, Mark, mergeAttributes, markPasteRule } from '@tiptap/core'; | ||
&& !oldState.doc.eq(newState.doc); | ||
if (!docChanges) { | ||
const preventAutolink = transactions.some(transaction => transaction.getMeta('preventAutolink')); | ||
if (!docChanges || preventAutolink) { | ||
return; | ||
@@ -166,10 +167,19 @@ } | ||
return { | ||
setLink: attributes => ({ commands }) => { | ||
return commands.setMark(this.name, attributes); | ||
setLink: attributes => ({ chain }) => { | ||
return chain() | ||
.setMark(this.name, attributes) | ||
.setMeta('preventAutolink', true) | ||
.run(); | ||
}, | ||
toggleLink: attributes => ({ commands }) => { | ||
return commands.toggleMark(this.name, attributes, { extendEmptyMarkRange: true }); | ||
toggleLink: attributes => ({ chain }) => { | ||
return chain() | ||
.toggleMark(this.name, attributes, { extendEmptyMarkRange: true }) | ||
.setMeta('preventAutolink', true) | ||
.run(); | ||
}, | ||
unsetLink: () => ({ commands }) => { | ||
return commands.unsetMark(this.name, { extendEmptyMarkRange: true }); | ||
unsetLink: () => ({ chain }) => { | ||
return chain() | ||
.unsetMark(this.name, { extendEmptyMarkRange: true }) | ||
.setMeta('preventAutolink', true) | ||
.run(); | ||
}, | ||
@@ -176,0 +186,0 @@ }; |
@@ -13,3 +13,4 @@ (function (global, factory) { | ||
&& !oldState.doc.eq(newState.doc); | ||
if (!docChanges) { | ||
const preventAutolink = transactions.some(transaction => transaction.getMeta('preventAutolink')); | ||
if (!docChanges || preventAutolink) { | ||
return; | ||
@@ -168,10 +169,19 @@ } | ||
return { | ||
setLink: attributes => ({ commands }) => { | ||
return commands.setMark(this.name, attributes); | ||
setLink: attributes => ({ chain }) => { | ||
return chain() | ||
.setMark(this.name, attributes) | ||
.setMeta('preventAutolink', true) | ||
.run(); | ||
}, | ||
toggleLink: attributes => ({ commands }) => { | ||
return commands.toggleMark(this.name, attributes, { extendEmptyMarkRange: true }); | ||
toggleLink: attributes => ({ chain }) => { | ||
return chain() | ||
.toggleMark(this.name, attributes, { extendEmptyMarkRange: true }) | ||
.setMeta('preventAutolink', true) | ||
.run(); | ||
}, | ||
unsetLink: () => ({ commands }) => { | ||
return commands.unsetMark(this.name, { extendEmptyMarkRange: true }); | ||
unsetLink: () => ({ chain }) => { | ||
return chain() | ||
.unsetMark(this.name, { extendEmptyMarkRange: true }) | ||
.setMeta('preventAutolink', true) | ||
.run(); | ||
}, | ||
@@ -178,0 +188,0 @@ }; |
{ | ||
"name": "@tiptap/extension-link", | ||
"description": "link extension for tiptap", | ||
"version": "2.0.0-beta.34", | ||
"version": "2.0.0-beta.35", | ||
"homepage": "https://tiptap.dev", | ||
@@ -36,3 +36,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "e550d3c69e06a1fb153c3faf17ab78c3081ae61b" | ||
"gitHead": "5144a6cd1b12a161b5879efab22d2dda0c2a20ba" | ||
} |
@@ -21,4 +21,5 @@ import { | ||
&& !oldState.doc.eq(newState.doc) | ||
const preventAutolink = transactions.some(transaction => transaction.getMeta('preventAutolink')) | ||
if (!docChanges) { | ||
if (!docChanges || preventAutolink) { | ||
return | ||
@@ -25,0 +26,0 @@ } |
@@ -95,12 +95,21 @@ import { Mark, markPasteRule, mergeAttributes } from '@tiptap/core' | ||
return { | ||
setLink: attributes => ({ commands }) => { | ||
return commands.setMark(this.name, attributes) | ||
setLink: attributes => ({ chain }) => { | ||
return chain() | ||
.setMark(this.name, attributes) | ||
.setMeta('preventAutolink', true) | ||
.run() | ||
}, | ||
toggleLink: attributes => ({ commands }) => { | ||
return commands.toggleMark(this.name, attributes, { extendEmptyMarkRange: true }) | ||
toggleLink: attributes => ({ chain }) => { | ||
return chain() | ||
.toggleMark(this.name, attributes, { extendEmptyMarkRange: true }) | ||
.setMeta('preventAutolink', true) | ||
.run() | ||
}, | ||
unsetLink: () => ({ commands }) => { | ||
return commands.unsetMark(this.name, { extendEmptyMarkRange: true }) | ||
unsetLink: () => ({ chain }) => { | ||
return chain() | ||
.unsetMark(this.name, { extendEmptyMarkRange: true }) | ||
.setMeta('preventAutolink', true) | ||
.run() | ||
}, | ||
@@ -107,0 +116,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
88076
1040