Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tiptap/extension-font-family

Package Overview
Dependencies
Maintainers
5
Versions
164
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tiptap/extension-font-family - npm Package Compare versions

Comparing version 3.0.0-next.0 to 3.0.0-next.1

dist/index.d.cts

101

dist/index.js

@@ -1,54 +0,53 @@

import '@tiptap/extension-text-style';
import { Extension } from '@tiptap/core';
/**
* This extension allows you to set a font family for text.
* @see https://www.tiptap.dev/api/extensions/font-family
*/
const FontFamily = Extension.create({
name: 'fontFamily',
addOptions() {
return {
types: ['textStyle'],
};
},
addGlobalAttributes() {
return [
{
types: this.options.types,
attributes: {
fontFamily: {
default: null,
parseHTML: element => { var _a; return (_a = element.style.fontFamily) === null || _a === void 0 ? void 0 : _a.replace(/['"]+/g, ''); },
renderHTML: attributes => {
if (!attributes.fontFamily) {
return {};
}
return {
style: `font-family: ${attributes.fontFamily}`,
};
},
},
},
// 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) => {
var _a;
return (_a = element.style.fontFamily) == null ? void 0 : _a.replace(/['"]+/g, "");
},
];
},
addCommands() {
return {
setFontFamily: fontFamily => ({ chain }) => {
return chain()
.setMark('textStyle', { fontFamily })
.run();
},
unsetFontFamily: () => ({ chain }) => {
return chain()
.setMark('textStyle', { fontFamily: null })
.removeEmptyTextStyle()
.run();
},
};
},
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();
}
};
}
});
export { FontFamily, FontFamily as default };
//# sourceMappingURL=index.js.map
// src/index.ts
var src_default = FontFamily;
export {
FontFamily,
src_default as default
};
//# sourceMappingURL=index.js.map
{
"name": "@tiptap/extension-font-family",
"description": "font family extension for tiptap",
"version": "3.0.0-next.0",
"version": "3.0.0-next.1",
"homepage": "https://tiptap.dev",

@@ -18,3 +18,3 @@ "keywords": [

".": {
"types": "./dist/packages/extension-font-family/src/index.d.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.js",

@@ -26,4 +26,3 @@ "require": "./dist/index.cjs"

"module": "dist/index.js",
"umd": "dist/index.umd.js",
"types": "dist/packages/extension-font-family/src/index.d.ts",
"types": "dist/index.d.ts",
"files": [

@@ -34,8 +33,8 @@ "src",

"devDependencies": {
"@tiptap/core": "^3.0.0-next.0",
"@tiptap/extension-text-style": "^3.0.0-next.0"
"@tiptap/core": "^3.0.0-next.1",
"@tiptap/extension-text-style": "^3.0.0-next.1"
},
"peerDependencies": {
"@tiptap/core": "^3.0.0-next.0",
"@tiptap/extension-text-style": "^3.0.0-next.0"
"@tiptap/core": "^3.0.0-next.1",
"@tiptap/extension-text-style": "^3.0.0-next.1"
},

@@ -48,5 +47,4 @@ "repository": {

"scripts": {
"clean": "rm -rf dist",
"build": "npm run clean && rollup -c"
"build": "tsup"
}
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc