Skip to content
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

fix firfox 135 compatibility #545

Merged

Conversation

liuning89757
Copy link
Contributor

@liuning89757 liuning89757 commented Feb 24, 2025

Changes Overview

bump snabbdom version to fix firefox v135 compatibility issue

Implementation Approach

modify dependency version "snabbdom": "^3.6.0"
patch document.createRange in test file to avoid jsdom error

Testing Done

yarn test passed

Verification Steps

yarn example and visit the demo using the latest firefox browser

Additional Notes

Checklist

  • I have created a changeset for this PR if necessary.
  • My changes do not break the library.
  • I have added tests where applicable.
  • I have followed the project guidelines.
  • I have fixed any lint issues.

Related Issues

#535

Summary by CodeRabbit

  • Tests
    • Improved the simulation environment for color menu displays to ensure more reliable quality checks.
  • Chores
    • Upgraded the core UI rendering dependency across multiple modules, enhancing overall performance, stability, and compatibility.

Copy link

changeset-bot bot commented Feb 24, 2025

⚠️ No Changeset found

Latest commit: f23805d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Feb 24, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This pull request introduces a mock implementation for document.createRange in the color menu tests to simulate an empty getClientRects method missing in jsdom. Additionally, the dependency version for snabbdom has been updated from ^3.1.0 to ^3.6.0 across multiple package.json files in various packages.

Changes

File(s) Change Summary
packages/basic-modules/__tests__/color/color-menus.test.ts Added a mock for document.createRange that returns a Range object with a getClientRects method (returns empty client rects) for jsdom compatibility.
packages/{basic-modules, code-highlight, core, editor, list-module, plugin-float-image, plugin-formula, plugin-link-card, plugin-markdown, plugin-mention, table-module, upload-image-module, video-module}/package.json Updated the snabbdom dependency version from ^3.1.0 to ^3.6.0 (in both dependencies and peerDependencies).

Sequence Diagram(s)

sequenceDiagram
    participant Test as Color Menu Test
    participant Document as Document Object
    participant Range as Range Object

    Test->>Document: document.createRange()
    Document-->>Range: Returns new Range object
    Test->>Range: getClientRects() call
    Range-->>Test: Returns empty client rects (length 0)
Loading

Poem

I'm a little rabbit, hopping through the code,
With mocks in my pocket where jsdom once slowed,
The ranges now sing a silent tune,
And "snabbdom" upgrades make errors immune.
In fields of code I joyfully bounce,
Celebrating each change with a happy pounce!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/basic-modules/__tests__/color/color-menus.test.ts (1)

14-25: Mocking document.createRange for jsdom Compatibility

The patch overriding document.createRange addresses the jsdom limitation regarding the missing getClientRects method effectively. To further improve maintainability and adhere to ESLint guidelines, consider reformatting the block for consistent indentation and removal of extra semicolons as suggested below:

-document.createRange = () => {
-  const range = new Range();
-  range.getClientRects = () => ({
-      item: () => null,
-      length: 0,
-      [Symbol.iterator]: function *() {
-          yield* [];
-      },
-  });
-  return range;
-};
+document.createRange = () => {
+  const range = new Range();
+
+  range.getClientRects = () => ({
+    item: () => null,
+    length: 0,
+    [Symbol.iterator]: function* () {
+      yield* [];
+    }
+  });
+
+  return range;
+};

This refactoring not only adheres to common style guides but also helps eliminate ESLint warnings related to indentation and extra semicolons.

🧰 Tools
🪛 ESLint

[error] 16-16: Expected blank line after variable declarations.

(newline-after-var)


[error] 16-16: Extra semicolon.

(semi)


[error] 18-18: Expected indentation of 4 spaces but found 6.

(indent)


[error] 19-19: Expected indentation of 4 spaces but found 6.

(indent)


[error] 20-20: Expected indentation of 4 spaces but found 6.

(indent)


[error] 20-22: Expected method shorthand.

(object-shorthand)


[error] 20-20: Unexpected space before *.

(generator-star-spacing)


[error] 20-20: Missing space after *.

(generator-star-spacing)


[error] 21-21: Expected indentation of 6 spaces but found 10.

(indent)


[error] 21-21: Extra semicolon.

(semi)


[error] 22-22: Expected indentation of 4 spaces but found 6.

(indent)


[error] 23-23: Extra semicolon.

(semi)


[error] 24-24: Extra semicolon.

(semi)


[error] 25-25: Extra semicolon.

(semi)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 37bd40c and ba8bf5f.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (14)
  • packages/basic-modules/__tests__/color/color-menus.test.ts (1 hunks)
  • packages/basic-modules/package.json (1 hunks)
  • packages/code-highlight/package.json (1 hunks)
  • packages/core/package.json (1 hunks)
  • packages/editor/package.json (1 hunks)
  • packages/list-module/package.json (1 hunks)
  • packages/plugin-float-image/package.json (1 hunks)
  • packages/plugin-formula/package.json (1 hunks)
  • packages/plugin-link-card/package.json (1 hunks)
  • packages/plugin-markdown/package.json (1 hunks)
  • packages/plugin-mention/package.json (1 hunks)
  • packages/table-module/package.json (1 hunks)
  • packages/upload-image-module/package.json (1 hunks)
  • packages/video-module/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/video-module/package.json
🧰 Additional context used
🪛 ESLint
packages/basic-modules/__tests__/color/color-menus.test.ts

[error] 16-16: Expected blank line after variable declarations.

(newline-after-var)


[error] 16-16: Extra semicolon.

(semi)


[error] 18-18: Expected indentation of 4 spaces but found 6.

(indent)


[error] 19-19: Expected indentation of 4 spaces but found 6.

(indent)


[error] 20-20: Expected indentation of 4 spaces but found 6.

(indent)


[error] 20-22: Expected method shorthand.

(object-shorthand)


[error] 20-20: Unexpected space before *.

(generator-star-spacing)


[error] 20-20: Missing space after *.

(generator-star-spacing)


[error] 21-21: Expected indentation of 6 spaces but found 10.

(indent)


[error] 21-21: Extra semicolon.

(semi)


[error] 22-22: Expected indentation of 4 spaces but found 6.

(indent)


[error] 23-23: Extra semicolon.

(semi)


[error] 24-24: Extra semicolon.

(semi)


[error] 25-25: Extra semicolon.

(semi)

🔇 Additional comments (12)
packages/core/package.json (1)

60-60: Dependency Version Update for snabbdom
The "snabbdom" dependency has been updated from "^3.1.0" to "^3.6.0", which is intended to improve Firefox 135 compatibility. Please verify that this update is fully compatible with the core package's usage and that no regressions occur due to breaking changes in the new version.

packages/editor/package.json (1)

76-76: Consistent Upgrade of snabbdom in Dependencies
The dependency "snabbdom" has been updated to "^3.6.0" here as well. This change aligns with the overall upgrade effort across the repository to resolve compatibility issues with Firefox 135. Please ensure that integration tests cover potential edge cases with this dependency update.

packages/basic-modules/package.json (1)

52-52: Peer Dependency Update to snabbdom
The "snabbdom" peer dependency has been bumped to "^3.6.0", ensuring consistency with the other parts of the project. Confirm that this change is reflected in any integrations using basic modules and that it does not introduce version conflicts.

packages/code-highlight/package.json (1)

50-50: Updated snabbdom Version in Peer Dependencies
Here in peerDependencies, the update to "snabbdom": "^3.6.0" is consistent with the rest of the project. It is advisable to run compatibility tests, especially in code highlight functionalities, to ensure the new version does not cause unexpected UI or runtime issues.

packages/list-module/package.json (1)

50-50: Maintaining Consistency with snabbdom Upgrade
The peer dependency "snabbdom" has been updated to "^3.6.0", matching the changes made across other modules. Please double-check that the upgrade does not impact the module's behavior or visual correctness in list rendering.

packages/table-module/package.json (1)

54-54: Update to snabbdom Version in Peer Dependencies.

The peer dependency for snabbdom has been updated to "^3.6.0" to remedy Firefox 135 compatibility issues. This update is aligned with the coordinated upgrade across modules.

packages/plugin-formula/package.json (1)

49-49: Bump snabbdom Version for Consistency.

The snabbdom dependency has been revised from "^3.1.0" to "^3.6.0" in the peerDependencies. This change is consistent with the other modules and supports the compatibility fixes.

packages/plugin-mention/package.json (1)

45-45: Synchronize snabbdom Dependency Version.

The update to "^3.6.0" for the snabbdom peer dependency ensures uniformity across the project’s packages, addressing the compatibility issue with Firefox 135.

packages/plugin-float-image/package.json (1)

47-47: Refined snabbdom Version in Peer Dependencies.

Bumping snabbdom to "^3.6.0" in the peerDependencies aligns this module with the global dependency strategy aimed at resolving Firefox compatibility issues.

packages/upload-image-module/package.json (1)

54-54: Uniform Dependency Upgrade for snabbdom.

The snabbdom version has been updated to "^3.6.0" here too, matching the changes in the other modules. This coherent upgrade should help eliminate version inconsistencies and support Firefox 135 compatibility.

packages/plugin-link-card/package.json (1)

47-47: Dependency Update for snabbdom

The upgrade from "snabbdom": "^3.1.0" to "^3.6.0" is consistent with the overall project updates to address Firefox 135 compatibility. Please ensure that any potential breaking changes in snabbdom v3.6.0 are covered by your test suite.

packages/plugin-markdown/package.json (1)

47-47: Uniform Dependency Version Change

The update of the snabbdom dependency to "^3.6.0" aligns with similar changes across the project. Verify that this change meets the compatibility requirements with Firefox 135 and that it does not introduce side effects in the plugin’s functionality.

@cycleccc
Copy link
Collaborator

想起来了,以前尝试过升级 snabbdom ,有 type 兼容性问题就没升,得再处理下
image

@liuning89757
Copy link
Contributor Author

liuning89757 commented Feb 25, 2025

想起来了,以前尝试过升级 snabbdom ,有 type 兼容性问题就没升,得再处理下 image

看起来问题出在 yjs-for-react 这个项目里,如果不编译这个项目就不报错。可能是内部混用了 VNode 和 ReactNode,但是再往下找超出我的能力范围了。。 @cycleccc

@cycleccc
Copy link
Collaborator

看起来问题出在 yjs-for-react 这个项目里,如果不编译这个项目就不报错。可能是内部混用了 VNode 和 ReactNode,但是再往下找超出我的能力范围了。。 @cycleccc

turbo 打包的问题,我处理一下

@cycleccc cycleccc merged commit 826d9c3 into wangeditor-next:master Feb 25, 2025
1 of 3 checks passed
@liuning89757 liuning89757 deleted the fix_firefox_compatibility branch February 26, 2025 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants