{"version":3,"file":"taiga-ui-editor-extensions-font-size.mjs","sources":["../../../projects/editor/extensions/font-size/index.ts","../../../projects/editor/extensions/font-size/taiga-ui-editor-extensions-font-size.ts"],"sourcesContent":["import {Extension} from '@tiptap/core';\n\ndeclare module '@tiptap/core' {\n    interface Commands<ReturnType> {\n        fontSize: {\n            /**\n             * Set the font size\n             */\n            setFontSize(fontSize: string): ReturnType;\n            /**\n             * Unset the font size\n             */\n            unsetFontSize(): ReturnType;\n        };\n        textStyle: {\n            /**\n             * Remove spans without inline style attributes.\n             * @example editor.commands.removeEmptyTextStyle()\n             */\n            removeEmptyTextStyle(): ReturnType;\n        };\n    }\n}\n\nexport interface TuiFontSizeOptions {\n    types: string[];\n}\n\nexport const TuiFontSizeExtension = Extension.create<TuiFontSizeOptions>({\n    name: 'fontSize',\n\n    addOptions(): TuiFontSizeOptions {\n        return {types: ['textStyle']};\n    },\n\n    addGlobalAttributes() {\n        return [\n            {\n                types: this.options.types,\n                attributes: {\n                    fontSize: {\n                        default: null,\n                        parseHTML: ({style}) => style.fontSize,\n                        renderHTML: ({fontSize}) =>\n                            fontSize ? {style: `font-size: ${fontSize}`} : {},\n                    },\n                },\n            },\n        ];\n    },\n\n    addCommands() {\n        return {\n            setFontSize:\n                (fontSize: string) =>\n                ({chain}) =>\n                    chain().setMark('textStyle', {fontSize}).run(),\n            unsetFontSize:\n                () =>\n                ({chain}) =>\n                    chain()\n                        .setMark('textStyle', {fontSize: null})\n                        .removeEmptyTextStyle()\n                        .run(),\n        };\n    },\n});\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AA4Ba,MAAA,oBAAoB,GAAG,SAAS,CAAC,MAAM,CAAqB;AACrE,IAAA,IAAI,EAAE,UAAU;IAEhB,UAAU,GAAA;AACN,QAAA,OAAO,EAAC,KAAK,EAAE,CAAC,WAAW,CAAC,EAAC,CAAC;KACjC;IAED,mBAAmB,GAAA;QACf,OAAO;AACH,YAAA;AACI,gBAAA,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;AACzB,gBAAA,UAAU,EAAE;AACR,oBAAA,QAAQ,EAAE;AACN,wBAAA,OAAO,EAAE,IAAI;wBACb,SAAS,EAAE,CAAC,EAAC,KAAK,EAAC,KAAK,KAAK,CAAC,QAAQ;wBACtC,UAAU,EAAE,CAAC,EAAC,QAAQ,EAAC,KACnB,QAAQ,GAAG,EAAC,KAAK,EAAE,CAAc,WAAA,EAAA,QAAQ,EAAE,EAAC,GAAG,EAAE;AACxD,qBAAA;AACJ,iBAAA;AACJ,aAAA;SACJ,CAAC;KACL;IAED,WAAW,GAAA;QACP,OAAO;YACH,WAAW,EACP,CAAC,QAAgB,KACjB,CAAC,EAAC,KAAK,EAAC,KACJ,KAAK,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,EAAC,QAAQ,EAAC,CAAC,CAAC,GAAG,EAAE;AACtD,YAAA,aAAa,EACT,MACA,CAAC,EAAC,KAAK,EAAC,KACJ,KAAK,EAAE;iBACF,OAAO,CAAC,WAAW,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;AACtC,iBAAA,oBAAoB,EAAE;AACtB,iBAAA,GAAG,EAAE;SACrB,CAAC;KACL;AACJ,CAAA;;AClED;;AAEG;;;;"}