@brevitaz/brv-text-editor 1.2.1 โ†’ 1.3.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.
package/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  A fully-featured React rich text editor and preview component built on [Tiptap](https://tiptap.dev/) (ProseMirror) + [Lucide React](https://lucide.dev/) icons.
4
4
 
5
- ![Editor](https://raw.githubusercontent.com/brevitaz/react-rich-text-editor/main/screenshots/editor.png)
5
+ ![Editor](https://raw.githubusercontent.com/brevitaz/brv-text-editor/main/screenshots/editor.png)
6
6
 
7
- ![Preview](https://raw.githubusercontent.com/brevitaz/react-rich-text-editor/main/screenshots/preview.png)
7
+ ![Preview](https://raw.githubusercontent.com/brevitaz/brv-text-editor/main/screenshots/preview.png)
8
8
 
9
9
  ---
10
10
 
@@ -119,6 +119,7 @@ function NotesPage() {
119
119
  | `showActions` | `boolean` | `true` | Whether to show the footer Save/Cancel bar |
120
120
  | `minHeight` | `number` | `140` | Minimum editor height in pixels |
121
121
  | `autofocus` | `boolean` | `false` | Whether to focus the editor on mount |
122
+ | `variant` | `string` | `'default'` | `'default'` shows the card border/background; `'bare'` removes them for embedding inside a custom container |
122
123
  | `toolbar` | `object` | `DEFAULT_TOOLBAR` | Toggle toolbar groups (see below) |
123
124
  | `theme` | `string` | `'unleashteams'` | Built-in theme preset |
124
125
  | `themeVars` | `object` | `{}` | CSS variable overrides for custom theming |
@@ -167,6 +168,7 @@ Callouts are stored as `<div data-callout="type">` in the HTML output, so they r
167
168
  | Prop | Type | Default | Description |
168
169
  |---|---|---|---|
169
170
  | `html` | `string` | `''` | Raw HTML string to render |
171
+ | `variant` | `string` | `'default'` | `'default'` shows the card border/shadow/background; `'bare'` removes them and strips side padding for embedding in a custom container |
170
172
  | `showReactions` | `boolean` | `true` | Whether to show the emoji reactions row |
171
173
  | `reactions` | `string[]` | `['๐Ÿ‘','โค๏ธ','๐ŸŽ‰','๐Ÿ™Œ']` | Emoji list for the reactions row |
172
174
  | `theme` | `string` | `'unleashteams'` | Built-in theme preset |
@@ -24409,7 +24409,7 @@ function CalloutDropdown({ editor, onClose }) {
24409
24409
  ))
24410
24410
  );
24411
24411
  }
24412
- function Toolbar({ editor, groups }) {
24412
+ function Toolbar({ editor, groups, bare }) {
24413
24413
  const [showLinkDialog, setShowLinkDialog] = useState(false);
24414
24414
  const [showImageDialog, setShowImageDialog] = useState(false);
24415
24415
  const [showHeadingMenu, setShowHeadingMenu] = useState(false);
@@ -24564,7 +24564,7 @@ function Toolbar({ editor, groups }) {
24564
24564
  padding: "5px 10px",
24565
24565
  borderBottom: "1px solid var(--rte-border-toolbar)",
24566
24566
  background: "var(--rte-surface-toolbar)",
24567
- borderRadius: "calc(var(--rte-radius) - 1px) calc(var(--rte-radius) - 1px) 0 0",
24567
+ borderRadius: bare ? 0 : "calc(var(--rte-radius) - 1px) calc(var(--rte-radius) - 1px) 0 0",
24568
24568
  position: "relative",
24569
24569
  userSelect: "none"
24570
24570
  }
@@ -24572,7 +24572,7 @@ function Toolbar({ editor, groups }) {
24572
24572
  sections
24573
24573
  );
24574
24574
  }
24575
- function EditorFooter({ editor, onSubmit, onCancel, submitLabel, showActions }) {
24575
+ function EditorFooter({ editor, onSubmit, onCancel, submitLabel, showActions, bare }) {
24576
24576
  if (!editor) return null;
24577
24577
  const text = editor.getText();
24578
24578
  const wordCount = text.trim() ? text.trim().split(/\s+/).length : 0;
@@ -24587,7 +24587,7 @@ function EditorFooter({ editor, onSubmit, onCancel, submitLabel, showActions })
24587
24587
  padding: "7px 12px",
24588
24588
  borderTop: "1px solid var(--rte-border-toolbar)",
24589
24589
  background: "var(--rte-surface-toolbar)",
24590
- borderRadius: "0 0 calc(var(--rte-radius) - 1px) calc(var(--rte-radius) - 1px)"
24590
+ borderRadius: bare ? 0 : "0 0 calc(var(--rte-radius) - 1px) calc(var(--rte-radius) - 1px)"
24591
24591
  }
24592
24592
  },
24593
24593
  /* @__PURE__ */ React.createElement("span", { style: { fontSize: 11, color: "var(--rte-text-muted)", fontFamily: "var(--rte-font-family)" } }, wordCount, " word", wordCount !== 1 ? "s" : "", " ยท ", charCount, " char", charCount !== 1 ? "s" : ""),
@@ -24641,6 +24641,7 @@ function RichTextEditor({
24641
24641
  minHeight = 140,
24642
24642
  autofocus = false,
24643
24643
  className = "",
24644
+ variant = "default",
24644
24645
  theme = "unleashteams",
24645
24646
  themeVars = {},
24646
24647
  toolbar = {}
@@ -24700,23 +24701,27 @@ function RichTextEditor({
24700
24701
  });
24701
24702
  const presetVars = RTE_THEMES[theme] ?? {};
24702
24703
  const resolvedVars = { ...presetVars, ...themeVars };
24704
+ const isBare = variant === "bare";
24703
24705
  return /* @__PURE__ */ React.createElement(
24704
24706
  "div",
24705
24707
  {
24706
24708
  className: `rte-root editor-wrapper ${className}`.trim(),
24707
24709
  "data-rte-theme": theme,
24710
+ "data-rte-variant": variant,
24708
24711
  style: {
24709
- border: "1px solid var(--rte-border)",
24710
- borderRadius: "var(--rte-radius)",
24711
- background: "var(--rte-surface)",
24712
+ ...isBare ? {} : {
24713
+ border: "1px solid var(--rte-border)",
24714
+ borderRadius: "var(--rte-radius)",
24715
+ background: "var(--rte-surface)",
24716
+ overflow: "hidden",
24717
+ transition: "box-shadow 0.15s, border-color 0.15s"
24718
+ },
24712
24719
  display: "flex",
24713
24720
  flexDirection: "column",
24714
- overflow: "hidden",
24715
- transition: "box-shadow 0.15s, border-color 0.15s",
24716
24721
  ...resolvedVars
24717
24722
  }
24718
24723
  },
24719
- /* @__PURE__ */ React.createElement(Toolbar, { editor, groups: resolvedToolbar }),
24724
+ /* @__PURE__ */ React.createElement(Toolbar, { editor, groups: resolvedToolbar, bare: isBare }),
24720
24725
  /* @__PURE__ */ React.createElement(
24721
24726
  "div",
24722
24727
  {
@@ -24733,7 +24738,8 @@ function RichTextEditor({
24733
24738
  onSubmit,
24734
24739
  onCancel,
24735
24740
  submitLabel,
24736
- showActions
24741
+ showActions,
24742
+ bare: isBare
24737
24743
  }
24738
24744
  )
24739
24745
  );
@@ -24772,6 +24778,7 @@ function EmojiReaction({ emoji: emoji2 }) {
24772
24778
  }
24773
24779
  function RichTextPreview({
24774
24780
  html = "",
24781
+ variant = "default",
24775
24782
  showReactions = true,
24776
24783
  reactions = ["๐Ÿ‘", "โค๏ธ", "๐ŸŽ‰", "๐Ÿ™Œ"],
24777
24784
  theme = "unleashteams",
@@ -24779,21 +24786,25 @@ function RichTextPreview({
24779
24786
  }) {
24780
24787
  const presetVars = RTE_THEMES[theme] ?? {};
24781
24788
  const resolvedVars = { ...presetVars, ...themeVars };
24789
+ const isBare = variant === "bare";
24782
24790
  return /* @__PURE__ */ React.createElement(
24783
24791
  "div",
24784
24792
  {
24785
24793
  className: "rte-root",
24786
24794
  "data-rte-theme": theme,
24795
+ "data-rte-variant": variant,
24787
24796
  style: {
24788
24797
  width: "100%",
24789
- maxWidth: 720,
24790
- marginTop: 20,
24791
- background: "var(--rte-surface)",
24792
- borderRadius: "var(--rte-radius-lg)",
24793
- boxShadow: "0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04)",
24794
- overflow: "hidden",
24795
- animation: "rtp-slideDown 0.22s ease",
24796
- border: "1px solid var(--rte-border)",
24798
+ ...isBare ? {} : {
24799
+ maxWidth: 720,
24800
+ marginTop: 20,
24801
+ background: "var(--rte-surface)",
24802
+ borderRadius: "var(--rte-radius-lg)",
24803
+ boxShadow: "0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04)",
24804
+ overflow: "hidden",
24805
+ animation: "rtp-slideDown 0.22s ease",
24806
+ border: "1px solid var(--rte-border)"
24807
+ },
24797
24808
  ...resolvedVars
24798
24809
  }
24799
24810
  },
@@ -24802,7 +24813,7 @@ function RichTextPreview({
24802
24813
  {
24803
24814
  className: "rtp-content",
24804
24815
  dangerouslySetInnerHTML: { __html: html },
24805
- style: { padding: "14px 22px 20px" }
24816
+ style: { padding: isBare ? "0" : "14px 22px 20px" }
24806
24817
  }
24807
24818
  ),
24808
24819
  showReactions && reactions.length > 0 && /* @__PURE__ */ React.createElement(