@tiptap/extension-font-family
Advanced tools
Comparing version 3.0.0-next.3 to 3.0.0-next.4
@@ -1,34 +0,2 @@ | ||
import { Extension } from '@tiptap/core'; | ||
type FontFamilyOptions = { | ||
/** | ||
* A list of node names where the font family can be applied. | ||
* @default ['textStyle'] | ||
* @example ['heading', 'paragraph'] | ||
*/ | ||
types: string[]; | ||
}; | ||
declare module '@tiptap/core' { | ||
interface Commands<ReturnType> { | ||
fontFamily: { | ||
/** | ||
* Set the font family | ||
* @param fontFamily The font family | ||
* @example editor.commands.setFontFamily('Arial') | ||
*/ | ||
setFontFamily: (fontFamily: string) => ReturnType; | ||
/** | ||
* Unset the font family | ||
* @example editor.commands.unsetFontFamily() | ||
*/ | ||
unsetFontFamily: () => ReturnType; | ||
}; | ||
} | ||
} | ||
/** | ||
* This extension allows you to set a font family for text. | ||
* @see https://www.tiptap.dev/api/extensions/font-family | ||
*/ | ||
declare const FontFamily: Extension<FontFamilyOptions, any>; | ||
export { FontFamily, type FontFamilyOptions, FontFamily as default }; | ||
import { FontFamily } from '@tiptap/extension-text-style'; | ||
export { FontFamily, FontFamilyOptions, FontFamily as default } from '@tiptap/extension-text-style'; |
@@ -1,50 +0,9 @@ | ||
// src/font-family.ts | ||
import "@tiptap/extension-text-style"; | ||
import { Extension } from "@tiptap/core"; | ||
var FontFamily = Extension.create({ | ||
name: "fontFamily", | ||
addOptions() { | ||
return { | ||
types: ["textStyle"] | ||
}; | ||
}, | ||
addGlobalAttributes() { | ||
return [ | ||
{ | ||
types: this.options.types, | ||
attributes: { | ||
fontFamily: { | ||
default: null, | ||
parseHTML: (element) => element.style.fontFamily, | ||
renderHTML: (attributes) => { | ||
if (!attributes.fontFamily) { | ||
return {}; | ||
} | ||
return { | ||
style: `font-family: ${attributes.fontFamily}` | ||
}; | ||
} | ||
} | ||
} | ||
} | ||
]; | ||
}, | ||
addCommands() { | ||
return { | ||
setFontFamily: (fontFamily) => ({ chain }) => { | ||
return chain().setMark("textStyle", { fontFamily }).run(); | ||
}, | ||
unsetFontFamily: () => ({ chain }) => { | ||
return chain().setMark("textStyle", { fontFamily: null }).removeEmptyTextStyle().run(); | ||
} | ||
}; | ||
} | ||
}); | ||
// src/index.ts | ||
var src_default = FontFamily; | ||
import { FontFamily, FontFamilyOptions } from "@tiptap/extension-text-style"; | ||
var index_default = FontFamily; | ||
export { | ||
FontFamily, | ||
src_default as default | ||
FontFamilyOptions, | ||
index_default as default | ||
}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@tiptap/extension-font-family", | ||
"description": "font family extension for tiptap", | ||
"version": "3.0.0-next.3", | ||
"version": "3.0.0-next.4", | ||
"homepage": "https://tiptap.dev", | ||
@@ -18,3 +18,6 @@ "keywords": [ | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"types": { | ||
"import": "./dist/index.d.ts", | ||
"require": "./dist/index.d.cts" | ||
}, | ||
"import": "./dist/index.js", | ||
@@ -32,8 +35,6 @@ "require": "./dist/index.cjs" | ||
"devDependencies": { | ||
"@tiptap/core": "^3.0.0-next.3", | ||
"@tiptap/extension-text-style": "^3.0.0-next.3" | ||
"@tiptap/extension-text-style": "^3.0.0-next.4" | ||
}, | ||
"peerDependencies": { | ||
"@tiptap/core": "^3.0.0-next.1", | ||
"@tiptap/extension-text-style": "^3.0.0-next.1" | ||
"@tiptap/extension-text-style": "^3.0.0-next.3" | ||
}, | ||
@@ -46,4 +47,5 @@ "repository": { | ||
"scripts": { | ||
"build": "tsup" | ||
"build": "tsup", | ||
"lint": "prettier ./src/ --check && eslint --cache --quiet --no-error-on-unmatched-pattern ./src/" | ||
} | ||
} | ||
} |
# @tiptap/extension-font-family | ||
[![Version](https://img.shields.io/npm/v/@tiptap/extension-font-family.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-font-family) | ||
@@ -8,8 +9,11 @@ [![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-font-family.svg)](https://npmcharts.com/compare/tiptap?minimal=true) | ||
## Introduction | ||
Tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as *New York Times*, *The Guardian* or *Atlassian*. | ||
Tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as _New York Times_, _The Guardian_ or _Atlassian_. | ||
## Official Documentation | ||
Documentation can be found on the [Tiptap website](https://tiptap.dev). | ||
## License | ||
Tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md). |
@@ -1,5 +0,5 @@ | ||
import { FontFamily } from './font-family.js' | ||
import { FontFamily, FontFamilyOptions } from '@tiptap/extension-text-style' | ||
export * from './font-family.js' | ||
export { FontFamily, FontFamilyOptions } | ||
export default FontFamily |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1
1
19
5972
46
1