@tiptap/extension-font-family 2.0.0-beta.21 → 2.0.0-beta.24
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/packages/extension-font-family/src/font-family.d.ts +1 -1
- package/dist/tiptap-extension-font-family.cjs.js +2 -2
- package/dist/tiptap-extension-font-family.cjs.js.map +1 -1
- package/dist/tiptap-extension-font-family.esm.js +2 -2
- package/dist/tiptap-extension-font-family.esm.js.map +1 -1
- package/dist/tiptap-extension-font-family.umd.js +5 -5
- package/dist/tiptap-extension-font-family.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/font-family.ts +3 -2
|
@@ -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'\
|
|
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'\
|
|
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/
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@tiptap/
|
|
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'\
|
|
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.
|
|
4
|
+
"version": "2.0.0-beta.24",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"url": "https://github.com/ueberdosis/tiptap",
|
|
30
30
|
"directory": "packages/extension-font-family"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "591c0807a2ab5c34b4b7fe12c12511fe4f493ebd"
|
|
33
33
|
}
|
package/src/font-family.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core'
|
|
2
1
|
import '@tiptap/extension-text-style'
|
|
3
2
|
|
|
3
|
+
import { Extension } from '@tiptap/core'
|
|
4
|
+
|
|
4
5
|
export type FontFamilyOptions = {
|
|
5
6
|
types: string[],
|
|
6
7
|
}
|
|
@@ -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
|
|
40
|
+
parseHTML: element => element.style.fontFamily?.replace(/['"]+/g, ''),
|
|
40
41
|
renderHTML: attributes => {
|
|
41
42
|
if (!attributes.fontFamily) {
|
|
42
43
|
return {}
|