@tiptap/extension-code
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@2.0.0-alpha.10...@tiptap/extension-code@2.0.0-alpha.11) (2021-02-16) | ||
**Note:** Version bump only for package @tiptap/extension-code | ||
# [2.0.0-alpha.10](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-code@2.0.0-alpha.9...@tiptap/extension-code@2.0.0-alpha.10) (2021-02-07) | ||
@@ -8,0 +16,0 @@ |
@@ -7,22 +7,22 @@ import { Command, Mark } from '@tiptap/core'; | ||
} | ||
export declare const inputRegex: RegExp; | ||
export declare const pasteRegex: RegExp; | ||
export declare const Code: Mark<CodeOptions, { | ||
/** | ||
* Set a code mark | ||
*/ | ||
setCode: () => Command; | ||
/** | ||
* Toggle inline code | ||
*/ | ||
toggleCode: () => Command; | ||
/** | ||
* Unset a code mark | ||
*/ | ||
unsetCode: () => Command; | ||
}>; | ||
declare module '@tiptap/core' { | ||
interface AllExtensions { | ||
Code: typeof Code; | ||
interface Commands { | ||
code: { | ||
/** | ||
* Set a code mark | ||
*/ | ||
setCode: () => Command; | ||
/** | ||
* Toggle inline code | ||
*/ | ||
toggleCode: () => Command; | ||
/** | ||
* Unset a code mark | ||
*/ | ||
unsetCode: () => Command; | ||
}; | ||
} | ||
} | ||
export declare const inputRegex: RegExp; | ||
export declare const pasteRegex: RegExp; | ||
export declare const Code: Mark<CodeOptions>; |
@@ -25,17 +25,8 @@ 'use strict'; | ||
return { | ||
/** | ||
* Set a code mark | ||
*/ | ||
setCode: () => ({ commands }) => { | ||
return commands.setMark('code'); | ||
}, | ||
/** | ||
* Toggle inline code | ||
*/ | ||
toggleCode: () => ({ commands }) => { | ||
return commands.toggleMark('code'); | ||
}, | ||
/** | ||
* Unset a code mark | ||
*/ | ||
unsetCode: () => ({ commands }) => { | ||
@@ -42,0 +33,0 @@ return commands.unsetMark('code'); |
@@ -21,17 +21,8 @@ import { Mark, mergeAttributes, markInputRule, markPasteRule } from '@tiptap/core'; | ||
return { | ||
/** | ||
* Set a code mark | ||
*/ | ||
setCode: () => ({ commands }) => { | ||
return commands.setMark('code'); | ||
}, | ||
/** | ||
* Toggle inline code | ||
*/ | ||
toggleCode: () => ({ commands }) => { | ||
return commands.toggleMark('code'); | ||
}, | ||
/** | ||
* Unset a code mark | ||
*/ | ||
unsetCode: () => ({ commands }) => { | ||
@@ -38,0 +29,0 @@ return commands.unsetMark('code'); |
@@ -25,17 +25,8 @@ (function (global, factory) { | ||
return { | ||
/** | ||
* Set a code mark | ||
*/ | ||
setCode: () => ({ commands }) => { | ||
return commands.setMark('code'); | ||
}, | ||
/** | ||
* Toggle inline code | ||
*/ | ||
toggleCode: () => ({ commands }) => { | ||
return commands.toggleMark('code'); | ||
}, | ||
/** | ||
* Unset a code mark | ||
*/ | ||
unsetCode: () => ({ commands }) => { | ||
@@ -42,0 +33,0 @@ return commands.unsetMark('code'); |
{ | ||
"name": "@tiptap/extension-code", | ||
"description": "code extension for tiptap", | ||
"version": "2.0.0-alpha.10", | ||
"version": "2.0.0-alpha.11", | ||
"homepage": "https://tiptap.dev", | ||
@@ -27,3 +27,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "6bdeb4615c7b6afba4a2fcac4e3c35d7a7c0030a" | ||
"gitHead": "71d8fbbcb1eacd664bb6992e0086a589e4684e69" | ||
} |
@@ -15,9 +15,28 @@ import { | ||
declare module '@tiptap/core' { | ||
interface Commands { | ||
code: { | ||
/** | ||
* Set a code mark | ||
*/ | ||
setCode: () => Command, | ||
/** | ||
* Toggle inline code | ||
*/ | ||
toggleCode: () => Command, | ||
/** | ||
* Unset a code mark | ||
*/ | ||
unsetCode: () => Command, | ||
} | ||
} | ||
} | ||
export const inputRegex = /(?:^|\s)((?:`)((?:[^`]+))(?:`))$/gm | ||
export const pasteRegex = /(?:^|\s)((?:`)((?:[^`]+))(?:`))/gm | ||
export const Code = Mark.create({ | ||
export const Code = Mark.create<CodeOptions>({ | ||
name: 'code', | ||
defaultOptions: <CodeOptions>{ | ||
defaultOptions: { | ||
HTMLAttributes: {}, | ||
@@ -40,18 +59,9 @@ }, | ||
return { | ||
/** | ||
* Set a code mark | ||
*/ | ||
setCode: (): Command => ({ commands }) => { | ||
setCode: () => ({ commands }) => { | ||
return commands.setMark('code') | ||
}, | ||
/** | ||
* Toggle inline code | ||
*/ | ||
toggleCode: (): Command => ({ commands }) => { | ||
toggleCode: () => ({ commands }) => { | ||
return commands.toggleMark('code') | ||
}, | ||
/** | ||
* Unset a code mark | ||
*/ | ||
unsetCode: (): Command => ({ commands }) => { | ||
unsetCode: () => ({ commands }) => { | ||
return commands.unsetMark('code') | ||
@@ -80,7 +90,1 @@ }, | ||
}) | ||
declare module '@tiptap/core' { | ||
interface AllExtensions { | ||
Code: typeof Code, | ||
} | ||
} |
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
25355
273