@rufous/ui 0.1.92 → 0.1.94

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/main.cjs CHANGED
@@ -28732,6 +28732,7 @@ __export(main_exports, {
28732
28732
  RufousBirdIcon: () => rufousBirdIcon_default,
28733
28733
  RufousLauncherIcon: () => rufousLauncherBird_default,
28734
28734
  RufousLogoLoader: () => RufousLogoLoader,
28735
+ RufousTextContent: () => RufousTextContent,
28735
28736
  RufousTextEditor: () => RufousTextEditor,
28736
28737
  RufousThemeProvider: () => RufousThemeProvider,
28737
28738
  Select: () => Select,
@@ -49677,20 +49678,29 @@ function createSpellCheckPlugin() {
49677
49678
  let debounceTimer = null;
49678
49679
  let viewRef = null;
49679
49680
  const runCheck = (view) => {
49680
- if (!typo || !view.dom?.isConnected) return;
49681
- const { doc: doc3 } = view.state;
49682
- const misspelled = findMisspelled(doc3);
49683
- const decos = misspelled.map(
49684
- ({ from, to, word }) => Decoration.inline(from, to, {
49685
- class: "rf-spell-error",
49686
- nodeName: "span",
49687
- "data-spell-word": word
49688
- })
49689
- );
49690
- const decorationSet = DecorationSet.create(doc3, decos);
49691
- const tr = view.state.tr.setMeta(spellCheckPluginKey, { decorations: decorationSet });
49692
- tr.setMeta("addToHistory", false);
49693
- view.dispatch(tr);
49681
+ try {
49682
+ if (!typo || !view?.dom?.isConnected || !view.state) return;
49683
+ const { doc: doc3 } = view.state;
49684
+ if (!doc3 || doc3.content.size <= 4) {
49685
+ const tr2 = view.state.tr.setMeta(spellCheckPluginKey, { decorations: DecorationSet.empty });
49686
+ tr2.setMeta("addToHistory", false);
49687
+ view.dispatch(tr2);
49688
+ return;
49689
+ }
49690
+ const misspelled = findMisspelled(doc3);
49691
+ const decos = misspelled.map(
49692
+ ({ from, to, word }) => Decoration.inline(from, to, {
49693
+ class: "rf-spell-error",
49694
+ nodeName: "span",
49695
+ "data-spell-word": word
49696
+ })
49697
+ );
49698
+ const decorationSet = DecorationSet.create(doc3, decos);
49699
+ const tr = view.state.tr.setMeta(spellCheckPluginKey, { decorations: decorationSet });
49700
+ tr.setMeta("addToHistory", false);
49701
+ view.dispatch(tr);
49702
+ } catch {
49703
+ }
49694
49704
  };
49695
49705
  const scheduleCheck = (view) => {
49696
49706
  if (debounceTimer) clearTimeout(debounceTimer);
@@ -49702,16 +49712,33 @@ function createSpellCheckPlugin() {
49702
49712
  init() {
49703
49713
  return DecorationSet.empty;
49704
49714
  },
49705
- apply(tr, oldDecos) {
49715
+ apply(tr, oldDecos, _oldState, newState) {
49706
49716
  const meta = tr.getMeta(spellCheckPluginKey);
49707
49717
  if (meta?.decorations) return meta.decorations;
49708
- if (tr.docChanged) return oldDecos.map(tr.mapping, tr.doc);
49718
+ if (tr.docChanged) {
49719
+ if (newState.doc.content.size <= 4) return DecorationSet.empty;
49720
+ if (oldDecos === DecorationSet.empty) return DecorationSet.empty;
49721
+ try {
49722
+ const mapped = oldDecos.map(tr.mapping, tr.doc);
49723
+ if (!mapped || typeof mapped.find !== "function") return DecorationSet.empty;
49724
+ return mapped;
49725
+ } catch {
49726
+ return DecorationSet.empty;
49727
+ }
49728
+ }
49709
49729
  return oldDecos;
49710
49730
  }
49711
49731
  },
49712
49732
  props: {
49713
49733
  decorations(state) {
49714
- return spellCheckPluginKey.getState(state);
49734
+ try {
49735
+ const decos = spellCheckPluginKey.getState(state);
49736
+ if (!decos || decos === DecorationSet.empty) return DecorationSet.empty;
49737
+ decos.find();
49738
+ return decos;
49739
+ } catch {
49740
+ return DecorationSet.empty;
49741
+ }
49715
49742
  }
49716
49743
  },
49717
49744
  view(editorView) {
@@ -49855,6 +49882,14 @@ var RufousTextEditor = ({
49855
49882
  style
49856
49883
  }) => {
49857
49884
  const mentionSuggestion = (0, import_react60.useMemo)(() => createMentionSuggestion(mentions), [mentions]);
49885
+ const onChangeRef = (0, import_react60.useRef)(onChange);
49886
+ const onBlurRef = (0, import_react60.useRef)(onBlur);
49887
+ (0, import_react60.useEffect)(() => {
49888
+ onChangeRef.current = onChange;
49889
+ }, [onChange]);
49890
+ (0, import_react60.useEffect)(() => {
49891
+ onBlurRef.current = onBlur;
49892
+ }, [onBlur]);
49858
49893
  const editor = (0, import_react61.useEditor)({
49859
49894
  editable,
49860
49895
  extensions: [
@@ -49944,16 +49979,19 @@ var RufousTextEditor = ({
49944
49979
  },
49945
49980
  content: initialContent || "",
49946
49981
  onUpdate: ({ editor: e }) => {
49947
- if (onChange) {
49948
- onChange(e.getHTML(), e.getJSON());
49949
- }
49950
- },
49951
- onBlur: ({ editor: e }) => {
49952
- if (onBlur) {
49953
- onBlur(e.getHTML(), e.getJSON());
49954
- }
49982
+ onChangeRef.current?.(e.getHTML(), e.getJSON());
49955
49983
  }
49956
49984
  });
49985
+ (0, import_react60.useEffect)(() => {
49986
+ if (!editor) return;
49987
+ const handler = () => {
49988
+ onBlurRef.current?.(editor.getHTML(), editor.getJSON());
49989
+ };
49990
+ editor.on("blur", handler);
49991
+ return () => {
49992
+ editor.off("blur", handler);
49993
+ };
49994
+ }, [editor]);
49957
49995
  const [linkModalOpen, setLinkModalOpen] = (0, import_react60.useState)(false);
49958
49996
  const [linkUrl, setLinkUrl] = (0, import_react60.useState)("");
49959
49997
  const [linkText, setLinkText] = (0, import_react60.useState)("");
@@ -50234,6 +50272,14 @@ var RufousTextEditor = ({
50234
50272
  }
50235
50273
  ), "No follow"))), /* @__PURE__ */ import_react60.default.createElement("div", { className: "link-modal-footer" }, /* @__PURE__ */ import_react60.default.createElement("button", { className: "link-modal-btn-unlink", onClick: handleLinkRemove }, "Unlink"), /* @__PURE__ */ import_react60.default.createElement("button", { className: "link-modal-btn-apply", onClick: handleLinkSubmit }, "Update"))))));
50236
50274
  };
50275
+ var RufousTextContent = ({ content, className, style }) => /* @__PURE__ */ import_react60.default.createElement(
50276
+ "div",
50277
+ {
50278
+ className: `rf-rte-content ${className || ""}`,
50279
+ style,
50280
+ dangerouslySetInnerHTML: { __html: content }
50281
+ }
50282
+ );
50237
50283
  // Annotate the CommonJS export names for ESM import in node:
50238
50284
  0 && (module.exports = {
50239
50285
  APP_THEMES,
@@ -50333,6 +50379,7 @@ var RufousTextEditor = ({
50333
50379
  RufousBirdIcon,
50334
50380
  RufousLauncherIcon,
50335
50381
  RufousLogoLoader,
50382
+ RufousTextContent,
50336
50383
  RufousTextEditor,
50337
50384
  RufousThemeProvider,
50338
50385
  Select,
package/dist/main.css CHANGED
@@ -16289,6 +16289,178 @@ svg.jodit-icon {
16289
16289
  background: #f3f4f6;
16290
16290
  color: #374151;
16291
16291
  }
16292
+ .rf-rte-content {
16293
+ font-size: 16px;
16294
+ line-height: 1.75;
16295
+ color: #1e293b;
16296
+ text-align: left;
16297
+ word-wrap: break-word;
16298
+ overflow-wrap: break-word;
16299
+ }
16300
+ .rf-rte-content h1 {
16301
+ font-size: 2em;
16302
+ font-weight: 700;
16303
+ margin: 1em 0 0.4em;
16304
+ line-height: 1.2;
16305
+ }
16306
+ .rf-rte-content h2 {
16307
+ font-size: 1.5em;
16308
+ font-weight: 600;
16309
+ margin: 0.8em 0 0.4em;
16310
+ line-height: 1.3;
16311
+ }
16312
+ .rf-rte-content h3 {
16313
+ font-size: 1.25em;
16314
+ font-weight: 600;
16315
+ margin: 0.6em 0 0.3em;
16316
+ line-height: 1.4;
16317
+ }
16318
+ .rf-rte-content h4 {
16319
+ font-size: 1.1em;
16320
+ font-weight: 600;
16321
+ margin: 0.5em 0 0.25em;
16322
+ }
16323
+ .rf-rte-content h5 {
16324
+ font-size: 1em;
16325
+ font-weight: 600;
16326
+ margin: 0.5em 0 0.25em;
16327
+ }
16328
+ .rf-rte-content h6 {
16329
+ font-size: 0.9em;
16330
+ font-weight: 600;
16331
+ margin: 0.5em 0 0.25em;
16332
+ text-transform: uppercase;
16333
+ letter-spacing: 0.05em;
16334
+ }
16335
+ .rf-rte-content p {
16336
+ margin: 0.5em 0;
16337
+ }
16338
+ .rf-rte-content ul,
16339
+ .rf-rte-content ol {
16340
+ padding-left: 24px;
16341
+ margin: 0.5em 0;
16342
+ }
16343
+ .rf-rte-content li {
16344
+ margin: 0.25em 0;
16345
+ }
16346
+ .rf-rte-content ul[data-type=taskList] {
16347
+ list-style: none;
16348
+ padding-left: 24px;
16349
+ }
16350
+ .rf-rte-content ul[data-type=taskList] li {
16351
+ display: flex;
16352
+ align-items: flex-start;
16353
+ gap: 8px;
16354
+ margin: 4px 0;
16355
+ }
16356
+ .rf-rte-content blockquote {
16357
+ border-left: 3px solid #6366f1;
16358
+ margin: 0.8em 0;
16359
+ padding: 0.4em 0 0.4em 16px;
16360
+ color: #4b5563;
16361
+ background: #f9fafb;
16362
+ border-radius: 0 4px 4px 0;
16363
+ }
16364
+ .rf-rte-content code {
16365
+ background: #f3f4f6;
16366
+ border-radius: 4px;
16367
+ padding: 2px 6px;
16368
+ font-size: 0.9em;
16369
+ color: #e11d48;
16370
+ font-family:
16371
+ "Fira Code",
16372
+ "Consolas",
16373
+ monospace;
16374
+ }
16375
+ .rf-rte-content pre {
16376
+ background: #1e1e2e;
16377
+ color: #cdd6f4;
16378
+ border-radius: 8px;
16379
+ padding: 16px;
16380
+ margin: 0.8em 0;
16381
+ overflow-x: auto;
16382
+ }
16383
+ .rf-rte-content pre code {
16384
+ background: none;
16385
+ color: inherit;
16386
+ padding: 0;
16387
+ font-size: 0.9em;
16388
+ }
16389
+ .rf-rte-content hr {
16390
+ border: none;
16391
+ border-top: 2px solid #e5e7eb;
16392
+ margin: 1.5em 0;
16393
+ }
16394
+ .rf-rte-content strong {
16395
+ font-weight: 700;
16396
+ }
16397
+ .rf-rte-content em {
16398
+ font-style: italic;
16399
+ }
16400
+ .rf-rte-content s {
16401
+ text-decoration: line-through;
16402
+ color: #9ca3af;
16403
+ }
16404
+ .rf-rte-content u {
16405
+ text-decoration: underline;
16406
+ }
16407
+ .rf-rte-content mark {
16408
+ border-radius: 2px;
16409
+ padding: 1px 2px;
16410
+ }
16411
+ .rf-rte-content table {
16412
+ border-collapse: collapse;
16413
+ width: 100%;
16414
+ margin: 0.8em 0;
16415
+ overflow: hidden;
16416
+ border-radius: 4px;
16417
+ }
16418
+ .rf-rte-content table td,
16419
+ .rf-rte-content table th {
16420
+ border: 1px solid #d1d5db;
16421
+ padding: 8px 12px;
16422
+ min-width: 80px;
16423
+ vertical-align: top;
16424
+ }
16425
+ .rf-rte-content table th {
16426
+ background: #f3f4f6;
16427
+ font-weight: 600;
16428
+ text-align: left;
16429
+ }
16430
+ .rf-rte-content img {
16431
+ max-width: 100%;
16432
+ height: auto;
16433
+ border-radius: 8px;
16434
+ margin: 0.8em 0;
16435
+ }
16436
+ .rf-rte-content video {
16437
+ max-width: 100%;
16438
+ }
16439
+ .rf-rte-content div[data-youtube-video] {
16440
+ margin: 0.8em 0;
16441
+ }
16442
+ .rf-rte-content div[data-youtube-video] iframe {
16443
+ border-radius: 8px;
16444
+ max-width: 100%;
16445
+ }
16446
+ .rf-rte-content .editor-link {
16447
+ color: #6366f1;
16448
+ text-decoration: underline;
16449
+ text-underline-offset: 2px;
16450
+ cursor: pointer;
16451
+ }
16452
+ .rf-rte-content .editor-link:hover {
16453
+ color: #4f46e5;
16454
+ }
16455
+ .rf-rte-content .mention {
16456
+ background: #fef2f2;
16457
+ color: #991b1b;
16458
+ border-radius: 4px;
16459
+ padding: 1px 4px;
16460
+ font-weight: 600;
16461
+ font-size: 0.95em;
16462
+ white-space: nowrap;
16463
+ }
16292
16464
  /*! Bundled license information:
16293
16465
 
16294
16466
  jodit/es5/jodit.min.css:
package/dist/main.d.cts CHANGED
@@ -1699,6 +1699,12 @@ interface RufousTextEditorProps {
1699
1699
  style?: React__default.CSSProperties;
1700
1700
  }
1701
1701
  declare const RufousTextEditor: React__default.FC<RufousTextEditorProps>;
1702
+ interface RufousTextContentProps {
1703
+ content: string;
1704
+ className?: string;
1705
+ style?: React__default.CSSProperties;
1706
+ }
1707
+ declare const RufousTextContent: React__default.FC<RufousTextContentProps>;
1702
1708
 
1703
1709
  interface MentionItemData {
1704
1710
  id: string;
@@ -1706,4 +1712,4 @@ interface MentionItemData {
1706
1712
  avatar?: string;
1707
1713
  }
1708
1714
 
1709
- export { APP_THEMES, Accordion, AccordionDetails, type AccordionDetailsProps, type AccordionProps, AccordionSummary, type AccordionSummaryProps, type Action, ActivateUserIcon, AddButton, AddressLookup, ArchivedIcon, AssignGroupIcon, Autocomplete, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, BaseDialog, Box, type BoxProps, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, CameraIcon, CancelButton, Card, CardActions, type CardActionsProps, CardContent, type CardContentProps, CardHeader, type CardHeaderProps, CardMedia, type CardMediaProps, type CardProps, Checkbox, type CheckboxProps, Chip, type ChipProps, CircularProgress, CircularProgressIcon, type CircularProgressIconProps, CloseIcon, Collapse, type CollapseProps, type Column, CopyIcon, DataGrid, type DataGridProps, DateField, type DateFieldProps, type DateFormatString, DateRangeField, type DateRangeFieldProps, type DateRangeValue, DifficultyAllIcon, DifficultyEasyIcon, DifficultyHardIcon, DifficultyMediumIcon, Divider, type DividerProps, DollarIcon, DownloadIcon, DownloadPdfIcon, Drawer, type DrawerProps, EditChatIcon, EditIcon, EngagementIcon, Fade, type FadeProps, FunctionIcon, Grid, type GridProps, Grow, type GrowProps, HelpOutlinedIcon, HierarchyIcon, IconButton, type IconButtonProps, ImageField, type ImageFieldProps, InactiveGroupIcon, IndustryIcon, InvoiceIcon, Link, type LinkProps, List, ListItem, ListItemButton, type ListItemButtonProps, ListItemIcon, type ListItemIconProps, type ListItemProps, ListItemText, type ListItemTextProps, type ListProps, ListSubheader, type ListSubheaderProps, LocationPinIcon, LogsIcon, type MentionItem, Menu, MenuDivider, MenuItem, type MenuItemProps, MenuList, type MenuListProps, type MenuProps, MinExperienceIcon, NineDotMenuIcon, NotificationIcon, Paper, type PaperProps, PhoneField, type PhoneFieldProps, Popover, type PopoverProps, Popper, type PopperProps, ProjectIcon, QualificationsIcon, QuestionStatusAllIcon, QuestionStatusPrivateIcon, QuestionStatusPublicIcon, QuestionTypeAllIcon, QuestionTypeCodingIcon, QuestionTypeDescriptiveIcon, QuestionTypeMultipleIcon, QuestionTypeSingleIcon, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Rating, type RatingProps, RefreshIcon, ResendInviteIcon, RichTextEditor, type RichTextEditorProps, RolesIcon, RufousAiIcon, RufousBirdIcon, RufousLauncherIcon, RufousLogoLoader, type RufousLogoLoaderProps, RufousTextEditor, type MentionItemData as RufousTextEditorMentionItem, type RufousTextEditorProps, RufousThemeProvider, Select, type SelectProps, SidebarIcon, Skeleton, type SkeletonProps, Slide, type SlideProps, Slider, type SliderProps, Snackbar, type SnackbarProps, SoftSkillsIcon, type SortDirection, Stack, type StackProps, StandardButton, Step, StepButton, type StepButtonProps, StepContent, type StepContentProps, StepLabel, type StepLabelProps, type StepProps, Stepper, type StepperProps, SubmitButton, SubscribeIcon, SuspendUserIcon, Switch, type SwitchProps, type SxProp, Tab, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, TechnicalSkillsIcon, TextField, type TextFieldProps, TickIcon, TimerIcon, ToggleButton, ToggleButtonGroup, type ToggleButtonGroupProps, type ToggleButtonProps, Tooltip, type TooltipProps, TrashIcon, Typography, type TypographyProps, UnArchivedIcon, UnsubscribeIcon, UploadIcon, UserAssignIcon, ViewIcon, WorkItemIcon, Zoom, type ZoomProps, useRufousTheme };
1715
+ export { APP_THEMES, Accordion, AccordionDetails, type AccordionDetailsProps, type AccordionProps, AccordionSummary, type AccordionSummaryProps, type Action, ActivateUserIcon, AddButton, AddressLookup, ArchivedIcon, AssignGroupIcon, Autocomplete, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, BaseDialog, Box, type BoxProps, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, CameraIcon, CancelButton, Card, CardActions, type CardActionsProps, CardContent, type CardContentProps, CardHeader, type CardHeaderProps, CardMedia, type CardMediaProps, type CardProps, Checkbox, type CheckboxProps, Chip, type ChipProps, CircularProgress, CircularProgressIcon, type CircularProgressIconProps, CloseIcon, Collapse, type CollapseProps, type Column, CopyIcon, DataGrid, type DataGridProps, DateField, type DateFieldProps, type DateFormatString, DateRangeField, type DateRangeFieldProps, type DateRangeValue, DifficultyAllIcon, DifficultyEasyIcon, DifficultyHardIcon, DifficultyMediumIcon, Divider, type DividerProps, DollarIcon, DownloadIcon, DownloadPdfIcon, Drawer, type DrawerProps, EditChatIcon, EditIcon, EngagementIcon, Fade, type FadeProps, FunctionIcon, Grid, type GridProps, Grow, type GrowProps, HelpOutlinedIcon, HierarchyIcon, IconButton, type IconButtonProps, ImageField, type ImageFieldProps, InactiveGroupIcon, IndustryIcon, InvoiceIcon, Link, type LinkProps, List, ListItem, ListItemButton, type ListItemButtonProps, ListItemIcon, type ListItemIconProps, type ListItemProps, ListItemText, type ListItemTextProps, type ListProps, ListSubheader, type ListSubheaderProps, LocationPinIcon, LogsIcon, type MentionItem, Menu, MenuDivider, MenuItem, type MenuItemProps, MenuList, type MenuListProps, type MenuProps, MinExperienceIcon, NineDotMenuIcon, NotificationIcon, Paper, type PaperProps, PhoneField, type PhoneFieldProps, Popover, type PopoverProps, Popper, type PopperProps, ProjectIcon, QualificationsIcon, QuestionStatusAllIcon, QuestionStatusPrivateIcon, QuestionStatusPublicIcon, QuestionTypeAllIcon, QuestionTypeCodingIcon, QuestionTypeDescriptiveIcon, QuestionTypeMultipleIcon, QuestionTypeSingleIcon, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Rating, type RatingProps, RefreshIcon, ResendInviteIcon, RichTextEditor, type RichTextEditorProps, RolesIcon, RufousAiIcon, RufousBirdIcon, RufousLauncherIcon, RufousLogoLoader, type RufousLogoLoaderProps, RufousTextContent, type RufousTextContentProps, RufousTextEditor, type MentionItemData as RufousTextEditorMentionItem, type RufousTextEditorProps, RufousThemeProvider, Select, type SelectProps, SidebarIcon, Skeleton, type SkeletonProps, Slide, type SlideProps, Slider, type SliderProps, Snackbar, type SnackbarProps, SoftSkillsIcon, type SortDirection, Stack, type StackProps, StandardButton, Step, StepButton, type StepButtonProps, StepContent, type StepContentProps, StepLabel, type StepLabelProps, type StepProps, Stepper, type StepperProps, SubmitButton, SubscribeIcon, SuspendUserIcon, Switch, type SwitchProps, type SxProp, Tab, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, TechnicalSkillsIcon, TextField, type TextFieldProps, TickIcon, TimerIcon, ToggleButton, ToggleButtonGroup, type ToggleButtonGroupProps, type ToggleButtonProps, Tooltip, type TooltipProps, TrashIcon, Typography, type TypographyProps, UnArchivedIcon, UnsubscribeIcon, UploadIcon, UserAssignIcon, ViewIcon, WorkItemIcon, Zoom, type ZoomProps, useRufousTheme };
package/dist/main.d.ts CHANGED
@@ -1699,6 +1699,12 @@ interface RufousTextEditorProps {
1699
1699
  style?: React__default.CSSProperties;
1700
1700
  }
1701
1701
  declare const RufousTextEditor: React__default.FC<RufousTextEditorProps>;
1702
+ interface RufousTextContentProps {
1703
+ content: string;
1704
+ className?: string;
1705
+ style?: React__default.CSSProperties;
1706
+ }
1707
+ declare const RufousTextContent: React__default.FC<RufousTextContentProps>;
1702
1708
 
1703
1709
  interface MentionItemData {
1704
1710
  id: string;
@@ -1706,4 +1712,4 @@ interface MentionItemData {
1706
1712
  avatar?: string;
1707
1713
  }
1708
1714
 
1709
- export { APP_THEMES, Accordion, AccordionDetails, type AccordionDetailsProps, type AccordionProps, AccordionSummary, type AccordionSummaryProps, type Action, ActivateUserIcon, AddButton, AddressLookup, ArchivedIcon, AssignGroupIcon, Autocomplete, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, BaseDialog, Box, type BoxProps, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, CameraIcon, CancelButton, Card, CardActions, type CardActionsProps, CardContent, type CardContentProps, CardHeader, type CardHeaderProps, CardMedia, type CardMediaProps, type CardProps, Checkbox, type CheckboxProps, Chip, type ChipProps, CircularProgress, CircularProgressIcon, type CircularProgressIconProps, CloseIcon, Collapse, type CollapseProps, type Column, CopyIcon, DataGrid, type DataGridProps, DateField, type DateFieldProps, type DateFormatString, DateRangeField, type DateRangeFieldProps, type DateRangeValue, DifficultyAllIcon, DifficultyEasyIcon, DifficultyHardIcon, DifficultyMediumIcon, Divider, type DividerProps, DollarIcon, DownloadIcon, DownloadPdfIcon, Drawer, type DrawerProps, EditChatIcon, EditIcon, EngagementIcon, Fade, type FadeProps, FunctionIcon, Grid, type GridProps, Grow, type GrowProps, HelpOutlinedIcon, HierarchyIcon, IconButton, type IconButtonProps, ImageField, type ImageFieldProps, InactiveGroupIcon, IndustryIcon, InvoiceIcon, Link, type LinkProps, List, ListItem, ListItemButton, type ListItemButtonProps, ListItemIcon, type ListItemIconProps, type ListItemProps, ListItemText, type ListItemTextProps, type ListProps, ListSubheader, type ListSubheaderProps, LocationPinIcon, LogsIcon, type MentionItem, Menu, MenuDivider, MenuItem, type MenuItemProps, MenuList, type MenuListProps, type MenuProps, MinExperienceIcon, NineDotMenuIcon, NotificationIcon, Paper, type PaperProps, PhoneField, type PhoneFieldProps, Popover, type PopoverProps, Popper, type PopperProps, ProjectIcon, QualificationsIcon, QuestionStatusAllIcon, QuestionStatusPrivateIcon, QuestionStatusPublicIcon, QuestionTypeAllIcon, QuestionTypeCodingIcon, QuestionTypeDescriptiveIcon, QuestionTypeMultipleIcon, QuestionTypeSingleIcon, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Rating, type RatingProps, RefreshIcon, ResendInviteIcon, RichTextEditor, type RichTextEditorProps, RolesIcon, RufousAiIcon, RufousBirdIcon, RufousLauncherIcon, RufousLogoLoader, type RufousLogoLoaderProps, RufousTextEditor, type MentionItemData as RufousTextEditorMentionItem, type RufousTextEditorProps, RufousThemeProvider, Select, type SelectProps, SidebarIcon, Skeleton, type SkeletonProps, Slide, type SlideProps, Slider, type SliderProps, Snackbar, type SnackbarProps, SoftSkillsIcon, type SortDirection, Stack, type StackProps, StandardButton, Step, StepButton, type StepButtonProps, StepContent, type StepContentProps, StepLabel, type StepLabelProps, type StepProps, Stepper, type StepperProps, SubmitButton, SubscribeIcon, SuspendUserIcon, Switch, type SwitchProps, type SxProp, Tab, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, TechnicalSkillsIcon, TextField, type TextFieldProps, TickIcon, TimerIcon, ToggleButton, ToggleButtonGroup, type ToggleButtonGroupProps, type ToggleButtonProps, Tooltip, type TooltipProps, TrashIcon, Typography, type TypographyProps, UnArchivedIcon, UnsubscribeIcon, UploadIcon, UserAssignIcon, ViewIcon, WorkItemIcon, Zoom, type ZoomProps, useRufousTheme };
1715
+ export { APP_THEMES, Accordion, AccordionDetails, type AccordionDetailsProps, type AccordionProps, AccordionSummary, type AccordionSummaryProps, type Action, ActivateUserIcon, AddButton, AddressLookup, ArchivedIcon, AssignGroupIcon, Autocomplete, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, BaseDialog, Box, type BoxProps, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, CameraIcon, CancelButton, Card, CardActions, type CardActionsProps, CardContent, type CardContentProps, CardHeader, type CardHeaderProps, CardMedia, type CardMediaProps, type CardProps, Checkbox, type CheckboxProps, Chip, type ChipProps, CircularProgress, CircularProgressIcon, type CircularProgressIconProps, CloseIcon, Collapse, type CollapseProps, type Column, CopyIcon, DataGrid, type DataGridProps, DateField, type DateFieldProps, type DateFormatString, DateRangeField, type DateRangeFieldProps, type DateRangeValue, DifficultyAllIcon, DifficultyEasyIcon, DifficultyHardIcon, DifficultyMediumIcon, Divider, type DividerProps, DollarIcon, DownloadIcon, DownloadPdfIcon, Drawer, type DrawerProps, EditChatIcon, EditIcon, EngagementIcon, Fade, type FadeProps, FunctionIcon, Grid, type GridProps, Grow, type GrowProps, HelpOutlinedIcon, HierarchyIcon, IconButton, type IconButtonProps, ImageField, type ImageFieldProps, InactiveGroupIcon, IndustryIcon, InvoiceIcon, Link, type LinkProps, List, ListItem, ListItemButton, type ListItemButtonProps, ListItemIcon, type ListItemIconProps, type ListItemProps, ListItemText, type ListItemTextProps, type ListProps, ListSubheader, type ListSubheaderProps, LocationPinIcon, LogsIcon, type MentionItem, Menu, MenuDivider, MenuItem, type MenuItemProps, MenuList, type MenuListProps, type MenuProps, MinExperienceIcon, NineDotMenuIcon, NotificationIcon, Paper, type PaperProps, PhoneField, type PhoneFieldProps, Popover, type PopoverProps, Popper, type PopperProps, ProjectIcon, QualificationsIcon, QuestionStatusAllIcon, QuestionStatusPrivateIcon, QuestionStatusPublicIcon, QuestionTypeAllIcon, QuestionTypeCodingIcon, QuestionTypeDescriptiveIcon, QuestionTypeMultipleIcon, QuestionTypeSingleIcon, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Rating, type RatingProps, RefreshIcon, ResendInviteIcon, RichTextEditor, type RichTextEditorProps, RolesIcon, RufousAiIcon, RufousBirdIcon, RufousLauncherIcon, RufousLogoLoader, type RufousLogoLoaderProps, RufousTextContent, type RufousTextContentProps, RufousTextEditor, type MentionItemData as RufousTextEditorMentionItem, type RufousTextEditorProps, RufousThemeProvider, Select, type SelectProps, SidebarIcon, Skeleton, type SkeletonProps, Slide, type SlideProps, Slider, type SliderProps, Snackbar, type SnackbarProps, SoftSkillsIcon, type SortDirection, Stack, type StackProps, StandardButton, Step, StepButton, type StepButtonProps, StepContent, type StepContentProps, StepLabel, type StepLabelProps, type StepProps, Stepper, type StepperProps, SubmitButton, SubscribeIcon, SuspendUserIcon, Switch, type SwitchProps, type SxProp, Tab, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, TechnicalSkillsIcon, TextField, type TextFieldProps, TickIcon, TimerIcon, ToggleButton, ToggleButtonGroup, type ToggleButtonGroupProps, type ToggleButtonProps, Tooltip, type TooltipProps, TrashIcon, Typography, type TypographyProps, UnArchivedIcon, UnsubscribeIcon, UploadIcon, UserAssignIcon, ViewIcon, WorkItemIcon, Zoom, type ZoomProps, useRufousTheme };
package/dist/main.js CHANGED
@@ -8721,7 +8721,7 @@ var PhoneField = forwardRef10(function PhoneField2(props, ref) {
8721
8721
  PhoneField.displayName = "PhoneField";
8722
8722
 
8723
8723
  // lib/RufousTextEditor/RufousTextEditor.tsx
8724
- import React117, { useMemo as useMemo4, useCallback as useCallback14, useState as useState35 } from "react";
8724
+ import React117, { useMemo as useMemo4, useCallback as useCallback14, useState as useState35, useRef as useRef31, useEffect as useEffect28 } from "react";
8725
8725
  import { useEditor, EditorContent, EditorContext, FloatingMenu, BubbleMenu } from "@tiptap/react";
8726
8726
  import StarterKit from "@tiptap/starter-kit";
8727
8727
  import Placeholder from "@tiptap/extension-placeholder";
@@ -21008,20 +21008,29 @@ function createSpellCheckPlugin() {
21008
21008
  let debounceTimer = null;
21009
21009
  let viewRef = null;
21010
21010
  const runCheck = (view) => {
21011
- if (!typo || !view.dom?.isConnected) return;
21012
- const { doc: doc3 } = view.state;
21013
- const misspelled = findMisspelled(doc3);
21014
- const decos = misspelled.map(
21015
- ({ from, to, word }) => Decoration.inline(from, to, {
21016
- class: "rf-spell-error",
21017
- nodeName: "span",
21018
- "data-spell-word": word
21019
- })
21020
- );
21021
- const decorationSet = DecorationSet.create(doc3, decos);
21022
- const tr = view.state.tr.setMeta(spellCheckPluginKey, { decorations: decorationSet });
21023
- tr.setMeta("addToHistory", false);
21024
- view.dispatch(tr);
21011
+ try {
21012
+ if (!typo || !view?.dom?.isConnected || !view.state) return;
21013
+ const { doc: doc3 } = view.state;
21014
+ if (!doc3 || doc3.content.size <= 4) {
21015
+ const tr2 = view.state.tr.setMeta(spellCheckPluginKey, { decorations: DecorationSet.empty });
21016
+ tr2.setMeta("addToHistory", false);
21017
+ view.dispatch(tr2);
21018
+ return;
21019
+ }
21020
+ const misspelled = findMisspelled(doc3);
21021
+ const decos = misspelled.map(
21022
+ ({ from, to, word }) => Decoration.inline(from, to, {
21023
+ class: "rf-spell-error",
21024
+ nodeName: "span",
21025
+ "data-spell-word": word
21026
+ })
21027
+ );
21028
+ const decorationSet = DecorationSet.create(doc3, decos);
21029
+ const tr = view.state.tr.setMeta(spellCheckPluginKey, { decorations: decorationSet });
21030
+ tr.setMeta("addToHistory", false);
21031
+ view.dispatch(tr);
21032
+ } catch {
21033
+ }
21025
21034
  };
21026
21035
  const scheduleCheck = (view) => {
21027
21036
  if (debounceTimer) clearTimeout(debounceTimer);
@@ -21033,16 +21042,33 @@ function createSpellCheckPlugin() {
21033
21042
  init() {
21034
21043
  return DecorationSet.empty;
21035
21044
  },
21036
- apply(tr, oldDecos) {
21045
+ apply(tr, oldDecos, _oldState, newState) {
21037
21046
  const meta = tr.getMeta(spellCheckPluginKey);
21038
21047
  if (meta?.decorations) return meta.decorations;
21039
- if (tr.docChanged) return oldDecos.map(tr.mapping, tr.doc);
21048
+ if (tr.docChanged) {
21049
+ if (newState.doc.content.size <= 4) return DecorationSet.empty;
21050
+ if (oldDecos === DecorationSet.empty) return DecorationSet.empty;
21051
+ try {
21052
+ const mapped = oldDecos.map(tr.mapping, tr.doc);
21053
+ if (!mapped || typeof mapped.find !== "function") return DecorationSet.empty;
21054
+ return mapped;
21055
+ } catch {
21056
+ return DecorationSet.empty;
21057
+ }
21058
+ }
21040
21059
  return oldDecos;
21041
21060
  }
21042
21061
  },
21043
21062
  props: {
21044
21063
  decorations(state) {
21045
- return spellCheckPluginKey.getState(state);
21064
+ try {
21065
+ const decos = spellCheckPluginKey.getState(state);
21066
+ if (!decos || decos === DecorationSet.empty) return DecorationSet.empty;
21067
+ decos.find();
21068
+ return decos;
21069
+ } catch {
21070
+ return DecorationSet.empty;
21071
+ }
21046
21072
  }
21047
21073
  },
21048
21074
  view(editorView) {
@@ -21186,6 +21212,14 @@ var RufousTextEditor = ({
21186
21212
  style
21187
21213
  }) => {
21188
21214
  const mentionSuggestion = useMemo4(() => createMentionSuggestion(mentions), [mentions]);
21215
+ const onChangeRef = useRef31(onChange);
21216
+ const onBlurRef = useRef31(onBlur);
21217
+ useEffect28(() => {
21218
+ onChangeRef.current = onChange;
21219
+ }, [onChange]);
21220
+ useEffect28(() => {
21221
+ onBlurRef.current = onBlur;
21222
+ }, [onBlur]);
21189
21223
  const editor = useEditor({
21190
21224
  editable,
21191
21225
  extensions: [
@@ -21275,16 +21309,19 @@ var RufousTextEditor = ({
21275
21309
  },
21276
21310
  content: initialContent || "",
21277
21311
  onUpdate: ({ editor: e }) => {
21278
- if (onChange) {
21279
- onChange(e.getHTML(), e.getJSON());
21280
- }
21281
- },
21282
- onBlur: ({ editor: e }) => {
21283
- if (onBlur) {
21284
- onBlur(e.getHTML(), e.getJSON());
21285
- }
21312
+ onChangeRef.current?.(e.getHTML(), e.getJSON());
21286
21313
  }
21287
21314
  });
21315
+ useEffect28(() => {
21316
+ if (!editor) return;
21317
+ const handler = () => {
21318
+ onBlurRef.current?.(editor.getHTML(), editor.getJSON());
21319
+ };
21320
+ editor.on("blur", handler);
21321
+ return () => {
21322
+ editor.off("blur", handler);
21323
+ };
21324
+ }, [editor]);
21288
21325
  const [linkModalOpen, setLinkModalOpen] = useState35(false);
21289
21326
  const [linkUrl, setLinkUrl] = useState35("");
21290
21327
  const [linkText, setLinkText] = useState35("");
@@ -21565,6 +21602,14 @@ var RufousTextEditor = ({
21565
21602
  }
21566
21603
  ), "No follow"))), /* @__PURE__ */ React117.createElement("div", { className: "link-modal-footer" }, /* @__PURE__ */ React117.createElement("button", { className: "link-modal-btn-unlink", onClick: handleLinkRemove }, "Unlink"), /* @__PURE__ */ React117.createElement("button", { className: "link-modal-btn-apply", onClick: handleLinkSubmit }, "Update"))))));
21567
21604
  };
21605
+ var RufousTextContent = ({ content, className, style }) => /* @__PURE__ */ React117.createElement(
21606
+ "div",
21607
+ {
21608
+ className: `rf-rte-content ${className || ""}`,
21609
+ style,
21610
+ dangerouslySetInnerHTML: { __html: content }
21611
+ }
21612
+ );
21568
21613
  export {
21569
21614
  APP_THEMES,
21570
21615
  Accordion,
@@ -21663,6 +21708,7 @@ export {
21663
21708
  rufousBirdIcon_default as RufousBirdIcon,
21664
21709
  rufousLauncherBird_default as RufousLauncherIcon,
21665
21710
  RufousLogoLoader,
21711
+ RufousTextContent,
21666
21712
  RufousTextEditor,
21667
21713
  RufousThemeProvider,
21668
21714
  Select,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rufous/ui",
3
3
  "private": false,
4
- "version": "0.1.92",
4
+ "version": "0.1.94",
5
5
  "type": "module",
6
6
  "description": "Experimental: A lightweight React UI component library (Beta)",
7
7
  "style": "./dist/main.css",