@prosekit/extensions
Advanced tools
Comparing version 0.4.4 to 0.4.5
@@ -32,3 +32,3 @@ import { Attrs } from '@prosekit/pm/model'; | ||
export declare function applyMarkRules(rules: MarkRule[], transactions: readonly Transaction[], oldState: EditorState, newState: EditorState): Transaction | null; | ||
export declare function applyMarkRules(rules: MarkRuleOptions[], transactions: readonly Transaction[], oldState: EditorState, newState: EditorState): Transaction | null; | ||
@@ -122,2 +122,7 @@ declare class AutocompleteRule { | ||
/** | ||
* @internal | ||
*/ | ||
export declare function createMarkInputRule({ regex, type, attrs, }: MarkInputRuleOptions): InputRule; | ||
export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>); | ||
@@ -170,2 +175,4 @@ | ||
export declare function defineBoldInputRule(): Extension<ExtensionTyping<string, string, CommandArgs>>; | ||
export declare function defineBoldKeymap(): Extension<ExtensionTyping<string, string, CommandArgs>>; | ||
@@ -289,2 +296,6 @@ | ||
export declare function defineCodeInputRule(): Extension<ExtensionTyping<string, string, CommandArgs>>; | ||
export declare function defineCodeKeymap(): Extension<ExtensionTyping<string, string, CommandArgs>>; | ||
/** | ||
@@ -392,6 +403,6 @@ * @public | ||
export declare function defineItalicInputRule(): Extension<ExtensionTyping<string, string, CommandArgs>>; | ||
export declare function defineItalicKeymap(): Extension<ExtensionTyping<string, string, CommandArgs>>; | ||
export declare function defineItalicKeymap_alias_1(): Extension<ExtensionTyping<string, string, CommandArgs>>; | ||
export declare function defineItalicSpec(): Extension< { | ||
@@ -490,2 +501,10 @@ MARKS: "italic"; | ||
/** | ||
* Defines an input rule for automatically adding inline marks when a given | ||
* pattern is typed. | ||
* | ||
* @public | ||
*/ | ||
export declare function defineMarkInputRule(options: MarkInputRuleOptions): Extension; | ||
/** | ||
* A mark rule is something that can automatically apply marks to text if it | ||
@@ -548,2 +567,4 @@ * matches a certain pattern, and remove them if it doesn't match anymore. | ||
export declare function defineStrikeInputRule(): Extension<ExtensionTyping<string, string, CommandArgs>>; | ||
export declare function defineStrikeKeymap(): Extension<ExtensionTyping<string, string, CommandArgs>>; | ||
@@ -638,4 +659,5 @@ | ||
/** | ||
* The regular expression to match against. You'll usually want to start it | ||
* with `^` to that it is only matched at the start of a textblock. | ||
* The regular expression to match against, which should end with `$`. It | ||
* usually also starts with `^` to that it is only matched at the start of a | ||
* textblock. | ||
*/ | ||
@@ -697,4 +719,5 @@ regex: RegExp; | ||
/** | ||
* The regular expression to match against. You'll usually want to start it | ||
* with `^` to that it is only matched at the start of a textblock. | ||
* The regular expression to match against, which should end with `$`. It | ||
* usually also starts with `^` to that it is only matched at the start of a | ||
* textblock. | ||
*/ | ||
@@ -851,8 +874,21 @@ regex: RegExp; | ||
/** | ||
* @internal | ||
* Options for {@link defineMarkInputRule}. | ||
* | ||
* @public | ||
*/ | ||
export declare interface MarkRule { | ||
export declare interface MarkInputRuleOptions { | ||
/** | ||
* The regular expression to match against, which should end with `$` and has | ||
* exactly one capture group. All other matched text outside the capture group | ||
* will be deleted. | ||
*/ | ||
regex: RegExp; | ||
/** | ||
* The type of mark to set. | ||
*/ | ||
type: string | MarkType; | ||
getAttrs?: ((match: RegExpMatchArray) => Attrs | null) | null; | ||
/** | ||
* Attributes to set on the mark. | ||
*/ | ||
attrs?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null); | ||
} | ||
@@ -859,0 +895,0 @@ |
import { | ||
defineWrappingInputRule | ||
} from "./chunk-DYFRBXUX.js"; | ||
} from "./chunk-CJ3SOSL6.js"; | ||
@@ -5,0 +5,0 @@ // src/blockquote/index.ts |
export { defineBoldSpec } from './_tsup-dts-rollup'; | ||
export { defineBoldCommands } from './_tsup-dts-rollup'; | ||
export { defineBoldKeymap } from './_tsup-dts-rollup'; | ||
export { defineBoldInputRule } from './_tsup-dts-rollup'; | ||
export { defineBold } from './_tsup-dts-rollup'; |
@@ -0,8 +1,13 @@ | ||
import { | ||
defineMarkInputRule | ||
} from "./chunk-CJ3SOSL6.js"; | ||
// src/bold/index.ts | ||
import { | ||
canUseRegexLookbehind, | ||
defineCommands, | ||
defineKeymap, | ||
defineMarkSpec, | ||
union, | ||
toggleMark | ||
toggleMark, | ||
union | ||
} from "@prosekit/core"; | ||
@@ -46,4 +51,15 @@ function defineBoldSpec() { | ||
} | ||
function defineBoldInputRule() { | ||
return defineMarkInputRule({ | ||
regex: canUseRegexLookbehind() ? /(?<=\s|^)\*\*([^\s*]|[^\s*][^*]*[^\s*])\*\*$/ : /\*\*([^\s*]|[^\s*][^*]*[^\s*])\*\*$/, | ||
type: "bold" | ||
}); | ||
} | ||
function defineBold() { | ||
return union([defineBoldSpec(), defineBoldCommands(), defineBoldKeymap()]); | ||
return union([ | ||
defineBoldSpec(), | ||
defineBoldCommands(), | ||
defineBoldKeymap(), | ||
defineBoldInputRule() | ||
]); | ||
} | ||
@@ -53,4 +69,5 @@ export { | ||
defineBoldCommands, | ||
defineBoldInputRule, | ||
defineBoldKeymap, | ||
defineBoldSpec | ||
}; |
import { | ||
defineTextBlockEnterRule | ||
} from "./chunk-ASTUC4KT.js"; | ||
} from "./chunk-HLBUHIMJ.js"; | ||
import { | ||
defineTextBlockInputRule | ||
} from "./chunk-DYFRBXUX.js"; | ||
} from "./chunk-CJ3SOSL6.js"; | ||
@@ -8,0 +8,0 @@ // src/code-block/code-block.ts |
export { defineCodeSpec } from './_tsup-dts-rollup'; | ||
export { defineCodeCommands } from './_tsup-dts-rollup'; | ||
export { defineItalicKeymap } from './_tsup-dts-rollup'; | ||
export { defineCodeKeymap } from './_tsup-dts-rollup'; | ||
export { defineCodeInputRule } from './_tsup-dts-rollup'; | ||
export { defineCode } from './_tsup-dts-rollup'; |
@@ -0,3 +1,8 @@ | ||
import { | ||
defineMarkInputRule | ||
} from "./chunk-CJ3SOSL6.js"; | ||
// src/code/index.ts | ||
import { | ||
canUseRegexLookbehind, | ||
defineCommands, | ||
@@ -23,3 +28,3 @@ defineKeymap, | ||
} | ||
function defineItalicKeymap() { | ||
function defineCodeKeymap() { | ||
return defineKeymap({ | ||
@@ -29,4 +34,15 @@ "Mod-e": toggleMark({ type: "code" }) | ||
} | ||
function defineCodeInputRule() { | ||
return defineMarkInputRule({ | ||
regex: canUseRegexLookbehind() ? /(?<=\s|^)`([^\s`]|[^\s`][^`]*[^\s`])`$/ : /`([^\s`]|[^\s`][^`]*[^\s`])`$/, | ||
type: "code" | ||
}); | ||
} | ||
function defineCode() { | ||
return union([defineCodeSpec(), defineCodeCommands(), defineItalicKeymap()]); | ||
return union([ | ||
defineCodeSpec(), | ||
defineCodeCommands(), | ||
defineCodeKeymap(), | ||
defineCodeInputRule() | ||
]); | ||
} | ||
@@ -36,4 +52,5 @@ export { | ||
defineCodeCommands, | ||
defineCodeSpec, | ||
defineItalicKeymap | ||
defineCodeInputRule, | ||
defineCodeKeymap, | ||
defineCodeSpec | ||
}; |
import { | ||
defineEnterRule, | ||
defineTextBlockEnterRule | ||
} from "./chunk-ASTUC4KT.js"; | ||
} from "./chunk-HLBUHIMJ.js"; | ||
export { | ||
@@ -6,0 +6,0 @@ defineEnterRule, |
import { | ||
defineTextBlockInputRule | ||
} from "./chunk-DYFRBXUX.js"; | ||
} from "./chunk-CJ3SOSL6.js"; | ||
@@ -5,0 +5,0 @@ // src/heading/index.ts |
export { defineInputRule } from './_tsup-dts-rollup'; | ||
export { createMarkInputRule } from './_tsup-dts-rollup'; | ||
export { defineMarkInputRule } from './_tsup-dts-rollup'; | ||
export { defineTextBlockInputRule } from './_tsup-dts-rollup'; | ||
export { defineWrappingInputRule } from './_tsup-dts-rollup'; | ||
export { MarkInputRuleOptions } from './_tsup-dts-rollup'; |
import { | ||
createMarkInputRule, | ||
defineInputRule, | ||
defineMarkInputRule, | ||
defineTextBlockInputRule, | ||
defineWrappingInputRule | ||
} from "./chunk-DYFRBXUX.js"; | ||
} from "./chunk-CJ3SOSL6.js"; | ||
export { | ||
createMarkInputRule, | ||
defineInputRule, | ||
defineMarkInputRule, | ||
defineTextBlockInputRule, | ||
defineWrappingInputRule | ||
}; |
export { defineItalicSpec } from './_tsup-dts-rollup'; | ||
export { defineItalicCommands } from './_tsup-dts-rollup'; | ||
export { defineItalicKeymap_alias_1 as defineItalicKeymap } from './_tsup-dts-rollup'; | ||
export { defineItalicKeymap } from './_tsup-dts-rollup'; | ||
export { defineItalicInputRule } from './_tsup-dts-rollup'; | ||
export { defineItalic } from './_tsup-dts-rollup'; |
@@ -0,8 +1,13 @@ | ||
import { | ||
defineMarkInputRule | ||
} from "./chunk-CJ3SOSL6.js"; | ||
// src/italic/index.ts | ||
import { | ||
canUseRegexLookbehind, | ||
defineCommands, | ||
defineKeymap, | ||
defineMarkSpec, | ||
union, | ||
toggleMark | ||
toggleMark, | ||
union | ||
} from "@prosekit/core"; | ||
@@ -36,2 +41,8 @@ function defineItalicSpec() { | ||
} | ||
function defineItalicInputRule() { | ||
return defineMarkInputRule({ | ||
regex: canUseRegexLookbehind() ? /(?<=\s|^)\*([^\s*]|[^\s*][^*]*[^\s*])\*$/ : /\*([^\s*]|[^\s*][^*]*[^\s*])\*$/, | ||
type: "italic" | ||
}); | ||
} | ||
function defineItalic() { | ||
@@ -41,3 +52,4 @@ return union([ | ||
defineItalicCommands(), | ||
defineItalicKeymap() | ||
defineItalicKeymap(), | ||
defineItalicInputRule() | ||
]); | ||
@@ -48,4 +60,5 @@ } | ||
defineItalicCommands, | ||
defineItalicInputRule, | ||
defineItalicKeymap, | ||
defineItalicSpec | ||
}; |
import { | ||
defineMarkRule | ||
} from "./chunk-MX6UNVWH.js"; | ||
} from "./chunk-FG6YUKCN.js"; | ||
import { | ||
defineEnterRule | ||
} from "./chunk-ASTUC4KT.js"; | ||
} from "./chunk-HLBUHIMJ.js"; | ||
import { | ||
defineInputRule | ||
} from "./chunk-DYFRBXUX.js"; | ||
} from "./chunk-CJ3SOSL6.js"; | ||
@@ -11,0 +11,0 @@ // src/link/index.ts |
import { | ||
defineInputRule | ||
} from "./chunk-DYFRBXUX.js"; | ||
} from "./chunk-CJ3SOSL6.js"; | ||
@@ -5,0 +5,0 @@ // src/list/index.ts |
@@ -0,2 +1,2 @@ | ||
export { defineMarkRule_alias_1 as defineMarkRule } from './_tsup-dts-rollup'; | ||
export { MarkRuleOptions } from './_tsup-dts-rollup'; | ||
export { defineMarkRule_alias_1 as defineMarkRule } from './_tsup-dts-rollup'; |
import { | ||
defineMarkRule | ||
} from "./chunk-MX6UNVWH.js"; | ||
} from "./chunk-FG6YUKCN.js"; | ||
export { | ||
defineMarkRule | ||
}; |
export { defineStrikeSpec } from './_tsup-dts-rollup'; | ||
export { defineStrikeCommands } from './_tsup-dts-rollup'; | ||
export { defineStrikeKeymap } from './_tsup-dts-rollup'; | ||
export { defineStrikeInputRule } from './_tsup-dts-rollup'; | ||
export { defineStrike } from './_tsup-dts-rollup'; |
@@ -0,1 +1,5 @@ | ||
import { | ||
defineMarkInputRule | ||
} from "./chunk-CJ3SOSL6.js"; | ||
// src/strike/index.ts | ||
@@ -7,3 +11,4 @@ import { | ||
union, | ||
toggleMark | ||
toggleMark, | ||
canUseRegexLookbehind | ||
} from "@prosekit/core"; | ||
@@ -36,2 +41,8 @@ function defineStrikeSpec() { | ||
} | ||
function defineStrikeInputRule() { | ||
return defineMarkInputRule({ | ||
regex: canUseRegexLookbehind() ? /(?<=\s|^)~~([^\s~]|[^\s~][^~]*[^\s~])~~$/ : /~~([^\s~]|[^\s~][^~]*[^\s~])~~$/, | ||
type: "strike" | ||
}); | ||
} | ||
function defineStrike() { | ||
@@ -41,3 +52,4 @@ return union([ | ||
defineStrikeCommands(), | ||
defineStrikeKeymap() | ||
defineStrikeKeymap(), | ||
defineStrikeInputRule() | ||
]); | ||
@@ -48,4 +60,5 @@ } | ||
defineStrikeCommands, | ||
defineStrikeInputRule, | ||
defineStrikeKeymap, | ||
defineStrikeSpec | ||
}; |
{ | ||
"name": "@prosekit/extensions", | ||
"type": "module", | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"private": false, | ||
@@ -155,3 +155,3 @@ "author": { | ||
"dependencies": { | ||
"@prosekit/core": "^0.4.1", | ||
"@prosekit/core": "^0.4.2", | ||
"@prosekit/pm": "^0.1.2", | ||
@@ -158,0 +158,0 @@ "prosemirror-dropcursor": "^1.8.1", |
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
100345
2970
Updated@prosekit/core@^0.4.2