Skip to content

Conversation

@juliusknorr
Copy link
Member

@juliusknorr juliusknorr commented Jun 18, 2025

This fixes a warning that occurs as for plain text editing we include the codeBlock extension twice. I noticed this when running tests on #7300

We can only add the extension in our PlainTextExtension as it wraps everything we need for that already. In this case the addition options are just needed to pass them trough to the code block extension.

Fixes tons of warnings like:

stderr | src/tests/plaintext.spec.js > commonmark as plaintext > commonmark 557
[tiptap warn]: Duplicate extension names found: ['codeBlock']. This can lead to issues.

@codecov
Copy link

codecov bot commented Jun 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.98%. Comparing base (fa7b1d6) to head (0a0827e).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7315      +/-   ##
==========================================
+ Coverage   52.09%   58.98%   +6.89%     
==========================================
  Files         483      482       -1     
  Lines       41999    37113    -4886     
  Branches     1047     1048       +1     
==========================================
+ Hits        21878    21891      +13     
+ Misses      20018    15120    -4898     
+ Partials      103      102       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@juliusknorr juliusknorr force-pushed the fix/duplicate-code-block branch 2 times, most recently from 76465d8 to f931dcf Compare June 18, 2025 06:26
Copy link
Member

@mejo- mejo- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Didn't test but looks sensible to me.

I have two smaller remarks, none of them blocking.

extensions: [
PlainText,
CodeBlockLowlight.configure({
PlainText.configure({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PlainText.configure({
PlainText.configure({
// Options to be passed through to `CodeBlockPlainText`

How about a short code comment here to explain why we pass codeblock config options to the plaintext extension?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively the options could be set as a separate object on the code block lowlight key similar to how tiptap defines its options in the starter kit.

Copy link
Member Author

@juliusknorr juliusknorr Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment for now, we can move to separate options if we have some for other extensions being passed as well

Copy link
Collaborator

@max-nextcloud max-nextcloud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this. Also saw it and had it on my todo list. Happy i can strike that off.

extensions: [
PlainText,
CodeBlockLowlight.configure({
PlainText.configure({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively the options could be set as a separate object on the code block lowlight key similar to how tiptap defines its options in the starter kit.

@juliusknorr juliusknorr force-pushed the fix/duplicate-code-block branch from f931dcf to 0a0827e Compare June 18, 2025 07:48
@max-nextcloud max-nextcloud merged commit b41a104 into main Jun 18, 2025
66 checks passed
@max-nextcloud max-nextcloud deleted the fix/duplicate-code-block branch June 18, 2025 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants