@prosekit/extensions
Advanced tools
Comparing version 0.0.0-next-20240427202431 to 0.0.0-next-20240427204211
@@ -418,6 +418,15 @@ import { Attrs } from '@prosekit/pm/model'; | ||
/** | ||
* Apply link marks after typing Enter. | ||
*/ | ||
export declare function defineLinkEnterRule(): Extension<ExtensionTyping<string, string, CommandArgs>>; | ||
/** | ||
* Apply link marks after pressing Space. | ||
*/ | ||
export declare function defineLinkInputRule(): Extension<ExtensionTyping<string, string, CommandArgs>>; | ||
/** | ||
* Apply and remove link marks to the text during typing. | ||
*/ | ||
export declare function defineLinkMarkRule(): Extension<ExtensionTyping<string, string, CommandArgs>>; | ||
@@ -816,6 +825,8 @@ | ||
export declare const LINK_RE: RegExp; | ||
export declare const LINK_ENTER_RE: RegExp; | ||
export declare const LINK_SPACE_RE: RegExp; | ||
export declare const LINK_INPUT_RE: RegExp; | ||
export declare const LINK_MARK_RE: RegExp; | ||
/** | ||
@@ -822,0 +833,0 @@ * @public |
@@ -30,6 +30,8 @@ import { | ||
var LINK_STOP_PATTERN = "(?:\\.|\\,|\\;\\!)?"; | ||
var LINK_RE_PATTERN = LINK_RE_BASE_PATTERN + LINK_STOP_PATTERN + "$"; | ||
var LINK_SPACE_RE_PATTERN = LINK_RE_BASE_PATTERN + LINK_STOP_PATTERN + "\\s$"; | ||
var LINK_RE = new RegExp(LINK_RE_PATTERN, "gi"); | ||
var LINK_SPACE_RE = new RegExp(LINK_SPACE_RE_PATTERN, "gi"); | ||
var LINK_ENTER_PATTERN = LINK_RE_BASE_PATTERN + LINK_STOP_PATTERN + "$"; | ||
var LINK_INPUT_PATTERN = LINK_RE_BASE_PATTERN + LINK_STOP_PATTERN + "\\s$"; | ||
var LINK_MARK_PATTERN = LINK_RE_BASE_PATTERN + LINK_STOP_PATTERN; | ||
var LINK_ENTER_RE = new RegExp(LINK_ENTER_PATTERN, "gi"); | ||
var LINK_INPUT_RE = new RegExp(LINK_INPUT_PATTERN, "gi"); | ||
var LINK_MARK_RE = new RegExp(LINK_MARK_PATTERN, "gi"); | ||
@@ -70,3 +72,3 @@ // src/link/index.ts | ||
return defineInputRule( | ||
new InputRule(LINK_SPACE_RE, (state, match, from) => { | ||
new InputRule(LINK_INPUT_RE, (state, match, from) => { | ||
const href = match[1]; | ||
@@ -82,3 +84,3 @@ if (!href) | ||
return defineEnterRule({ | ||
regex: LINK_RE, | ||
regex: LINK_ENTER_RE, | ||
handler: ({ state, from, match }) => { | ||
@@ -96,3 +98,3 @@ const href = match[1]; | ||
return defineMarkRule({ | ||
regex: LINK_RE, | ||
regex: LINK_MARK_RE, | ||
type: "link", | ||
@@ -99,0 +101,0 @@ attrs: (match) => ({ href: match[1] }) |
{ | ||
"name": "@prosekit/extensions", | ||
"type": "module", | ||
"version": "0.0.0-next-20240427202431", | ||
"version": "0.0.0-next-20240427204211", | ||
"private": false, | ||
@@ -155,4 +155,4 @@ "author": { | ||
"dependencies": { | ||
"@prosekit/core": "0.0.0-next-20240427202431", | ||
"@prosekit/pm": "0.0.0-next-20240427202431", | ||
"@prosekit/core": "0.0.0-next-20240427204211", | ||
"@prosekit/pm": "0.0.0-next-20240427204211", | ||
"prosemirror-dropcursor": "^1.8.1", | ||
@@ -159,0 +159,0 @@ "prosemirror-flat-list": "^0.5.0", |
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
95842
2820
+ Added@prosekit/core@0.0.0-next-20240427204211(transitive)
+ Added@prosekit/pm@0.0.0-next-20240427204211(transitive)
- Removed@prosekit/core@0.0.0-next-20240427202431(transitive)
- Removed@prosekit/pm@0.0.0-next-20240427202431(transitive)