Commit Graph

290 Commits

Author SHA1 Message Date
hykocx 5ff1e0cd3c fix(media): apply fill positioning classes to private image fallback 2026-04-26 19:24:17 -04:00
hykocx 66ced30d8f perf(media): memoize toast context and improve loading state UX
- wrap ToastContext value in useMemo to prevent unnecessary re-renders
- show skeleton only on initial load, use opacity transition for subsequent fetches
- destructure toastError from toast context to stabilize fetchItems dependency
2026-04-26 19:22:55 -04:00
hykocx 8e37eb53ff feat(media): add MediaImage wrapper to handle public/private image rendering
- add `MediaImage.client.js` component that routes to `next/image` for public media and native `<img>` for private media to prevent CDN cache leaking private content
- replace direct `<img>` usage in `MediaGrid` and `MediaPage` with `MediaImage`
- document `MediaImage` usage and rationale in `src/features/media/README.md`
- update `docs/dev/ARCHITECTURE.md` to reference the `MediaImage` wrapper convention
2026-04-26 19:18:35 -04:00
hykocx 56c334684f feat(ui): add MediaPicker integration to BlockEditor image block
- import MediaPicker from features/media to avoid circular dependency with @zen/core
- add "Choisir un média" button in ImageUrlForm alongside existing URL input
- insert image block with `/zen/api/media/file/<slug>` src on media selection
- update README to document dual-source form (external URL + media library) and revise known limitations
2026-04-26 17:40:58 -04:00
hykocx 3cc5a49518 refactor(media): promote media nav item to top-level sidebar entry
- replace generic "Contenu" section with a dedicated "media" section sharing the same id/label as the item
- update sectionId and order to trigger shouldRenderAsDirectLink in AdminSidebar
- update README to reflect top-level entry instead of nested section
2026-04-26 17:12:43 -04:00
hykocx fcb1a192ba refactor(media): remove redundant card wrappers from media page 2026-04-26 17:10:22 -04:00
hykocx c9f7b23498 feat(media): add media management feature module
- add `ZEN_MEDIA` env flag and document it in `.env.example`
- add media schema, server routes, and API handlers (`api.server.js`, `routes.server.js`, `schema.server.js`)
- add `MediaPage`, `MediaGrid`, `MediaFilters`, and `MediaPicker` client components
- expose `@zen/core/features/media` and `@zen/core/features/media/picker` package exports
- register media navigation and permissions; wire module into `init.js`
- document media API, client picker usage, and boundary rules in `MODULES.md` and `ARCHITECTURE.md`
- add `src/features/media/README.md`
2026-04-26 17:07:19 -04:00
hykocx 67274687a3 style(ui): simplify image caption and alt input layout using full-width utility class 2026-04-26 16:28:40 -04:00
hykocx d66b107636 feat(BlockEditor): add image alignment, link, and replace/delete controls
- add align (left/center/right/full), href, newTab fields to image block
- render floating toolbar on image hover with alignment buttons and link popover
- add replace and delete actions to image toolbar
- wrap image in <a> in disabled mode and HTML export when href is set
- update htmlToBlocks/blocksToHtml to serialize/parse align, href, newTab
- guard handleContainerMouseDown to prevent multi-block selection on input/textarea focus
- add alignment and link icons to shared icons index
- update README with image block spec and toolbar behaviour
2026-04-26 16:26:41 -04:00
hykocx 5ecbf13348 fix(ui): replace form submit with explicit key and click handlers in image block
- remove form element and onSubmit in favor of a plain div
- add handleKeyDown to trigger submit on Enter key press
- attach onClick handler directly to the insert button with type="button"
2026-04-26 16:03:28 -04:00
hykocx a1bcc4bfb9 fix(ui): add null guard for missing element in caret utils 2026-04-26 16:01:53 -04:00
hykocx 7ac4caea23 feat(ui): add current block type label to actions menu 2026-04-26 15:57:18 -04:00
hykocx 543c4f5029 refactor(BlockEditor): replace hover-based submenu open/close with click-toggle
- remove timer-based submenu close logic (scheduleSubmenuClose, cancelSubmenuClose, submenuTimerRef) from BlockActionsMenu
- replace onMouseEnter/onMouseLeave handlers with onClick toggle on submenu trigger
- remove SUBMENU_CLOSE_DELAY constant and hover handlers from inline Toolbar submenus
- update README to reflect click-to-open/close-on-outside-click behavior for all submenus
2026-04-26 15:53:21 -04:00
hykocx b54dce9445 fix(ui): remove autofocus from link form url input 2026-04-26 15:46:52 -04:00
hykocx ff10c2ffea fix(ui): prevent inline toolbar from hiding when interacting with submenus
- keep toolbar visible when focus moves to an element inside `[data-inline-toolbar]`
- unpin toolbar on cleanup when submenu closes to avoid stale pinned state
2026-04-26 15:45:18 -04:00
hykocx db468b56b5 refactor(block-editor): extract shared menu styles into dedicated module
- add `menuStyles.js` with reusable `BOX_CLASS`, `ITEM_CLASS`, `ITEM_DANGER_CLASS`, and `SEPARATOR_CLASS` constants
- replace inline tailwind strings in `Block.client.js` with imported style constants
- update `BlockEditor.client.js`, `LinkPopover.client.js`, and `Toolbar.client.js` to use shared menu styles
- update `README.md` to document the new `menuStyles.js` file
2026-04-26 15:39:41 -04:00
hykocx 94a7bcf44d feat(ui): add link popover component for inline link editing
- add LinkPopover.client.js component for creating, editing, and removing links
- replace autoOpenLink ref-based approach with dedicated linkPopover state
- import and integrate removeMark utility in BlockEditor
- wire up handleLinkPopoverSet and handleLinkPopoverRemove handlers
- open link popover on link click instead of expanding caret range
- close link popover on mousedown outside popover and toolbar
- refactor InlineToolbar to delegate link editing to linkPopover
2026-04-26 15:19:35 -04:00
hykocx 8159b5316a feat(BlockEditor): auto-open link popover when clicking on existing link
- add `linkRangeAt` import to detect link span under caret
- handle `mouseup` on container to detect collapsed click inside a link mark
- set `autoOpenLink` flag via ref and expand selection to full link range
- pass `autoOpenLink` to toolbar state and use `initialPopover='link'` prop
- initialize toolbar popover state from `initialPopover` prop
- pre-fill link url and new-tab from existing mark when `initialPopover` is set
- add `linkRangeAt` helper in `types.js` to find enclosing link range at offset
2026-04-26 15:11:00 -04:00
hykocx 9f328bc818 feat(BlockEditor): add setMark utility and wire link submission to it
- add `setMark` helper in `types.js` that removes then applies a mark, replacing existing marks of the same type without toggling
- expose `applySetMark` in `BlockEditor.client.js` and pass it as `onSetMark` prop to `InlineToolbar`
- switch `handleLinkSubmit` in `Toolbar.client.js` to use `onSetMark` instead of `onToggleMark` so re-submitting a link always applies the new href
2026-04-26 15:06:31 -04:00
hykocx 62cfb76d99 fix(ui): replace form with div in link popover to prevent unintended submit behavior
- swap `<form>` wrapper for `<div>` to avoid native form submission
- add `onKeyDown` handler on input to trigger submit on Enter key
- change button type from `submit` to `button` with explicit `onClick` handler
2026-04-26 15:03:17 -04:00
hykocx 88e1840c8a chore(admin): update nav section order values for system and devkit sections 2026-04-26 12:11:56 -04:00
hykocx bbd12e7596 style(BlockEditor): adjust container padding values 2026-04-26 12:01:13 -04:00
hykocx d57d3a1ca1 feat(BlockEditor): add minHeight prop to control minimum container height
- accept `minHeight` as number (converted to px) or css string value
- apply inline style on container when prop is defined
- document new prop in README
2026-04-26 11:55:51 -04:00
hykocx c9d41a8abe docs(styles): add tailwind source scanning for zen modules
- add `@source` directive in zen.css to auto-scan `@zen/module-*/dist/**/*.js`
- document tailwind class auto-discovery mechanism for modules in MODULES.md
2026-04-26 11:53:18 -04:00
hykocx 3fea89dbd4 feat(ui): add size and variant props to Input component
- add `size` prop (sm | md | lg) with corresponding tailwind size classes
- add `variant` prop supporting `default` and `ghost` styles
- add focus state tracking to enable ghost→default transition on focus
- forward `onFocus` and `onBlur` callbacks with internal focus handling
- isolate color input styling from size/variant logic
2026-04-26 11:37:42 -04:00
hykocx d170058509 refactor(icons): add categoryIcon support for representative category icons
- add optional `categoryIcon` flag to icon metadata helper in add-remove.js and business.js
- mark Add01Icon and ChartLineData01Icon as category representative icons
- use categoryIcon flag in IconsPage to display the most representative icon per category
- add `cursor-pointer` to category sidebar buttons and widen sidebar from 200px to 250px
2026-04-26 11:04:19 -04:00
hykocx 8d8c773c00 refactor(icons): remove export from internal helper function m 2026-04-26 10:53:13 -04:00
hykocx 8254e05202 chore(ui): add business icons export to shared icons index 2026-04-26 10:51:27 -04:00
hykocx 4afe334c6b feat(icons): add business icon set and improve devkit icon copy behavior
- add `src/shared/icons/business.js` with new business-related icons
- move `Wallet03Icon` from `index.js` to `business.js`
- update `index.js` to export icons from business module
- add shift+click to copy JSX snippet in icons devkit page
- update icon button tooltip to hint shift shortcut
- document apostrophe escaping rule in icons README
2026-04-26 10:50:52 -04:00
hykocx 0b73ff1d04 docs(icons): add duplicate detection guide and remove duplicate icon definitions
- add duplicate detection section in README.md with bash commands to identify duplicates
- remove `Cancel01Icon` duplicate definition from `index.js`
- remove `Delete02Icon` duplicate definition from `index.js`
2026-04-26 09:57:09 -04:00
hykocx 85d94fe135 refactor(icons): update add-remove icon components svg attributes and paths 2026-04-26 09:53:17 -04:00
hykocx 8d51e9ba03 style(admin): improve icon card layout with square aspect ratio and balanced spacing 2026-04-26 09:42:24 -04:00
hykocx d30c6b49fd style(admin): improve icon card layout and label display in icons devkit page 2026-04-26 09:40:58 -04:00
hykocx 668890fa7f refactor(admin): improve icons page sidebar layout and category display
- store first icon reference alongside count in category map
- add hasSidebar flag to conditionally adjust layout classes
- make sidebar full-width on mobile with horizontal scrolling category list
- reduce icon size and spacing to accommodate sidebar presence
- adjust grid columns breakpoints when sidebar is visible
2026-04-26 09:38:03 -04:00
hykocx 7412de96ea feat(admin): add category filter and keyword search to icons devkit page
- add category sidebar with icon counts derived from Icon.category metadata
- extend search to match icon keywords via Icon.keywords array
- add AddRemoveIcon to shared icons with category and keywords metadata
- add icons README documenting category and keywords conventions
2026-04-26 09:31:10 -04:00
hykocx a1069c3e3d feat(BlockEditor): add notion native json paste support
- import `notionJsonToBlocks` in `Block.client.js` and prioritize `text/_notion-blocks-v3-production` mime over `text/html` on paste
- implement `notionJsonToBlocks` and `notionValueToBlock` in `clipboard.js` to convert notion block json to editor blocks, preserving native types (`to_do`, `sub_sub_header`, etc.)
- update README to document the notion mime priority in paste handling
2026-04-25 21:03:13 -04:00
hykocx 0fa20ace1e fix(clipboard): add support for notion and github-flavored markdown checklist formats
- detect `to-do-list` (Notion) and `task-list` (GitHub MD) classes as checklist containers
- handle notion `<div class="checkbox-on/off">` as checkbox indicator in list items
- update README to document newly recognized HTML tags for checklist input
2026-04-25 21:00:55 -04:00
hykocx 303042e749 fix(ui): adjust submenu placement based on available viewport space
- add refs for submenu trigger and panel elements
- compute available space above/below using getBoundingClientRect
- dynamically set submenu side to avoid overflow outside viewport
2026-04-25 20:57:18 -04:00
hykocx a1f71860fe feat(ui): add repeat icon and improve block actions menu transform option
- add RepeatIcon component to shared icons index
- import and display RepeatIcon in the transform menu item of BlockActionsMenu
- remove maxHeight constraint and overflow-y-auto from actions menu panel
2026-04-25 20:55:45 -04:00
hykocx c32ab0909c feat(ui): add smart dropdown placement to block editor menus
- introduce `useDropdownPlacement` hook to compute above/below positioning based on available viewport space
- apply dynamic `maxHeight` and position class to `BlockInsertMenu` and `BlockActionsMenu` panels
- attach `triggerRef` to menu trigger buttons for accurate anchor rect calculation
- use `useLayoutEffect` to avoid layout flicker on open
2026-04-25 20:51:52 -04:00
hykocx 63ba04d583 fix(ui): anchor slash menu to bottom edge when flipped above cursor
- initialize position state with a `bottom` field set to null
- use `bottom` css property instead of `top` when menu flips above the anchor to prevent floating when content shrinks on query filtering
- remove `items.length` from layout effect dependencies since repositioning on item count change caused the flipping issue
- build `positionStyle` object conditionally based on whether `bottom` is set
2026-04-25 20:49:38 -04:00
hykocx e928e5317c refactor(BlockEditor): add BlockInsertMenu component and unify block type icon styling
- introduce `BlockInsertMenu` dropdown to insert a new block after the current one
- extract `TYPE_ICON_BOX_CLASS` constant shared between insert menu and transform menu
- align `BlockActionsMenu` transform list item padding/gap to match new insert menu style
- update README to document the new insert menu behaviour and enabled blocks filtering
2026-04-25 20:46:45 -04:00
hykocx 9d8133c7f5 refactor(ui): replace headless ui menu with custom dropdown in BlockActionsMenu
- remove Headless UI Menu and Fragment imports, unused TextIcon import
- implement manual BlockActionsMenu component to avoid pointerdown-triggered open interfering with drag start
- open dropdown only on click after checking justDragged flag
- handle outside click and Escape key for closing
- migrate submenu hover logic from BlockMenuTransformItem into new component
2026-04-25 20:42:12 -04:00
hykocx bde634d169 feat(ui): add block transform submenu with hover panel and drag fix
- add `BlockMenuTransformItem` component with hover-triggered submenu panel
- import `ArrowRight01Icon` and `TextIcon` icons for transform UI
- track drag state via `justDraggedRef` to prevent menu opening after drag
- expose `close` from `<Menu>` render prop to allow manual close on transform select
- wire transform options from block registry into the new submenu item
2026-04-25 20:35:51 -04:00
hykocx 53ace7fc1f refactor(BlockEditor): replace drag handle button with headless ui menu
- add context menu on drag handle with transform, duplicate and delete actions
- introduce `MenuOpenSync` helper to keep handle visible while menu is open
- pass `onTransformBlock`, `onDuplicateBlock`, `onDeleteBlock` and `enabledBlocks` props to Block
- compute `transformOptions` via `useMemo` filtering allowed text block types
- update BlockEditor to wire new block action handlers down to each Block
- update README to document new block action props and menu behavior
2026-04-25 20:29:18 -04:00
hykocx 085a779c74 feat(BlockEditor): add rich paste support with html-to-blocks parsing
- add clipboard.js with htmlToBlocks, blocksToHtml, and blocksToPlainText helpers
- handle single-paragraph html paste as inline splice preserving block type
- handle multi-block html paste by splitting current block and merging head/tail paragraphs
- add onPasteInline and onPasteBlocks props to Block component
- implement handlePasteInline and handlePasteBlocks in BlockEditor
- fallback to plain text insertion when html is absent or yields no blocks
- update README to document clipboard behaviour and new paste handlers
2026-04-25 20:19:32 -04:00
hykocx 0c10dd0142 docs(devkit): add dot badge variants preview to components page 2026-04-25 20:07:48 -04:00
hykocx c87f74a18e fix(BlockEditor): close slash menu when clicking outside or on different block
- add `handleFocus` in Block to reopen slash menu on focus if content starts with `/`
- add `outerRef` on editor root div to detect outside clicks
- add `useEffect` with document `mousedown` listener to close slash menu when clicking outside the editor or on a different block
- add `data-slash-menu` attribute on SlashMenu to exclude it from the close trigger
2026-04-25 20:05:32 -04:00
hykocx 3d9431389b fix(BlockEditor): handle br tags as single character in caret offset calculation
- replace `getCaretOffset` with `countCharsUpTo` to treat `<br>` as 1 char
- rewrite `locateOffset` to walk dom tree and account for `<br>` nodes
- add `textLength` helper to compute model-consistent node length
- update `getCaretOffset` and `getCaretRange` to use new counting logic
2026-04-25 19:36:30 -04:00
hykocx e26314b38d fix(BlockEditor): handle newline characters in inline nodes by inserting br elements 2026-04-25 19:31:13 -04:00