@parathantl/react-email-editor 0.1.7 → 0.1.8

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/index.cjs CHANGED
@@ -3078,7 +3078,7 @@ var editor_default = {
3078
3078
 
3079
3079
  // src/components/Toolbar/Toolbar.tsx
3080
3080
  var import_jsx_runtime4 = require("react/jsx-runtime");
3081
- var Toolbar = import_react15.default.memo(function Toolbar2({ sidebarOpen, propertiesOpen, onToggleSidebar, onToggleProperties }) {
3081
+ var Toolbar = import_react15.default.memo(function Toolbar2({ sidebarOpen, propertiesOpen, onToggleSidebar, onToggleProperties, toolbarActions }) {
3082
3082
  const { template, activeTab } = useTemplateContext();
3083
3083
  const { canUndo, canRedo } = useHistoryContext();
3084
3084
  const dispatch = useEditorDispatch();
@@ -3264,6 +3264,7 @@ var Toolbar = import_react15.default.memo(function Toolbar2({ sidebarOpen, prope
3264
3264
  ] })
3265
3265
  ] })
3266
3266
  ] }),
3267
+ toolbarActions && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: `ee-toolbar-actions ${toolbar_default.toolbarGroup}`, children: toolbarActions }),
3267
3268
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3268
3269
  "input",
3269
3270
  {
@@ -25176,12 +25177,12 @@ function preventBlur(e) {
25176
25177
  }
25177
25178
  e.preventDefault();
25178
25179
  }
25179
- function RichTextToolbar({ editor }) {
25180
+ function RichTextToolbar({ editor, defaultFontFamily, defaultFontSize }) {
25180
25181
  if (!editor) return null;
25181
25182
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `ee-richtext-toolbar ${toolbar_default.richTextToolbar}`, onMouseDown: preventBlur, children: [
25182
25183
  /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `ee-richtext-group ${toolbar_default.richTextGroup}`, children: [
25183
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FontFamilySelect, { editor }),
25184
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FontSizeSelect, { editor })
25184
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FontFamilySelect, { editor, defaultFontFamily }),
25185
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FontSizeSelect, { editor, defaultFontSize })
25185
25186
  ] }),
25186
25187
  /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `ee-richtext-group ${toolbar_default.richTextGroup}`, children: [
25187
25188
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Tooltip, { label: "Bold", shortcut: "Ctrl+B", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
@@ -25364,9 +25365,10 @@ function RichTextToolbar({ editor }) {
25364
25365
  ] })
25365
25366
  ] });
25366
25367
  }
25367
- function FontFamilySelect({ editor }) {
25368
+ function FontFamilySelect({ editor, defaultFontFamily }) {
25368
25369
  const { fontFamilies } = useEditorFonts();
25369
- const currentFont = editor.getAttributes("textStyle").fontFamily || "";
25370
+ const inlineFont = editor.getAttributes("textStyle").fontFamily || "";
25371
+ const currentFont = inlineFont || defaultFontFamily || "";
25370
25372
  const fonts = fontFamilies.slice();
25371
25373
  if (currentFont && !fonts.some((f) => f.toLowerCase() === currentFont.toLowerCase())) {
25372
25374
  fonts.push(currentFont);
@@ -25392,9 +25394,10 @@ function FontFamilySelect({ editor }) {
25392
25394
  }
25393
25395
  );
25394
25396
  }
25395
- function FontSizeSelect({ editor }) {
25397
+ function FontSizeSelect({ editor, defaultFontSize }) {
25396
25398
  const { fontSizes } = useEditorFonts();
25397
- const currentSize = editor.getAttributes("textStyle").fontSize || "";
25399
+ const inlineSize = editor.getAttributes("textStyle").fontSize || "";
25400
+ const currentSize = inlineSize || defaultFontSize || "";
25398
25401
  const sizes = fontSizes.slice();
25399
25402
  if (currentSize && !sizes.includes(currentSize)) {
25400
25403
  sizes.push(currentSize);
@@ -25823,7 +25826,14 @@ var TextBlockInner = function TextBlock({ block }) {
25823
25826
  backgroundColor: p.backgroundColor && p.backgroundColor !== "transparent" ? p.backgroundColor : void 0
25824
25827
  }), [p.fontFamily, p.fontSize, p.color, p.lineHeight, p.padding, p.fontWeight, p.textTransform, p.letterSpacing, p.backgroundColor]);
25825
25828
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `ee-block-text ${blocks_default.textBlock}`, ref: wrapperRef, children: [
25826
- isFocused && editorInstance && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: blocks_default.textBlockToolbar, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RichTextToolbar, { editor: editorInstance }) }),
25829
+ isFocused && editorInstance && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: blocks_default.textBlockToolbar, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
25830
+ RichTextToolbar,
25831
+ {
25832
+ editor: editorInstance,
25833
+ defaultFontFamily: p.fontFamily,
25834
+ defaultFontSize: p.fontSize
25835
+ }
25836
+ ) }),
25827
25837
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: wrapperStyle, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
25828
25838
  TipTapEditor,
25829
25839
  {
@@ -29826,7 +29836,8 @@ var EditorInner = (0, import_react61.forwardRef)(function EditorInner2(props, re
29826
29836
  sidebarOpen,
29827
29837
  propertiesOpen,
29828
29838
  onToggleSidebar: toggleSidebar,
29829
- onToggleProperties: toggleProperties
29839
+ onToggleProperties: toggleProperties,
29840
+ toolbarActions: props.toolbarActions
29830
29841
  }
29831
29842
  ),
29832
29843
  /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: editor_default.editorBody, children: [