@djangocfg/widget-editor 0.1.93 → 0.1.95

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/widget-editor",
3
- "version": "0.1.93",
3
+ "version": "0.1.95",
4
4
  "description": "TipTap editors: a markdown field with mentions and chips, and a Notion-style block editor with slash commands, tables and embedded blocks",
5
5
  "keywords": [
6
6
  "editor",
@@ -71,9 +71,9 @@
71
71
  "test:watch": "vitest"
72
72
  },
73
73
  "dependencies": {
74
- "@djangocfg/widget-data": "^0.1.18",
74
+ "@djangocfg/widget-data": "^0.1.21",
75
75
  "@djangocfg/widget-kit": "^0.1.19",
76
- "@djangocfg/widget-map": "^0.1.22",
76
+ "@djangocfg/widget-map": "^0.1.25",
77
77
  "@floating-ui/dom": "^1.8.0",
78
78
  "@tiptap/core": "^3.32.2",
79
79
  "@tiptap/extension-code-block-lowlight": "^3.32.2",
@@ -95,15 +95,15 @@
95
95
  "tiptap-extension-global-drag-handle": "^0.1.18"
96
96
  },
97
97
  "peerDependencies": {
98
- "@djangocfg/ui-core": "^2.1.635",
98
+ "@djangocfg/ui-core": "^2.1.637",
99
99
  "lucide-react": "^1.68.0",
100
100
  "react": "^19.0.0",
101
101
  "react-dom": "^19.0.0",
102
102
  "zod": "^4.3.6"
103
103
  },
104
104
  "devDependencies": {
105
- "@djangocfg/typescript-config": "^2.1.635",
106
- "@djangocfg/ui-core": "^2.1.635",
105
+ "@djangocfg/typescript-config": "^2.1.637",
106
+ "@djangocfg/ui-core": "^2.1.637",
107
107
  "@storybook/react-vite": "^10.6.5",
108
108
  "@types/node": "^25.9.5",
109
109
  "@types/react": "19.3.0",
@@ -35,7 +35,7 @@ import {
35
35
  Underline as UnderlineIcon,
36
36
  type LucideIcon,
37
37
  } from 'lucide-react';
38
- import { Kbd, Tooltip, TooltipContent, TooltipTrigger } from '@djangocfg/ui-core';
38
+ import { TooltipHint } from '@djangocfg/ui-core';
39
39
  import { useHotkey } from '@djangocfg/ui-core/hooks';
40
40
  import { notionExtensions } from './extensions';
41
41
  import { LinkDialog } from './LinkDialog';
@@ -191,8 +191,8 @@ export const NotionEditor = forwardRef<NotionEditorHandle, NotionEditorProps>(
191
191
  interface BubbleItem {
192
192
  icon: LucideIcon;
193
193
  title: string;
194
- /** Keyboard shortcut to display in the tooltip. macOS-style (⌘ B). */
195
- shortcut: readonly string[];
194
+ /** Keyboard shortcut to display in the tooltip. `useHotkey` string (mod+b). */
195
+ hotkey: string;
196
196
  isActive: () => boolean;
197
197
  run: () => void;
198
198
  }
@@ -214,49 +214,49 @@ function BubbleSelectionToolbar({
214
214
  {
215
215
  icon: Bold,
216
216
  title: 'Bold',
217
- shortcut: ['⌘', 'B'],
217
+ hotkey: 'mod+b',
218
218
  isActive: () => editor.isActive('bold'),
219
219
  run: () => editor.chain().focus().toggleBold().run(),
220
220
  },
221
221
  {
222
222
  icon: Italic,
223
223
  title: 'Italic',
224
- shortcut: ['⌘', 'I'],
224
+ hotkey: 'mod+i',
225
225
  isActive: () => editor.isActive('italic'),
226
226
  run: () => editor.chain().focus().toggleItalic().run(),
227
227
  },
228
228
  {
229
229
  icon: UnderlineIcon,
230
230
  title: 'Underline',
231
- shortcut: ['⌘', 'U'],
231
+ hotkey: 'mod+u',
232
232
  isActive: () => editor.isActive('underline'),
233
233
  run: () => editor.chain().focus().toggleUnderline().run(),
234
234
  },
235
235
  {
236
236
  icon: Strikethrough,
237
237
  title: 'Strike',
238
- shortcut: ['⌘', '⇧', 'X'],
238
+ hotkey: 'mod+shift+x',
239
239
  isActive: () => editor.isActive('strike'),
240
240
  run: () => editor.chain().focus().toggleStrike().run(),
241
241
  },
242
242
  {
243
243
  icon: CodeIcon,
244
244
  title: 'Inline code',
245
- shortcut: ['⌘', 'E'],
245
+ hotkey: 'mod+e',
246
246
  isActive: () => editor.isActive('code'),
247
247
  run: () => editor.chain().focus().toggleCode().run(),
248
248
  },
249
249
  {
250
250
  icon: Highlighter,
251
251
  title: 'Highlight',
252
- shortcut: ['⌘', '⇧', 'H'],
252
+ hotkey: 'mod+shift+h',
253
253
  isActive: () => editor.isActive('highlight'),
254
254
  run: () => editor.chain().focus().toggleHighlight().run(),
255
255
  },
256
256
  {
257
257
  icon: LinkIcon,
258
258
  title: 'Link',
259
- shortcut: ['⌘', 'K'],
259
+ hotkey: 'mod+k',
260
260
  isActive: () => editor.isActive('link'),
261
261
  run: onOpenLink,
262
262
  },
@@ -280,28 +280,18 @@ function BubbleSelectionToolbar({
280
280
  const Icon = item.icon;
281
281
  const active = item.isActive();
282
282
  return (
283
- <Tooltip key={item.title}>
284
- <TooltipTrigger asChild>
285
- <button
286
- type="button"
287
- aria-label={item.title}
288
- aria-pressed={active}
289
- onMouseDown={(e) => e.preventDefault()}
290
- onClick={item.run}
291
- className={`notion-bubble-btn${active ? ' notion-bubble-btn--active' : ''}`}
292
- >
293
- <Icon style={{ width: 14, height: 14 }} aria-hidden />
294
- </button>
295
- </TooltipTrigger>
296
- <TooltipContent side="top" sideOffset={6} className="flex items-center gap-1.5">
297
- <span>{item.title}</span>
298
- <span className="flex items-center gap-0.5">
299
- {item.shortcut.map((k) => (
300
- <Kbd key={k}>{k}</Kbd>
301
- ))}
302
- </span>
303
- </TooltipContent>
304
- </Tooltip>
283
+ <TooltipHint key={item.title} tooltip={{ content: item.title, hotkey: item.hotkey, side: 'top', sideOffset: 6 }}>
284
+ <button
285
+ type="button"
286
+ aria-label={item.title}
287
+ aria-pressed={active}
288
+ onMouseDown={(e) => e.preventDefault()}
289
+ onClick={item.run}
290
+ className={`notion-bubble-btn${active ? ' notion-bubble-btn--active' : ''}`}
291
+ >
292
+ <Icon style={{ width: 14, height: 14 }} aria-hidden />
293
+ </button>
294
+ </TooltipHint>
305
295
  );
306
296
  })}
307
297
  </BubbleMenu>