@tiptap/extension-italic
Advanced tools
Comparing version 2.3.2 to 2.4.0
import { Mark, mergeAttributes, markInputRule, markPasteRule } from '@tiptap/core'; | ||
/** | ||
* Matches an italic to a *italic* on input. | ||
*/ | ||
const starInputRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/; | ||
/** | ||
* Matches an italic to a *italic* on paste. | ||
*/ | ||
const starPasteRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g; | ||
/** | ||
* Matches an italic to a _italic_ on input. | ||
*/ | ||
const underscoreInputRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/; | ||
/** | ||
* Matches an italic to a _italic_ on paste. | ||
*/ | ||
const underscorePasteRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g; | ||
/** | ||
* This extension allows you to create italic text. | ||
* @see https://www.tiptap.dev/api/marks/italic | ||
*/ | ||
const Italic = Mark.create({ | ||
@@ -8,0 +24,0 @@ name: 'italic', |
@@ -7,6 +7,22 @@ (function (global, factory) { | ||
/** | ||
* Matches an italic to a *italic* on input. | ||
*/ | ||
const starInputRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/; | ||
/** | ||
* Matches an italic to a *italic* on paste. | ||
*/ | ||
const starPasteRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g; | ||
/** | ||
* Matches an italic to a _italic_ on input. | ||
*/ | ||
const underscoreInputRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/; | ||
/** | ||
* Matches an italic to a _italic_ on paste. | ||
*/ | ||
const underscorePasteRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g; | ||
/** | ||
* This extension allows you to create italic text. | ||
* @see https://www.tiptap.dev/api/marks/italic | ||
*/ | ||
const Italic = core.Mark.create({ | ||
@@ -13,0 +29,0 @@ name: 'italic', |
import { Mark } from '@tiptap/core'; | ||
export interface ItalicOptions { | ||
/** | ||
* HTML attributes to add to the italic element. | ||
* @default {} | ||
* @example { class: 'foo' } | ||
*/ | ||
HTMLAttributes: Record<string, any>; | ||
@@ -10,2 +15,3 @@ } | ||
* Set an italic mark | ||
* @example editor.commands.setItalic() | ||
*/ | ||
@@ -15,2 +21,3 @@ setItalic: () => ReturnType; | ||
* Toggle an italic mark | ||
* @example editor.commands.toggleItalic() | ||
*/ | ||
@@ -20,2 +27,3 @@ toggleItalic: () => ReturnType; | ||
* Unset an italic mark | ||
* @example editor.commands.unsetItalic() | ||
*/ | ||
@@ -26,6 +34,22 @@ unsetItalic: () => ReturnType; | ||
} | ||
/** | ||
* Matches an italic to a *italic* on input. | ||
*/ | ||
export declare const starInputRegex: RegExp; | ||
/** | ||
* Matches an italic to a *italic* on paste. | ||
*/ | ||
export declare const starPasteRegex: RegExp; | ||
/** | ||
* Matches an italic to a _italic_ on input. | ||
*/ | ||
export declare const underscoreInputRegex: RegExp; | ||
/** | ||
* Matches an italic to a _italic_ on paste. | ||
*/ | ||
export declare const underscorePasteRegex: RegExp; | ||
/** | ||
* This extension allows you to create italic text. | ||
* @see https://www.tiptap.dev/api/marks/italic | ||
*/ | ||
export declare const Italic: Mark<ItalicOptions, any>; |
{ | ||
"name": "@tiptap/extension-italic", | ||
"description": "italic extension for tiptap", | ||
"version": "2.3.2", | ||
"version": "2.4.0", | ||
"homepage": "https://tiptap.dev", | ||
@@ -32,3 +32,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@tiptap/core": "^2.3.2" | ||
"@tiptap/core": "^2.4.0" | ||
}, | ||
@@ -35,0 +35,0 @@ "peerDependencies": { |
@@ -9,2 +9,7 @@ import { | ||
export interface ItalicOptions { | ||
/** | ||
* HTML attributes to add to the italic element. | ||
* @default {} | ||
* @example { class: 'foo' } | ||
*/ | ||
HTMLAttributes: Record<string, any>, | ||
@@ -18,2 +23,3 @@ } | ||
* Set an italic mark | ||
* @example editor.commands.setItalic() | ||
*/ | ||
@@ -23,2 +29,3 @@ setItalic: () => ReturnType, | ||
* Toggle an italic mark | ||
* @example editor.commands.toggleItalic() | ||
*/ | ||
@@ -28,2 +35,3 @@ toggleItalic: () => ReturnType, | ||
* Unset an italic mark | ||
* @example editor.commands.unsetItalic() | ||
*/ | ||
@@ -35,7 +43,26 @@ unsetItalic: () => ReturnType, | ||
/** | ||
* Matches an italic to a *italic* on input. | ||
*/ | ||
export const starInputRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/ | ||
/** | ||
* Matches an italic to a *italic* on paste. | ||
*/ | ||
export const starPasteRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g | ||
/** | ||
* Matches an italic to a _italic_ on input. | ||
*/ | ||
export const underscoreInputRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/ | ||
/** | ||
* Matches an italic to a _italic_ on paste. | ||
*/ | ||
export const underscorePasteRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g | ||
/** | ||
* This extension allows you to create italic text. | ||
* @see https://www.tiptap.dev/api/marks/italic | ||
*/ | ||
export const Italic = Mark.create<ItalicOptions>({ | ||
@@ -42,0 +69,0 @@ name: 'italic', |
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
30346
471