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: add Page JS alert info. #1012

Merged
merged 3 commits into from
Jan 13, 2025
Merged

Conversation

SonyLeo
Copy link
Contributor

@SonyLeo SonyLeo commented Jan 10, 2025

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

What is the current behavior?

未展示页面 JS 保存代码保存规则,用户保存代码时容易误操作

image

Issue Number: N/A

What is the new behavior?

页面 JS 增加编辑器内部 placeholder 代码保存规则

image

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features
    • Added instructional placeholder text in the Monaco editor to guide users on valid and invalid top-level declarations in JavaScript.
  • Dependencies
    • Updated the monaco-editor dependency version across multiple packages from 0.33.0 to 0.51.0.

Copy link
Contributor

coderabbitai bot commented Jan 10, 2025

Walkthrough

The pull request introduces instructional placeholder text in the options object of the Monaco editor configuration within the Main.vue file. This placeholder illustrates valid and invalid top-level declarations in JavaScript, providing users with examples of function and variable declarations. Additionally, it updates the monaco-editor dependency version across multiple package configurations, changing it from 0.33.0 to 0.51.0. No existing functionality was altered, and the changes primarily enhance user guidance and maintain updated dependencies.

Changes

File Change Summary
packages/plugins/script/src/Main.vue - Added instructional placeholder text in Monaco editor configuration for valid/invalid declarations.
packages/common/package.json
packages/configurator/package.json
packages/design-core/package.json
packages/plugins/state/package.json
- Updated monaco-editor dependency version from 0.33.0 to 0.51.0.

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • hexqi
  • chilingling

Poem

🐰 In the code where rabbits play,
A new guide lights the way!
Function calls and variables too,
Learn what's right, and what's not true.
With Monaco's latest, hop along,
Coding together, we can't go wrong! 🎉


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 749a97f and c27e7dd.

📒 Files selected for processing (1)
  • packages/plugins/script/src/Main.vue (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/plugins/script/src/Main.vue
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check

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.

@github-actions github-actions bot added bug Something isn't working refactor-main refactor/develop branch feature labels Jan 10, 2025
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

🔭 Outside diff range comments (1)
packages/plugins/script/src/Main.vue (1)

Remove unused saveMethods from setup function

The saveMethods function is no longer used in the component or by its parents. It should be removed from both the destructuring assignment and the setup return object.

  • Remove saveMethods from the destructuring: const { state, monaco, change, close } = useMethod({ emit })
  • Remove saveMethods from the setup return object
🔗 Analysis chain

Line range hint 55-82: Verify if saveMethods is still needed.

The saveMethods function is returned in the setup function but might no longer be used since the save button has been removed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining usage of saveMethods in the template
rg "saveMethods" packages/plugins/script/src/Main.vue

Length of output: 150


Script:

#!/bin/bash
# Get the full context of Main.vue to see template usage and setup return
rg "saveMethods" packages/plugins/script/src/Main.vue -B 2 -A 2

# Find useMethod hook implementation
ast-grep --pattern 'export function useMethod($_) {
  $$$
}'

Length of output: 390


Script:

#!/bin/bash
# Search for any usage of Main.vue component with saveMethods
rg -g '*.{vue,js,ts,jsx,tsx}' '<script-plugin' -A 5 -B 5

# Search for any event emissions using saveMethods
rg -g '*.{vue,js,ts}' 'emit.*saveMethods'

Length of output: 102


Script:

#!/bin/bash
# Get the component name or registration
rg -g '*.{vue,js,ts}' -l 'export default defineComponent' packages/plugins/script/src/Main.vue

# Search for any imports of this component
rg -g '*.{vue,js,ts}' "from.*plugins/script/src/Main"

Length of output: 152

🧹 Nitpick comments (2)
packages/plugins/script/src/Main.vue (2)

12-18: Consider internationalizing the alert message.

The alert message is hardcoded in Chinese. Consider using i18n to support multiple languages and improve accessibility for non-Chinese users.

 <tiny-alert
-  description="注意:JS 面板顶层只支持函数声明,其余变量声明、表达式、类声明均不会保存。"
+  :description="t('plugins.script.functionDeclarationAlert')"
   custom-class="tiny-alert_custom"
   :closable="false"
 />

188-206: Consider using CSS variables for colors.

The background color is hardcoded as rgb(240, 247, 255). Consider using a CSS variable for better theme consistency and maintainability.

 .tiny-alert_custom {
   border: 0;
   padding: 8px 0;
   margin-top: 12px;
   margin-bottom: 0;
   padding-left: 17px;
   border-radius: 4px;
-  background: rgb(240, 247, 255);
+  background: var(--ti-lowcode-alert-info-bg);
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a834f60 and d260c86.

📒 Files selected for processing (1)
  • packages/plugins/script/src/Main.vue (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check
🔇 Additional comments (1)
packages/plugins/script/src/Main.vue (1)

33-33: LGTM! Component changes look good.

The Alert component is properly imported and registered.

Also applies to: 51-52

@hexqi hexqi added this to the v2.2.0 milestone Jan 13, 2025
@hexqi
Copy link
Collaborator

hexqi commented Jan 13, 2025

涉及UI改动需要补充下修改后效果截图

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


If it involves UI changes, please add screenshots of the modified effects.

@hexqi hexqi merged commit a5b1df6 into opentiny:refactor/develop Jan 13, 2025
2 checks passed
@SonyLeo SonyLeo deleted the fix/pageJSTip branch January 21, 2025 07:06
@coderabbitai coderabbitai bot mentioned this pull request Feb 18, 2025
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working refactor-main refactor/develop branch feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants