@udecode/plate-autoformat
Advanced tools
Comparing version 36.0.0 to 36.4.0
@@ -75,2 +75,9 @@ import * as _udecode_plate_common_server from '@udecode/plate-common/server'; | ||
/** | ||
* If true, `match` will be interpreted as regex expression(s). Otherwise, it | ||
* will be compared by string equality. | ||
* | ||
* @default false | ||
*/ | ||
matchByRegex?: boolean; | ||
/** | ||
* Function called just before `format`. Generally used to reset the selected | ||
@@ -157,3 +164,3 @@ * block. | ||
} | ||
declare const autoformatBlock: <V extends Value>(editor: PlateEditor<V>, { allowSameTypeAbove, format, match: _match, preFormat, text, trigger, triggerAtBlockStart, type, }: AutoformatBlockOptions<V>) => boolean; | ||
declare const autoformatBlock: <V extends Value>(editor: PlateEditor<V>, { allowSameTypeAbove, format, match: _match, matchByRegex, preFormat, text, trigger, triggerAtBlockStart, type, }: AutoformatBlockOptions<V>) => boolean; | ||
@@ -160,0 +167,0 @@ interface AutoformatMarkOptions extends AutoformatMarkRule { |
@@ -172,2 +172,3 @@ "use strict"; | ||
match: _match, | ||
matchByRegex = false, | ||
preFormat, | ||
@@ -197,6 +198,8 @@ text, | ||
const textFromBlockStart = (0, import_server2.getEditorString)(editor, matchRange); | ||
if (end !== textFromBlockStart) | ||
const isMatched = matchByRegex ? !!textFromBlockStart.match(end) : end === textFromBlockStart; | ||
if (!isMatched) | ||
continue; | ||
} else { | ||
matchRange = (0, import_server2.getRangeBefore)(editor, editor.selection, { | ||
matchByRegex, | ||
matchString: end | ||
@@ -203,0 +206,0 @@ }); |
{ | ||
"name": "@udecode/plate-autoformat", | ||
"version": "36.0.0", | ||
"version": "36.4.0", | ||
"description": "Autoformatting plugin for Plate", | ||
@@ -48,3 +48,3 @@ "license": "MIT", | ||
"peerDependencies": { | ||
"@udecode/plate-common": ">=36.0.0", | ||
"@udecode/plate-common": ">=36.3.9", | ||
"react": ">=16.8.0", | ||
@@ -51,0 +51,0 @@ "react-dom": ">=16.8.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
127892
1896