@domternal/core 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -84
- package/dist/helpers/inputRulesPlugin.d.ts.map +1 -0
- package/dist/index.cjs +366 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +177 -1
- package/dist/index.d.ts +177 -1
- package/dist/index.js +363 -64
- package/dist/index.js.map +1 -1
- package/dist/nodes/HorizontalRule.d.ts.map +1 -0
- package/package.json +11 -13
package/dist/index.d.cts
CHANGED
|
@@ -3068,6 +3068,11 @@ interface MarkInputRuleOptions {
|
|
|
3068
3068
|
* The mark type to apply
|
|
3069
3069
|
*/
|
|
3070
3070
|
type: MarkType;
|
|
3071
|
+
/**
|
|
3072
|
+
* Whether Backspace can undo this input rule immediately after it fires.
|
|
3073
|
+
* @default true
|
|
3074
|
+
*/
|
|
3075
|
+
undoable?: boolean;
|
|
3071
3076
|
/**
|
|
3072
3077
|
* Optional: get attributes from the match
|
|
3073
3078
|
*
|
|
@@ -3126,6 +3131,177 @@ declare const markInputRulePatterns: {
|
|
|
3126
3131
|
readonly highlight: RegExp;
|
|
3127
3132
|
};
|
|
3128
3133
|
|
|
3134
|
+
/**
|
|
3135
|
+
* Wrapping Input Rule Helper
|
|
3136
|
+
*
|
|
3137
|
+
* Drop-in replacement for ProseMirror's wrappingInputRule that exposes
|
|
3138
|
+
* the `undoable` option so extension authors can opt out of Backspace undo.
|
|
3139
|
+
*/
|
|
3140
|
+
|
|
3141
|
+
interface WrappingInputRuleOptions {
|
|
3142
|
+
/**
|
|
3143
|
+
* The regex pattern to match. Should start with `^` so it only
|
|
3144
|
+
* fires at the start of a textblock.
|
|
3145
|
+
*/
|
|
3146
|
+
find: RegExp;
|
|
3147
|
+
/**
|
|
3148
|
+
* The node type to wrap in.
|
|
3149
|
+
*/
|
|
3150
|
+
type: NodeType;
|
|
3151
|
+
/**
|
|
3152
|
+
* Whether Backspace can undo this input rule immediately after it fires.
|
|
3153
|
+
* @default true
|
|
3154
|
+
*/
|
|
3155
|
+
undoable?: boolean;
|
|
3156
|
+
/**
|
|
3157
|
+
* Node attributes, or a function that computes them from the match.
|
|
3158
|
+
*/
|
|
3159
|
+
getAttributes?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
|
|
3160
|
+
/**
|
|
3161
|
+
* Predicate that decides whether to join with an adjacent node of
|
|
3162
|
+
* the same type above the newly wrapped node.
|
|
3163
|
+
*/
|
|
3164
|
+
joinPredicate?: (match: RegExpMatchArray, node: Node$1) => boolean;
|
|
3165
|
+
/**
|
|
3166
|
+
* Optional guard predicate. When provided, the rule only fires if
|
|
3167
|
+
* this returns true. Use this to prevent wrapping in certain contexts
|
|
3168
|
+
* (e.g. don't create a nested list inside an existing list item).
|
|
3169
|
+
*/
|
|
3170
|
+
guard?: (state: EditorState) => boolean;
|
|
3171
|
+
}
|
|
3172
|
+
/**
|
|
3173
|
+
* Creates an input rule that wraps a textblock in a given node type.
|
|
3174
|
+
*
|
|
3175
|
+
* @example
|
|
3176
|
+
* // `> ` at start of line wraps in blockquote
|
|
3177
|
+
* wrappingInputRule({
|
|
3178
|
+
* find: /^\s*>\s$/,
|
|
3179
|
+
* type: schema.nodes.blockquote,
|
|
3180
|
+
* });
|
|
3181
|
+
*
|
|
3182
|
+
* @example
|
|
3183
|
+
* // Non-undoable wrapping rule
|
|
3184
|
+
* wrappingInputRule({
|
|
3185
|
+
* find: /^\s*>\s$/,
|
|
3186
|
+
* type: schema.nodes.blockquote,
|
|
3187
|
+
* undoable: false,
|
|
3188
|
+
* });
|
|
3189
|
+
*/
|
|
3190
|
+
declare function wrappingInputRule(options: WrappingInputRuleOptions): InputRule;
|
|
3191
|
+
|
|
3192
|
+
/**
|
|
3193
|
+
* Textblock Type Input Rule Helper
|
|
3194
|
+
*
|
|
3195
|
+
* Drop-in replacement for ProseMirror's textblockTypeInputRule that exposes
|
|
3196
|
+
* the `undoable` option so extension authors can opt out of Backspace undo.
|
|
3197
|
+
*/
|
|
3198
|
+
|
|
3199
|
+
interface TextblockTypeInputRuleOptions {
|
|
3200
|
+
/**
|
|
3201
|
+
* The regex pattern to match. Should start with `^` so it only
|
|
3202
|
+
* fires at the start of a textblock.
|
|
3203
|
+
*/
|
|
3204
|
+
find: RegExp;
|
|
3205
|
+
/**
|
|
3206
|
+
* The node type to change the textblock to.
|
|
3207
|
+
*/
|
|
3208
|
+
type: NodeType;
|
|
3209
|
+
/**
|
|
3210
|
+
* Whether Backspace can undo this input rule immediately after it fires.
|
|
3211
|
+
* @default true
|
|
3212
|
+
*/
|
|
3213
|
+
undoable?: boolean;
|
|
3214
|
+
/**
|
|
3215
|
+
* Node attributes, or a function that computes them from the match.
|
|
3216
|
+
*/
|
|
3217
|
+
getAttributes?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
|
|
3218
|
+
}
|
|
3219
|
+
/**
|
|
3220
|
+
* Creates an input rule that changes the type of a textblock.
|
|
3221
|
+
*
|
|
3222
|
+
* @example
|
|
3223
|
+
* // `## ` at start of line converts to heading level 2
|
|
3224
|
+
* textblockTypeInputRule({
|
|
3225
|
+
* find: /^(#{1,4})\s$/,
|
|
3226
|
+
* type: schema.nodes.heading,
|
|
3227
|
+
* getAttributes: (match) => ({ level: match[1].length }),
|
|
3228
|
+
* });
|
|
3229
|
+
*/
|
|
3230
|
+
declare function textblockTypeInputRule(options: TextblockTypeInputRuleOptions): InputRule;
|
|
3231
|
+
|
|
3232
|
+
/**
|
|
3233
|
+
* Text Input Rule Helper
|
|
3234
|
+
*
|
|
3235
|
+
* Creates input rules for simple text replacements (e.g. `--` to em dash).
|
|
3236
|
+
*/
|
|
3237
|
+
|
|
3238
|
+
interface TextInputRuleOptions {
|
|
3239
|
+
/**
|
|
3240
|
+
* The regex pattern to match.
|
|
3241
|
+
*/
|
|
3242
|
+
find: RegExp;
|
|
3243
|
+
/**
|
|
3244
|
+
* The replacement text.
|
|
3245
|
+
*/
|
|
3246
|
+
replace: string;
|
|
3247
|
+
/**
|
|
3248
|
+
* Whether Backspace can undo this input rule immediately after it fires.
|
|
3249
|
+
* @default true
|
|
3250
|
+
*/
|
|
3251
|
+
undoable?: boolean;
|
|
3252
|
+
}
|
|
3253
|
+
/**
|
|
3254
|
+
* Creates an input rule that replaces matched text with a string.
|
|
3255
|
+
*
|
|
3256
|
+
* @example
|
|
3257
|
+
* // `--` converts to em dash
|
|
3258
|
+
* textInputRule({ find: /--$/, replace: '\u2014' });
|
|
3259
|
+
*
|
|
3260
|
+
* @example
|
|
3261
|
+
* // Non-undoable replacement
|
|
3262
|
+
* textInputRule({ find: /->$/, replace: '\u2192', undoable: false });
|
|
3263
|
+
*/
|
|
3264
|
+
declare function textInputRule(options: TextInputRuleOptions): InputRule;
|
|
3265
|
+
|
|
3266
|
+
/**
|
|
3267
|
+
* Node Input Rule Helper
|
|
3268
|
+
*
|
|
3269
|
+
* Creates input rules that replace matched text with a node.
|
|
3270
|
+
* Used for nodes like HorizontalRule, Image, Emoji, etc.
|
|
3271
|
+
*/
|
|
3272
|
+
|
|
3273
|
+
interface NodeInputRuleOptions {
|
|
3274
|
+
/**
|
|
3275
|
+
* The regex pattern to match.
|
|
3276
|
+
*/
|
|
3277
|
+
find: RegExp;
|
|
3278
|
+
/**
|
|
3279
|
+
* The node type to insert.
|
|
3280
|
+
*/
|
|
3281
|
+
type: NodeType;
|
|
3282
|
+
/**
|
|
3283
|
+
* Whether Backspace can undo this input rule immediately after it fires.
|
|
3284
|
+
* @default true
|
|
3285
|
+
*/
|
|
3286
|
+
undoable?: boolean;
|
|
3287
|
+
/**
|
|
3288
|
+
* Node attributes, or a function that computes them from the match.
|
|
3289
|
+
*/
|
|
3290
|
+
getAttributes?: Attrs | null | ((match: RegExpMatchArray, state: EditorState) => Attrs | null);
|
|
3291
|
+
}
|
|
3292
|
+
/**
|
|
3293
|
+
* Creates an input rule that replaces matched text with a node.
|
|
3294
|
+
*
|
|
3295
|
+
* @example
|
|
3296
|
+
* // `:smile:` inserts an emoji node
|
|
3297
|
+
* nodeInputRule({
|
|
3298
|
+
* find: /:([a-zA-Z0-9_+-]+):$/,
|
|
3299
|
+
* type: schema.nodes.emoji,
|
|
3300
|
+
* getAttributes: (match) => ({ name: match[1] }),
|
|
3301
|
+
* });
|
|
3302
|
+
*/
|
|
3303
|
+
declare function nodeInputRule(options: NodeInputRuleOptions): InputRule;
|
|
3304
|
+
|
|
3129
3305
|
/**
|
|
3130
3306
|
* URL Validation Helper
|
|
3131
3307
|
*
|
|
@@ -5628,4 +5804,4 @@ declare const StarterKit: Extension<StarterKitOptions, unknown>;
|
|
|
5628
5804
|
*/
|
|
5629
5805
|
declare const VERSION = "0.1.0";
|
|
5630
5806
|
|
|
5631
|
-
export { type AnyExtension, type AnyExtensionConfig, type AttributeSpec, type AttributeSpecs, type AutolinkPluginOptions, BaseKeymap, type BaseKeymapOptions, Blockquote, type BlockquoteOptions, Bold, type BoldOptions, BubbleMenu, type BubbleMenuOptions, type BuildCommandPropsOptions, BulletList, type BulletListOptions, type CanChainedCommands, CanChecker, type CanCheckerEditor, type CanCheckerOptions, type CanCommands, ChainBuilder, type ChainBuilderEditor, type ChainBuilderOptions, type ChainFailure, type ChainedCommands, CharacterCount, type CharacterCountOptions, type CharacterCountStorage, type ClearContentOptions, ClearFormatting, Code, CodeBlock, type CodeBlockOptions, type CodeOptions, type Command, type CommandEditor, CommandManager, type CommandManagerEditor, type CommandMap, type CommandProps, type CommandPropsEditor, type CommandSpec$1 as CommandSpec, type Content, type ContentErrorProps, type CreateBubbleMenuPluginOptions, type CreateDocumentOptions, type CreateEventProps, type CreateFloatingMenuPluginOptions, DEFAULT_HIGHLIGHT_COLORS, DEFAULT_TEXT_COLORS, type DeleteEventProps, Document$1 as Document, type DropEventProps, Dropcursor, type DropcursorOptions, Editor, type EditorEventName, type EditorEvents, type EditorInstance, type EditorOptions, EventEmitter, Extension, type ExtensionConfig, type ExtensionEditor, ExtensionManager, type ExtensionManagerEditor, type ExtensionManagerOptions, type FindChildResult, type FindParentNodeResult, FloatingMenu, type FloatingMenuOptions, Focus, type FocusEventProps, type FocusOptions, type FocusPosition, FontFamily, type FontFamilyOptions, FontSize, type FontSizeOptions, Gapcursor, type GenerateHTMLOptions, type GenerateJSONOptions, type GenerateTextOptions, type GlobalAttributeSpec, type GlobalAttributes, HardBreak, type HardBreakOptions, Heading, type HeadingOptions, Highlight, type HighlightOptions, History, type HistoryOptions, HorizontalRule, type HorizontalRuleOptions, type IconSet, type InlineStyleOverrides, InvisibleChars, type InvisibleCharsOptions, type InvisibleCharsStorage, type IsNodeEmptyOptions, type IsValidUrlOptions, Italic, type ItalicOptions, type JSONAttribute, type JSONContent, type JSONMark, type KeyboardShortcutCommand, LineHeight, type LineHeightOptions, Link, type LinkAttributes, type LinkClickPluginOptions, type LinkExitPluginOptions, type LinkOptions, type LinkPastePluginOptions, LinkPopover, type LinkPopoverOptions, ListItem, type ListItemOptions, ListKeymap, type ListKeymapOptions, Mark, type MarkConfig, type MarkInputRuleOptions, type MarkParseRule, type MarkRange, type MarkRenderHTMLProps, type MountEventProps, Node, type NodeConfig, type NodeParseRule, type NodeRenderHTMLProps, OrderedList, type OrderedListOptions, Paragraph, type ParagraphOptions, type PasteEventProps, Placeholder, type PlaceholderOptions, type PositionFloatingOptions, type Range, type RawCommands, Selection, SelectionDecoration, type SelectionDecorationOptions, type SelectionOptions, type SelectionStorage, type SetContentOptions, type SingleCommands, StarterKit, type StarterKitOptions, Strike, type StrikeOptions, Subscript, type SubscriptOptions, Superscript, type SuperscriptOptions, TaskItem, type TaskItemOptions, TaskList, type TaskListOptions, Text, TextAlign, type TextAlignOptions, TextColor, type TextColorOptions, TextStyle, type TextStyleOptions, type ToolbarButton, ToolbarController, type ToolbarControllerEditor, type ToolbarDropdown, type ToolbarGroup, type ToolbarItem, type ToolbarLayoutDropdown, type ToolbarLayoutEntry, type ToolbarSeparator, TrailingNode, type TrailingNodeOptions, type TransactionEventProps, Typography, type TypographyOptions, Underline, type UnderlineOptions, UniqueID, type UniqueIDOptions, VERSION, applyInlineStyles, autolinkPlugin, autolinkPluginKey, blur, bubbleMenuPluginKey, buildCommandProps, builtInCommands, callOrReturn, characterCountPluginKey, clearContent, createAccumulatingDispatch, createBubbleMenuPlugin, createCanChecker, createChainBuilder, createDocument, createFloatingMenuPlugin, defaultBlockAt, defaultIcons, deleteSelection, findChildren, findParentNode, floatingMenuPluginKey, focus, focusPluginKey, generateHTML, generateJSON, generateText, getMarkRange, inlineStyles, insertContent, insertText, invisibleCharsPluginKey, isDocumentEmpty, isNodeEmpty, isValidUrl, lift, linkClickPlugin, linkClickPluginKey, linkExitPlugin, linkExitPluginKey, linkPastePlugin, linkPastePluginKey, markInputRule, markInputRulePatterns, placeholderPluginKey, positionFloating, positionFloatingOnce, resetAttributes, selectAll, selectNodeBackward, selectionDecorationPluginKey, setBlockType, setContent, setMark, toggleBlockType, toggleList, toggleMark, toggleWrap, uniqueIDPluginKey, unsetAllMarks, unsetMark, updateAttributes, wrapIn };
|
|
5807
|
+
export { type AnyExtension, type AnyExtensionConfig, type AttributeSpec, type AttributeSpecs, type AutolinkPluginOptions, BaseKeymap, type BaseKeymapOptions, Blockquote, type BlockquoteOptions, Bold, type BoldOptions, BubbleMenu, type BubbleMenuOptions, type BuildCommandPropsOptions, BulletList, type BulletListOptions, type CanChainedCommands, CanChecker, type CanCheckerEditor, type CanCheckerOptions, type CanCommands, ChainBuilder, type ChainBuilderEditor, type ChainBuilderOptions, type ChainFailure, type ChainedCommands, CharacterCount, type CharacterCountOptions, type CharacterCountStorage, type ClearContentOptions, ClearFormatting, Code, CodeBlock, type CodeBlockOptions, type CodeOptions, type Command, type CommandEditor, CommandManager, type CommandManagerEditor, type CommandMap, type CommandProps, type CommandPropsEditor, type CommandSpec$1 as CommandSpec, type Content, type ContentErrorProps, type CreateBubbleMenuPluginOptions, type CreateDocumentOptions, type CreateEventProps, type CreateFloatingMenuPluginOptions, DEFAULT_HIGHLIGHT_COLORS, DEFAULT_TEXT_COLORS, type DeleteEventProps, Document$1 as Document, type DropEventProps, Dropcursor, type DropcursorOptions, Editor, type EditorEventName, type EditorEvents, type EditorInstance, type EditorOptions, EventEmitter, Extension, type ExtensionConfig, type ExtensionEditor, ExtensionManager, type ExtensionManagerEditor, type ExtensionManagerOptions, type FindChildResult, type FindParentNodeResult, FloatingMenu, type FloatingMenuOptions, Focus, type FocusEventProps, type FocusOptions, type FocusPosition, FontFamily, type FontFamilyOptions, FontSize, type FontSizeOptions, Gapcursor, type GenerateHTMLOptions, type GenerateJSONOptions, type GenerateTextOptions, type GlobalAttributeSpec, type GlobalAttributes, HardBreak, type HardBreakOptions, Heading, type HeadingOptions, Highlight, type HighlightOptions, History, type HistoryOptions, HorizontalRule, type HorizontalRuleOptions, type IconSet, type InlineStyleOverrides, InvisibleChars, type InvisibleCharsOptions, type InvisibleCharsStorage, type IsNodeEmptyOptions, type IsValidUrlOptions, Italic, type ItalicOptions, type JSONAttribute, type JSONContent, type JSONMark, type KeyboardShortcutCommand, LineHeight, type LineHeightOptions, Link, type LinkAttributes, type LinkClickPluginOptions, type LinkExitPluginOptions, type LinkOptions, type LinkPastePluginOptions, LinkPopover, type LinkPopoverOptions, ListItem, type ListItemOptions, ListKeymap, type ListKeymapOptions, Mark, type MarkConfig, type MarkInputRuleOptions, type MarkParseRule, type MarkRange, type MarkRenderHTMLProps, type MountEventProps, Node, type NodeConfig, type NodeInputRuleOptions, type NodeParseRule, type NodeRenderHTMLProps, OrderedList, type OrderedListOptions, Paragraph, type ParagraphOptions, type PasteEventProps, Placeholder, type PlaceholderOptions, type PositionFloatingOptions, type Range, type RawCommands, Selection, SelectionDecoration, type SelectionDecorationOptions, type SelectionOptions, type SelectionStorage, type SetContentOptions, type SingleCommands, StarterKit, type StarterKitOptions, Strike, type StrikeOptions, Subscript, type SubscriptOptions, Superscript, type SuperscriptOptions, TaskItem, type TaskItemOptions, TaskList, type TaskListOptions, Text, TextAlign, type TextAlignOptions, TextColor, type TextColorOptions, type TextInputRuleOptions, TextStyle, type TextStyleOptions, type TextblockTypeInputRuleOptions, type ToolbarButton, ToolbarController, type ToolbarControllerEditor, type ToolbarDropdown, type ToolbarGroup, type ToolbarItem, type ToolbarLayoutDropdown, type ToolbarLayoutEntry, type ToolbarSeparator, TrailingNode, type TrailingNodeOptions, type TransactionEventProps, Typography, type TypographyOptions, Underline, type UnderlineOptions, UniqueID, type UniqueIDOptions, VERSION, type WrappingInputRuleOptions, applyInlineStyles, autolinkPlugin, autolinkPluginKey, blur, bubbleMenuPluginKey, buildCommandProps, builtInCommands, callOrReturn, characterCountPluginKey, clearContent, createAccumulatingDispatch, createBubbleMenuPlugin, createCanChecker, createChainBuilder, createDocument, createFloatingMenuPlugin, defaultBlockAt, defaultIcons, deleteSelection, findChildren, findParentNode, floatingMenuPluginKey, focus, focusPluginKey, generateHTML, generateJSON, generateText, getMarkRange, inlineStyles, insertContent, insertText, invisibleCharsPluginKey, isDocumentEmpty, isNodeEmpty, isValidUrl, lift, linkClickPlugin, linkClickPluginKey, linkExitPlugin, linkExitPluginKey, linkPastePlugin, linkPastePluginKey, markInputRule, markInputRulePatterns, nodeInputRule, placeholderPluginKey, positionFloating, positionFloatingOnce, resetAttributes, selectAll, selectNodeBackward, selectionDecorationPluginKey, setBlockType, setContent, setMark, textInputRule, textblockTypeInputRule, toggleBlockType, toggleList, toggleMark, toggleWrap, uniqueIDPluginKey, unsetAllMarks, unsetMark, updateAttributes, wrapIn, wrappingInputRule };
|
package/dist/index.d.ts
CHANGED
|
@@ -3068,6 +3068,11 @@ interface MarkInputRuleOptions {
|
|
|
3068
3068
|
* The mark type to apply
|
|
3069
3069
|
*/
|
|
3070
3070
|
type: MarkType;
|
|
3071
|
+
/**
|
|
3072
|
+
* Whether Backspace can undo this input rule immediately after it fires.
|
|
3073
|
+
* @default true
|
|
3074
|
+
*/
|
|
3075
|
+
undoable?: boolean;
|
|
3071
3076
|
/**
|
|
3072
3077
|
* Optional: get attributes from the match
|
|
3073
3078
|
*
|
|
@@ -3126,6 +3131,177 @@ declare const markInputRulePatterns: {
|
|
|
3126
3131
|
readonly highlight: RegExp;
|
|
3127
3132
|
};
|
|
3128
3133
|
|
|
3134
|
+
/**
|
|
3135
|
+
* Wrapping Input Rule Helper
|
|
3136
|
+
*
|
|
3137
|
+
* Drop-in replacement for ProseMirror's wrappingInputRule that exposes
|
|
3138
|
+
* the `undoable` option so extension authors can opt out of Backspace undo.
|
|
3139
|
+
*/
|
|
3140
|
+
|
|
3141
|
+
interface WrappingInputRuleOptions {
|
|
3142
|
+
/**
|
|
3143
|
+
* The regex pattern to match. Should start with `^` so it only
|
|
3144
|
+
* fires at the start of a textblock.
|
|
3145
|
+
*/
|
|
3146
|
+
find: RegExp;
|
|
3147
|
+
/**
|
|
3148
|
+
* The node type to wrap in.
|
|
3149
|
+
*/
|
|
3150
|
+
type: NodeType;
|
|
3151
|
+
/**
|
|
3152
|
+
* Whether Backspace can undo this input rule immediately after it fires.
|
|
3153
|
+
* @default true
|
|
3154
|
+
*/
|
|
3155
|
+
undoable?: boolean;
|
|
3156
|
+
/**
|
|
3157
|
+
* Node attributes, or a function that computes them from the match.
|
|
3158
|
+
*/
|
|
3159
|
+
getAttributes?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
|
|
3160
|
+
/**
|
|
3161
|
+
* Predicate that decides whether to join with an adjacent node of
|
|
3162
|
+
* the same type above the newly wrapped node.
|
|
3163
|
+
*/
|
|
3164
|
+
joinPredicate?: (match: RegExpMatchArray, node: Node$1) => boolean;
|
|
3165
|
+
/**
|
|
3166
|
+
* Optional guard predicate. When provided, the rule only fires if
|
|
3167
|
+
* this returns true. Use this to prevent wrapping in certain contexts
|
|
3168
|
+
* (e.g. don't create a nested list inside an existing list item).
|
|
3169
|
+
*/
|
|
3170
|
+
guard?: (state: EditorState) => boolean;
|
|
3171
|
+
}
|
|
3172
|
+
/**
|
|
3173
|
+
* Creates an input rule that wraps a textblock in a given node type.
|
|
3174
|
+
*
|
|
3175
|
+
* @example
|
|
3176
|
+
* // `> ` at start of line wraps in blockquote
|
|
3177
|
+
* wrappingInputRule({
|
|
3178
|
+
* find: /^\s*>\s$/,
|
|
3179
|
+
* type: schema.nodes.blockquote,
|
|
3180
|
+
* });
|
|
3181
|
+
*
|
|
3182
|
+
* @example
|
|
3183
|
+
* // Non-undoable wrapping rule
|
|
3184
|
+
* wrappingInputRule({
|
|
3185
|
+
* find: /^\s*>\s$/,
|
|
3186
|
+
* type: schema.nodes.blockquote,
|
|
3187
|
+
* undoable: false,
|
|
3188
|
+
* });
|
|
3189
|
+
*/
|
|
3190
|
+
declare function wrappingInputRule(options: WrappingInputRuleOptions): InputRule;
|
|
3191
|
+
|
|
3192
|
+
/**
|
|
3193
|
+
* Textblock Type Input Rule Helper
|
|
3194
|
+
*
|
|
3195
|
+
* Drop-in replacement for ProseMirror's textblockTypeInputRule that exposes
|
|
3196
|
+
* the `undoable` option so extension authors can opt out of Backspace undo.
|
|
3197
|
+
*/
|
|
3198
|
+
|
|
3199
|
+
interface TextblockTypeInputRuleOptions {
|
|
3200
|
+
/**
|
|
3201
|
+
* The regex pattern to match. Should start with `^` so it only
|
|
3202
|
+
* fires at the start of a textblock.
|
|
3203
|
+
*/
|
|
3204
|
+
find: RegExp;
|
|
3205
|
+
/**
|
|
3206
|
+
* The node type to change the textblock to.
|
|
3207
|
+
*/
|
|
3208
|
+
type: NodeType;
|
|
3209
|
+
/**
|
|
3210
|
+
* Whether Backspace can undo this input rule immediately after it fires.
|
|
3211
|
+
* @default true
|
|
3212
|
+
*/
|
|
3213
|
+
undoable?: boolean;
|
|
3214
|
+
/**
|
|
3215
|
+
* Node attributes, or a function that computes them from the match.
|
|
3216
|
+
*/
|
|
3217
|
+
getAttributes?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
|
|
3218
|
+
}
|
|
3219
|
+
/**
|
|
3220
|
+
* Creates an input rule that changes the type of a textblock.
|
|
3221
|
+
*
|
|
3222
|
+
* @example
|
|
3223
|
+
* // `## ` at start of line converts to heading level 2
|
|
3224
|
+
* textblockTypeInputRule({
|
|
3225
|
+
* find: /^(#{1,4})\s$/,
|
|
3226
|
+
* type: schema.nodes.heading,
|
|
3227
|
+
* getAttributes: (match) => ({ level: match[1].length }),
|
|
3228
|
+
* });
|
|
3229
|
+
*/
|
|
3230
|
+
declare function textblockTypeInputRule(options: TextblockTypeInputRuleOptions): InputRule;
|
|
3231
|
+
|
|
3232
|
+
/**
|
|
3233
|
+
* Text Input Rule Helper
|
|
3234
|
+
*
|
|
3235
|
+
* Creates input rules for simple text replacements (e.g. `--` to em dash).
|
|
3236
|
+
*/
|
|
3237
|
+
|
|
3238
|
+
interface TextInputRuleOptions {
|
|
3239
|
+
/**
|
|
3240
|
+
* The regex pattern to match.
|
|
3241
|
+
*/
|
|
3242
|
+
find: RegExp;
|
|
3243
|
+
/**
|
|
3244
|
+
* The replacement text.
|
|
3245
|
+
*/
|
|
3246
|
+
replace: string;
|
|
3247
|
+
/**
|
|
3248
|
+
* Whether Backspace can undo this input rule immediately after it fires.
|
|
3249
|
+
* @default true
|
|
3250
|
+
*/
|
|
3251
|
+
undoable?: boolean;
|
|
3252
|
+
}
|
|
3253
|
+
/**
|
|
3254
|
+
* Creates an input rule that replaces matched text with a string.
|
|
3255
|
+
*
|
|
3256
|
+
* @example
|
|
3257
|
+
* // `--` converts to em dash
|
|
3258
|
+
* textInputRule({ find: /--$/, replace: '\u2014' });
|
|
3259
|
+
*
|
|
3260
|
+
* @example
|
|
3261
|
+
* // Non-undoable replacement
|
|
3262
|
+
* textInputRule({ find: /->$/, replace: '\u2192', undoable: false });
|
|
3263
|
+
*/
|
|
3264
|
+
declare function textInputRule(options: TextInputRuleOptions): InputRule;
|
|
3265
|
+
|
|
3266
|
+
/**
|
|
3267
|
+
* Node Input Rule Helper
|
|
3268
|
+
*
|
|
3269
|
+
* Creates input rules that replace matched text with a node.
|
|
3270
|
+
* Used for nodes like HorizontalRule, Image, Emoji, etc.
|
|
3271
|
+
*/
|
|
3272
|
+
|
|
3273
|
+
interface NodeInputRuleOptions {
|
|
3274
|
+
/**
|
|
3275
|
+
* The regex pattern to match.
|
|
3276
|
+
*/
|
|
3277
|
+
find: RegExp;
|
|
3278
|
+
/**
|
|
3279
|
+
* The node type to insert.
|
|
3280
|
+
*/
|
|
3281
|
+
type: NodeType;
|
|
3282
|
+
/**
|
|
3283
|
+
* Whether Backspace can undo this input rule immediately after it fires.
|
|
3284
|
+
* @default true
|
|
3285
|
+
*/
|
|
3286
|
+
undoable?: boolean;
|
|
3287
|
+
/**
|
|
3288
|
+
* Node attributes, or a function that computes them from the match.
|
|
3289
|
+
*/
|
|
3290
|
+
getAttributes?: Attrs | null | ((match: RegExpMatchArray, state: EditorState) => Attrs | null);
|
|
3291
|
+
}
|
|
3292
|
+
/**
|
|
3293
|
+
* Creates an input rule that replaces matched text with a node.
|
|
3294
|
+
*
|
|
3295
|
+
* @example
|
|
3296
|
+
* // `:smile:` inserts an emoji node
|
|
3297
|
+
* nodeInputRule({
|
|
3298
|
+
* find: /:([a-zA-Z0-9_+-]+):$/,
|
|
3299
|
+
* type: schema.nodes.emoji,
|
|
3300
|
+
* getAttributes: (match) => ({ name: match[1] }),
|
|
3301
|
+
* });
|
|
3302
|
+
*/
|
|
3303
|
+
declare function nodeInputRule(options: NodeInputRuleOptions): InputRule;
|
|
3304
|
+
|
|
3129
3305
|
/**
|
|
3130
3306
|
* URL Validation Helper
|
|
3131
3307
|
*
|
|
@@ -5628,4 +5804,4 @@ declare const StarterKit: Extension<StarterKitOptions, unknown>;
|
|
|
5628
5804
|
*/
|
|
5629
5805
|
declare const VERSION = "0.1.0";
|
|
5630
5806
|
|
|
5631
|
-
export { type AnyExtension, type AnyExtensionConfig, type AttributeSpec, type AttributeSpecs, type AutolinkPluginOptions, BaseKeymap, type BaseKeymapOptions, Blockquote, type BlockquoteOptions, Bold, type BoldOptions, BubbleMenu, type BubbleMenuOptions, type BuildCommandPropsOptions, BulletList, type BulletListOptions, type CanChainedCommands, CanChecker, type CanCheckerEditor, type CanCheckerOptions, type CanCommands, ChainBuilder, type ChainBuilderEditor, type ChainBuilderOptions, type ChainFailure, type ChainedCommands, CharacterCount, type CharacterCountOptions, type CharacterCountStorage, type ClearContentOptions, ClearFormatting, Code, CodeBlock, type CodeBlockOptions, type CodeOptions, type Command, type CommandEditor, CommandManager, type CommandManagerEditor, type CommandMap, type CommandProps, type CommandPropsEditor, type CommandSpec$1 as CommandSpec, type Content, type ContentErrorProps, type CreateBubbleMenuPluginOptions, type CreateDocumentOptions, type CreateEventProps, type CreateFloatingMenuPluginOptions, DEFAULT_HIGHLIGHT_COLORS, DEFAULT_TEXT_COLORS, type DeleteEventProps, Document$1 as Document, type DropEventProps, Dropcursor, type DropcursorOptions, Editor, type EditorEventName, type EditorEvents, type EditorInstance, type EditorOptions, EventEmitter, Extension, type ExtensionConfig, type ExtensionEditor, ExtensionManager, type ExtensionManagerEditor, type ExtensionManagerOptions, type FindChildResult, type FindParentNodeResult, FloatingMenu, type FloatingMenuOptions, Focus, type FocusEventProps, type FocusOptions, type FocusPosition, FontFamily, type FontFamilyOptions, FontSize, type FontSizeOptions, Gapcursor, type GenerateHTMLOptions, type GenerateJSONOptions, type GenerateTextOptions, type GlobalAttributeSpec, type GlobalAttributes, HardBreak, type HardBreakOptions, Heading, type HeadingOptions, Highlight, type HighlightOptions, History, type HistoryOptions, HorizontalRule, type HorizontalRuleOptions, type IconSet, type InlineStyleOverrides, InvisibleChars, type InvisibleCharsOptions, type InvisibleCharsStorage, type IsNodeEmptyOptions, type IsValidUrlOptions, Italic, type ItalicOptions, type JSONAttribute, type JSONContent, type JSONMark, type KeyboardShortcutCommand, LineHeight, type LineHeightOptions, Link, type LinkAttributes, type LinkClickPluginOptions, type LinkExitPluginOptions, type LinkOptions, type LinkPastePluginOptions, LinkPopover, type LinkPopoverOptions, ListItem, type ListItemOptions, ListKeymap, type ListKeymapOptions, Mark, type MarkConfig, type MarkInputRuleOptions, type MarkParseRule, type MarkRange, type MarkRenderHTMLProps, type MountEventProps, Node, type NodeConfig, type NodeParseRule, type NodeRenderHTMLProps, OrderedList, type OrderedListOptions, Paragraph, type ParagraphOptions, type PasteEventProps, Placeholder, type PlaceholderOptions, type PositionFloatingOptions, type Range, type RawCommands, Selection, SelectionDecoration, type SelectionDecorationOptions, type SelectionOptions, type SelectionStorage, type SetContentOptions, type SingleCommands, StarterKit, type StarterKitOptions, Strike, type StrikeOptions, Subscript, type SubscriptOptions, Superscript, type SuperscriptOptions, TaskItem, type TaskItemOptions, TaskList, type TaskListOptions, Text, TextAlign, type TextAlignOptions, TextColor, type TextColorOptions, TextStyle, type TextStyleOptions, type ToolbarButton, ToolbarController, type ToolbarControllerEditor, type ToolbarDropdown, type ToolbarGroup, type ToolbarItem, type ToolbarLayoutDropdown, type ToolbarLayoutEntry, type ToolbarSeparator, TrailingNode, type TrailingNodeOptions, type TransactionEventProps, Typography, type TypographyOptions, Underline, type UnderlineOptions, UniqueID, type UniqueIDOptions, VERSION, applyInlineStyles, autolinkPlugin, autolinkPluginKey, blur, bubbleMenuPluginKey, buildCommandProps, builtInCommands, callOrReturn, characterCountPluginKey, clearContent, createAccumulatingDispatch, createBubbleMenuPlugin, createCanChecker, createChainBuilder, createDocument, createFloatingMenuPlugin, defaultBlockAt, defaultIcons, deleteSelection, findChildren, findParentNode, floatingMenuPluginKey, focus, focusPluginKey, generateHTML, generateJSON, generateText, getMarkRange, inlineStyles, insertContent, insertText, invisibleCharsPluginKey, isDocumentEmpty, isNodeEmpty, isValidUrl, lift, linkClickPlugin, linkClickPluginKey, linkExitPlugin, linkExitPluginKey, linkPastePlugin, linkPastePluginKey, markInputRule, markInputRulePatterns, placeholderPluginKey, positionFloating, positionFloatingOnce, resetAttributes, selectAll, selectNodeBackward, selectionDecorationPluginKey, setBlockType, setContent, setMark, toggleBlockType, toggleList, toggleMark, toggleWrap, uniqueIDPluginKey, unsetAllMarks, unsetMark, updateAttributes, wrapIn };
|
|
5807
|
+
export { type AnyExtension, type AnyExtensionConfig, type AttributeSpec, type AttributeSpecs, type AutolinkPluginOptions, BaseKeymap, type BaseKeymapOptions, Blockquote, type BlockquoteOptions, Bold, type BoldOptions, BubbleMenu, type BubbleMenuOptions, type BuildCommandPropsOptions, BulletList, type BulletListOptions, type CanChainedCommands, CanChecker, type CanCheckerEditor, type CanCheckerOptions, type CanCommands, ChainBuilder, type ChainBuilderEditor, type ChainBuilderOptions, type ChainFailure, type ChainedCommands, CharacterCount, type CharacterCountOptions, type CharacterCountStorage, type ClearContentOptions, ClearFormatting, Code, CodeBlock, type CodeBlockOptions, type CodeOptions, type Command, type CommandEditor, CommandManager, type CommandManagerEditor, type CommandMap, type CommandProps, type CommandPropsEditor, type CommandSpec$1 as CommandSpec, type Content, type ContentErrorProps, type CreateBubbleMenuPluginOptions, type CreateDocumentOptions, type CreateEventProps, type CreateFloatingMenuPluginOptions, DEFAULT_HIGHLIGHT_COLORS, DEFAULT_TEXT_COLORS, type DeleteEventProps, Document$1 as Document, type DropEventProps, Dropcursor, type DropcursorOptions, Editor, type EditorEventName, type EditorEvents, type EditorInstance, type EditorOptions, EventEmitter, Extension, type ExtensionConfig, type ExtensionEditor, ExtensionManager, type ExtensionManagerEditor, type ExtensionManagerOptions, type FindChildResult, type FindParentNodeResult, FloatingMenu, type FloatingMenuOptions, Focus, type FocusEventProps, type FocusOptions, type FocusPosition, FontFamily, type FontFamilyOptions, FontSize, type FontSizeOptions, Gapcursor, type GenerateHTMLOptions, type GenerateJSONOptions, type GenerateTextOptions, type GlobalAttributeSpec, type GlobalAttributes, HardBreak, type HardBreakOptions, Heading, type HeadingOptions, Highlight, type HighlightOptions, History, type HistoryOptions, HorizontalRule, type HorizontalRuleOptions, type IconSet, type InlineStyleOverrides, InvisibleChars, type InvisibleCharsOptions, type InvisibleCharsStorage, type IsNodeEmptyOptions, type IsValidUrlOptions, Italic, type ItalicOptions, type JSONAttribute, type JSONContent, type JSONMark, type KeyboardShortcutCommand, LineHeight, type LineHeightOptions, Link, type LinkAttributes, type LinkClickPluginOptions, type LinkExitPluginOptions, type LinkOptions, type LinkPastePluginOptions, LinkPopover, type LinkPopoverOptions, ListItem, type ListItemOptions, ListKeymap, type ListKeymapOptions, Mark, type MarkConfig, type MarkInputRuleOptions, type MarkParseRule, type MarkRange, type MarkRenderHTMLProps, type MountEventProps, Node, type NodeConfig, type NodeInputRuleOptions, type NodeParseRule, type NodeRenderHTMLProps, OrderedList, type OrderedListOptions, Paragraph, type ParagraphOptions, type PasteEventProps, Placeholder, type PlaceholderOptions, type PositionFloatingOptions, type Range, type RawCommands, Selection, SelectionDecoration, type SelectionDecorationOptions, type SelectionOptions, type SelectionStorage, type SetContentOptions, type SingleCommands, StarterKit, type StarterKitOptions, Strike, type StrikeOptions, Subscript, type SubscriptOptions, Superscript, type SuperscriptOptions, TaskItem, type TaskItemOptions, TaskList, type TaskListOptions, Text, TextAlign, type TextAlignOptions, TextColor, type TextColorOptions, type TextInputRuleOptions, TextStyle, type TextStyleOptions, type TextblockTypeInputRuleOptions, type ToolbarButton, ToolbarController, type ToolbarControllerEditor, type ToolbarDropdown, type ToolbarGroup, type ToolbarItem, type ToolbarLayoutDropdown, type ToolbarLayoutEntry, type ToolbarSeparator, TrailingNode, type TrailingNodeOptions, type TransactionEventProps, Typography, type TypographyOptions, Underline, type UnderlineOptions, UniqueID, type UniqueIDOptions, VERSION, type WrappingInputRuleOptions, applyInlineStyles, autolinkPlugin, autolinkPluginKey, blur, bubbleMenuPluginKey, buildCommandProps, builtInCommands, callOrReturn, characterCountPluginKey, clearContent, createAccumulatingDispatch, createBubbleMenuPlugin, createCanChecker, createChainBuilder, createDocument, createFloatingMenuPlugin, defaultBlockAt, defaultIcons, deleteSelection, findChildren, findParentNode, floatingMenuPluginKey, focus, focusPluginKey, generateHTML, generateJSON, generateText, getMarkRange, inlineStyles, insertContent, insertText, invisibleCharsPluginKey, isDocumentEmpty, isNodeEmpty, isValidUrl, lift, linkClickPlugin, linkClickPluginKey, linkExitPlugin, linkExitPluginKey, linkPastePlugin, linkPastePluginKey, markInputRule, markInputRulePatterns, nodeInputRule, placeholderPluginKey, positionFloating, positionFloatingOnce, resetAttributes, selectAll, selectNodeBackward, selectionDecorationPluginKey, setBlockType, setContent, setMark, textInputRule, textblockTypeInputRule, toggleBlockType, toggleList, toggleMark, toggleWrap, uniqueIDPluginKey, unsetAllMarks, unsetMark, updateAttributes, wrapIn, wrappingInputRule };
|