@tiptap/extension-link
Advanced tools
Comparing version 2.5.0-beta.1 to 2.5.0-beta.2
@@ -77,3 +77,3 @@ import { combineTransactionSteps, getChangedRanges, findChildrenInRange, getMarksBetween, getAttributes, Mark, mergeAttributes, markPasteRule } from '@tiptap/core'; | ||
} | ||
const linksBeforeSpace = tokenize(lastWordBeforeSpace).map(t => t.toObject()); | ||
const linksBeforeSpace = tokenize(lastWordBeforeSpace).map(t => t.toObject(options.defaultProtocol)); | ||
if (!isValidLinkStructure(linksBeforeSpace)) { | ||
@@ -165,3 +165,3 @@ return false; | ||
}); | ||
const link = find(textContent).find(item => item.isLink && item.value === textContent); | ||
const link = find(textContent, { defaultProtocol: options.defaultProtocol }).find(item => item.isLink && item.value === textContent); | ||
if (!textContent || !link) { | ||
@@ -195,2 +195,3 @@ return false; | ||
keepOnSplit: false, | ||
exitable: true, | ||
onCreate() { | ||
@@ -217,2 +218,3 @@ this.options.protocols.forEach(protocol => { | ||
protocols: [], | ||
defaultProtocol: 'http', | ||
HTMLAttributes: { | ||
@@ -317,2 +319,3 @@ target: '_blank', | ||
type: this.type, | ||
defaultProtocol: this.options.defaultProtocol, | ||
validate: this.options.validate, | ||
@@ -329,2 +332,3 @@ })); | ||
editor: this.editor, | ||
defaultProtocol: this.options.defaultProtocol, | ||
type: this.type, | ||
@@ -331,0 +335,0 @@ })); |
@@ -79,3 +79,3 @@ (function (global, factory) { | ||
} | ||
const linksBeforeSpace = linkifyjs.tokenize(lastWordBeforeSpace).map(t => t.toObject()); | ||
const linksBeforeSpace = linkifyjs.tokenize(lastWordBeforeSpace).map(t => t.toObject(options.defaultProtocol)); | ||
if (!isValidLinkStructure(linksBeforeSpace)) { | ||
@@ -167,3 +167,3 @@ return false; | ||
}); | ||
const link = linkifyjs.find(textContent).find(item => item.isLink && item.value === textContent); | ||
const link = linkifyjs.find(textContent, { defaultProtocol: options.defaultProtocol }).find(item => item.isLink && item.value === textContent); | ||
if (!textContent || !link) { | ||
@@ -197,2 +197,3 @@ return false; | ||
keepOnSplit: false, | ||
exitable: true, | ||
onCreate() { | ||
@@ -219,2 +220,3 @@ this.options.protocols.forEach(protocol => { | ||
protocols: [], | ||
defaultProtocol: 'http', | ||
HTMLAttributes: { | ||
@@ -319,2 +321,3 @@ target: '_blank', | ||
type: this.type, | ||
defaultProtocol: this.options.defaultProtocol, | ||
validate: this.options.validate, | ||
@@ -331,2 +334,3 @@ })); | ||
editor: this.editor, | ||
defaultProtocol: this.options.defaultProtocol, | ||
type: this.type, | ||
@@ -333,0 +337,0 @@ })); |
@@ -5,2 +5,3 @@ import { MarkType } from '@tiptap/pm/model'; | ||
type: MarkType; | ||
defaultProtocol: string; | ||
validate: (url: string) => boolean; | ||
@@ -7,0 +8,0 @@ }; |
@@ -6,2 +6,3 @@ import { Editor } from '@tiptap/core'; | ||
editor: Editor; | ||
defaultProtocol: string; | ||
type: MarkType; | ||
@@ -8,0 +9,0 @@ }; |
@@ -32,2 +32,7 @@ import { Mark } from '@tiptap/core'; | ||
/** | ||
* Default protocol to use when no protocol is specified. | ||
* @default 'http' | ||
*/ | ||
defaultProtocol: string; | ||
/** | ||
* If enabled, links will be opened on click. | ||
@@ -34,0 +39,0 @@ * @default true |
{ | ||
"name": "@tiptap/extension-link", | ||
"description": "link extension for tiptap", | ||
"version": "2.5.0-beta.1", | ||
"version": "2.5.0-beta.2", | ||
"homepage": "https://tiptap.dev", | ||
@@ -35,4 +35,4 @@ "keywords": [ | ||
"devDependencies": { | ||
"@tiptap/core": "^2.5.0-beta.1", | ||
"@tiptap/pm": "^2.5.0-beta.1" | ||
"@tiptap/core": "^2.5.0-beta.2", | ||
"@tiptap/pm": "^2.5.0-beta.2" | ||
}, | ||
@@ -39,0 +39,0 @@ "peerDependencies": { |
@@ -36,2 +36,3 @@ import { | ||
type: MarkType | ||
defaultProtocol: string | ||
validate: (url: string) => boolean | ||
@@ -119,3 +120,3 @@ } | ||
const linksBeforeSpace = tokenize(lastWordBeforeSpace).map(t => t.toObject()) | ||
const linksBeforeSpace = tokenize(lastWordBeforeSpace).map(t => t.toObject(options.defaultProtocol)) | ||
@@ -122,0 +123,0 @@ if (!isValidLinkStructure(linksBeforeSpace)) { |
@@ -8,2 +8,3 @@ import { Editor } from '@tiptap/core' | ||
editor: Editor | ||
defaultProtocol: string | ||
type: MarkType | ||
@@ -31,3 +32,3 @@ } | ||
const link = find(textContent).find(item => item.isLink && item.value === textContent) | ||
const link = find(textContent, { defaultProtocol: options.defaultProtocol }).find(item => item.isLink && item.value === textContent) | ||
@@ -34,0 +35,0 @@ if (!textContent || !link) { |
@@ -46,2 +46,7 @@ import { | ||
/** | ||
* Default protocol to use when no protocol is specified. | ||
* @default 'http' | ||
*/ | ||
defaultProtocol: string | ||
/** | ||
* If enabled, links will be opened on click. | ||
@@ -119,2 +124,4 @@ * @default true | ||
exitable: true, | ||
onCreate() { | ||
@@ -144,2 +151,3 @@ this.options.protocols.forEach(protocol => { | ||
protocols: [], | ||
defaultProtocol: 'http', | ||
HTMLAttributes: { | ||
@@ -261,2 +269,3 @@ target: '_blank', | ||
type: this.type, | ||
defaultProtocol: this.options.defaultProtocol, | ||
validate: this.options.validate, | ||
@@ -279,2 +288,3 @@ }), | ||
editor: this.editor, | ||
defaultProtocol: this.options.defaultProtocol, | ||
type: this.type, | ||
@@ -281,0 +291,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
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
143145
1615