[lexical-playground] DateTime Plugin#7707
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
@etrepum Would you know why marking the decorator node as inline does not actually work? Something is off with the selection bit. |
|
I don't think it works inline because of the css, divs are To make it work with formatting you could make it not a decorator, it could be a TextNode subclass, although we don't currently have a selection/navigation mode by default that would treat a |
I started with Element node initially, but the decorator just allowed for nice isolation of the component code with all the event listeners. I do agree, the node is closer to a mention or a hashtag with just a 'onclick' behaviour. I'll look into the CSS. Maybe we can get @zurfyx or @fantactuka to help with the 'token' part? |
etrepum
left a comment
There was a problem hiding this comment.
I didn't spend any time looking at the UI but I can see that the DateTimeNode implementation has some bugs with serialization and possibly collab that should be straightforward to fix by switching from an explicit property to NodeState.
packages/lexical-playground/src/nodes/DateTimeNode/DateTimeNode.tsx
Outdated
Show resolved
Hide resolved
packages/lexical-playground/src/nodes/DateTimeNode/DateTimeNode.tsx
Outdated
Show resolved
Hide resolved
packages/lexical-playground/src/nodes/DateTimeNode/DateTimeNode.tsx
Outdated
Show resolved
Hide resolved
etrepum
left a comment
There was a problem hiding this comment.
Almost there, still doesn't quite deserialize correctly (never parses from string, which it will be after JSON) and there's a type error
packages/lexical-playground/src/nodes/DateTimeNode/DateTimeNode.tsx
Outdated
Show resolved
Hide resolved
packages/lexical-playground/src/nodes/DateTimeNode/DateTimeNode.tsx
Outdated
Show resolved
Hide resolved
packages/lexical-playground/src/plugins/DateTimePlugin/index.tsx
Outdated
Show resolved
Hide resolved
etrepum
left a comment
There was a problem hiding this comment.
Looks good, assuming the tests will pass after that explicit serialization. This is a good demo of using a more exotic type with NodeState and collab which was very hard to do correctly before
|
Just for information, here is the Clipboard HTML from Google Docs' <meta charset="utf-8">
<b style="font-weight:normal;" id="docs-internal-guid-8ead19bd-7fff-859b-a6a8-bd93d5d97918">
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;">
<span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;" data-rich-links="{"dat_df":{"fres_frt":1,"dfie_ts":{"tv":{"tv_s":1754913600,"tv_n":0}},"dfie_l":"en","dfie_p":{"fres_frt":0,"tres_tv":"MMM d, y"},"dfie_dt":"Aug 11, 2025","dfie_pt":3,"dfie_tpt":0,"dfie_tzi":""},"type":"date"}">Aug 11, 2025</span>
</p>
</b>
<br class="Apple-interchange-newline">Will now Lexical be able to paste this HTML as DateTime Node? Ha-ha, I'm still sad, no-one actually uses |
I'm currently on holidays. If you raise the PR, I'd be more than happy to review and merge 😃. |
Fixes #13386 Below I write a clarification to copy and paste into the release note, based on our latest upgrade of Lexical [in v3.29.0](https://github.com/payloadcms/payload/releases/tag/v3.29.0). ## Important This release upgrades the lexical dependency from 0.28.0 to 0.34.0. If you installed lexical manually, update it to 0.34.0. Installing lexical manually is not recommended, as it may break between updates, and our re-exported versions should be used. See the [yellow banner box](https://payloadcms.com/docs/rich-text/custom-features) for details. If you still encounter richtext-lexical errors, do the following, in this order: - Delete node_modules - Delete your lockfile (e.g. pnpm-lock.json) - Reinstall your dependencies (e.g. pnpm install) ### Lexical Breaking Changes The following Lexical releases describe breaking changes. We recommend reading them if you're using Lexical APIs directly (`@payloadcms/richtext-lexical/lexical/*`). - [v.0.33.0](https://github.com/facebook/lexical/releases/tag/v0.33.0) - [v.0.30.0](https://github.com/facebook/lexical/releases/tag/v0.30.0) - [v.0.29.0](https://github.com/facebook/lexical/releases/tag/v0.29.0) ___ TODO: - [x] facebook/lexical#7719 - [x] facebook/lexical#7362 - [x] facebook/lexical#7707 - [x] facebook/lexical#7388 - [x] facebook/lexical#7357 - [x] facebook/lexical#7352 - [x] facebook/lexical#7472 - [x] facebook/lexical#7556 - [x] facebook/lexical#7417 - [x] facebook/lexical#1036 - [x] facebook/lexical#7509 - [x] facebook/lexical#7693 - [x] facebook/lexical#7408 - [x] facebook/lexical#7450 - [x] facebook/lexical#7415 - [x] facebook/lexical#7368 - [x] facebook/lexical#7372 - [x] facebook/lexical#7572 - [x] facebook/lexical#7558 - [x] facebook/lexical#7613 - [x] facebook/lexical#7405 - [x] facebook/lexical#7420 - [x] facebook/lexical#7662 --- - To see the specific tasks where the Asana app for GitHub is being used, see below: - https://app.asana.com/0/0/1211202581885926
Add DateTime Plugin with typeahead completions for 'Date', 'Today', 'Tomorrow', 'Yesterday'.
The popover rendering positioning respects the widget positioning and where it is relative to the edges.
If a time is added to widget, it defaults to the user's browser local time zone. In the future someone else can extend it further to support timezone selection using 'tzdb'.
Screen.Recording.2025-08-04.at.20.59.41.mov