-
-
Notifications
You must be signed in to change notification settings - Fork 50.1k
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 Theme Config Editor #39621
Conversation
Codecov ReportBase: 100.00% // Head: 100.00% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## feature #39621 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 546 556 +10
Lines 9363 9602 +239
Branches 2653 2714 +61
==========================================
+ Hits 9363 9602 +239
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
can we make this a window that pops up that allows you to add plain text to a text area. Similar to how you copy the text area when exporting |
That's good idea. |
@rohanbhangui @MadCcc |
@BoyYangzai works well! Can we also get the theme editor indexed? It is very difficult to google for. or find. I stumbled on it by accident. |
glad for you approve 😊 |
.dumi/pages/theme-editor/index.tsx
Outdated
const [editModelOpen, setEditModelOpen] = useState<boolean>(false); | ||
const [editThemeFormatRight, setEditThemeFormatRight] = useState<boolean>(true); | ||
const [content, setContent] = useState<TextContent>({ | ||
text: '{}', |
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.
初始化的时候能不能让默认值是当前的配置,而不是空对象?
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.
初始化的时候能不能让默认值是当前的配置,而不是空对象?
可以
package.json
Outdated
@@ -154,7 +154,8 @@ | |||
"rc-util": "^5.25.2", | |||
"scroll-into-view-if-needed": "^3.0.3", | |||
"shallowequal": "^1.1.0", | |||
"throttle-debounce": "^5.0.0" | |||
"throttle-debounce": "^5.0.0", | |||
"vanilla-jsoneditor": "^0.11.4" |
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.
这个是不是可以放进 devDependencies 里面?
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.
这个是不是可以放进 devDependencies 里面?
应该不可以吧qwq
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.
应该放 devDependencies 里
.dumi/pages/theme-editor/index.tsx
Outdated
@@ -1,19 +1,27 @@ | |||
import React, { useEffect } from 'react'; | |||
import { isObject } from 'lodash'; |
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.
这个干掉吧,lodash 太大了,可以自己实现
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.
这个干掉吧,lodash 太大了,可以自己实现
ok
@li-jia-nan |
@@ -0,0 +1,4 @@ | |||
/* eslint-disable import/prefer-default-export */ | |||
export function isObject(target: any) { | |||
return Object.prototype.toString.call(target) === '[object Object]'; |
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.
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.
这里我用错了,只想要纯Object,所以这个就够了,不需要_.isObject
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.
OK,那就更不需要 lodash 了,因为 antd 中用到 lodash 的地方不多,所以后面计划把这个库干掉,体积实在太大了
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.
OK,那就更不需要 lodash 了,因为 antd 中用到 lodash 的地方不多,所以后面计划把这个库干掉,体积实在太大了
哈哈哈,看到你们的pr了
@@ -0,0 +1,33 @@ | |||
import { JSONEditor as Editor, Mode, type JSONEditorPropsOptional } from 'vanilla-jsoneditor'; |
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.
vanilla-jsoneditor 可以加到 https://ant.design/docs/react/recommendation-cn 里来
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.
vanilla-jsoneditor 可以加到 https://ant.design/docs/react/recommendation-cn 里来
收到🫡
导出功能应该不需要了,可以合并起来叫 代码/Code |
@MadCcc |
@li-jia-nan @afc163 |
/> | ||
</div> | ||
</Modal> | ||
<Button onClick={handleEditConfig} icon={<EditOutlined />} style={{ marginRight: 8 }}> |
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.
<Button onClick={handleEditConfig} icon={<EditOutlined />} style={{ marginRight: 8 }}> | |
<Button onClick={handleEditConfig} style={{ marginRight: 8 }}> |
exportDesc: '将下面的 JSON 对象复制到 ConfigProvider 的 theme 属性中即可。', | ||
edit: '代码', | ||
editModelTitle: '编辑主题配置', | ||
editTitle: '在下方编辑你的主题 JSON 即可', |
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.
将 JSON 复制到 ConfigProvider 的 theme 属性中套用主题。
ping |
* feat: add Theme Editor theme upload * verision 2 * 移除lodash、同步当前Config * remove export,add into devDependencies,add tool link
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
💡 Background and solution
📝 Changelog
☑️ Self-Check before Merge