-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for tiptap task-item #179
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue ueberdosis/tiptap#3676 means changes in View mode will not be saved
f17e472
to
3d43ba9
Compare
That glitch seems to be due to this line: const content = `<div markdown="1">${$(".editor-space .ProseMirror")
.html()
.replace(/<h1>.*?<\/h1>/, "")}</div>`; Sample output: <ul data-type="taskList">
<li data-checked="true">
<label contenteditable="false">
<input type="checkbox" checked="checked">
<span></span>
</label>
<div>
<p>Task 1</p>
<p>Description</p>
</div>
</li>
</ul> Fixed when updated like so: const content = `<div markdown="1">${editor.getHTML()
.replace(/<h1>.*?<\/h1>/, "")}</div>`; Sample output: <ul data-type="taskList">
<li data-checked="true" data-type="taskItem">
<label>
<input type="checkbox" checked="checked">
<span></span>
</label>
<div>
<p>Task 1</p>
<p>Description</p>
</div>
</li>
</ul> But it seems like changing it would introduce regression to existing code though. The issue mentioned there is still open (ueberdosis/tiptap#4044) |
On a related note, It seems like task-item state is only saved in Edit mode but it's still editable in View mode. I think the optimal solution would be to allow saving state for it regardless of whether or not the editor is in editable mode (same as Github) but there seems to be a known bug for this option (ueberdosis/tiptap#3676) that hasn't been resolved. Alternatively I think having the checkbox be read only when in View mode would also be acceptable - as it should already be with the default settings but that does not work as expected (I believe it's due to the same bug). So I added a temporary manual override instead. |
Hey, sorry this PR got drifted out of my mind We aren't using view mode in from tiptap due to SEO reasons which could also be why the checkbox isn't disabled while just viewing the page. I think we could've more control if we used tiptap view mode but it's not viable in our situation. |
No worries :) If that's the case, I'll update the code such that the jquery method is retained and see if I can fix it using an alternative method. I suspect I just need to append As for the other issue, since not using tiptap view mode is a design decision, would it be okay to keep my manual patch to make the checkbox readonly when in Wiki's View Mode? I added comments to remove the patch once the upstream bug is fixed. |
Works for me |
Will be made redundant once ueberdosis/tiptap#4044 is fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Added some style changes. But thanks a lot for the PR.
Passing run #234 ↗︎
Details:
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
Fixes #177