2
0
Fork
You've already forked cms
0

Tiptap editor draft #66

Merged
oscarotero merged 5 commits from tiptap-editor into main 2025年11月11日 17:56:22 +01:00
Contributor
Copy link

Add a rich-text field type.

Rich text fields display a Tiptap editor and are saved as HTML.

TODO:

  • vendor Tiptap library
  • make it look good
  • clean up code (I made this by copying the markdown impl, so there's a lot of dead code right now)
Add a `rich-text` field type. Rich text fields display a Tiptap editor and are saved as HTML. TODO: - [ ] vendor Tiptap library - [ ] make it look good - [ ] clean up code (I made this by copying the markdown impl, so there's a lot of dead code right now)

I just tested it and it's really great! I love the integration with markdown syntax.

  • For styling, I think you can duplicate code.css to rich-text.css and change the class names to (.tiptap instead of .cm-editor).
  • Can we apply tags not available in the toolbar? Like <code> or <dl>, for example. Maybe there should be be a way to see and edit the code directly?
I just tested it and it's really great! I love the integration with markdown syntax. - For styling, I think you can duplicate `code.css` to `rich-text.css` and change the class names to (`.tiptap` instead of `.cm-editor`). - Can we apply tags not available in the toolbar? Like `<code>` or `<dl>`, for example. Maybe there should be be a way to see and edit the code directly?
Author
Contributor
Copy link

Yeah, I'll get to styling now.

Editing HTML code could be possible, but a bit of work (Tiptap has its own content model separate from HTML, but it gives us functions to convert back and forth).

For <code>, you can use backticks, and we can add a button for it as well. Unfortunately I don't see a way to do <dl>.

Yeah, I'll get to styling now. Editing HTML code could be possible, but a bit of work (Tiptap has its own content model separate from HTML, but it gives us functions to convert back and forth). For `<code>`, you can use backticks, and we can add a button for it as well. Unfortunately I don't see a way to do `<dl>`.

Oh, I didn't realized markdown you can write directly markdown and it's converted automatically to HTML. That's fantastic.

Would be possible to add images? In markdown, images and other media elements are detected automatically on paste urls using this function.

Is it possible to have something similar here? Ideally, a dialog to add the source and alt would be great, but we can start with something simpler.

Oh, I didn't realized markdown you can write directly markdown and it's converted automatically to HTML. That's fantastic. Would be possible to add images? In markdown, images and other media elements are detected automatically on paste urls [using this function](https://github.com/lumeland/cms/blob/main/static/components/f-markdown.js#L170). Is it possible to have something similar here? Ideally, a dialog to add the source and alt would be great, but we can start with something simpler.

Hi. I tried to test your latest changes but it fails in my local because the markup_util.js file is not found.
Let me know if you have any question or need some help.

Hi. I tried to test your latest changes but it fails in my local because the `markup_util.js` file is not found. Let me know if you have any question or need some help.
Author
Contributor
Copy link

I couldn't figure out the library build setup. markup_util.js is in scripts/

I couldn't figure out the library build setup. markup_util.js is in scripts/
@ -0,0 +1,146 @@
import {

This file doesn't exist

This file doesn't exist
@ -0,0 +1,146 @@
import {

Can you bundle all these external imports to a new file in scripts/tiptap.js and create a build script in scripts/package.json?
You can use markdown.js or code.js as a reference. They only exports a single init function (using a textarea to get and update the content). This allows to edit the code even if the script fails, because the textarea is visible.

Can you bundle all these external imports to a new file in `scripts/tiptap.js` and create a build script in `scripts/package.json`? You can use `markdown.js` or `code.js` as a reference. They only exports a single `init` function (using a `textarea` to get and update the content). This allows to edit the code even if the script fails, because the textarea is visible.

Hi!
Just to clarify: are you still working on this? If you are, there's no rush, I just want to know.
I'm asking because if you can't continue, I could.

Hi! Just to clarify: are you still working on this? If you are, there's no rush, I just want to know. I'm asking because if you can't continue, I could.
Author
Contributor
Copy link

Hi, sorry about that, I had to leave this for a while.

I haven't figured out how to implement full snippet support, if that's not needed then I think this is ready

Hi, sorry about that, I had to leave this for a while. I haven't figured out how to implement full snippet support, if that's not needed then I think this is ready

I think we can skip snippets for now.
Thank you!

I think we can skip snippets for now. Thank you!
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lume/cms!66
Reference in a new issue
lume/cms
No description provided.
Delete branch "tiptap-editor"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?