@tiptap/extension-code-block
Advanced tools
Comparing version 2.0.0-alpha.10 to 2.0.0-alpha.11
@@ -6,2 +6,10 @@ # Change Log | ||
# [2.0.0-alpha.11](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code-block@2.0.0-alpha.10...@tiptap/extension-code-block@2.0.0-alpha.11) (2021-02-16) | ||
**Note:** Version bump only for package @tiptap/extension-code-block | ||
# [2.0.0-alpha.10](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code-block@2.0.0-alpha.9...@tiptap/extension-code-block@2.0.0-alpha.10) (2021-02-07) | ||
@@ -8,0 +16,0 @@ |
@@ -8,22 +8,22 @@ import { Command, Node } from '@tiptap/core'; | ||
} | ||
export declare const backtickInputRegex: RegExp; | ||
export declare const tildeInputRegex: RegExp; | ||
export declare const CodeBlock: Node<CodeBlockOptions, { | ||
/** | ||
* Set a code block | ||
*/ | ||
setCodeBlock: (attributes?: { | ||
language: string; | ||
} | undefined) => Command; | ||
/** | ||
* Toggle a code block | ||
*/ | ||
toggleCodeBlock: (attributes?: { | ||
language: string; | ||
} | undefined) => Command; | ||
}>; | ||
declare module '@tiptap/core' { | ||
interface AllExtensions { | ||
CodeBlock: typeof CodeBlock; | ||
interface Commands { | ||
codeBlock: { | ||
/** | ||
* Set a code block | ||
*/ | ||
setCodeBlock: (attributes?: { | ||
language: string; | ||
}) => Command; | ||
/** | ||
* Toggle a code block | ||
*/ | ||
toggleCodeBlock: (attributes?: { | ||
language: string; | ||
}) => Command; | ||
}; | ||
} | ||
} | ||
export declare const backtickInputRegex: RegExp; | ||
export declare const tildeInputRegex: RegExp; | ||
export declare const CodeBlock: Node<CodeBlockOptions>; |
@@ -60,12 +60,6 @@ 'use strict'; | ||
return { | ||
/** | ||
* Set a code block | ||
*/ | ||
setCodeBlock: (attributes) => ({ commands }) => { | ||
setCodeBlock: attributes => ({ commands }) => { | ||
return commands.setNode('codeBlock', attributes); | ||
}, | ||
/** | ||
* Toggle a code block | ||
*/ | ||
toggleCodeBlock: (attributes) => ({ commands }) => { | ||
toggleCodeBlock: attributes => ({ commands }) => { | ||
return commands.toggleNode('codeBlock', 'paragraph', attributes); | ||
@@ -72,0 +66,0 @@ }, |
@@ -56,12 +56,6 @@ import { Node } from '@tiptap/core'; | ||
return { | ||
/** | ||
* Set a code block | ||
*/ | ||
setCodeBlock: (attributes) => ({ commands }) => { | ||
setCodeBlock: attributes => ({ commands }) => { | ||
return commands.setNode('codeBlock', attributes); | ||
}, | ||
/** | ||
* Toggle a code block | ||
*/ | ||
toggleCodeBlock: (attributes) => ({ commands }) => { | ||
toggleCodeBlock: attributes => ({ commands }) => { | ||
return commands.toggleNode('codeBlock', 'paragraph', attributes); | ||
@@ -68,0 +62,0 @@ }, |
@@ -59,12 +59,6 @@ (function (global, factory) { | ||
return { | ||
/** | ||
* Set a code block | ||
*/ | ||
setCodeBlock: (attributes) => ({ commands }) => { | ||
setCodeBlock: attributes => ({ commands }) => { | ||
return commands.setNode('codeBlock', attributes); | ||
}, | ||
/** | ||
* Toggle a code block | ||
*/ | ||
toggleCodeBlock: (attributes) => ({ commands }) => { | ||
toggleCodeBlock: attributes => ({ commands }) => { | ||
return commands.toggleNode('codeBlock', 'paragraph', attributes); | ||
@@ -71,0 +65,0 @@ }, |
{ | ||
"name": "@tiptap/extension-code-block", | ||
"description": "code block extension for tiptap", | ||
"version": "2.0.0-alpha.10", | ||
"version": "2.0.0-alpha.11", | ||
"homepage": "https://tiptap.dev", | ||
@@ -30,3 +30,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "6bdeb4615c7b6afba4a2fcac4e3c35d7a7c0030a" | ||
"gitHead": "71d8fbbcb1eacd664bb6992e0086a589e4684e69" | ||
} |
@@ -11,9 +11,24 @@ import { Command, Node } from '@tiptap/core' | ||
declare module '@tiptap/core' { | ||
interface Commands { | ||
codeBlock: { | ||
/** | ||
* Set a code block | ||
*/ | ||
setCodeBlock: (attributes?: { language: string }) => Command, | ||
/** | ||
* Toggle a code block | ||
*/ | ||
toggleCodeBlock: (attributes?: { language: string }) => Command, | ||
} | ||
} | ||
} | ||
export const backtickInputRegex = /^```(?<language>[a-z]*)? $/ | ||
export const tildeInputRegex = /^~~~(?<language>[a-z]*)? $/ | ||
export const CodeBlock = Node.create({ | ||
export const CodeBlock = Node.create<CodeBlockOptions>({ | ||
name: 'codeBlock', | ||
defaultOptions: <CodeBlockOptions>{ | ||
defaultOptions: { | ||
languageClassPrefix: 'language-', | ||
@@ -78,12 +93,6 @@ HTMLAttributes: {}, | ||
return { | ||
/** | ||
* Set a code block | ||
*/ | ||
setCodeBlock: (attributes?: { language: string }): Command => ({ commands }) => { | ||
setCodeBlock: attributes => ({ commands }) => { | ||
return commands.setNode('codeBlock', attributes) | ||
}, | ||
/** | ||
* Toggle a code block | ||
*/ | ||
toggleCodeBlock: (attributes?: { language: string }): Command => ({ commands }) => { | ||
toggleCodeBlock: attributes => ({ commands }) => { | ||
return commands.toggleNode('codeBlock', 'paragraph', attributes) | ||
@@ -107,7 +116,1 @@ }, | ||
}) | ||
declare module '@tiptap/core' { | ||
interface AllExtensions { | ||
CodeBlock: typeof CodeBlock, | ||
} | ||
} |
Sorry, the diff of this file is too big to display
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
469156
694