@tiptap/extension-font-family 2.0.0-beta.20 → 2.0.0-beta.200

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.
@@ -1,6 +1,6 @@
1
- import { Extension } from '@tiptap/core';
2
1
  import '@tiptap/extension-text-style';
3
- declare type FontFamilyOptions = {
2
+ import { Extension } from '@tiptap/core';
3
+ export declare type FontFamilyOptions = {
4
4
  types: string[];
5
5
  };
6
6
  declare module '@tiptap/core' {
@@ -18,4 +18,3 @@ declare module '@tiptap/core' {
18
18
  }
19
19
  }
20
20
  export declare const FontFamily: Extension<FontFamilyOptions, any>;
21
- export {};
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var core = require('@tiptap/core');
6
5
  require('@tiptap/extension-text-style');
6
+ var core = require('@tiptap/core');
7
7
 
8
8
  const FontFamily = core.Extension.create({
9
9
  name: 'fontFamily',
@@ -19,7 +19,7 @@ const FontFamily = core.Extension.create({
19
19
  attributes: {
20
20
  fontFamily: {
21
21
  default: null,
22
- parseHTML: element => element.style.fontFamily.replace(/['"]+/g, ''),
22
+ parseHTML: element => { var _a; return (_a = element.style.fontFamily) === null || _a === void 0 ? void 0 : _a.replace(/['"]+/g, ''); },
23
23
  renderHTML: attributes => {
24
24
  if (!attributes.fontFamily) {
25
25
  return {};
@@ -1 +1 @@
1
- {"version":3,"file":"tiptap-extension-font-family.cjs.js","sources":["../src/font-family.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport '@tiptap/extension-text-style'\n\ntype 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":";;;;;;;MAsBa,UAAU,GAAGA,cAAS,CAAC,MAAM,CAAoB;IAC5D,IAAI,EAAE,YAAY;IAElB,UAAU;QACR,OAAO;YACL,KAAK,EAAE,CAAC,WAAW,CAAC;SACrB,CAAA;KACF;IAED,mBAAmB;QACjB,OAAO;YACL;gBACE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;gBACzB,UAAU,EAAE;oBACV,UAAU,EAAE;wBACV,OAAO,EAAE,IAAI;wBACb,SAAS,EAAE,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;wBACpE,UAAU,EAAE,UAAU;4BACpB,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE;gCAC1B,OAAO,EAAE,CAAA;6BACV;4BAED,OAAO;gCACL,KAAK,EAAE,gBAAgB,UAAU,CAAC,UAAU,EAAE;6BAC/C,CAAA;yBACF;qBACF;iBACF;aACF;SACF,CAAA;KACF;IAED,WAAW;QACT,OAAO;YACL,aAAa,EAAE,UAAU,IAAI,CAAC,EAAE,KAAK,EAAE;gBACrC,OAAO,KAAK,EAAE;qBACX,OAAO,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,CAAC;qBACpC,GAAG,EAAE,CAAA;aACT;YACD,eAAe,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE;gBAC/B,OAAO,KAAK,EAAE;qBACX,OAAO,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;qBAC1C,oBAAoB,EAAE;qBACtB,GAAG,EAAE,CAAA;aACT;SACF,CAAA;KACF;CACF;;;;;"}
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;;;;;"}
@@ -1,5 +1,5 @@
1
- import { Extension } from '@tiptap/core';
2
1
  import '@tiptap/extension-text-style';
2
+ import { Extension } from '@tiptap/core';
3
3
 
4
4
  const FontFamily = Extension.create({
5
5
  name: 'fontFamily',
@@ -15,7 +15,7 @@ const FontFamily = Extension.create({
15
15
  attributes: {
16
16
  fontFamily: {
17
17
  default: null,
18
- parseHTML: element => element.style.fontFamily.replace(/['"]+/g, ''),
18
+ parseHTML: element => { var _a; return (_a = element.style.fontFamily) === null || _a === void 0 ? void 0 : _a.replace(/['"]+/g, ''); },
19
19
  renderHTML: attributes => {
20
20
  if (!attributes.fontFamily) {
21
21
  return {};
@@ -1 +1 @@
1
- {"version":3,"file":"tiptap-extension-font-family.esm.js","sources":["../src/font-family.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport '@tiptap/extension-text-style'\n\ntype 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":[],"mappings":";;;MAsBa,UAAU,GAAG,SAAS,CAAC,MAAM,CAAoB;IAC5D,IAAI,EAAE,YAAY;IAElB,UAAU;QACR,OAAO;YACL,KAAK,EAAE,CAAC,WAAW,CAAC;SACrB,CAAA;KACF;IAED,mBAAmB;QACjB,OAAO;YACL;gBACE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;gBACzB,UAAU,EAAE;oBACV,UAAU,EAAE;wBACV,OAAO,EAAE,IAAI;wBACb,SAAS,EAAE,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;wBACpE,UAAU,EAAE,UAAU;4BACpB,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE;gCAC1B,OAAO,EAAE,CAAA;6BACV;4BAED,OAAO;gCACL,KAAK,EAAE,gBAAgB,UAAU,CAAC,UAAU,EAAE;6BAC/C,CAAA;yBACF;qBACF;iBACF;aACF;SACF,CAAA;KACF;IAED,WAAW;QACT,OAAO;YACL,aAAa,EAAE,UAAU,IAAI,CAAC,EAAE,KAAK,EAAE;gBACrC,OAAO,KAAK,EAAE;qBACX,OAAO,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,CAAC;qBACpC,GAAG,EAAE,CAAA;aACT;YACD,eAAe,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE;gBAC/B,OAAO,KAAK,EAAE;qBACX,OAAO,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;qBAC1C,oBAAoB,EAAE;qBACtB,GAAG,EAAE,CAAA;aACT;SACF,CAAA;KACF;CACF;;;;"}
1
+ {"version":3,"file":"tiptap-extension-font-family.esm.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":[],"mappings":";;;AAuBa,MAAA,UAAU,GAAG,SAAS,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;;;;"}
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/core'), require('@tiptap/extension-text-style')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@tiptap/core', '@tiptap/extension-text-style'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-font-family"] = {}, global.core));
5
- })(this, (function (exports, core) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/extension-text-style'), require('@tiptap/core')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@tiptap/extension-text-style', '@tiptap/core'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-font-family"] = {}, null, global.core));
5
+ })(this, (function (exports, extensionTextStyle, core) { 'use strict';
6
6
 
7
7
  const FontFamily = core.Extension.create({
8
8
  name: 'fontFamily',
@@ -18,7 +18,7 @@
18
18
  attributes: {
19
19
  fontFamily: {
20
20
  default: null,
21
- parseHTML: element => element.style.fontFamily.replace(/['"]+/g, ''),
21
+ parseHTML: element => { var _a; return (_a = element.style.fontFamily) === null || _a === void 0 ? void 0 : _a.replace(/['"]+/g, ''); },
22
22
  renderHTML: attributes => {
23
23
  if (!attributes.fontFamily) {
24
24
  return {};
@@ -1 +1 @@
1
- {"version":3,"file":"tiptap-extension-font-family.umd.js","sources":["../src/font-family.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport '@tiptap/extension-text-style'\n\ntype 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":";;;;;;QAsBa,UAAU,GAAGA,cAAS,CAAC,MAAM,CAAoB;MAC5D,IAAI,EAAE,YAAY;MAElB,UAAU;UACR,OAAO;cACL,KAAK,EAAE,CAAC,WAAW,CAAC;WACrB,CAAA;OACF;MAED,mBAAmB;UACjB,OAAO;cACL;kBACE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;kBACzB,UAAU,EAAE;sBACV,UAAU,EAAE;0BACV,OAAO,EAAE,IAAI;0BACb,SAAS,EAAE,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;0BACpE,UAAU,EAAE,UAAU;8BACpB,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE;kCAC1B,OAAO,EAAE,CAAA;+BACV;8BAED,OAAO;kCACL,KAAK,EAAE,gBAAgB,UAAU,CAAC,UAAU,EAAE;+BAC/C,CAAA;2BACF;uBACF;mBACF;eACF;WACF,CAAA;OACF;MAED,WAAW;UACT,OAAO;cACL,aAAa,EAAE,UAAU,IAAI,CAAC,EAAE,KAAK,EAAE;kBACrC,OAAO,KAAK,EAAE;uBACX,OAAO,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,CAAC;uBACpC,GAAG,EAAE,CAAA;eACT;cACD,eAAe,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE;kBAC/B,OAAO,KAAK,EAAE;uBACX,OAAO,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;uBAC1C,oBAAoB,EAAE;uBACtB,GAAG,EAAE,CAAA;eACT;WACF,CAAA;OACF;GACF;;;;;;;;;;;"}
1
+ {"version":3,"file":"tiptap-extension-font-family.umd.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,QAAA,UAAU,GAAGA,cAAS,CAAC,MAAM,CAAoB;EAC5D,IAAA,IAAI,EAAE,YAAY;MAElB,UAAU,GAAA;UACR,OAAO;cACL,KAAK,EAAE,CAAC,WAAW,CAAC;WACrB,CAAA;OACF;MAED,mBAAmB,GAAA;UACjB,OAAO;EACL,YAAA;EACE,gBAAA,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;EACzB,gBAAA,UAAU,EAAE;EACV,oBAAA,UAAU,EAAE;EACV,wBAAA,OAAO,EAAE,IAAI;0BACb,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;0BACrE,UAAU,EAAE,UAAU,IAAG;EACvB,4BAAA,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE;EAC1B,gCAAA,OAAO,EAAE,CAAA;EACV,6BAAA;8BAED,OAAO;EACL,gCAAA,KAAK,EAAE,CAAA,aAAA,EAAgB,UAAU,CAAC,UAAU,CAAE,CAAA;+BAC/C,CAAA;2BACF;EACF,qBAAA;EACF,iBAAA;EACF,aAAA;WACF,CAAA;OACF;MAED,WAAW,GAAA;UACT,OAAO;cACL,aAAa,EAAE,UAAU,IAAI,CAAC,EAAE,KAAK,EAAE,KAAI;EACzC,gBAAA,OAAO,KAAK,EAAE;EACX,qBAAA,OAAO,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,CAAC;EACpC,qBAAA,GAAG,EAAE,CAAA;eACT;cACD,eAAe,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,KAAI;EACnC,gBAAA,OAAO,KAAK,EAAE;uBACX,OAAO,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;EAC1C,qBAAA,oBAAoB,EAAE;EACtB,qBAAA,GAAG,EAAE,CAAA;eACT;WACF,CAAA;OACF;EACF,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.20",
4
+ "version": "2.0.0-beta.200",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -21,13 +21,12 @@
21
21
  "dist"
22
22
  ],
23
23
  "peerDependencies": {
24
- "@tiptap/core": "^2.0.0-beta.1",
25
- "@tiptap/extension-text-style": "^2.0.0-beta.1"
24
+ "@tiptap/core": "^2.0.0-beta.193",
25
+ "@tiptap/extension-text-style": "^2.0.0-beta.193"
26
26
  },
27
27
  "repository": {
28
28
  "type": "git",
29
29
  "url": "https://github.com/ueberdosis/tiptap",
30
30
  "directory": "packages/extension-font-family"
31
- },
32
- "gitHead": "621cfa2f7e98a48525fa22f9d97a92fc08368966"
31
+ }
33
32
  }
@@ -1,7 +1,8 @@
1
- import { Extension } from '@tiptap/core'
2
1
  import '@tiptap/extension-text-style'
3
2
 
4
- type FontFamilyOptions = {
3
+ import { Extension } from '@tiptap/core'
4
+
5
+ export type FontFamilyOptions = {
5
6
  types: string[],
6
7
  }
7
8
 
@@ -36,7 +37,7 @@ export const FontFamily = Extension.create<FontFamilyOptions>({
36
37
  attributes: {
37
38
  fontFamily: {
38
39
  default: null,
39
- parseHTML: element => element.style.fontFamily.replace(/['"]+/g, ''),
40
+ parseHTML: element => element.style.fontFamily?.replace(/['"]+/g, ''),
40
41
  renderHTML: attributes => {
41
42
  if (!attributes.fontFamily) {
42
43
  return {}
package/LICENSE.md DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021, überdosis GbR
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.