@tiptap/extension-color 2.0.0-beta.5 → 2.0.0-beta.9

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
1
  import { Extension } from '@tiptap/core';
2
2
  import '@tiptap/extension-text-style';
3
- declare type ColorOptions = {
3
+ export declare type ColorOptions = {
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 Color: Extension<ColorOptions, any>;
21
- export {};
@@ -1 +1 @@
1
- {"version":3,"file":"tiptap-extension-color.cjs.js","sources":["../src/color.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport '@tiptap/extension-text-style'\n\ntype ColorOptions = {\n types: string[],\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n color: {\n /**\n * Set the text color\n */\n setColor: (color: string) => ReturnType,\n /**\n * Unset the text color\n */\n unsetColor: () => ReturnType,\n }\n }\n}\n\nexport const Color = Extension.create<ColorOptions>({\n name: 'color',\n\n addOptions() {\n return {\n types: ['textStyle'],\n }\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n color: {\n default: null,\n parseHTML: element => element.style.color.replace(/['\"]+/g, ''),\n renderHTML: attributes => {\n if (!attributes.color) {\n return {}\n }\n\n return {\n style: `color: ${attributes.color}`,\n }\n },\n },\n },\n },\n ]\n },\n\n addCommands() {\n return {\n setColor: color => ({ chain }) => {\n return chain()\n .setMark('textStyle', { color })\n .run()\n },\n unsetColor: () => ({ chain }) => {\n return chain()\n .setMark('textStyle', { color: null })\n .removeEmptyTextStyle()\n .run()\n },\n }\n },\n})\n"],"names":["Extension"],"mappings":";;;;;;;MAsBa,KAAK,GAAGA,cAAS,CAAC,MAAM,CAAe;IAClD,IAAI,EAAE,OAAO;IAEb,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,KAAK,EAAE;wBACL,OAAO,EAAE,IAAI;wBACb,SAAS,EAAE,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;wBAC/D,UAAU,EAAE,UAAU;4BACpB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;gCACrB,OAAO,EAAE,CAAA;6BACV;4BAED,OAAO;gCACL,KAAK,EAAE,UAAU,UAAU,CAAC,KAAK,EAAE;6BACpC,CAAA;yBACF;qBACF;iBACF;aACF;SACF,CAAA;KACF;IAED,WAAW;QACT,OAAO;YACL,QAAQ,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,EAAE;gBAC3B,OAAO,KAAK,EAAE;qBACX,OAAO,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,CAAC;qBAC/B,GAAG,EAAE,CAAA;aACT;YACD,UAAU,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE;gBAC1B,OAAO,KAAK,EAAE;qBACX,OAAO,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;qBACrC,oBAAoB,EAAE;qBACtB,GAAG,EAAE,CAAA;aACT;SACF,CAAA;KACF;CACF;;;;;"}
1
+ {"version":3,"file":"tiptap-extension-color.cjs.js","sources":["../src/color.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport '@tiptap/extension-text-style'\n\nexport type ColorOptions = {\n types: string[],\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n color: {\n /**\n * Set the text color\n */\n setColor: (color: string) => ReturnType,\n /**\n * Unset the text color\n */\n unsetColor: () => ReturnType,\n }\n }\n}\n\nexport const Color = Extension.create<ColorOptions>({\n name: 'color',\n\n addOptions() {\n return {\n types: ['textStyle'],\n }\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n color: {\n default: null,\n parseHTML: element => element.style.color.replace(/['\"]+/g, ''),\n renderHTML: attributes => {\n if (!attributes.color) {\n return {}\n }\n\n return {\n style: `color: ${attributes.color}`,\n }\n },\n },\n },\n },\n ]\n },\n\n addCommands() {\n return {\n setColor: color => ({ chain }) => {\n return chain()\n .setMark('textStyle', { color })\n .run()\n },\n unsetColor: () => ({ chain }) => {\n return chain()\n .setMark('textStyle', { color: null })\n .removeEmptyTextStyle()\n .run()\n },\n }\n },\n})\n"],"names":["Extension"],"mappings":";;;;;;;MAsBa,KAAK,GAAGA,cAAS,CAAC,MAAM,CAAe;IAClD,IAAI,EAAE,OAAO;IAEb,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,KAAK,EAAE;wBACL,OAAO,EAAE,IAAI;wBACb,SAAS,EAAE,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;wBAC/D,UAAU,EAAE,UAAU;4BACpB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;gCACrB,OAAO,EAAE,CAAA;6BACV;4BAED,OAAO;gCACL,KAAK,EAAE,UAAU,UAAU,CAAC,KAAK,EAAE;6BACpC,CAAA;yBACF;qBACF;iBACF;aACF;SACF,CAAA;KACF;IAED,WAAW;QACT,OAAO;YACL,QAAQ,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,EAAE;gBAC3B,OAAO,KAAK,EAAE;qBACX,OAAO,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,CAAC;qBAC/B,GAAG,EAAE,CAAA;aACT;YACD,UAAU,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE;gBAC1B,OAAO,KAAK,EAAE;qBACX,OAAO,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;qBACrC,oBAAoB,EAAE;qBACtB,GAAG,EAAE,CAAA;aACT;SACF,CAAA;KACF;CACF;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"tiptap-extension-color.esm.js","sources":["../src/color.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport '@tiptap/extension-text-style'\n\ntype ColorOptions = {\n types: string[],\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n color: {\n /**\n * Set the text color\n */\n setColor: (color: string) => ReturnType,\n /**\n * Unset the text color\n */\n unsetColor: () => ReturnType,\n }\n }\n}\n\nexport const Color = Extension.create<ColorOptions>({\n name: 'color',\n\n addOptions() {\n return {\n types: ['textStyle'],\n }\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n color: {\n default: null,\n parseHTML: element => element.style.color.replace(/['\"]+/g, ''),\n renderHTML: attributes => {\n if (!attributes.color) {\n return {}\n }\n\n return {\n style: `color: ${attributes.color}`,\n }\n },\n },\n },\n },\n ]\n },\n\n addCommands() {\n return {\n setColor: color => ({ chain }) => {\n return chain()\n .setMark('textStyle', { color })\n .run()\n },\n unsetColor: () => ({ chain }) => {\n return chain()\n .setMark('textStyle', { color: null })\n .removeEmptyTextStyle()\n .run()\n },\n }\n },\n})\n"],"names":[],"mappings":";;;MAsBa,KAAK,GAAG,SAAS,CAAC,MAAM,CAAe;IAClD,IAAI,EAAE,OAAO;IAEb,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,KAAK,EAAE;wBACL,OAAO,EAAE,IAAI;wBACb,SAAS,EAAE,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;wBAC/D,UAAU,EAAE,UAAU;4BACpB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;gCACrB,OAAO,EAAE,CAAA;6BACV;4BAED,OAAO;gCACL,KAAK,EAAE,UAAU,UAAU,CAAC,KAAK,EAAE;6BACpC,CAAA;yBACF;qBACF;iBACF;aACF;SACF,CAAA;KACF;IAED,WAAW;QACT,OAAO;YACL,QAAQ,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,EAAE;gBAC3B,OAAO,KAAK,EAAE;qBACX,OAAO,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,CAAC;qBAC/B,GAAG,EAAE,CAAA;aACT;YACD,UAAU,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE;gBAC1B,OAAO,KAAK,EAAE;qBACX,OAAO,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;qBACrC,oBAAoB,EAAE;qBACtB,GAAG,EAAE,CAAA;aACT;SACF,CAAA;KACF;CACF;;;;"}
1
+ {"version":3,"file":"tiptap-extension-color.esm.js","sources":["../src/color.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport '@tiptap/extension-text-style'\n\nexport type ColorOptions = {\n types: string[],\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n color: {\n /**\n * Set the text color\n */\n setColor: (color: string) => ReturnType,\n /**\n * Unset the text color\n */\n unsetColor: () => ReturnType,\n }\n }\n}\n\nexport const Color = Extension.create<ColorOptions>({\n name: 'color',\n\n addOptions() {\n return {\n types: ['textStyle'],\n }\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n color: {\n default: null,\n parseHTML: element => element.style.color.replace(/['\"]+/g, ''),\n renderHTML: attributes => {\n if (!attributes.color) {\n return {}\n }\n\n return {\n style: `color: ${attributes.color}`,\n }\n },\n },\n },\n },\n ]\n },\n\n addCommands() {\n return {\n setColor: color => ({ chain }) => {\n return chain()\n .setMark('textStyle', { color })\n .run()\n },\n unsetColor: () => ({ chain }) => {\n return chain()\n .setMark('textStyle', { color: null })\n .removeEmptyTextStyle()\n .run()\n },\n }\n },\n})\n"],"names":[],"mappings":";;;MAsBa,KAAK,GAAG,SAAS,CAAC,MAAM,CAAe;IAClD,IAAI,EAAE,OAAO;IAEb,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,KAAK,EAAE;wBACL,OAAO,EAAE,IAAI;wBACb,SAAS,EAAE,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;wBAC/D,UAAU,EAAE,UAAU;4BACpB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;gCACrB,OAAO,EAAE,CAAA;6BACV;4BAED,OAAO;gCACL,KAAK,EAAE,UAAU,UAAU,CAAC,KAAK,EAAE;6BACpC,CAAA;yBACF;qBACF;iBACF;aACF;SACF,CAAA;KACF;IAED,WAAW;QACT,OAAO;YACL,QAAQ,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,EAAE;gBAC3B,OAAO,KAAK,EAAE;qBACX,OAAO,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,CAAC;qBAC/B,GAAG,EAAE,CAAA;aACT;YACD,UAAU,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE;gBAC1B,OAAO,KAAK,EAAE;qBACX,OAAO,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;qBACrC,oBAAoB,EAAE;qBACtB,GAAG,EAAE,CAAA;aACT;SACF,CAAA;KACF;CACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"tiptap-extension-color.umd.js","sources":["../src/color.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport '@tiptap/extension-text-style'\n\ntype ColorOptions = {\n types: string[],\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n color: {\n /**\n * Set the text color\n */\n setColor: (color: string) => ReturnType,\n /**\n * Unset the text color\n */\n unsetColor: () => ReturnType,\n }\n }\n}\n\nexport const Color = Extension.create<ColorOptions>({\n name: 'color',\n\n addOptions() {\n return {\n types: ['textStyle'],\n }\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n color: {\n default: null,\n parseHTML: element => element.style.color.replace(/['\"]+/g, ''),\n renderHTML: attributes => {\n if (!attributes.color) {\n return {}\n }\n\n return {\n style: `color: ${attributes.color}`,\n }\n },\n },\n },\n },\n ]\n },\n\n addCommands() {\n return {\n setColor: color => ({ chain }) => {\n return chain()\n .setMark('textStyle', { color })\n .run()\n },\n unsetColor: () => ({ chain }) => {\n return chain()\n .setMark('textStyle', { color: null })\n .removeEmptyTextStyle()\n .run()\n },\n }\n },\n})\n"],"names":["Extension"],"mappings":";;;;;;QAsBa,KAAK,GAAGA,cAAS,CAAC,MAAM,CAAe;MAClD,IAAI,EAAE,OAAO;MAEb,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,KAAK,EAAE;0BACL,OAAO,EAAE,IAAI;0BACb,SAAS,EAAE,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;0BAC/D,UAAU,EAAE,UAAU;8BACpB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;kCACrB,OAAO,EAAE,CAAA;+BACV;8BAED,OAAO;kCACL,KAAK,EAAE,UAAU,UAAU,CAAC,KAAK,EAAE;+BACpC,CAAA;2BACF;uBACF;mBACF;eACF;WACF,CAAA;OACF;MAED,WAAW;UACT,OAAO;cACL,QAAQ,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,EAAE;kBAC3B,OAAO,KAAK,EAAE;uBACX,OAAO,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,CAAC;uBAC/B,GAAG,EAAE,CAAA;eACT;cACD,UAAU,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE;kBAC1B,OAAO,KAAK,EAAE;uBACX,OAAO,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;uBACrC,oBAAoB,EAAE;uBACtB,GAAG,EAAE,CAAA;eACT;WACF,CAAA;OACF;GACF;;;;;;;;;;;"}
1
+ {"version":3,"file":"tiptap-extension-color.umd.js","sources":["../src/color.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport '@tiptap/extension-text-style'\n\nexport type ColorOptions = {\n types: string[],\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n color: {\n /**\n * Set the text color\n */\n setColor: (color: string) => ReturnType,\n /**\n * Unset the text color\n */\n unsetColor: () => ReturnType,\n }\n }\n}\n\nexport const Color = Extension.create<ColorOptions>({\n name: 'color',\n\n addOptions() {\n return {\n types: ['textStyle'],\n }\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n color: {\n default: null,\n parseHTML: element => element.style.color.replace(/['\"]+/g, ''),\n renderHTML: attributes => {\n if (!attributes.color) {\n return {}\n }\n\n return {\n style: `color: ${attributes.color}`,\n }\n },\n },\n },\n },\n ]\n },\n\n addCommands() {\n return {\n setColor: color => ({ chain }) => {\n return chain()\n .setMark('textStyle', { color })\n .run()\n },\n unsetColor: () => ({ chain }) => {\n return chain()\n .setMark('textStyle', { color: null })\n .removeEmptyTextStyle()\n .run()\n },\n }\n },\n})\n"],"names":["Extension"],"mappings":";;;;;;QAsBa,KAAK,GAAGA,cAAS,CAAC,MAAM,CAAe;MAClD,IAAI,EAAE,OAAO;MAEb,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,KAAK,EAAE;0BACL,OAAO,EAAE,IAAI;0BACb,SAAS,EAAE,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;0BAC/D,UAAU,EAAE,UAAU;8BACpB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;kCACrB,OAAO,EAAE,CAAA;+BACV;8BAED,OAAO;kCACL,KAAK,EAAE,UAAU,UAAU,CAAC,KAAK,EAAE;+BACpC,CAAA;2BACF;uBACF;mBACF;eACF;WACF,CAAA;OACF;MAED,WAAW;UACT,OAAO;cACL,QAAQ,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,EAAE;kBAC3B,OAAO,KAAK,EAAE;uBACX,OAAO,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,CAAC;uBAC/B,GAAG,EAAE,CAAA;eACT;cACD,UAAU,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE;kBAC1B,OAAO,KAAK,EAAE;uBACX,OAAO,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;uBACrC,oBAAoB,EAAE;uBACtB,GAAG,EAAE,CAAA;eACT;WACF,CAAA;OACF;GACF;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/extension-color",
3
3
  "description": "text color extension for tiptap",
4
- "version": "2.0.0-beta.5",
4
+ "version": "2.0.0-beta.9",
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-color"
31
31
  },
32
- "gitHead": "31c23336d0e5d2be8b250530353531b8a241253c"
32
+ "gitHead": "53f6ad47bcb6c6f718faef6245061fe023c94d61"
33
33
  }
package/src/color.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Extension } from '@tiptap/core'
2
2
  import '@tiptap/extension-text-style'
3
3
 
4
- type ColorOptions = {
4
+ export type ColorOptions = {
5
5
  types: string[],
6
6
  }
7
7