@tiptap/extension-bold
Advanced tools
Comparing version 2.3.2 to 2.4.0
import { Mark, mergeAttributes, markInputRule, markPasteRule } from '@tiptap/core'; | ||
/** | ||
* Matches bold text via `**` as input. | ||
*/ | ||
const starInputRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/; | ||
/** | ||
* Matches bold text via `**` while pasting. | ||
*/ | ||
const starPasteRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g; | ||
/** | ||
* Matches bold text via `__` as input. | ||
*/ | ||
const underscoreInputRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/; | ||
/** | ||
* Matches bold text via `__` while pasting. | ||
*/ | ||
const underscorePasteRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g; | ||
/** | ||
* This extension allows you to mark text as bold. | ||
* @see https://tiptap.dev/api/marks/bold | ||
*/ | ||
const Bold = Mark.create({ | ||
@@ -8,0 +24,0 @@ name: 'bold', |
@@ -7,6 +7,22 @@ (function (global, factory) { | ||
/** | ||
* Matches bold text via `**` as input. | ||
*/ | ||
const starInputRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/; | ||
/** | ||
* Matches bold text via `**` while pasting. | ||
*/ | ||
const starPasteRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g; | ||
/** | ||
* Matches bold text via `__` as input. | ||
*/ | ||
const underscoreInputRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/; | ||
/** | ||
* Matches bold text via `__` while pasting. | ||
*/ | ||
const underscorePasteRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g; | ||
/** | ||
* This extension allows you to mark text as bold. | ||
* @see https://tiptap.dev/api/marks/bold | ||
*/ | ||
const Bold = core.Mark.create({ | ||
@@ -13,0 +29,0 @@ name: 'bold', |
import { Mark } from '@tiptap/core'; | ||
export interface BoldOptions { | ||
/** | ||
* HTML attributes to add to the bold element. | ||
* @default {} | ||
* @example { class: 'foo' } | ||
*/ | ||
HTMLAttributes: Record<string, any>; | ||
@@ -23,6 +28,22 @@ } | ||
} | ||
/** | ||
* Matches bold text via `**` as input. | ||
*/ | ||
export declare const starInputRegex: RegExp; | ||
/** | ||
* Matches bold text via `**` while pasting. | ||
*/ | ||
export declare const starPasteRegex: RegExp; | ||
/** | ||
* Matches bold text via `__` as input. | ||
*/ | ||
export declare const underscoreInputRegex: RegExp; | ||
/** | ||
* Matches bold text via `__` while pasting. | ||
*/ | ||
export declare const underscorePasteRegex: RegExp; | ||
/** | ||
* This extension allows you to mark text as bold. | ||
* @see https://tiptap.dev/api/marks/bold | ||
*/ | ||
export declare const Bold: Mark<BoldOptions, any>; |
{ | ||
"name": "@tiptap/extension-bold", | ||
"description": "bold 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 BoldOptions { | ||
/** | ||
* HTML attributes to add to the bold element. | ||
* @default {} | ||
* @example { class: 'foo' } | ||
*/ | ||
HTMLAttributes: Record<string, any>, | ||
@@ -32,7 +37,26 @@ } | ||
/** | ||
* Matches bold text via `**` as input. | ||
*/ | ||
export const starInputRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/ | ||
/** | ||
* Matches bold text via `**` while pasting. | ||
*/ | ||
export const starPasteRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g | ||
/** | ||
* Matches bold text via `__` as input. | ||
*/ | ||
export const underscoreInputRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/ | ||
/** | ||
* Matches bold text via `__` while pasting. | ||
*/ | ||
export const underscorePasteRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g | ||
/** | ||
* This extension allows you to mark text as bold. | ||
* @see https://tiptap.dev/api/marks/bold | ||
*/ | ||
export const Bold = Mark.create<BoldOptions>({ | ||
@@ -39,0 +63,0 @@ name: 'bold', |
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
30226
469