@tiptap/extension-font-family 3.0.0-next.1 → 3.0.0-next.3
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/dist/index.cjs +1 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/font-family.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -42,10 +42,7 @@ var FontFamily = import_core.Extension.create({
|
|
|
42
42
|
attributes: {
|
|
43
43
|
fontFamily: {
|
|
44
44
|
default: null,
|
|
45
|
-
parseHTML: (element) =>
|
|
46
|
-
var _a;
|
|
47
|
-
return (_a = element.style.fontFamily) == null ? void 0 : _a.replace(/['"]+/g, "");
|
|
48
|
-
},
|
|
45
|
+
parseHTML: (element) => element.style.fontFamily,
|
|
49
46
|
renderHTML: (attributes) => {
|
|
50
47
|
if (!attributes.fontFamily) {
|
|
51
48
|
return {};
|
package/dist/index.cjs.map
CHANGED
|
@@ -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
|
|
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":[]}
|
package/dist/index.js
CHANGED
|
@@ -15,10 +15,7 @@ var FontFamily = Extension.create({
|
|
|
15
15
|
attributes: {
|
|
16
16
|
fontFamily: {
|
|
17
17
|
default: null,
|
|
18
|
-
parseHTML: (element) =>
|
|
19
|
-
var _a;
|
|
20
|
-
return (_a = element.style.fontFamily) == null ? void 0 : _a.replace(/['"]+/g, "");
|
|
21
|
-
},
|
|
18
|
+
parseHTML: (element) => element.style.fontFamily,
|
|
22
19
|
renderHTML: (attributes) => {
|
|
23
20
|
if (!attributes.fontFamily) {
|
|
24
21
|
return {};
|
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
|
|
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":[]}
|
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.
|
|
4
|
+
"version": "3.0.0-next.3",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@tiptap/core": "^3.0.0-next.
|
|
32
|
-
"@tiptap/extension-text-style": "^3.0.0-next.
|
|
31
|
+
"@tiptap/core": "^3.0.0-next.3",
|
|
32
|
+
"@tiptap/extension-text-style": "^3.0.0-next.3"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@tiptap/core": "^3.0.0-next.1",
|
package/src/font-family.ts
CHANGED
|
@@ -49,7 +49,7 @@ export const FontFamily = Extension.create<FontFamilyOptions>({
|
|
|
49
49
|
attributes: {
|
|
50
50
|
fontFamily: {
|
|
51
51
|
default: null,
|
|
52
|
-
parseHTML: element => element.style.fontFamily
|
|
52
|
+
parseHTML: element => element.style.fontFamily,
|
|
53
53
|
renderHTML: attributes => {
|
|
54
54
|
if (!attributes.fontFamily) {
|
|
55
55
|
return {}
|