feat: Allow a rule to be skipped from the getAttributes callback in markPasteRule (#1625)
For example: you are matching URLs with a Regex but want to make additional checks on the match array before deciding if you want to apply the mark or not. Returning null or false won't attempt to apply the mark. Currently the return value of getAttributes is applied unconditionally.
This commit is contained in:
@@ -29,6 +29,10 @@ export default function (
|
||||
const attrs = getAttributes instanceof Function
|
||||
? getAttributes(match)
|
||||
: getAttributes
|
||||
|
||||
if (!attrs) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// adding text before markdown to nodes
|
||||
if (matchStart > 0) {
|
||||
|
||||
Reference in New Issue
Block a user