@webiny/lexical-editor 0.0.0-unstable.ecd8734205 → 5.35.0-beta.0

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.
Files changed (186) hide show
  1. package/commands/webiny-list.d.ts +7 -0
  2. package/commands/webiny-list.js +13 -0
  3. package/commands/webiny-list.js.map +1 -0
  4. package/commands/webiny-quote.d.ts +5 -0
  5. package/commands/webiny-quote.js +9 -0
  6. package/commands/webiny-quote.js.map +1 -0
  7. package/components/AddRichTextEditorNodeType.js.map +1 -1
  8. package/components/AddRichTextEditorPlugin.d.ts +2 -0
  9. package/components/AddRichTextEditorPlugin.js +4 -2
  10. package/components/AddRichTextEditorPlugin.js.map +1 -1
  11. package/components/AddToolbarAction.js.map +1 -1
  12. package/components/Editor/HeadingEditor.js +2 -1
  13. package/components/Editor/HeadingEditor.js.map +1 -1
  14. package/components/Editor/ParagraphEditor.js +3 -3
  15. package/components/Editor/ParagraphEditor.js.map +1 -1
  16. package/components/Editor/RichTextEditor.d.ts +4 -1
  17. package/components/Editor/RichTextEditor.js +37 -6
  18. package/components/Editor/RichTextEditor.js.map +1 -1
  19. package/components/LexicalEditorConfig/LexicalEditorConfig.d.ts +9 -0
  20. package/components/LexicalEditorConfig/LexicalEditorConfig.js +17 -0
  21. package/components/LexicalEditorConfig/LexicalEditorConfig.js.map +1 -0
  22. package/components/LexicalHtmlRenderer.d.ts +8 -1
  23. package/components/LexicalHtmlRenderer.js +29 -6
  24. package/components/LexicalHtmlRenderer.js.map +1 -1
  25. package/components/Toolbar/HeadingToolbar.js.map +1 -1
  26. package/components/Toolbar/ParagraphToolbar.js.map +1 -1
  27. package/components/Toolbar/Toolbar.css +9 -0
  28. package/components/Toolbar/Toolbar.js +25 -5
  29. package/components/Toolbar/Toolbar.js.map +1 -1
  30. package/components/ToolbarActions/BoldAction.d.ts +0 -3
  31. package/components/ToolbarActions/BoldAction.js +8 -3
  32. package/components/ToolbarActions/BoldAction.js.map +1 -1
  33. package/components/ToolbarActions/BulletListAction.d.ts +0 -3
  34. package/components/ToolbarActions/BulletListAction.js +17 -55
  35. package/components/ToolbarActions/BulletListAction.js.map +1 -1
  36. package/components/ToolbarActions/CodeHighlightAction.d.ts +0 -4
  37. package/components/ToolbarActions/CodeHighlightAction.js +8 -4
  38. package/components/ToolbarActions/CodeHighlightAction.js.map +1 -1
  39. package/components/ToolbarActions/FontColorAction.d.ts +11 -0
  40. package/components/ToolbarActions/FontColorAction.js +83 -0
  41. package/components/ToolbarActions/FontColorAction.js.map +1 -0
  42. package/components/ToolbarActions/FontSizeAction.js +0 -3
  43. package/components/ToolbarActions/FontSizeAction.js.map +1 -1
  44. package/components/ToolbarActions/ItalicAction.d.ts +0 -3
  45. package/components/ToolbarActions/ItalicAction.js +8 -3
  46. package/components/ToolbarActions/ItalicAction.js.map +1 -1
  47. package/components/ToolbarActions/LinkAction.d.ts +0 -5
  48. package/components/ToolbarActions/LinkAction.js +0 -5
  49. package/components/ToolbarActions/LinkAction.js.map +1 -1
  50. package/components/ToolbarActions/NumberedListAction.d.ts +0 -3
  51. package/components/ToolbarActions/NumberedListAction.js +17 -53
  52. package/components/ToolbarActions/NumberedListAction.js.map +1 -1
  53. package/components/ToolbarActions/QuoteAction.d.ts +0 -2
  54. package/components/ToolbarActions/QuoteAction.js +16 -29
  55. package/components/ToolbarActions/QuoteAction.js.map +1 -1
  56. package/components/ToolbarActions/TypographyAction.d.ts +11 -0
  57. package/components/ToolbarActions/TypographyAction.js +118 -0
  58. package/components/ToolbarActions/TypographyAction.js.map +1 -0
  59. package/components/ToolbarActions/UnderlineAction.d.ts +0 -3
  60. package/components/ToolbarActions/UnderlineAction.js +8 -3
  61. package/components/ToolbarActions/UnderlineAction.js.map +1 -1
  62. package/components/ToolbarPresets/HeadingToolbarPreset.js +8 -0
  63. package/components/ToolbarPresets/HeadingToolbarPreset.js.map +1 -1
  64. package/components/ToolbarPresets/ParagraphToolbarPreset.js +8 -0
  65. package/components/ToolbarPresets/ParagraphToolbarPreset.js.map +1 -1
  66. package/context/FontColorActionContext.d.ts +6 -0
  67. package/context/FontColorActionContext.js +10 -0
  68. package/context/FontColorActionContext.js.map +1 -0
  69. package/context/RichTextEditorContext.d.ts +10 -0
  70. package/context/RichTextEditorContext.js +28 -1
  71. package/context/RichTextEditorContext.js.map +1 -1
  72. package/context/SharedHistoryContext.d.ts +11 -0
  73. package/context/SharedHistoryContext.js +26 -0
  74. package/context/SharedHistoryContext.js.map +1 -0
  75. package/context/TypographyActionContext.d.ts +7 -0
  76. package/context/TypographyActionContext.js +10 -0
  77. package/context/TypographyActionContext.js.map +1 -0
  78. package/hooks/useFontColorPicker.d.ts +2 -0
  79. package/hooks/useFontColorPicker.js +15 -0
  80. package/hooks/useFontColorPicker.js.map +1 -0
  81. package/hooks/useRichTextEditor.js.map +1 -1
  82. package/hooks/useTypographyAction.d.ts +1 -0
  83. package/hooks/useTypographyAction.js +15 -0
  84. package/hooks/useTypographyAction.js.map +1 -0
  85. package/hooks/useWebinyList.d.ts +2 -0
  86. package/hooks/useWebinyList.js +39 -0
  87. package/hooks/useWebinyList.js.map +1 -0
  88. package/hooks/useWebinyQuote.d.ts +2 -0
  89. package/hooks/useWebinyQuote.js +20 -0
  90. package/hooks/useWebinyQuote.js.map +1 -0
  91. package/images/icons/font-color.svg +1 -0
  92. package/index.d.ts +7 -1
  93. package/index.js +44 -2
  94. package/index.js.map +1 -1
  95. package/nodes/FontColorNode.d.ts +43 -0
  96. package/nodes/FontColorNode.js +127 -0
  97. package/nodes/FontColorNode.js.map +1 -0
  98. package/nodes/TypographyElementNode.d.ts +42 -0
  99. package/nodes/TypographyElementNode.js +154 -0
  100. package/nodes/TypographyElementNode.js.map +1 -0
  101. package/nodes/WebinyQuoteNode.d.ts +29 -0
  102. package/nodes/WebinyQuoteNode.js +148 -0
  103. package/nodes/WebinyQuoteNode.js.map +1 -0
  104. package/nodes/list-node/WebinyListItemNode.d.ts +46 -0
  105. package/nodes/list-node/WebinyListItemNode.js +441 -0
  106. package/nodes/list-node/WebinyListItemNode.js.map +1 -0
  107. package/nodes/list-node/WebinyListNode.d.ts +38 -0
  108. package/nodes/list-node/WebinyListNode.js +253 -0
  109. package/nodes/list-node/WebinyListNode.js.map +1 -0
  110. package/nodes/list-node/formatList.d.ts +12 -0
  111. package/nodes/list-node/formatList.js +423 -0
  112. package/nodes/list-node/formatList.js.map +1 -0
  113. package/nodes/webinyNodes.d.ts +6 -1
  114. package/nodes/webinyNodes.js +8 -2
  115. package/nodes/webinyNodes.js.map +1 -1
  116. package/package.json +9 -6
  117. package/plugins/AutoLinkPlugin/AutoLinkPlugin.js.map +1 -1
  118. package/plugins/AutoLinkPlugin/index.js.map +1 -1
  119. package/plugins/BlurEventPlugin/BlurEventPlugin.js.map +1 -1
  120. package/plugins/ClickableLinkPlugin/ClickableLinkPlugin.js.map +1 -1
  121. package/plugins/ClickableLinkPlugin/index.js.map +1 -1
  122. package/plugins/CodeHighlightPlugin/CodeHighlightPlugin.js.map +1 -1
  123. package/plugins/CodeHighlightPlugin/index.js.map +1 -1
  124. package/plugins/FloatingLinkEditorPlugin/FloatingLinkEditorPlugin.js.map +1 -1
  125. package/plugins/FloatingLinkEditorPlugin/index.js.map +1 -1
  126. package/plugins/FontColorPlugin/FontColorPlugin.d.ts +2 -0
  127. package/plugins/FontColorPlugin/FontColorPlugin.js +38 -0
  128. package/plugins/FontColorPlugin/FontColorPlugin.js.map +1 -0
  129. package/plugins/LexicalUpdateStatePlugin/LexicalUpdateStatePlugin.js.map +1 -1
  130. package/plugins/LexicalUpdateStatePlugin/index.js.map +1 -1
  131. package/plugins/TypographyPlugin/TypographyPlugin.d.ts +2 -0
  132. package/plugins/TypographyPlugin/TypographyPlugin.js +31 -0
  133. package/plugins/TypographyPlugin/TypographyPlugin.js.map +1 -0
  134. package/plugins/WebinyListPLugin/WebinyListPlugin.d.ts +1 -0
  135. package/plugins/WebinyListPLugin/WebinyListPlugin.js +25 -0
  136. package/plugins/WebinyListPLugin/WebinyListPlugin.js.map +1 -0
  137. package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.d.ts +1 -0
  138. package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.js +24 -0
  139. package/plugins/WebinyQuoteNodePlugin/WebinyQuoteNodePlugin.js.map +1 -0
  140. package/themes/webinyLexicalTheme.css +0 -2
  141. package/themes/webinyLexicalTheme.d.ts +7 -8
  142. package/themes/webinyLexicalTheme.js +7 -27
  143. package/themes/webinyLexicalTheme.js.map +1 -1
  144. package/types.d.ts +59 -0
  145. package/types.js +8 -1
  146. package/types.js.map +1 -1
  147. package/ui/Divider.js.map +1 -1
  148. package/ui/DropDown.d.ts +2 -1
  149. package/ui/DropDown.js +7 -2
  150. package/ui/DropDown.js.map +1 -1
  151. package/ui/LinkPreview.js.map +1 -1
  152. package/ui/Placeholder.js.map +1 -1
  153. package/ui/TextInput.js.map +1 -1
  154. package/ui/ToolbarActionDialog.d.ts +12 -0
  155. package/ui/ToolbarActionDialog.js +106 -0
  156. package/ui/ToolbarActionDialog.js.map +1 -0
  157. package/utils/generateInitialLexicalValue.js.map +1 -1
  158. package/utils/getDOMRangeRect.js.map +1 -1
  159. package/utils/getLexicalTextSelectionState.d.ts +5 -0
  160. package/utils/getLexicalTextSelectionState.js +141 -0
  161. package/utils/getLexicalTextSelectionState.js.map +1 -0
  162. package/utils/getSelectedNode.js.map +1 -1
  163. package/utils/isValidJSON.js.map +1 -1
  164. package/utils/isValidLexicalData.js.map +1 -1
  165. package/utils/nodes/clearNodeFormating.d.ts +2 -0
  166. package/utils/nodes/clearNodeFormating.js +28 -0
  167. package/utils/nodes/clearNodeFormating.js.map +1 -0
  168. package/utils/nodes/formatToParagraph.d.ts +2 -0
  169. package/utils/nodes/formatToParagraph.js +19 -0
  170. package/utils/nodes/formatToParagraph.js.map +1 -0
  171. package/utils/nodes/formatToQuote.d.ts +2 -0
  172. package/utils/nodes/formatToQuote.js +20 -0
  173. package/utils/nodes/formatToQuote.js.map +1 -0
  174. package/utils/nodes/list-node.d.ts +11 -0
  175. package/utils/nodes/list-node.js +107 -0
  176. package/utils/nodes/list-node.js.map +1 -0
  177. package/utils/point.js.map +1 -1
  178. package/utils/rect.js.map +1 -1
  179. package/utils/sanitizeUrl.js.map +1 -1
  180. package/utils/setFloatingElemPosition.js.map +1 -1
  181. package/utils/styleObjectToString.d.ts +2 -0
  182. package/utils/styleObjectToString.js +22 -0
  183. package/utils/styleObjectToString.js.map +1 -0
  184. package/utils/toTypographyEmotionMap.d.ts +3 -0
  185. package/utils/toTypographyEmotionMap.js +36 -0
  186. package/utils/toTypographyEmotionMap.js.map +1 -0
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.$applyStylesToNode = $applyStylesToNode;
8
+ exports.FontColorNode = exports.ADD_FONT_COLOR_COMMAND = exports.$isFontColorNode = exports.$createFontColorNode = void 0;
9
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
12
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
13
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
14
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
16
+ var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
17
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
18
+ var _lexical = require("lexical");
19
+ var ADD_FONT_COLOR_COMMAND = (0, _lexical.createCommand)("ADD_FONT_COLOR_COMMAND");
20
+ exports.ADD_FONT_COLOR_COMMAND = ADD_FONT_COLOR_COMMAND;
21
+ var FontColorNodeAttrName = "data-theme-font-color-name";
22
+ /**
23
+ * Main responsibility of this node is to apply custom or Webiny theme color to selected text.
24
+ * Extends the original TextNode node to add additional transformation and support for webiny theme font color.
25
+ */
26
+ var FontColorNode = /*#__PURE__*/function (_TextNode) {
27
+ (0, _inherits2.default)(FontColorNode, _TextNode);
28
+ var _super = (0, _createSuper2.default)(FontColorNode);
29
+ function FontColorNode(text, color, themeColor, key) {
30
+ var _this;
31
+ (0, _classCallCheck2.default)(this, FontColorNode);
32
+ _this = _super.call(this, text, key);
33
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "__themeColor", void 0);
34
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "__color", void 0);
35
+ _this.__themeColor = themeColor || "custom";
36
+ _this.__color = color;
37
+ return _this;
38
+ }
39
+ (0, _createClass2.default)(FontColorNode, [{
40
+ key: "exportJSON",
41
+ value: function exportJSON() {
42
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(FontColorNode.prototype), "exportJSON", this).call(this)), {}, {
43
+ themeColor: this.__themeColor,
44
+ color: this.__color,
45
+ type: "font-color-node",
46
+ version: 1
47
+ });
48
+ }
49
+ }, {
50
+ key: "addColorValueToHTMLElement",
51
+ value: function addColorValueToHTMLElement(element, theme) {
52
+ var _theme$styles;
53
+ var hasThemeColor = this.__themeColor !== "custom";
54
+ // get the updated color from webiny theme
55
+ if (hasThemeColor && theme !== null && theme !== void 0 && (_theme$styles = theme.styles) !== null && _theme$styles !== void 0 && _theme$styles.colors) {
56
+ this.__color = theme.styles.colors[this.__themeColor];
57
+ }
58
+ element.setAttribute(FontColorNodeAttrName, this.__themeColor);
59
+ element.style.color = this.__color;
60
+ return element;
61
+ }
62
+ }, {
63
+ key: "updateDOM",
64
+ value: function updateDOM(prevNode, dom, config) {
65
+ var _theme$styles2;
66
+ var theme = config.theme;
67
+ var isUpdated = (0, _get2.default)((0, _getPrototypeOf2.default)(FontColorNode.prototype), "updateDOM", this).call(this, prevNode, dom, config);
68
+ var hasThemeColor = this.__themeColor !== "custom";
69
+ // get the updated color from webiny theme
70
+ if (hasThemeColor && theme !== null && theme !== void 0 && (_theme$styles2 = theme.styles) !== null && _theme$styles2 !== void 0 && _theme$styles2.colors) {
71
+ this.__color = theme.styles.colors[this.__themeColor];
72
+ }
73
+ dom.setAttribute(FontColorNodeAttrName, this.__themeColor);
74
+ dom.style.color = this.__color;
75
+ return isUpdated;
76
+ }
77
+ }, {
78
+ key: "getColorStyle",
79
+ value: function getColorStyle() {
80
+ return {
81
+ color: this.__color,
82
+ themeColor: this.__themeColor
83
+ };
84
+ }
85
+ }, {
86
+ key: "createDOM",
87
+ value: function createDOM(config) {
88
+ var element = (0, _get2.default)((0, _getPrototypeOf2.default)(FontColorNode.prototype), "createDOM", this).call(this, config);
89
+ return this.addColorValueToHTMLElement(element, config.theme);
90
+ }
91
+ }], [{
92
+ key: "getType",
93
+ value: function getType() {
94
+ return "font-color-node";
95
+ }
96
+ }, {
97
+ key: "clone",
98
+ value: function clone(node) {
99
+ return new FontColorNode(node.__text, node.__color, node.__themeColor, node.__key);
100
+ }
101
+ }, {
102
+ key: "importJSON",
103
+ value: function importJSON(serializedNode) {
104
+ var node = new FontColorNode(serializedNode.text, serializedNode.color, serializedNode.themeColor);
105
+ node.setTextContent(serializedNode.text);
106
+ node.setFormat(serializedNode.format);
107
+ node.setDetail(serializedNode.detail);
108
+ node.setMode(serializedNode.mode);
109
+ node.setStyle(serializedNode.style);
110
+ return node;
111
+ }
112
+ }]);
113
+ return FontColorNode;
114
+ }(_lexical.TextNode);
115
+ exports.FontColorNode = FontColorNode;
116
+ var $createFontColorNode = function $createFontColorNode(text, color, themeColor, key) {
117
+ return new FontColorNode(text, color, themeColor, key);
118
+ };
119
+ exports.$createFontColorNode = $createFontColorNode;
120
+ var $isFontColorNode = function $isFontColorNode(node) {
121
+ return node instanceof FontColorNode;
122
+ };
123
+ exports.$isFontColorNode = $isFontColorNode;
124
+ function $applyStylesToNode(node, nodeStyleProvider) {
125
+ node.setFormat(nodeStyleProvider.format);
126
+ node.setStyle(nodeStyleProvider.style);
127
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ADD_FONT_COLOR_COMMAND","createCommand","FontColorNodeAttrName","FontColorNode","text","color","themeColor","key","__themeColor","__color","type","version","element","theme","hasThemeColor","styles","colors","setAttribute","style","prevNode","dom","config","isUpdated","addColorValueToHTMLElement","node","__text","__key","serializedNode","setTextContent","setFormat","format","setDetail","detail","setMode","mode","setStyle","TextNode","$createFontColorNode","$isFontColorNode","$applyStylesToNode","nodeStyleProvider"],"sources":["FontColorNode.ts"],"sourcesContent":["import {\n createCommand,\n EditorConfig,\n LexicalCommand,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n RangeSelection,\n SerializedTextNode,\n Spread,\n TextNode\n} from \"lexical\";\nimport { WebinyEditorTheme } from \"~/themes/webinyLexicalTheme\";\n\nexport const ADD_FONT_COLOR_COMMAND: LexicalCommand<FontColorPayload> =\n createCommand(\"ADD_FONT_COLOR_COMMAND\");\nconst FontColorNodeAttrName = \"data-theme-font-color-name\";\n\nexport interface FontColorPayload {\n // This color can be hex string\n color: string;\n // webiny theme color variable like color1, color2...\n themeColorName: string | undefined;\n caption?: LexicalEditor;\n key?: NodeKey;\n}\n\ntype ThemeStyleColorName = string;\ntype ThemeColor = \"custom\" | ThemeStyleColorName;\n\nexport type SerializedFontColorNode = Spread<\n {\n themeColor: ThemeColor;\n color: string;\n type: \"font-color-node\";\n version: 1;\n },\n SerializedTextNode\n>;\n\n/**\n * Main responsibility of this node is to apply custom or Webiny theme color to selected text.\n * Extends the original TextNode node to add additional transformation and support for webiny theme font color.\n */\nexport class FontColorNode extends TextNode {\n __themeColor: ThemeColor;\n __color: string;\n\n constructor(text: string, color: string, themeColor?: ThemeColor, key?: NodeKey) {\n super(text, key);\n this.__themeColor = themeColor || \"custom\";\n this.__color = color;\n }\n\n static override getType(): string {\n return \"font-color-node\";\n }\n\n static override clone(node: FontColorNode): FontColorNode {\n return new FontColorNode(node.__text, node.__color, node.__themeColor, node.__key);\n }\n\n static override importJSON(serializedNode: SerializedFontColorNode): TextNode {\n const node = new FontColorNode(\n serializedNode.text,\n serializedNode.color,\n serializedNode.themeColor\n );\n node.setTextContent(serializedNode.text);\n node.setFormat(serializedNode.format);\n node.setDetail(serializedNode.detail);\n node.setMode(serializedNode.mode);\n node.setStyle(serializedNode.style);\n return node;\n }\n\n override exportJSON(): SerializedFontColorNode {\n return {\n ...super.exportJSON(),\n themeColor: this.__themeColor,\n color: this.__color,\n type: \"font-color-node\",\n version: 1\n };\n }\n\n addColorValueToHTMLElement(element: HTMLElement, theme: WebinyEditorTheme): HTMLElement {\n const hasThemeColor = this.__themeColor !== \"custom\";\n // get the updated color from webiny theme\n if (hasThemeColor && theme?.styles?.colors) {\n this.__color = theme.styles.colors[this.__themeColor];\n }\n\n element.setAttribute(FontColorNodeAttrName, this.__themeColor);\n element.style.color = this.__color;\n return element;\n }\n\n override updateDOM(prevNode: FontColorNode, dom: HTMLElement, config: EditorConfig): boolean {\n const theme = config.theme;\n const isUpdated = super.updateDOM(prevNode, dom, config);\n const hasThemeColor = this.__themeColor !== \"custom\";\n // get the updated color from webiny theme\n if (hasThemeColor && theme?.styles?.colors) {\n this.__color = theme.styles.colors[this.__themeColor];\n }\n\n dom.setAttribute(FontColorNodeAttrName, this.__themeColor);\n dom.style.color = this.__color;\n return isUpdated;\n }\n\n getColorStyle(): { color: string; themeColor: ThemeColor } {\n return {\n color: this.__color,\n themeColor: this.__themeColor\n };\n }\n\n override createDOM(config: EditorConfig): HTMLElement {\n const element = super.createDOM(config);\n return this.addColorValueToHTMLElement(element, config.theme);\n }\n}\n\nexport const $createFontColorNode = (\n text: string,\n color: string,\n themeColor?: ThemeColor,\n key?: NodeKey\n): FontColorNode => {\n return new FontColorNode(text, color, themeColor, key);\n};\n\nexport const $isFontColorNode = (node: LexicalNode): boolean => {\n return node instanceof FontColorNode;\n};\n\nexport function $applyStylesToNode(node: FontColorNode, nodeStyleProvider: RangeSelection) {\n node.setFormat(nodeStyleProvider.format);\n node.setStyle(nodeStyleProvider.style);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAcO,IAAMA,sBAAwD,GACjE,IAAAC,sBAAa,EAAC,wBAAwB,CAAC;AAAC;AAC5C,IAAMC,qBAAqB,GAAG,4BAA4B;AAwB1D;AACA;AACA;AACA;AAHA,IAIaC,aAAa;EAAA;EAAA;EAItB,uBAAYC,IAAY,EAAEC,KAAa,EAAEC,UAAuB,EAAEC,GAAa,EAAE;IAAA;IAAA;IAC7E,0BAAMH,IAAI,EAAEG,GAAG;IAAE;IAAA;IACjB,MAAKC,YAAY,GAAGF,UAAU,IAAI,QAAQ;IAC1C,MAAKG,OAAO,GAAGJ,KAAK;IAAC;EACzB;EAAC;IAAA;IAAA,OAwBD,sBAA+C;MAC3C;QAEIC,UAAU,EAAE,IAAI,CAACE,YAAY;QAC7BH,KAAK,EAAE,IAAI,CAACI,OAAO;QACnBC,IAAI,EAAE,iBAAiB;QACvBC,OAAO,EAAE;MAAC;IAElB;EAAC;IAAA;IAAA,OAED,oCAA2BC,OAAoB,EAAEC,KAAwB,EAAe;MAAA;MACpF,IAAMC,aAAa,GAAG,IAAI,CAACN,YAAY,KAAK,QAAQ;MACpD;MACA,IAAIM,aAAa,IAAID,KAAK,aAALA,KAAK,gCAALA,KAAK,CAAEE,MAAM,0CAAb,cAAeC,MAAM,EAAE;QACxC,IAAI,CAACP,OAAO,GAAGI,KAAK,CAACE,MAAM,CAACC,MAAM,CAAC,IAAI,CAACR,YAAY,CAAC;MACzD;MAEAI,OAAO,CAACK,YAAY,CAACf,qBAAqB,EAAE,IAAI,CAACM,YAAY,CAAC;MAC9DI,OAAO,CAACM,KAAK,CAACb,KAAK,GAAG,IA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,EAAY;MAC1E,IAAMH,IAAI,GAAG,IAAIrB,aAAa,CAC1BwB,cAAc,CAACvB,IAAI,EACnBuB,cAAc,CAACtB,KAAK,EACpBsB,cAAc,CAACrB,UAAU,CAC5B;MACDkB,IAAI,CAACI,cAAc,CAACD,cAAc,CAACvB,IAAI,CAAC;MACxCoB,IAAI,CAACK,SAAS,CAACF,cAAc,CAACG,MAAM,CAAC;MACrCN,IAAI,CAACO,SAAS,CAACJ,cAAc,CAACK,MAAM,CAAC;MACrCR,IAAI,CAACS,OAAO,CAACN,cAAc,CAACO,IAAI,CAAC;MACjCV,IAAI,CAACW,QAAQ,CAACR,cAAc,CAACT,KAAK,CAAC;MACnC,OAAOM,IAAI;IACf;EAAC;EAAA;AAAA,EA9B8BY,iBAAQ;AAAA;AAiFpC,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoB,CAC7BjC,IAAY,EACZC,KAAa,EACbC,UAAuB,EACvBC,GAAa,EACG;EAChB,OAAO,IAAIJ,aAAa,CAACC,IAAI,EAAEC,KAAK,EAAEC,UAAU,EAAEC,GAAG,CAAC;AAC1D,CAAC;AAAC;AAEK,IAAM+B,gBAAgB,GAAG,SAAnBA,gBAAgB,CAAId,IAAiB,EAAc;EAC5D,OAAOA,IAAI,YAAYrB,aAAa;AACxC,CAAC;AAAC;AAEK,SAASoC,kBAAkB,CAACf,IAAmB,EAAEgB,iBAAiC,EAAE;EACvFhB,IAAI,CAACK,SAAS,CAACW,iBAAiB,CAACV,MAAM,CAAC;EACxCN,IAAI,CAACW,QAAQ,CAACK,iBAAiB,CAACtB,KAAK,CAAC;AAC1C"}
@@ -0,0 +1,42 @@
1
+ /// <reference types="react" />
2
+ /// <reference types="web" />
3
+ import { EditorConfig, ElementNode, LexicalCommand, LexicalEditor, LexicalNode, NodeKey, SerializedElementNode, Spread } from "lexical";
4
+ import { WebinyEditorTheme } from "../themes/webinyLexicalTheme";
5
+ import { TypographyHTMLTag, TypographyValue } from "../types";
6
+ export declare const ADD_TYPOGRAPHY_ELEMENT_COMMAND: LexicalCommand<TypographyPayload>;
7
+ export interface TypographyPayload {
8
+ value: TypographyValue;
9
+ caption?: LexicalEditor;
10
+ key?: NodeKey;
11
+ }
12
+ export declare type SerializedTypographyNode = Spread<{
13
+ tag: TypographyHTMLTag;
14
+ styleId: string;
15
+ name: string;
16
+ typographyStyles: Record<string, any>;
17
+ type: "typography-el-node";
18
+ version: 1;
19
+ }, SerializedElementNode>;
20
+ /**
21
+ * Main responsibility of this node is to apply custom or Webiny theme typography to selected text.
22
+ * Extends the original ElementNode node to add additional transformation and support for webiny theme typography.
23
+ */
24
+ export declare class TypographyElementNode extends ElementNode {
25
+ __styleId: string;
26
+ __tag: TypographyHTMLTag;
27
+ __name: string;
28
+ __css: Record<string, any>;
29
+ constructor(value: TypographyValue, key?: NodeKey);
30
+ static getType(): string;
31
+ static clone(node: TypographyElementNode): TypographyElementNode;
32
+ getTypographyValue(): TypographyValue;
33
+ addStylesHTMLElement(element: HTMLElement, theme: WebinyEditorTheme): HTMLElement;
34
+ exportJSON(): SerializedTypographyNode;
35
+ static importJSON(serializedNode: SerializedTypographyNode): TypographyElementNode;
36
+ createDOM(config: EditorConfig): HTMLElement;
37
+ updateDOM(): boolean;
38
+ insertNewAfter(): TypographyElementNode;
39
+ collapseAtStart(): true;
40
+ }
41
+ export declare const $createTypographyNode: (value: TypographyValue, key?: NodeKey) => TypographyElementNode;
42
+ export declare const $isTypographyElementNode: (node: ElementNode | LexicalNode | null) => boolean;
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.TypographyElementNode = exports.ADD_TYPOGRAPHY_ELEMENT_COMMAND = exports.$isTypographyElementNode = exports.$createTypographyNode = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
12
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
13
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
+ var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
16
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
+ var _lexical = require("lexical");
18
+ var _utils = require("@lexical/utils");
19
+ // Command and payload
20
+ var ADD_TYPOGRAPHY_ELEMENT_COMMAND = (0, _lexical.createCommand)("ADD_TYPOGRAPHY_ELEMENT_COMMAND");
21
+ exports.ADD_TYPOGRAPHY_ELEMENT_COMMAND = ADD_TYPOGRAPHY_ELEMENT_COMMAND;
22
+ var TypographyNodeAttrName = "data-typography-style-id";
23
+ /**
24
+ * Main responsibility of this node is to apply custom or Webiny theme typography to selected text.
25
+ * Extends the original ElementNode node to add additional transformation and support for webiny theme typography.
26
+ */
27
+ var TypographyElementNode = /*#__PURE__*/function (_ElementNode) {
28
+ (0, _inherits2.default)(TypographyElementNode, _ElementNode);
29
+ var _super = (0, _createSuper2.default)(TypographyElementNode);
30
+ function TypographyElementNode(value, key) {
31
+ var _this;
32
+ (0, _classCallCheck2.default)(this, TypographyElementNode);
33
+ _this = _super.call(this, key);
34
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "__styleId", void 0);
35
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "__tag", void 0);
36
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "__name", void 0);
37
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "__css", void 0);
38
+ _this.__tag = value.tag;
39
+ _this.__styleId = value.id;
40
+ _this.__name = value.name;
41
+ _this.__css = value.css;
42
+ return _this;
43
+ }
44
+ (0, _createClass2.default)(TypographyElementNode, [{
45
+ key: "getTypographyValue",
46
+ value: function getTypographyValue() {
47
+ return {
48
+ tag: this.__tag,
49
+ css: this.__css,
50
+ id: this.__styleId,
51
+ name: this.__name
52
+ };
53
+ }
54
+ }, {
55
+ key: "addStylesHTMLElement",
56
+ value: function addStylesHTMLElement(element, theme) {
57
+ var typographyStyleValue = theme !== null && theme !== void 0 && theme.emotionMap ? theme === null || theme === void 0 ? void 0 : theme.emotionMap[this.__styleId] : undefined;
58
+ if (typographyStyleValue) {
59
+ this.__css = typographyStyleValue.styles;
60
+ (0, _utils.addClassNamesToElement)(element, typographyStyleValue.className);
61
+ }
62
+ element.setAttribute(TypographyNodeAttrName, this.__styleId);
63
+ return element;
64
+ }
65
+ }, {
66
+ key: "exportJSON",
67
+ value: function exportJSON() {
68
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(TypographyElementNode.prototype), "exportJSON", this).call(this)), {}, {
69
+ tag: this.__tag,
70
+ typographyStyles: this.__css,
71
+ name: this.__name,
72
+ styleId: this.__styleId,
73
+ type: "typography-el-node",
74
+ version: 1
75
+ });
76
+ }
77
+ }, {
78
+ key: "createDOM",
79
+ value: function createDOM(config) {
80
+ var tag = this.__tag;
81
+ var element = document.createElement(tag);
82
+ return this.addStylesHTMLElement(element, config.theme);
83
+ }
84
+ }, {
85
+ key: "updateDOM",
86
+ value: function updateDOM() {
87
+ return false;
88
+ }
89
+ }, {
90
+ key: "insertNewAfter",
91
+ value: function insertNewAfter() {
92
+ var newElement = $createTypographyNode({
93
+ tag: this.__tag,
94
+ name: this.__name,
95
+ css: this.__css,
96
+ id: this.__styleId
97
+ });
98
+ var direction = this.getDirection();
99
+ newElement.setDirection(direction);
100
+ this.insertAfter(newElement);
101
+ return newElement;
102
+ }
103
+ }, {
104
+ key: "collapseAtStart",
105
+ value: function collapseAtStart() {
106
+ var paragraph = (0, _lexical.$createParagraphNode)();
107
+ var children = this.getChildren();
108
+ children.forEach(function (child) {
109
+ return paragraph.append(child);
110
+ });
111
+ this.replace(paragraph);
112
+ return true;
113
+ }
114
+ }], [{
115
+ key: "getType",
116
+ value: function getType() {
117
+ return "typography-el-node";
118
+ }
119
+ }, {
120
+ key: "clone",
121
+ value: function clone(node) {
122
+ return new TypographyElementNode({
123
+ css: node.__css,
124
+ id: node.__styleId,
125
+ name: node.__name,
126
+ tag: node.__tag
127
+ }, node.__key);
128
+ }
129
+ }, {
130
+ key: "importJSON",
131
+ value: function importJSON(serializedNode) {
132
+ var node = new TypographyElementNode({
133
+ id: serializedNode.styleId,
134
+ css: serializedNode.typographyStyles,
135
+ tag: serializedNode.tag,
136
+ name: serializedNode.name
137
+ });
138
+ node.setFormat(serializedNode.format);
139
+ node.setIndent(serializedNode.indent);
140
+ node.setDirection(serializedNode.direction);
141
+ return node;
142
+ }
143
+ }]);
144
+ return TypographyElementNode;
145
+ }(_lexical.ElementNode);
146
+ exports.TypographyElementNode = TypographyElementNode;
147
+ var $createTypographyNode = function $createTypographyNode(value, key) {
148
+ return new TypographyElementNode(value, key);
149
+ };
150
+ exports.$createTypographyNode = $createTypographyNode;
151
+ var $isTypographyElementNode = function $isTypographyElementNode(node) {
152
+ return node instanceof TypographyElementNode;
153
+ };
154
+ exports.$isTypographyElementNode = $isTypographyElementNode;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ADD_TYPOGRAPHY_ELEMENT_COMMAND","createCommand","TypographyNodeAttrName","TypographyElementNode","value","key","__tag","tag","__styleId","id","__name","name","__css","css","element","theme","typographyStyleValue","emotionMap","undefined","styles","addClassNamesToElement","className","setAttribute","typographyStyles","styleId","type","version","config","document","createElement","addStylesHTMLElement","newElement","$createTypographyNode","direction","getDirection","setDirection","insertAfter","paragraph","$createParagraphNode","children","getChildren","forEach","child","append","replace","node","__key","serializedNode","setFormat","format","setIndent","indent","ElementNode","$isTypographyElementNode"],"sources":["TypographyElementNode.ts"],"sourcesContent":["import {\n $createParagraphNode,\n createCommand,\n EditorConfig,\n ElementNode,\n LexicalCommand,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedElementNode,\n Spread\n} from \"lexical\";\nimport { WebinyEditorTheme } from \"~/themes/webinyLexicalTheme\";\nimport { TypographyHTMLTag, TypographyValue } from \"~/types\";\nimport { addClassNamesToElement } from \"@lexical/utils\";\n\n// Command and payload\nexport const ADD_TYPOGRAPHY_ELEMENT_COMMAND: LexicalCommand<TypographyPayload> = createCommand(\n \"ADD_TYPOGRAPHY_ELEMENT_COMMAND\"\n);\nconst TypographyNodeAttrName = \"data-typography-style-id\";\n\nexport interface TypographyPayload {\n value: TypographyValue;\n caption?: LexicalEditor;\n key?: NodeKey;\n}\n\n// Node\nexport type SerializedTypographyNode = Spread<\n {\n tag: TypographyHTMLTag;\n styleId: string;\n name: string;\n typographyStyles: Record<string, any>;\n type: \"typography-el-node\";\n version: 1;\n },\n SerializedElementNode\n>;\n\n/**\n * Main responsibility of this node is to apply custom or Webiny theme typography to selected text.\n * Extends the original ElementNode node to add additional transformation and support for webiny theme typography.\n */\nexport class TypographyElementNode extends ElementNode {\n __styleId: string;\n __tag: TypographyHTMLTag;\n __name: string;\n __css: Record<string, any>;\n\n constructor(value: TypographyValue, key?: NodeKey) {\n super(key);\n this.__tag = value.tag;\n this.__styleId = value.id;\n this.__name = value.name;\n this.__css = value.css;\n }\n\n static override getType(): string {\n return \"typography-el-node\";\n }\n\n static override clone(node: TypographyElementNode): TypographyElementNode {\n return new TypographyElementNode(\n {\n css: node.__css,\n id: node.__styleId,\n name: node.__name,\n tag: node.__tag\n },\n node.__key\n );\n }\n getTypographyValue(): TypographyValue {\n return {\n tag: this.__tag,\n css: this.__css,\n id: this.__styleId,\n name: this.__name\n };\n }\n\n addStylesHTMLElement(element: HTMLElement, theme: WebinyEditorTheme): HTMLElement {\n const typographyStyleValue = theme?.emotionMap\n ? theme?.emotionMap[this.__styleId]\n : undefined;\n if (typographyStyleValue) {\n this.__css = typographyStyleValue.styles;\n addClassNamesToElement(element, typographyStyleValue.className);\n }\n element.setAttribute(TypographyNodeAttrName, this.__styleId);\n\n return element;\n }\n\n override exportJSON(): SerializedTypographyNode {\n return {\n ...super.exportJSON(),\n tag: this.__tag,\n typographyStyles: this.__css,\n name: this.__name,\n styleId: this.__styleId,\n type: \"typography-el-node\",\n version: 1\n };\n }\n\n static override importJSON(serializedNode: SerializedTypographyNode): TypographyElementNode {\n const node = new TypographyElementNode({\n id: serializedNode.styleId,\n css: serializedNode.typographyStyles,\n tag: serializedNode.tag,\n name: serializedNode.name\n });\n node.setFormat(serializedNode.format);\n node.setIndent(serializedNode.indent);\n node.setDirection(serializedNode.direction);\n return node;\n }\n\n override createDOM(config: EditorConfig): HTMLElement {\n const tag = this.__tag;\n const element = document.createElement(tag);\n return this.addStylesHTMLElement(element, config.theme);\n }\n\n override updateDOM(): boolean {\n return false;\n }\n\n override insertNewAfter(): TypographyElementNode {\n const newElement = $createTypographyNode({\n tag: this.__tag,\n name: this.__name,\n css: this.__css,\n id: this.__styleId\n });\n const direction = this.getDirection();\n newElement.setDirection(direction);\n this.insertAfter(newElement);\n return newElement;\n }\n\n override collapseAtStart(): true {\n const paragraph = $createParagraphNode();\n const children = this.getChildren();\n children.forEach(child => paragraph.append(child));\n this.replace(paragraph);\n return true;\n }\n}\n\nexport const $createTypographyNode = (\n value: TypographyValue,\n key?: NodeKey\n): TypographyElementNode => {\n return new TypographyElementNode(value, key);\n};\n\nexport const $isTypographyElementNode = (node: ElementNode | LexicalNode | null): boolean => {\n return node instanceof TypographyElementNode;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAcA;AAEA;AACO,IAAMA,8BAAiE,GAAG,IAAAC,sBAAa,EAC1F,gCAAgC,CACnC;AAAC;AACF,IAAMC,sBAAsB,GAAG,0BAA0B;AAqBzD;AACA;AACA;AACA;AAHA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CAACrC,SAAS;QAClBG,IAAI,EAAEkC,IAAI,CAACnC,MAAM;QACjBH,GAAG,EAAEsC,IAAI,CAACvC;MACd,CAAC,EACDuC,IAAI,CAACC,KAAK,CACb;IACL;EAAC;IAAA;IAAA,OAmCD,oBAA2BC,cAAwC,EAAyB;MACxF,IAAMF,IAAI,GAAG,IAAI1C,qBAAqB,CAAC;QACnCM,EAAE,EAAEsC,cAAc,CAACvB,OAAO;QAC1BX,GAAG,EAAEkC,cAAc,CAACxB,gBAAgB;QACpChB,GAAG,EAAEwC,cAAc,CAACxC,GAAG;QACvBI,IAAI,EAAEoC,cAAc,CAACpC;MACzB,CAAC,CAAC;MACFkC,IAAI,CAACG,SAAS,CAACD,cAAc,CAACE,MAAM,CAAC;MACrCJ,IAAI,CAACK,SAAS,CAACH,cAAc,CAACI,MAAM,CAAC;MACrCN,IAAI,CAACV,YAAY,CAACY,cAAc,CAACd,SAAS,CAAC;MAC3C,OAAOY,IAAI;IACf;EAAC;EAAA;AAAA,EA1EsCO,oBAAW;AAAA;AA4G/C,IAAMpB,qBAAqB,GAAG,SAAxBA,qBAAqB,CAC9B5B,KAAsB,EACtBC,GAAa,EACW;EACxB,OAAO,IAAIF,qBAAqB,CAACC,KAAK,EAAEC,GAAG,CAAC;AAChD,CAAC;AAAC;AAEK,IAAMgD,wBAAwB,GAAG,SAA3BA,wBAAwB,CAAIR,IAAsC,EAAc;EACzF,OAAOA,IAAI,YAAY1C,qBAAqB;AAChD,CAAC;AAAC"}
@@ -0,0 +1,29 @@
1
+ /// <reference types="react" />
2
+ /// <reference types="web" />
3
+ import { DOMConversionMap, EditorConfig, ElementNode, LexicalNode, NodeKey, ParagraphNode, SerializedElementNode, Spread } from "lexical";
4
+ import { WebinyEditorTheme } from "../themes/webinyLexicalTheme";
5
+ import { QuoteBlockHtmlTag, WebinyThemeNode } from "../types";
6
+ export declare type SerializedWebinyQuoteNode = Spread<{
7
+ tag: QuoteBlockHtmlTag;
8
+ styleId: string;
9
+ type: "webiny-quote";
10
+ version: 1;
11
+ }, SerializedElementNode>;
12
+ export declare class WebinyQuoteNode extends ElementNode implements WebinyThemeNode {
13
+ __themeStyleId: string;
14
+ constructor(themeStyleId?: string, key?: NodeKey);
15
+ getStyleId: () => string;
16
+ static getType(): string;
17
+ getTag(): QuoteBlockHtmlTag;
18
+ static clone(node: WebinyQuoteNode): WebinyQuoteNode;
19
+ addThemeStylesToHTMLElement(element: HTMLElement, theme: WebinyEditorTheme): HTMLElement;
20
+ createDOM(config: EditorConfig): HTMLElement;
21
+ updateDOM(): boolean;
22
+ static importDOM(): DOMConversionMap | null;
23
+ static importJSON(serializedNode: SerializedWebinyQuoteNode): WebinyQuoteNode;
24
+ exportJSON(): SerializedWebinyQuoteNode;
25
+ insertNewAfter(): ParagraphNode;
26
+ collapseAtStart(): true;
27
+ }
28
+ export declare function $createWebinyQuoteNode(themeStyleId?: string, key?: NodeKey): WebinyQuoteNode;
29
+ export declare function $isWebinyQuoteNode(node: LexicalNode | null | undefined): node is WebinyQuoteNode;
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.$createWebinyQuoteNode = $createWebinyQuoteNode;
8
+ exports.$isWebinyQuoteNode = $isWebinyQuoteNode;
9
+ exports.WebinyQuoteNode = void 0;
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
14
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
15
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
16
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
+ var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
18
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
19
+ var _lexical = require("lexical");
20
+ var _styleObjectToString = require("../utils/styleObjectToString");
21
+ var _utils = require("@lexical/utils");
22
+ function convertBlockquoteElement() {
23
+ var node = $createWebinyQuoteNode();
24
+ return {
25
+ node: node
26
+ };
27
+ }
28
+ var QuoteNodeAttrName = "data-quote-style-id";
29
+ var WebinyQuoteNode = /*#__PURE__*/function (_ElementNode) {
30
+ (0, _inherits2.default)(WebinyQuoteNode, _ElementNode);
31
+ var _super = (0, _createSuper2.default)(WebinyQuoteNode);
32
+ function WebinyQuoteNode(themeStyleId, key) {
33
+ var _this;
34
+ (0, _classCallCheck2.default)(this, WebinyQuoteNode);
35
+ _this = _super.call(this, key);
36
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "__themeStyleId", void 0);
37
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getStyleId", function () {
38
+ return _this.__themeStyleId;
39
+ });
40
+ _this.__themeStyleId = themeStyleId || "";
41
+ return _this;
42
+ }
43
+ (0, _createClass2.default)(WebinyQuoteNode, [{
44
+ key: "getTag",
45
+ value: function getTag() {
46
+ return "quoteblock";
47
+ }
48
+ }, {
49
+ key: "addThemeStylesToHTMLElement",
50
+ value: function addThemeStylesToHTMLElement(element, theme) {
51
+ var styles = {};
52
+ var typographyValue = theme !== null && theme !== void 0 && theme.emotionMap ? theme.emotionMap[this.__themeStyleId] : undefined;
53
+ if (this.__themeStyleId && typographyValue) {
54
+ styles = typographyValue.styles;
55
+ (0, _utils.addClassNamesToElement)(element, typographyValue === null || typographyValue === void 0 ? void 0 : typographyValue.className);
56
+ }
57
+ element.setAttribute(QuoteNodeAttrName, this.__themeStyleId || "");
58
+ element.style.cssText = (0, _styleObjectToString.styleObjectToString)(styles);
59
+ return element;
60
+ }
61
+
62
+ // View
63
+ }, {
64
+ key: "createDOM",
65
+ value: function createDOM(config) {
66
+ var element = document.createElement("blockquote");
67
+ (0, _utils.addClassNamesToElement)(element, config.theme.quote);
68
+ this.addThemeStylesToHTMLElement(element, config.theme);
69
+ return element;
70
+ }
71
+ }, {
72
+ key: "updateDOM",
73
+ value: function updateDOM() {
74
+ return false;
75
+ }
76
+ }, {
77
+ key: "exportJSON",
78
+ value: function exportJSON() {
79
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _get2.default)((0, _getPrototypeOf2.default)(WebinyQuoteNode.prototype), "exportJSON", this).call(this)), {}, {
80
+ tag: "quoteblock",
81
+ type: "webiny-quote",
82
+ styleId: this.__themeStyleId,
83
+ version: 1
84
+ });
85
+ }
86
+
87
+ // Mutation
88
+ }, {
89
+ key: "insertNewAfter",
90
+ value: function insertNewAfter() {
91
+ var newBlock = (0, _lexical.$createParagraphNode)();
92
+ var direction = this.getDirection();
93
+ newBlock.setDirection(direction);
94
+ this.insertAfter(newBlock);
95
+ return newBlock;
96
+ }
97
+ }, {
98
+ key: "collapseAtStart",
99
+ value: function collapseAtStart() {
100
+ var paragraph = (0, _lexical.$createParagraphNode)();
101
+ var children = this.getChildren();
102
+ children.forEach(function (child) {
103
+ return paragraph.append(child);
104
+ });
105
+ this.replace(paragraph);
106
+ return true;
107
+ }
108
+ }], [{
109
+ key: "getType",
110
+ value: function getType() {
111
+ return "webiny-quote";
112
+ }
113
+ }, {
114
+ key: "clone",
115
+ value: function clone(node) {
116
+ return new WebinyQuoteNode(node.__themeStyleId, node.__key);
117
+ }
118
+ }, {
119
+ key: "importDOM",
120
+ value: function importDOM() {
121
+ return {
122
+ blockquote: function blockquote() {
123
+ return {
124
+ conversion: convertBlockquoteElement,
125
+ priority: 0
126
+ };
127
+ }
128
+ };
129
+ }
130
+ }, {
131
+ key: "importJSON",
132
+ value: function importJSON(serializedNode) {
133
+ var node = $createWebinyQuoteNode(serializedNode.styleId);
134
+ node.setFormat(serializedNode.format);
135
+ node.setIndent(serializedNode.indent);
136
+ node.setDirection(serializedNode.direction);
137
+ return node;
138
+ }
139
+ }]);
140
+ return WebinyQuoteNode;
141
+ }(_lexical.ElementNode);
142
+ exports.WebinyQuoteNode = WebinyQuoteNode;
143
+ function $createWebinyQuoteNode(themeStyleId, key) {
144
+ return new WebinyQuoteNode(themeStyleId, key);
145
+ }
146
+ function $isWebinyQuoteNode(node) {
147
+ return node instanceof WebinyQuoteNode;
148
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["convertBlockquoteElement","node","$createWebinyQuoteNode","QuoteNodeAttrName","WebinyQuoteNode","themeStyleId","key","__themeStyleId","element","theme","styles","typographyValue","emotionMap","undefined","addClassNamesToElement","className","setAttribute","style","cssText","styleObjectToString","config","document","createElement","quote","addThemeStylesToHTMLElement","tag","type","styleId","version","newBlock","$createParagraphNode","direction","getDirection","setDirection","insertAfter","paragraph","children","getChildren","forEach","child","append","replace","__key","blockquote","conversion","priority","serializedNode","setFormat","format","setIndent","indent","ElementNode","$isWebinyQuoteNode"],"sources":["WebinyQuoteNode.ts"],"sourcesContent":["import {\n $createParagraphNode,\n DOMConversionMap,\n EditorConfig,\n ElementNode,\n LexicalNode,\n NodeKey,\n ParagraphNode,\n SerializedElementNode,\n Spread\n} from \"lexical\";\nimport { WebinyEditorTheme } from \"~/themes/webinyLexicalTheme\";\nimport { styleObjectToString } from \"~/utils/styleObjectToString\";\nimport { QuoteBlockHtmlTag, WebinyThemeNode } from \"~/types\";\nimport { addClassNamesToElement } from \"@lexical/utils\";\nimport { CSSObject } from \"@emotion/react\";\n\nfunction convertBlockquoteElement() {\n const node = $createWebinyQuoteNode();\n return {\n node\n };\n}\n\nconst QuoteNodeAttrName = \"data-quote-style-id\";\n\nexport type SerializedWebinyQuoteNode = Spread<\n {\n tag: QuoteBlockHtmlTag;\n styleId: string;\n type: \"webiny-quote\";\n version: 1;\n },\n SerializedElementNode\n>;\n\nexport class WebinyQuoteNode extends ElementNode implements WebinyThemeNode {\n __themeStyleId: string;\n\n constructor(themeStyleId?: string, key?: NodeKey) {\n super(key);\n this.__themeStyleId = themeStyleId || \"\";\n }\n\n getStyleId = (): string => {\n return this.__themeStyleId;\n };\n\n static override getType(): string {\n return \"webiny-quote\";\n }\n\n getTag(): QuoteBlockHtmlTag {\n return \"quoteblock\";\n }\n\n static override clone(node: WebinyQuoteNode): WebinyQuoteNode {\n return new WebinyQuoteNode(node.__themeStyleId, node.__key);\n }\n\n addThemeStylesToHTMLElement(element: HTMLElement, theme: WebinyEditorTheme): HTMLElement {\n let styles: CSSObject = {};\n const typographyValue = theme?.emotionMap\n ? theme.emotionMap[this.__themeStyleId]\n : undefined;\n if (this.__themeStyleId && typographyValue) {\n styles = typographyValue.styles;\n addClassNamesToElement(element, typographyValue?.className);\n }\n\n element.setAttribute(QuoteNodeAttrName, this.__themeStyleId || \"\");\n element.style.cssText = styleObjectToString(styles);\n return element;\n }\n\n // View\n override createDOM(config: EditorConfig): HTMLElement {\n const element = document.createElement(\"blockquote\");\n addClassNamesToElement(element, config.theme.quote);\n this.addThemeStylesToHTMLElement(element, config.theme);\n return element;\n }\n override updateDOM(): boolean {\n return false;\n }\n\n static importDOM(): DOMConversionMap | null {\n return {\n blockquote: () => ({\n conversion: convertBlockquoteElement,\n priority: 0\n })\n };\n }\n\n static override importJSON(serializedNode: SerializedWebinyQuoteNode): WebinyQuoteNode {\n const node = $createWebinyQuoteNode(serializedNode.styleId);\n node.setFormat(serializedNode.format);\n node.setIndent(serializedNode.indent);\n node.setDirection(serializedNode.direction);\n return node;\n }\n\n override exportJSON(): SerializedWebinyQuoteNode {\n return {\n ...super.exportJSON(),\n tag: \"quoteblock\",\n type: \"webiny-quote\",\n styleId: this.__themeStyleId,\n version: 1\n };\n }\n\n // Mutation\n\n override insertNewAfter(): ParagraphNode {\n const newBlock = $createParagraphNode();\n const direction = this.getDirection();\n newBlock.setDirection(direction);\n this.insertAfter(newBlock);\n return newBlock;\n }\n\n override collapseAtStart(): true {\n const paragraph = $createParagraphNode();\n const children = this.getChildren();\n children.forEach(child => paragraph.append(child));\n this.replace(paragraph);\n return true;\n }\n}\n\nexport function $createWebinyQuoteNode(themeStyleId?: string, key?: NodeKey): WebinyQuoteNode {\n return new WebinyQuoteNode(themeStyleId, key);\n}\n\nexport function $isWebinyQuoteNode(node: LexicalNode | null | undefined): node is WebinyQuoteNode {\n return node instanceof WebinyQuoteNode;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAYA;AAEA;AAGA,SAASA,wBAAwB,GAAG;EAChC,IAAMC,IAAI,GAAGC,sBAAsB,EAAE;EACrC,OAAO;IACHD,IAAI,EAAJA;EACJ,CAAC;AACL;AAEA,IAAME,iBAAiB,GAAG,qBAAqB;AAAC,IAYnCC,eAAe;EAAA;EAAA;EAGxB,yBAAYC,YAAqB,EAAEC,GAAa,EAAE;IAAA;IAAA;IAC9C,0BAAMA,GAAG;IAAE;IAAA,yFAIF,YAAc;MACvB,OAAO,MAAKC,cAAc;IAC9B,CAAC;IALG,MAAKA,cAAc,GAAGF,YAAY,IAAI,EAAE;IAAC;EAC7C;EAAC;IAAA;IAAA,OAUD,kBAA4B;MACxB,OAAO,YAAY;IACvB;EAAC;IAAA;IAAA,OAMD,qCAA4BG,OAAoB,EAAEC,KAAwB,EAAe;MACrF,IAAIC,MAAiB,GAAG,CAAC,CAAC;MAC1B,IAAMC,eAAe,GAAGF,KAAK,aAALA,KAAK,eAALA,KAAK,CAAEG,UAAU,GACnCH,KAAK,CAACG,UAAU,CAAC,IAAI,CAACL,cAAc,CAAC,GACrCM,SAAS;MACf,IAAI,IAAI,CAACN,cAAc,IAAII,eAAe,EAAE;QACxCD,MAAM,GAAGC,eAAe,CAACD,MAAM;QAC/B,IAAAI,6BAAsB,EAACN,OAAO,EAAEG,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAEI,SAAS,CAAC;MAC/D;MAEAP,OAAO,CAACQ,YAAY,CAACb,iB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AAA,OAjFD,mBAAkC;MAC9B,OAAO,cAAc;IACzB;EAAC;IAAA;IAAA,OAMD,eAAsBlC,IAAqB,EAAmB;MAC1D,OAAO,IAAIG,eAAe,CAACH,IAAI,CAACM,cAAc,EAAEN,IAAI,CAACyC,KAAK,CAAC;IAC/D;EAAC;IAAA;IAAA,OA4BD,qBAA4C;MACxC,OAAO;QACHC,UAAU,EAAE;UAAA,OAAO;YACfC,UAAU,EAAE5C,wBAAwB;YACpC6C,QAAQ,EAAE;UACd,CAAC;QAAA;MACL,CAAC;IACL;EAAC;IAAA;IAAA,OAED,oBAA2BC,cAAyC,EAAmB;MACnF,IAAM7C,IAAI,GAAGC,sBAAsB,CAAC4C,cAAc,CAACnB,OAAO,CAAC;MAC3D1B,IAAI,CAAC8C,SAAS,CAACD,cAAc,CAACE,MAAM,CAAC;MACrC/C,IAAI,CAACgD,SAAS,CAACH,cAAc,CAACI,MAAM,CAAC;MACrCjD,IAAI,CAACgC,YAAY,CAACa,cAAc,CAACf,SAAS,CAAC;MAC3C,OAAO9B,IAAI;IACf;EAAC;EAAA;AAAA,EAjEgCkD,oBAAW;AAAA;AAgGzC,SAASjD,sBAAsB,CAACG,YAAqB,EAAEC,GAAa,EAAmB;EAC1F,OAAO,IAAIF,eAAe,CAACC,YAAY,EAAEC,GAAG,CAAC;AACjD;AAEO,SAAS8C,kBAAkB,CAACnD,IAAoC,EAA2B;EAC9F,OAAOA,IAAI,YAAYG,eAAe;AAC1C"}
@@ -0,0 +1,46 @@
1
+ /// <reference types="react" />
2
+ /// <reference types="web" />
3
+ import { DOMConversionMap, EditorConfig, ElementNode, GridSelection, LexicalNode, NodeKey, NodeSelection, ParagraphNode, RangeSelection, SerializedElementNode } from "lexical";
4
+ import { Spread } from "lexical";
5
+ export declare type SerializedWebinyListItemNode = Spread<{
6
+ checked: boolean | undefined;
7
+ type: "webiny-listitem";
8
+ value: number;
9
+ version: 1;
10
+ }, SerializedElementNode>;
11
+ /** @noInheritDoc */
12
+ export declare class WebinyListItemNode extends ElementNode {
13
+ /** @internal */
14
+ __value: number;
15
+ /** @internal */
16
+ __checked?: boolean;
17
+ static getType(): string;
18
+ static clone(node: WebinyListItemNode): WebinyListItemNode;
19
+ constructor(value?: number, checked?: boolean, key?: NodeKey);
20
+ createDOM(config: EditorConfig): HTMLElement;
21
+ updateDOM(prevNode: WebinyListItemNode, dom: HTMLElement, config: EditorConfig): boolean;
22
+ static importDOM(): DOMConversionMap | null;
23
+ static importJSON(serializedNode: SerializedWebinyListItemNode): WebinyListItemNode;
24
+ exportJSON(): SerializedWebinyListItemNode;
25
+ append(...nodes: LexicalNode[]): this;
26
+ replace<N extends LexicalNode>(replaceWithNode: N): N;
27
+ insertAfter(node: LexicalNode): LexicalNode;
28
+ remove(preserveEmptyParent?: boolean): void;
29
+ insertNewAfter(): WebinyListItemNode | ParagraphNode;
30
+ collapseAtStart(selection: RangeSelection): true;
31
+ getValue(): number;
32
+ setValue(value: number): void;
33
+ getChecked(): boolean | undefined;
34
+ setChecked(checked?: boolean): void;
35
+ toggleChecked(): void;
36
+ getIndent(): number;
37
+ setIndent(indent: number): this;
38
+ canIndent(): false;
39
+ insertBefore(nodeToInsert: LexicalNode): LexicalNode;
40
+ canInsertAfter(node: LexicalNode): boolean;
41
+ canReplaceWith(replacement: LexicalNode): boolean;
42
+ canMergeWith(node: LexicalNode): boolean;
43
+ extractWithChild(child: LexicalNode, selection: RangeSelection | NodeSelection | GridSelection): boolean;
44
+ }
45
+ export declare function $createWebinyListItemNode(checked?: boolean): WebinyListItemNode;
46
+ export declare function $isWebinyListItemNode(node: LexicalNode | null | undefined): node is WebinyListItemNode;