@tiptap/extension-link
Advanced tools
Comparing version 2.0.0-alpha.10 to 2.0.0-alpha.11
@@ -6,2 +6,10 @@ # Change Log | ||
# [2.0.0-alpha.11](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-link@2.0.0-alpha.10...@tiptap/extension-link@2.0.0-alpha.11) (2021-02-16) | ||
**Note:** Version bump only for package @tiptap/extension-link | ||
# [2.0.0-alpha.10](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-link@2.0.0-alpha.9...@tiptap/extension-link@2.0.0-alpha.10) (2021-02-07) | ||
@@ -8,0 +16,0 @@ |
@@ -8,28 +8,28 @@ import { Command, Mark } from '@tiptap/core'; | ||
} | ||
export declare const pasteRegex: RegExp; | ||
export declare const pasteRegexWithBrackets: RegExp; | ||
export declare const Link: Mark<LinkOptions, { | ||
/** | ||
* Set a link mark | ||
*/ | ||
setLink: (attributes?: { | ||
href?: string; | ||
target?: string; | ||
}) => Command; | ||
/** | ||
* Toggle a link mark | ||
*/ | ||
toggleLink: (attributes?: { | ||
href?: string; | ||
target?: string; | ||
}) => Command; | ||
/** | ||
* Unset a link mark | ||
*/ | ||
unsetLink: () => Command; | ||
}>; | ||
declare module '@tiptap/core' { | ||
interface AllExtensions { | ||
Link: typeof Link; | ||
interface Commands { | ||
link: { | ||
/** | ||
* Set a link mark | ||
*/ | ||
setLink: (attributes: { | ||
href: string; | ||
target?: string; | ||
}) => Command; | ||
/** | ||
* Toggle a link mark | ||
*/ | ||
toggleLink: (attributes: { | ||
href: string; | ||
target?: string; | ||
}) => Command; | ||
/** | ||
* Unset a link mark | ||
*/ | ||
unsetLink: () => Command; | ||
}; | ||
} | ||
} | ||
export declare const pasteRegex: RegExp; | ||
export declare const pasteRegexWithBrackets: RegExp; | ||
export declare const Link: Mark<LinkOptions>; |
@@ -40,17 +40,8 @@ 'use strict'; | ||
return { | ||
/** | ||
* Set a link mark | ||
*/ | ||
setLink: (attributes = {}) => ({ commands }) => { | ||
setLink: attributes => ({ commands }) => { | ||
return commands.setMark('link', attributes); | ||
}, | ||
/** | ||
* Toggle a link mark | ||
*/ | ||
toggleLink: (attributes = {}) => ({ commands }) => { | ||
toggleLink: attributes => ({ commands }) => { | ||
return commands.toggleMark('link', attributes); | ||
}, | ||
/** | ||
* Unset a link mark | ||
*/ | ||
unsetLink: () => ({ commands }) => { | ||
@@ -57,0 +48,0 @@ return commands.unsetMark('link'); |
@@ -36,17 +36,8 @@ import { Mark, mergeAttributes, markPasteRule } from '@tiptap/core'; | ||
return { | ||
/** | ||
* Set a link mark | ||
*/ | ||
setLink: (attributes = {}) => ({ commands }) => { | ||
setLink: attributes => ({ commands }) => { | ||
return commands.setMark('link', attributes); | ||
}, | ||
/** | ||
* Toggle a link mark | ||
*/ | ||
toggleLink: (attributes = {}) => ({ commands }) => { | ||
toggleLink: attributes => ({ commands }) => { | ||
return commands.toggleMark('link', attributes); | ||
}, | ||
/** | ||
* Unset a link mark | ||
*/ | ||
unsetLink: () => ({ commands }) => { | ||
@@ -53,0 +44,0 @@ return commands.unsetMark('link'); |
@@ -39,17 +39,8 @@ (function (global, factory) { | ||
return { | ||
/** | ||
* Set a link mark | ||
*/ | ||
setLink: (attributes = {}) => ({ commands }) => { | ||
setLink: attributes => ({ commands }) => { | ||
return commands.setMark('link', attributes); | ||
}, | ||
/** | ||
* Toggle a link mark | ||
*/ | ||
toggleLink: (attributes = {}) => ({ commands }) => { | ||
toggleLink: attributes => ({ commands }) => { | ||
return commands.toggleMark('link', attributes); | ||
}, | ||
/** | ||
* Unset a link mark | ||
*/ | ||
unsetLink: () => ({ commands }) => { | ||
@@ -56,0 +47,0 @@ return commands.unsetMark('link'); |
{ | ||
"name": "@tiptap/extension-link", | ||
"description": "link extension for tiptap", | ||
"version": "2.0.0-alpha.10", | ||
"version": "2.0.0-alpha.11", | ||
"homepage": "https://tiptap.dev", | ||
@@ -30,3 +30,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "6bdeb4615c7b6afba4a2fcac4e3c35d7a7c0030a" | ||
"gitHead": "71d8fbbcb1eacd664bb6992e0086a589e4684e69" | ||
} |
@@ -16,6 +16,25 @@ import { | ||
declare module '@tiptap/core' { | ||
interface Commands { | ||
link: { | ||
/** | ||
* Set a link mark | ||
*/ | ||
setLink: (attributes: { href: string, target?: string }) => Command, | ||
/** | ||
* Toggle a link mark | ||
*/ | ||
toggleLink: (attributes: { href: string, target?: string }) => Command, | ||
/** | ||
* Unset a link mark | ||
*/ | ||
unsetLink: () => Command, | ||
} | ||
} | ||
} | ||
export const pasteRegex = /https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)/gi | ||
export const pasteRegexWithBrackets = /(?:\()https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b(?:[-a-zA-Z0-9@:%._+~#=?!&/()]*)(?:\))/gi | ||
export const Link = Mark.create({ | ||
export const Link = Mark.create<LinkOptions>({ | ||
name: 'link', | ||
@@ -25,3 +44,3 @@ | ||
defaultOptions: <LinkOptions>{ | ||
defaultOptions: { | ||
openOnClick: true, | ||
@@ -57,18 +76,9 @@ HTMLAttributes: { | ||
return { | ||
/** | ||
* Set a link mark | ||
*/ | ||
setLink: (attributes: { href?: string, target?: string } = {}): Command => ({ commands }) => { | ||
setLink: attributes => ({ commands }) => { | ||
return commands.setMark('link', attributes) | ||
}, | ||
/** | ||
* Toggle a link mark | ||
*/ | ||
toggleLink: (attributes: { href?: string, target?: string } = {}): Command => ({ commands }) => { | ||
toggleLink: attributes => ({ commands }) => { | ||
return commands.toggleMark('link', attributes) | ||
}, | ||
/** | ||
* Unset a link mark | ||
*/ | ||
unsetLink: (): Command => ({ commands }) => { | ||
unsetLink: () => ({ commands }) => { | ||
return commands.unsetMark('link') | ||
@@ -111,7 +121,1 @@ }, | ||
}) | ||
declare module '@tiptap/core' { | ||
interface AllExtensions { | ||
Link: typeof Link, | ||
} | ||
} |
Sorry, the diff of this file is too big to display
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
467809
703