@tiptap/extension-font-family 3.0.0-next.3 → 3.0.0-next.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025, Tiptap GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,14 +1,18 @@
1
1
  # @tiptap/extension-font-family
2
+
2
3
  [![Version](https://img.shields.io/npm/v/@tiptap/extension-font-family.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-font-family)
3
4
  [![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-font-family.svg)](https://npmcharts.com/compare/tiptap?minimal=true)
4
5
  [![License](https://img.shields.io/npm/l/@tiptap/extension-font-family.svg)](https://www.npmjs.com/package/@tiptap/extension-font-family)
5
6
  [![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub)](https://github.com/sponsors/ueberdosis)
6
7
 
7
8
  ## Introduction
8
- 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*.
9
+
10
+ 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_.
9
11
 
10
12
  ## Official Documentation
13
+
11
14
  Documentation can be found on the [Tiptap website](https://tiptap.dev).
12
15
 
13
16
  ## License
17
+
14
18
  Tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
package/dist/index.cjs CHANGED
@@ -18,60 +18,18 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- FontFamily: () => FontFamily,
24
- default: () => src_default
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ FontFamily: () => import_extension_text_style.FontFamily,
24
+ FontFamilyOptions: () => import_extension_text_style.FontFamilyOptions,
25
+ default: () => index_default
25
26
  });
26
- module.exports = __toCommonJS(src_exports);
27
-
28
- // src/font-family.ts
27
+ module.exports = __toCommonJS(index_exports);
29
28
  var import_extension_text_style = require("@tiptap/extension-text-style");
30
- var import_core = require("@tiptap/core");
31
- var FontFamily = import_core.Extension.create({
32
- name: "fontFamily",
33
- addOptions() {
34
- return {
35
- types: ["textStyle"]
36
- };
37
- },
38
- addGlobalAttributes() {
39
- return [
40
- {
41
- types: this.options.types,
42
- attributes: {
43
- fontFamily: {
44
- default: null,
45
- parseHTML: (element) => element.style.fontFamily,
46
- renderHTML: (attributes) => {
47
- if (!attributes.fontFamily) {
48
- return {};
49
- }
50
- return {
51
- style: `font-family: ${attributes.fontFamily}`
52
- };
53
- }
54
- }
55
- }
56
- }
57
- ];
58
- },
59
- addCommands() {
60
- return {
61
- setFontFamily: (fontFamily) => ({ chain }) => {
62
- return chain().setMark("textStyle", { fontFamily }).run();
63
- },
64
- unsetFontFamily: () => ({ chain }) => {
65
- return chain().setMark("textStyle", { fontFamily: null }).removeEmptyTextStyle().run();
66
- }
67
- };
68
- }
69
- });
70
-
71
- // src/index.ts
72
- var src_default = FontFamily;
29
+ var index_default = import_extension_text_style.FontFamily;
73
30
  // Annotate the CommonJS export names for ESM import in node:
74
31
  0 && (module.exports = {
75
- FontFamily
32
+ FontFamily,
33
+ FontFamilyOptions
76
34
  });
77
35
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/font-family.ts"],"sourcesContent":["import { FontFamily } from './font-family.js'\n\nexport * from './font-family.js'\n\nexport default FontFamily\n","import '@tiptap/extension-text-style'\n\nimport { Extension } from '@tiptap/core'\n\nexport type FontFamilyOptions = {\n /**\n * A list of node names where the font family can be applied.\n * @default ['textStyle']\n * @example ['heading', 'paragraph']\n */\n types: string[],\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n fontFamily: {\n /**\n * Set the font family\n * @param fontFamily The font family\n * @example editor.commands.setFontFamily('Arial')\n */\n setFontFamily: (fontFamily: string) => ReturnType,\n /**\n * Unset the font family\n * @example editor.commands.unsetFontFamily()\n */\n unsetFontFamily: () => ReturnType,\n }\n }\n}\n\n/**\n * This extension allows you to set a font family for text.\n * @see https://www.tiptap.dev/api/extensions/font-family\n */\nexport const FontFamily = Extension.create<FontFamilyOptions>({\n name: 'fontFamily',\n\n addOptions() {\n return {\n types: ['textStyle'],\n }\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n fontFamily: {\n default: null,\n parseHTML: element => element.style.fontFamily,\n renderHTML: attributes => {\n if (!attributes.fontFamily) {\n return {}\n }\n\n return {\n style: `font-family: ${attributes.fontFamily}`,\n }\n },\n },\n },\n },\n ]\n },\n\n addCommands() {\n return {\n setFontFamily: fontFamily => ({ chain }) => {\n return chain()\n .setMark('textStyle', { fontFamily })\n .run()\n },\n unsetFontFamily: () => ({ chain }) => {\n return chain()\n .setMark('textStyle', { fontFamily: null })\n .removeEmptyTextStyle()\n .run()\n },\n }\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kCAAO;AAEP,kBAA0B;AAiCnB,IAAM,aAAa,sBAAU,OAA0B;AAAA,EAC5D,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,OAAO,CAAC,WAAW;AAAA,IACrB;AAAA,EACF;AAAA,EAEA,sBAAsB;AACpB,WAAO;AAAA,MACL;AAAA,QACE,OAAO,KAAK,QAAQ;AAAA,QACpB,YAAY;AAAA,UACV,YAAY;AAAA,YACV,SAAS;AAAA,YACT,WAAW,aAAW,QAAQ,MAAM;AAAA,YACpC,YAAY,gBAAc;AACxB,kBAAI,CAAC,WAAW,YAAY;AAC1B,uBAAO,CAAC;AAAA,cACV;AAEA,qBAAO;AAAA,gBACL,OAAO,gBAAgB,WAAW,UAAU;AAAA,cAC9C;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,eAAe,gBAAc,CAAC,EAAE,MAAM,MAAM;AAC1C,eAAO,MAAM,EACV,QAAQ,aAAa,EAAE,WAAW,CAAC,EACnC,IAAI;AAAA,MACT;AAAA,MACA,iBAAiB,MAAM,CAAC,EAAE,MAAM,MAAM;AACpC,eAAO,MAAM,EACV,QAAQ,aAAa,EAAE,YAAY,KAAK,CAAC,EACzC,qBAAqB,EACrB,IAAI;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;AD9ED,IAAO,cAAQ;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { FontFamily, FontFamilyOptions } from '@tiptap/extension-text-style'\n\nexport { FontFamily, FontFamilyOptions }\n\nexport default FontFamily\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAA8C;AAI9C,IAAO,gBAAQ;","names":[]}
package/dist/index.d.cts CHANGED
@@ -1,34 +1,2 @@
1
- import { Extension } from '@tiptap/core';
2
-
3
- type FontFamilyOptions = {
4
- /**
5
- * A list of node names where the font family can be applied.
6
- * @default ['textStyle']
7
- * @example ['heading', 'paragraph']
8
- */
9
- types: string[];
10
- };
11
- declare module '@tiptap/core' {
12
- interface Commands<ReturnType> {
13
- fontFamily: {
14
- /**
15
- * Set the font family
16
- * @param fontFamily The font family
17
- * @example editor.commands.setFontFamily('Arial')
18
- */
19
- setFontFamily: (fontFamily: string) => ReturnType;
20
- /**
21
- * Unset the font family
22
- * @example editor.commands.unsetFontFamily()
23
- */
24
- unsetFontFamily: () => ReturnType;
25
- };
26
- }
27
- }
28
- /**
29
- * This extension allows you to set a font family for text.
30
- * @see https://www.tiptap.dev/api/extensions/font-family
31
- */
32
- declare const FontFamily: Extension<FontFamilyOptions, any>;
33
-
34
- export { FontFamily, type FontFamilyOptions, FontFamily as default };
1
+ import { FontFamily } from '@tiptap/extension-text-style';
2
+ export { FontFamily, FontFamilyOptions, FontFamily as default } from '@tiptap/extension-text-style';
package/dist/index.d.ts CHANGED
@@ -1,34 +1,2 @@
1
- import { Extension } from '@tiptap/core';
2
-
3
- type FontFamilyOptions = {
4
- /**
5
- * A list of node names where the font family can be applied.
6
- * @default ['textStyle']
7
- * @example ['heading', 'paragraph']
8
- */
9
- types: string[];
10
- };
11
- declare module '@tiptap/core' {
12
- interface Commands<ReturnType> {
13
- fontFamily: {
14
- /**
15
- * Set the font family
16
- * @param fontFamily The font family
17
- * @example editor.commands.setFontFamily('Arial')
18
- */
19
- setFontFamily: (fontFamily: string) => ReturnType;
20
- /**
21
- * Unset the font family
22
- * @example editor.commands.unsetFontFamily()
23
- */
24
- unsetFontFamily: () => ReturnType;
25
- };
26
- }
27
- }
28
- /**
29
- * This extension allows you to set a font family for text.
30
- * @see https://www.tiptap.dev/api/extensions/font-family
31
- */
32
- declare const FontFamily: Extension<FontFamilyOptions, any>;
33
-
34
- export { FontFamily, type FontFamilyOptions, FontFamily as default };
1
+ import { FontFamily } from '@tiptap/extension-text-style';
2
+ export { FontFamily, FontFamilyOptions, FontFamily as default } from '@tiptap/extension-text-style';
package/dist/index.js CHANGED
@@ -1,50 +1,9 @@
1
- // src/font-family.ts
2
- import "@tiptap/extension-text-style";
3
- import { Extension } from "@tiptap/core";
4
- var FontFamily = Extension.create({
5
- name: "fontFamily",
6
- addOptions() {
7
- return {
8
- types: ["textStyle"]
9
- };
10
- },
11
- addGlobalAttributes() {
12
- return [
13
- {
14
- types: this.options.types,
15
- attributes: {
16
- fontFamily: {
17
- default: null,
18
- parseHTML: (element) => element.style.fontFamily,
19
- renderHTML: (attributes) => {
20
- if (!attributes.fontFamily) {
21
- return {};
22
- }
23
- return {
24
- style: `font-family: ${attributes.fontFamily}`
25
- };
26
- }
27
- }
28
- }
29
- }
30
- ];
31
- },
32
- addCommands() {
33
- return {
34
- setFontFamily: (fontFamily) => ({ chain }) => {
35
- return chain().setMark("textStyle", { fontFamily }).run();
36
- },
37
- unsetFontFamily: () => ({ chain }) => {
38
- return chain().setMark("textStyle", { fontFamily: null }).removeEmptyTextStyle().run();
39
- }
40
- };
41
- }
42
- });
43
-
44
1
  // src/index.ts
45
- var src_default = FontFamily;
2
+ import { FontFamily, FontFamilyOptions } from "@tiptap/extension-text-style";
3
+ var index_default = FontFamily;
46
4
  export {
47
5
  FontFamily,
48
- src_default as default
6
+ FontFamilyOptions,
7
+ index_default as default
49
8
  };
50
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/font-family.ts","../src/index.ts"],"sourcesContent":["import '@tiptap/extension-text-style'\n\nimport { Extension } from '@tiptap/core'\n\nexport type FontFamilyOptions = {\n /**\n * A list of node names where the font family can be applied.\n * @default ['textStyle']\n * @example ['heading', 'paragraph']\n */\n types: string[],\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n fontFamily: {\n /**\n * Set the font family\n * @param fontFamily The font family\n * @example editor.commands.setFontFamily('Arial')\n */\n setFontFamily: (fontFamily: string) => ReturnType,\n /**\n * Unset the font family\n * @example editor.commands.unsetFontFamily()\n */\n unsetFontFamily: () => ReturnType,\n }\n }\n}\n\n/**\n * This extension allows you to set a font family for text.\n * @see https://www.tiptap.dev/api/extensions/font-family\n */\nexport const FontFamily = Extension.create<FontFamilyOptions>({\n name: 'fontFamily',\n\n addOptions() {\n return {\n types: ['textStyle'],\n }\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n fontFamily: {\n default: null,\n parseHTML: element => element.style.fontFamily,\n renderHTML: attributes => {\n if (!attributes.fontFamily) {\n return {}\n }\n\n return {\n style: `font-family: ${attributes.fontFamily}`,\n }\n },\n },\n },\n },\n ]\n },\n\n addCommands() {\n return {\n setFontFamily: fontFamily => ({ chain }) => {\n return chain()\n .setMark('textStyle', { fontFamily })\n .run()\n },\n unsetFontFamily: () => ({ chain }) => {\n return chain()\n .setMark('textStyle', { fontFamily: null })\n .removeEmptyTextStyle()\n .run()\n },\n }\n },\n})\n","import { FontFamily } from './font-family.js'\n\nexport * from './font-family.js'\n\nexport default FontFamily\n"],"mappings":";AAAA,OAAO;AAEP,SAAS,iBAAiB;AAiCnB,IAAM,aAAa,UAAU,OAA0B;AAAA,EAC5D,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,OAAO,CAAC,WAAW;AAAA,IACrB;AAAA,EACF;AAAA,EAEA,sBAAsB;AACpB,WAAO;AAAA,MACL;AAAA,QACE,OAAO,KAAK,QAAQ;AAAA,QACpB,YAAY;AAAA,UACV,YAAY;AAAA,YACV,SAAS;AAAA,YACT,WAAW,aAAW,QAAQ,MAAM;AAAA,YACpC,YAAY,gBAAc;AACxB,kBAAI,CAAC,WAAW,YAAY;AAC1B,uBAAO,CAAC;AAAA,cACV;AAEA,qBAAO;AAAA,gBACL,OAAO,gBAAgB,WAAW,UAAU;AAAA,cAC9C;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,eAAe,gBAAc,CAAC,EAAE,MAAM,MAAM;AAC1C,eAAO,MAAM,EACV,QAAQ,aAAa,EAAE,WAAW,CAAC,EACnC,IAAI;AAAA,MACT;AAAA,MACA,iBAAiB,MAAM,CAAC,EAAE,MAAM,MAAM;AACpC,eAAO,MAAM,EACV,QAAQ,aAAa,EAAE,YAAY,KAAK,CAAC,EACzC,qBAAqB,EACrB,IAAI;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;AC9ED,IAAO,cAAQ;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { FontFamily, FontFamilyOptions } from '@tiptap/extension-text-style'\n\nexport { FontFamily, FontFamilyOptions }\n\nexport default FontFamily\n"],"mappings":";AAAA,SAAS,YAAY,yBAAyB;AAI9C,IAAO,gBAAQ;","names":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/extension-font-family",
3
3
  "description": "font family extension for tiptap",
4
- "version": "3.0.0-next.3",
4
+ "version": "3.0.0-next.5",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -15,7 +15,10 @@
15
15
  "type": "module",
16
16
  "exports": {
17
17
  ".": {
18
- "types": "./dist/index.d.ts",
18
+ "types": {
19
+ "import": "./dist/index.d.ts",
20
+ "require": "./dist/index.d.cts"
21
+ },
19
22
  "import": "./dist/index.js",
20
23
  "require": "./dist/index.cjs"
21
24
  }
@@ -28,12 +31,10 @@
28
31
  "dist"
29
32
  ],
30
33
  "devDependencies": {
31
- "@tiptap/core": "^3.0.0-next.3",
32
- "@tiptap/extension-text-style": "^3.0.0-next.3"
34
+ "@tiptap/extension-text-style": "^3.0.0-next.5"
33
35
  },
34
36
  "peerDependencies": {
35
- "@tiptap/core": "^3.0.0-next.1",
36
- "@tiptap/extension-text-style": "^3.0.0-next.1"
37
+ "@tiptap/extension-text-style": "^3.0.0-next.3"
37
38
  },
38
39
  "repository": {
39
40
  "type": "git",
@@ -41,6 +42,7 @@
41
42
  "directory": "packages/extension-font-family"
42
43
  },
43
44
  "scripts": {
44
- "build": "tsup"
45
+ "build": "tsup",
46
+ "lint": "prettier ./src/ --check && eslint --cache --quiet --no-error-on-unmatched-pattern ./src/"
45
47
  }
46
- }
48
+ }
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { FontFamily } from './font-family.js'
1
+ import { FontFamily, FontFamilyOptions } from '@tiptap/extension-text-style'
2
2
 
3
- export * from './font-family.js'
3
+ export { FontFamily, FontFamilyOptions }
4
4
 
5
5
  export default FontFamily
@@ -1,83 +0,0 @@
1
- import '@tiptap/extension-text-style'
2
-
3
- import { Extension } from '@tiptap/core'
4
-
5
- export type FontFamilyOptions = {
6
- /**
7
- * A list of node names where the font family can be applied.
8
- * @default ['textStyle']
9
- * @example ['heading', 'paragraph']
10
- */
11
- types: string[],
12
- }
13
-
14
- declare module '@tiptap/core' {
15
- interface Commands<ReturnType> {
16
- fontFamily: {
17
- /**
18
- * Set the font family
19
- * @param fontFamily The font family
20
- * @example editor.commands.setFontFamily('Arial')
21
- */
22
- setFontFamily: (fontFamily: string) => ReturnType,
23
- /**
24
- * Unset the font family
25
- * @example editor.commands.unsetFontFamily()
26
- */
27
- unsetFontFamily: () => ReturnType,
28
- }
29
- }
30
- }
31
-
32
- /**
33
- * This extension allows you to set a font family for text.
34
- * @see https://www.tiptap.dev/api/extensions/font-family
35
- */
36
- export const FontFamily = Extension.create<FontFamilyOptions>({
37
- name: 'fontFamily',
38
-
39
- addOptions() {
40
- return {
41
- types: ['textStyle'],
42
- }
43
- },
44
-
45
- addGlobalAttributes() {
46
- return [
47
- {
48
- types: this.options.types,
49
- attributes: {
50
- fontFamily: {
51
- default: null,
52
- parseHTML: element => element.style.fontFamily,
53
- renderHTML: attributes => {
54
- if (!attributes.fontFamily) {
55
- return {}
56
- }
57
-
58
- return {
59
- style: `font-family: ${attributes.fontFamily}`,
60
- }
61
- },
62
- },
63
- },
64
- },
65
- ]
66
- },
67
-
68
- addCommands() {
69
- return {
70
- setFontFamily: fontFamily => ({ chain }) => {
71
- return chain()
72
- .setMark('textStyle', { fontFamily })
73
- .run()
74
- },
75
- unsetFontFamily: () => ({ chain }) => {
76
- return chain()
77
- .setMark('textStyle', { fontFamily: null })
78
- .removeEmptyTextStyle()
79
- .run()
80
- },
81
- }
82
- },
83
- })