@webiny/lexical-editor-actions 5.35.2 → 5.36.0-beta.1

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.
@@ -22,11 +22,9 @@ var TypographyDropDown = function TypographyDropDown() {
22
22
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
23
23
  styles = _useState2[0],
24
24
  setStyles = _useState2[1];
25
- var typographyStyles = theme.styles.typography;
26
25
  var _useRichTextEditor = (0, _lexicalEditor.useRichTextEditor)(),
27
26
  textBlockSelection = _useRichTextEditor.textBlockSelection;
28
27
  var textType = textBlockSelection === null || textBlockSelection === void 0 ? void 0 : (_textBlockSelection$s = textBlockSelection.state) === null || _textBlockSelection$s === void 0 ? void 0 : _textBlockSelection$s.textType;
29
- var hasTypographyStyles = !!typographyStyles;
30
28
  (0, _react.useEffect)(function () {
31
29
  var _theme$styles$typogra, _theme$styles$typogra2, _theme$styles$typogra3, _theme$styles$typogra4, _theme$styles$typogra5, _theme$styles$typogra6;
32
30
  if (textType) {
@@ -55,7 +53,7 @@ var TypographyDropDown = function TypographyDropDown() {
55
53
  }
56
54
  }
57
55
  }, [textType]);
58
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, theme && hasTypographyStyles ? /*#__PURE__*/_react.default.createElement(_lexicalEditor.DropDown, {
56
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !!(styles !== null && styles !== void 0 && styles.length) ? /*#__PURE__*/_react.default.createElement(_lexicalEditor.DropDown, {
59
57
  buttonClassName: "toolbar-item typography-dropdown",
60
58
  buttonAriaLabel: "Typography formatting options",
61
59
  buttonLabel: (value === null || value === void 0 ? void 0 : value.name) || "Normal",
@@ -1 +1 @@
1
- {"version":3,"names":["TypographyDropDown","useTypographyAction","value","applyTypography","usePageElements","theme","useState","styles","setStyles","typographyStyles","typography","useRichTextEditor","textBlockSelection","textType","state","hasTypographyStyles","useEffect","headings","paragraphs","lists","filter","x","tag","quotes","name","map","option","id","css"],"sources":["TypographyDropDown.tsx"],"sourcesContent":["import React, { useEffect, useState } from \"react\";\nimport {\n DropDown,\n DropDownItem,\n useRichTextEditor,\n useTypographyAction\n} from \"@webiny/lexical-editor\";\nimport { usePageElements } from \"@webiny/app-page-builder-elements\";\nimport { TypographyStyle } from \"@webiny/theme/types\";\nimport { TypographyValue } from \"@webiny/lexical-editor/types\";\n\nexport const TypographyDropDown = () => {\n const { value, applyTypography } = useTypographyAction();\n const { theme } = usePageElements();\n const [styles, setStyles] = useState<TypographyStyle[]>([]);\n const typographyStyles = theme.styles.typography;\n const { textBlockSelection } = useRichTextEditor();\n const textType = textBlockSelection?.state?.textType;\n\n const hasTypographyStyles = !!typographyStyles;\n\n useEffect(() => {\n if (textType) {\n switch (textType) {\n case \"heading\":\n setStyles(theme.styles.typography?.headings || []);\n break;\n case \"paragraph\":\n setStyles(theme.styles.typography?.paragraphs || []);\n break;\n case \"bullet\":\n setStyles(theme.styles.typography.lists?.filter(x => x.tag === \"ul\") || []);\n break;\n case \"number\":\n setStyles(theme.styles.typography?.lists?.filter(x => x.tag === \"ol\") || []);\n break;\n case \"quoteblock\":\n setStyles(theme.styles.typography?.quotes || []);\n break;\n default:\n setStyles([]);\n }\n }\n }, [textType]);\n\n return (\n <>\n {theme && hasTypographyStyles ? (\n <DropDown\n buttonClassName=\"toolbar-item typography-dropdown\"\n buttonAriaLabel={\"Typography formatting options\"}\n buttonLabel={value?.name || \"Normal\"}\n stopCloseOnClickSelf={true}\n disabled={false}\n showScroll={false}\n >\n {styles?.map(option => (\n <DropDownItem\n className={`item typography-item ${\n value?.id === option.id ? \"active dropdown-item-active\" : \"\"\n }`}\n onClick={() =>\n applyTypography({\n ...option,\n css: option.styles\n } as TypographyValue)\n }\n key={option.id}\n >\n <span className=\"text\">{option.name}</span>\n </DropDownItem>\n ))}\n </DropDown>\n ) : null}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;AAAA;AACA;AAMA;AAIO,IAAMA,kBAAkB,GAAG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AC,CAAC;YAAA,OAAIA,CAAC,CAACC,GAAG,KAAK,IAAI;UAAA,EAAC,KAAI,EAAE,CAAC;UAC5E;QACJ,KAAK,YAAY;UACbd,SAAS,CAAC,2BAAAH,KAAK,CAACE,MAAM,CAACG,UAAU,2DAAvB,uBAAyBa,MAAM,KAAI,EAAE,CAAC;UAChD;QACJ;UACIf,SAAS,CAAC,EAAE,CAAC;MAAC;IAE1B;EACJ,CAAC,EAAE,CAACK,QAAQ,CAAC,CAAC;EAEd,oBACI,4DACKR,KAAK,IAAIU,mBAAmB,gBACzB,6BAAC,uBAAQ;IACL,eAAe,EAAC,kCAAkC;IAClD,eAAe,EAAE,+BAAgC;IACjD,WAAW,EAAE,CAAAb,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEsB,IAAI,KAAI,QAAS;IACrC,oBAAoB,EAAE,IAAK;IAC3B,QAAQ,EAAE,KAAM;IAChB,UAAU,EAAE;EAAM,GAEjBjB,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEkB,GAAG,CAAC,UAAAC,MAAM;IAAA,oBACf,6BAAC,2BAAY;MACT,SAAS,iCACL,CAAAxB,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEyB,EAAE,MAAKD,MAAM,CAACC,EAAE,GAAG,6BAA6B,GAAG,EAAE,CAC7D;MACH,OAAO,EAAE;QAAA,OACLxB,eAAe,6DACRuB,MAAM;UACTE,GAAG,EAAEF,MAAM,CAACnB;QAAM,GACD;MAAA,CACxB;MACD,GAAG,EAAEmB,MAAM,CAACC;IAAG,gBAEf;MAAM,SAAS,EAAC;IAAM,GAAED,MAAM,CAACF,IAAI,CAAQ,CAChC;EAAA,CAClB,CAAC,CACK,GACX,IAAI,CACT;AAEX,CAAC;AAAC"}
1
+ {"version":3,"names":["TypographyDropDown","useTypographyAction","value","applyTypography","usePageElements","theme","useState","styles","setStyles","useRichTextEditor","textBlockSelection","textType","state","useEffect","typography","headings","paragraphs","lists","filter","x","tag","quotes","length","name","map","option","id","css"],"sources":["TypographyDropDown.tsx"],"sourcesContent":["import React, { useEffect, useState } from \"react\";\nimport {\n DropDown,\n DropDownItem,\n useRichTextEditor,\n useTypographyAction\n} from \"@webiny/lexical-editor\";\nimport { usePageElements } from \"@webiny/app-page-builder-elements\";\nimport { TypographyStyle } from \"@webiny/theme/types\";\nimport { TypographyValue } from \"@webiny/lexical-editor/types\";\n\nexport const TypographyDropDown = () => {\n const { value, applyTypography } = useTypographyAction();\n const { theme } = usePageElements();\n const [styles, setStyles] = useState<TypographyStyle[]>([]);\n const { textBlockSelection } = useRichTextEditor();\n const textType = textBlockSelection?.state?.textType;\n\n useEffect(() => {\n if (textType) {\n switch (textType) {\n case \"heading\":\n setStyles(theme.styles.typography?.headings || []);\n break;\n case \"paragraph\":\n setStyles(theme.styles.typography?.paragraphs || []);\n break;\n case \"bullet\":\n setStyles(theme.styles.typography.lists?.filter(x => x.tag === \"ul\") || []);\n break;\n case \"number\":\n setStyles(theme.styles.typography?.lists?.filter(x => x.tag === \"ol\") || []);\n break;\n case \"quoteblock\":\n setStyles(theme.styles.typography?.quotes || []);\n break;\n default:\n setStyles([]);\n }\n }\n }, [textType]);\n\n return (\n <>\n {!!styles?.length ? (\n <DropDown\n buttonClassName=\"toolbar-item typography-dropdown\"\n buttonAriaLabel={\"Typography formatting options\"}\n buttonLabel={value?.name || \"Normal\"}\n stopCloseOnClickSelf={true}\n disabled={false}\n showScroll={false}\n >\n {styles?.map(option => (\n <DropDownItem\n className={`item typography-item ${\n value?.id === option.id ? \"active dropdown-item-active\" : \"\"\n }`}\n onClick={() =>\n applyTypography({\n ...option,\n css: option.styles\n } as TypographyValue)\n }\n key={option.id}\n >\n <span className=\"text\">{option.name}</span>\n </DropDownItem>\n ))}\n </DropDown>\n ) : null}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;AAAA;AACA;AAMA;AAIO,IAAMA,kBAAkB,GAAG,SAArBA,kBAAkB,GAAS;EAAA;EACpC,2BAAmC,IAAAC,kCAAmB,G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AAvB,uBAAyBO,MAAM,KAAI,EAAE,CAAC;UAChD;QACJ;UACIb,SAAS,CAAC,EAAE,CAAC;MAAC;IAE1B;EACJ,CAAC,EAAE,CAACG,QAAQ,CAAC,CAAC;EAEd,oBACI,4DACK,CAAC,EAACJ,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEe,MAAM,iBACb,6BAAC,uBAAQ;IACL,eAAe,EAAC,kCAAkC;IAClD,eAAe,EAAE,+BAAgC;IACjD,WAAW,EAAE,CAAApB,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEqB,IAAI,KAAI,QAAS;IACrC,oBAAoB,EAAE,IAAK;IAC3B,QAAQ,EAAE,KAAM;IAChB,UAAU,EAAE;EAAM,GAEjBhB,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEiB,GAAG,CAAC,UAAAC,MAAM;IAAA,oBACf,6BAAC,2BAAY;MACT,SAAS,iCACL,CAAAvB,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEwB,EAAE,MAAKD,MAAM,CAACC,EAAE,GAAG,6BAA6B,GAAG,EAAE,CAC7D;MACH,OAAO,EAAE;QAAA,OACLvB,eAAe,6DACRsB,MAAM;UACTE,GAAG,EAAEF,MAAM,CAAClB;QAAM,GACD;MAAA,CACxB;MACD,GAAG,EAAEkB,MAAM,CAACC;IAAG,gBAEf;MAAM,SAAS,EAAC;IAAM,GAAED,MAAM,CAACF,IAAI,CAAQ,CAChC;EAAA,CAClB,CAAC,CACK,GACX,IAAI,CACT;AAEX,CAAC;AAAC"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@webiny/lexical-editor-actions",
3
- "version": "5.35.2",
3
+ "version": "5.36.0-beta.1",
4
4
  "dependencies": {
5
5
  "@emotion/styled": "11.10.6",
6
- "@webiny/app-page-builder": "^5.35.2",
7
- "@webiny/app-page-builder-elements": "^5.35.2",
8
- "@webiny/lexical-editor": "^5.35.2",
9
- "@webiny/theme": "^5.35.2",
6
+ "@webiny/app-page-builder": "5.36.0-beta.1",
7
+ "@webiny/app-page-builder-elements": "5.36.0-beta.1",
8
+ "@webiny/lexical-editor": "5.36.0-beta.1",
9
+ "@webiny/theme": "5.36.0-beta.1",
10
10
  "classnames": "2.3.2",
11
11
  "emotion": "10.0.27",
12
12
  "react": "17.0.2",
@@ -14,8 +14,8 @@
14
14
  "react-dom": "17.0.2"
15
15
  },
16
16
  "devDependencies": {
17
- "@webiny/cli": "^5.35.2",
18
- "@webiny/project-utils": "^5.35.2"
17
+ "@webiny/cli": "5.36.0-beta.1",
18
+ "@webiny/project-utils": "5.36.0-beta.1"
19
19
  },
20
20
  "publishConfig": {
21
21
  "access": "public",
@@ -25,5 +25,5 @@
25
25
  "build": "yarn webiny run build",
26
26
  "watch": "yarn webiny run watch"
27
27
  },
28
- "gitHead": "d3f7b134892b6c5ea794e9e7dd4811b27cdf6eb1"
28
+ "gitHead": "db7103cc3e74c3c71c2b88e50ef0fd19ae7c3fd2"
29
29
  }