@tiptap/extension-code-block
Advanced tools
Comparing version 2.3.2 to 2.4.0
import { Node, mergeAttributes, textblockTypeInputRule } from '@tiptap/core'; | ||
import { Plugin, PluginKey, TextSelection } from '@tiptap/pm/state'; | ||
/** | ||
* Matches a code block with backticks. | ||
*/ | ||
const backtickInputRegex = /^```([a-z]+)?[\s\n]$/; | ||
/** | ||
* Matches a code block with tildes. | ||
*/ | ||
const tildeInputRegex = /^~~~([a-z]+)?[\s\n]$/; | ||
/** | ||
* This extension allows you to create code blocks. | ||
* @see https://tiptap.dev/api/nodes/code-block | ||
*/ | ||
const CodeBlock = Node.create({ | ||
@@ -7,0 +17,0 @@ name: 'codeBlock', |
@@ -7,4 +7,14 @@ (function (global, factory) { | ||
/** | ||
* Matches a code block with backticks. | ||
*/ | ||
const backtickInputRegex = /^```([a-z]+)?[\s\n]$/; | ||
/** | ||
* Matches a code block with tildes. | ||
*/ | ||
const tildeInputRegex = /^~~~([a-z]+)?[\s\n]$/; | ||
/** | ||
* This extension allows you to create code blocks. | ||
* @see https://tiptap.dev/api/nodes/code-block | ||
*/ | ||
const CodeBlock = core.Node.create({ | ||
@@ -11,0 +21,0 @@ name: 'codeBlock', |
@@ -5,3 +5,3 @@ import { Node } from '@tiptap/core'; | ||
* Adds a prefix to language classes that are applied to code tags. | ||
* Defaults to `'language-'`. | ||
* @default 'language-' | ||
*/ | ||
@@ -11,3 +11,3 @@ languageClassPrefix: string; | ||
* Define whether the node should be exited on triple enter. | ||
* Defaults to `true`. | ||
* @default true | ||
*/ | ||
@@ -17,3 +17,3 @@ exitOnTripleEnter: boolean; | ||
* Define whether the node should be exited on arrow down if there is no node after it. | ||
* Defaults to `true`. | ||
* @default true | ||
*/ | ||
@@ -23,2 +23,4 @@ exitOnArrowDown: boolean; | ||
* Custom HTML attributes that should be added to the rendered HTML tag. | ||
* @default {} | ||
* @example { class: 'foo' } | ||
*/ | ||
@@ -32,2 +34,4 @@ HTMLAttributes: Record<string, any>; | ||
* Set a code block | ||
* @param attributes Code block attributes | ||
* @example editor.commands.setCodeBlock({ language: 'javascript' }) | ||
*/ | ||
@@ -39,2 +43,4 @@ setCodeBlock: (attributes?: { | ||
* Toggle a code block | ||
* @param attributes Code block attributes | ||
* @example editor.commands.toggleCodeBlock({ language: 'javascript' }) | ||
*/ | ||
@@ -47,4 +53,14 @@ toggleCodeBlock: (attributes?: { | ||
} | ||
/** | ||
* Matches a code block with backticks. | ||
*/ | ||
export declare const backtickInputRegex: RegExp; | ||
/** | ||
* Matches a code block with tildes. | ||
*/ | ||
export declare const tildeInputRegex: RegExp; | ||
/** | ||
* This extension allows you to create code blocks. | ||
* @see https://tiptap.dev/api/nodes/code-block | ||
*/ | ||
export declare const CodeBlock: Node<CodeBlockOptions, any>; |
{ | ||
"name": "@tiptap/extension-code-block", | ||
"description": "code block extension for tiptap", | ||
"version": "2.3.2", | ||
"version": "2.4.0", | ||
"homepage": "https://tiptap.dev", | ||
@@ -32,4 +32,4 @@ "keywords": [ | ||
"devDependencies": { | ||
"@tiptap/core": "^2.3.2", | ||
"@tiptap/pm": "^2.3.2" | ||
"@tiptap/core": "^2.4.0", | ||
"@tiptap/pm": "^2.4.0" | ||
}, | ||
@@ -36,0 +36,0 @@ "peerDependencies": { |
@@ -7,3 +7,3 @@ import { mergeAttributes, Node, textblockTypeInputRule } from '@tiptap/core' | ||
* Adds a prefix to language classes that are applied to code tags. | ||
* Defaults to `'language-'`. | ||
* @default 'language-' | ||
*/ | ||
@@ -13,3 +13,3 @@ languageClassPrefix: string | ||
* Define whether the node should be exited on triple enter. | ||
* Defaults to `true`. | ||
* @default true | ||
*/ | ||
@@ -19,3 +19,3 @@ exitOnTripleEnter: boolean | ||
* Define whether the node should be exited on arrow down if there is no node after it. | ||
* Defaults to `true`. | ||
* @default true | ||
*/ | ||
@@ -25,2 +25,4 @@ exitOnArrowDown: boolean | ||
* Custom HTML attributes that should be added to the rendered HTML tag. | ||
* @default {} | ||
* @example { class: 'foo' } | ||
*/ | ||
@@ -35,2 +37,4 @@ HTMLAttributes: Record<string, any> | ||
* Set a code block | ||
* @param attributes Code block attributes | ||
* @example editor.commands.setCodeBlock({ language: 'javascript' }) | ||
*/ | ||
@@ -40,2 +44,4 @@ setCodeBlock: (attributes?: { language: string }) => ReturnType | ||
* Toggle a code block | ||
* @param attributes Code block attributes | ||
* @example editor.commands.toggleCodeBlock({ language: 'javascript' }) | ||
*/ | ||
@@ -47,5 +53,16 @@ toggleCodeBlock: (attributes?: { language: string }) => ReturnType | ||
/** | ||
* Matches a code block with backticks. | ||
*/ | ||
export const backtickInputRegex = /^```([a-z]+)?[\s\n]$/ | ||
/** | ||
* Matches a code block with tildes. | ||
*/ | ||
export const tildeInputRegex = /^~~~([a-z]+)?[\s\n]$/ | ||
/** | ||
* This extension allows you to create code blocks. | ||
* @see https://tiptap.dev/api/nodes/code-block | ||
*/ | ||
export const CodeBlock = Node.create<CodeBlockOptions>({ | ||
@@ -52,0 +69,0 @@ name: 'codeBlock', |
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
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
85668
1001