@tiptap/extension-font-family 2.0.0-beta.202 → 2.0.0-beta.204
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tiptap-extension-font-family.cjs","sources":["../src/font-family.ts"],"sourcesContent":["import '@tiptap/extension-text-style'\n\nimport { Extension } from '@tiptap/core'\n\nexport type FontFamilyOptions = {\n types: string[],\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n fontFamily: {\n /**\n * Set the font family\n */\n setFontFamily: (fontFamily: string) => ReturnType,\n /**\n * Unset the font family\n */\n unsetFontFamily: () => ReturnType,\n }\n }\n}\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?.replace(/['\"]+/g, ''),\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"],"names":["Extension"],"mappings":";;;;;;;AAuBa,MAAA,UAAU,GAAGA,cAAS,CAAC,MAAM,CAAoB;AAC5D,IAAA,IAAI,EAAE,YAAY;IAElB,UAAU,GAAA;QACR,OAAO;YACL,KAAK,EAAE,CAAC,WAAW,CAAC;SACrB,CAAA;KACF;IAED,mBAAmB,GAAA;QACjB,OAAO;AACL,YAAA;AACE,gBAAA,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;AACzB,gBAAA,UAAU,EAAE;AACV,oBAAA,UAAU,EAAE;AACV,wBAAA,OAAO,EAAE,IAAI;wBACb,SAAS,EAAE,OAAO,cAAI,OAAA,CAAA,EAAA,GAAA,OAAO,CAAC,KAAK,CAAC,UAAU,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA,EAAA;wBACrE,UAAU,EAAE,UAAU,IAAG;AACvB,4BAAA,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE;AAC1B,gCAAA,OAAO,EAAE,CAAA;AACV,6BAAA;4BAED,OAAO;AACL,gCAAA,KAAK,EAAE,CAAA,aAAA,EAAgB,UAAU,CAAC,UAAU,CAAE,CAAA;6BAC/C,CAAA;yBACF;AACF,qBAAA;AACF,iBAAA;AACF,aAAA;SACF,CAAA;KACF;IAED,WAAW,GAAA;QACT,OAAO;YACL,aAAa,EAAE,UAAU,IAAI,CAAC,EAAE,KAAK,EAAE,KAAI;AACzC,gBAAA,OAAO,KAAK,EAAE;AACX,qBAAA,OAAO,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,CAAC;AACpC,qBAAA,GAAG,EAAE,CAAA;aACT;YACD,eAAe,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,KAAI;AACnC,gBAAA,OAAO,KAAK,EAAE;qBACX,OAAO,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;AAC1C,qBAAA,oBAAoB,EAAE;AACtB,qBAAA,GAAG,EAAE,CAAA;aACT;SACF,CAAA;KACF;AACF,CAAA;;;;;"}
|
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": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.204",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -12,7 +12,15 @@
|
|
|
12
12
|
"type": "github",
|
|
13
13
|
"url": "https://github.com/sponsors/ueberdosis"
|
|
14
14
|
},
|
|
15
|
-
"
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/packages/extension-font-family/src/index.d.ts",
|
|
19
|
+
"import": "./dist/tiptap-extension-font-family.esm.js",
|
|
20
|
+
"require": "./dist/tiptap-extension-font-family.cjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"main": "dist/tiptap-extension-font-family.cjs",
|
|
16
24
|
"umd": "dist/tiptap-extension-font-family.umd.js",
|
|
17
25
|
"module": "dist/tiptap-extension-font-family.esm.js",
|
|
18
26
|
"types": "dist/packages/extension-font-family/src/index.d.ts",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extension-font-family.cjs.js","sources":["../src/font-family.ts"],"sourcesContent":["import '@tiptap/extension-text-style'\n\nimport { Extension } from '@tiptap/core'\n\nexport type FontFamilyOptions = {\n types: string[],\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n fontFamily: {\n /**\n * Set the font family\n */\n setFontFamily: (fontFamily: string) => ReturnType,\n /**\n * Unset the font family\n */\n unsetFontFamily: () => ReturnType,\n }\n }\n}\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?.replace(/['\"]+/g, ''),\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"],"names":["Extension"],"mappings":";;;;;;;AAuBa,MAAA,UAAU,GAAGA,cAAS,CAAC,MAAM,CAAoB;AAC5D,IAAA,IAAI,EAAE,YAAY;IAElB,UAAU,GAAA;QACR,OAAO;YACL,KAAK,EAAE,CAAC,WAAW,CAAC;SACrB,CAAA;KACF;IAED,mBAAmB,GAAA;QACjB,OAAO;AACL,YAAA;AACE,gBAAA,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;AACzB,gBAAA,UAAU,EAAE;AACV,oBAAA,UAAU,EAAE;AACV,wBAAA,OAAO,EAAE,IAAI;wBACb,SAAS,EAAE,OAAO,cAAI,OAAA,CAAA,EAAA,GAAA,OAAO,CAAC,KAAK,CAAC,UAAU,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA,EAAA;wBACrE,UAAU,EAAE,UAAU,IAAG;AACvB,4BAAA,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE;AAC1B,gCAAA,OAAO,EAAE,CAAA;AACV,6BAAA;4BAED,OAAO;AACL,gCAAA,KAAK,EAAE,CAAA,aAAA,EAAgB,UAAU,CAAC,UAAU,CAAE,CAAA;6BAC/C,CAAA;yBACF;AACF,qBAAA;AACF,iBAAA;AACF,aAAA;SACF,CAAA;KACF;IAED,WAAW,GAAA;QACT,OAAO;YACL,aAAa,EAAE,UAAU,IAAI,CAAC,EAAE,KAAK,EAAE,KAAI;AACzC,gBAAA,OAAO,KAAK,EAAE;AACX,qBAAA,OAAO,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,CAAC;AACpC,qBAAA,GAAG,EAAE,CAAA;aACT;YACD,eAAe,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,KAAI;AACnC,gBAAA,OAAO,KAAK,EAAE;qBACX,OAAO,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;AAC1C,qBAAA,oBAAoB,EAAE;AACtB,qBAAA,GAAG,EAAE,CAAA;aACT;SACF,CAAA;KACF;AACF,CAAA;;;;;"}
|