Skip to content

Commit 8e2c225

Browse files
author
veedrin
committed
老的编辑器对象 editor 被去掉了,导致 HtmlEditor 预览报错,已修复
修复 intro 页面的比赛广告图片会拉伸 使用自己是项目成员而不是项目所有者的项目创建工作空间,应该显示自己的用户名。实际上 ownerName 是无用的,统一用 ownerGlobalKey
1 parent a575606 commit 8e2c225

File tree

5 files changed

+34
-54
lines changed

5 files changed

+34
-54
lines changed

app/components/MonacoEditor/Editors/HtmlEditor.jsx

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class HtmlEditor extends Component {
6868
}
6969

7070
render() {
71-
const { editor, tab, editorInfo } = this.props;
71+
const { tab, editorInfo } = this.props;
7272
const { leftGrow, rightGrow, showBigSize, showPreview, previewUniqueId } = tab;
7373
const editorStyle = { flexGrow: leftGrow, display: !showBigSize || (showBigSize && !showPreview) ? 'block' : 'none' };
7474
const previewStyle = { flexGrow: rightGrow };
@@ -77,27 +77,21 @@ class HtmlEditor extends Component {
7777
return (
7878
<div className="html-editor-container">
7979
<div className="preview-action">
80-
{
81-
showPreview && <i className={expandIcon} onClick={() => actions.togglePreviewSize({ state: tab })}></i>
82-
}
80+
{showPreview && <i className={expandIcon} onClick={() => actions.togglePreviewSize({ state: tab })}></i>}
8381
<i className={eyeIcon} onClick={() => actions.togglePreview({ state: tab })}></i>
8482
</div>
8583
<div className="wrap">
8684
<div id='editor_preview_html_editor' style={editorStyle}>
87-
<CodeEditor editor={editor} editorInfo={editorInfo} tab={tab} />
85+
<CodeEditor editorInfo={editorInfo} tab={tab} />
8886
</div>
89-
{
90-
(showPreview && !showBigSize) && (
91-
<ResizeBar startResize={startResize} actions={actions} state={tab} />
92-
)
93-
}
94-
{
95-
showPreview && (
96-
<div id='editor_preview_html_preview' style={previewStyle}>
97-
<PreviewEditor url={`${config.previewURL}${editor.file.path}?r=${previewUniqueId}`} isResizing={tab.isResizing} />
98-
</div>
99-
)
100-
}
87+
{(showPreview && !showBigSize) && (
88+
<ResizeBar startResize={startResize} actions={actions} state={tab} />
89+
)}
90+
{showPreview && (
91+
<div id='editor_preview_html_preview' style={previewStyle}>
92+
<PreviewEditor url={`${config.previewURL}${editorInfo.filePath}?r=${previewUniqueId}`} isResizing={tab.isResizing} />
93+
</div>
94+
)}
10195
</div>
10296
</div>
10397
);

app/components/MonacoEditor/Editors/MarkDownEditor.jsx

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class MarkdownEditor extends Component {
166166
}, 500)
167167

168168
render() {
169-
const { editor, tab, active, editorInfo } = this.props
169+
const { tab, active, editorInfo } = this.props
170170
const { leftGrow, rightGrow, showBigSize, showPreview } = tab
171171
const editorStyle = { flexGrow: leftGrow, display: !showBigSize || (showBigSize && !showPreview) ? 'block' : 'none' };
172172
const previewStyle = { flexGrow: rightGrow };
@@ -175,27 +175,21 @@ class MarkdownEditor extends Component {
175175
return (
176176
<div className="markdown-editor-container">
177177
<div className="preview-action">
178-
{
179-
showPreview && <i className={expandIcon} onClick={() => actions.togglePreviewSize({ state: tab })}></i>
180-
}
178+
{showPreview && <i className={expandIcon} onClick={() => actions.togglePreviewSize({ state: tab })}></i>}
181179
<i className={eyeIcon} onClick={() => actions.togglePreview({ state: tab })}></i>
182180
</div>
183181
<div className="wrap">
184182
<div id='editor_preview_markdown_editor' style={editorStyle}>
185-
<CodeEditor editor={editor} editorInfo={editorInfo} tab={tab} />
183+
<CodeEditor editorInfo={editorInfo} tab={tab} />
186184
</div>
187-
{
188-
(showPreview && !showBigSize) && (
189-
<ResizeBar startResize={startResize} actions={actions} state={tab} />
190-
)
191-
}
192-
{
193-
showPreview && (
194-
<div id='editor_preview_preview' style={previewStyle} ref={dom => this.previewDOM = dom}>
195-
<PreviewEditor content={this.state.previewContent} editor={editor} />
196-
</div>
197-
)
198-
}
185+
{(showPreview && !showBigSize) && (
186+
<ResizeBar startResize={startResize} actions={actions} state={tab} />
187+
)}
188+
{showPreview && (
189+
<div id='editor_preview_preview' style={previewStyle} ref={dom => this.previewDOM = dom}>
190+
<PreviewEditor content={this.state.previewContent} />
191+
</div>
192+
)}
199193
</div>
200194
</div>
201195
)

app/dashboard/view/workspace/Workspace.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,9 @@ class Workspace extends Component {
176176
const item = res[i];
177177
const ws = {};
178178
ws.spaceKey = item.spaceKey;
179-
// codingide 是无来源创建的特殊项目名
180-
ws.ownerName = item.ownerName !== 'codingide' ? item.ownerName : item.ownerGlobalKey;
179+
// ownerGlobalKey 是工作空间所有者的名字
180+
// ownerName 是项目所有者的名字,有可能项目所有者不是你。codingide 是无来源创建的特殊项目名
181+
ws.ownerGlobalKey = item.ownerGlobalKey;
181182
// 无远端仓库有一个 workspaceName 字段
182183
ws.projectName = item.workspaceName && item.workspaceName !== 'default' ? item.workspaceName : item.projectName;
183184
ws.repoUrl = item.projectHtmlUrl;
@@ -211,8 +212,7 @@ class Workspace extends Component {
211212
const item = res[i];
212213
const ws = {};
213214
ws.spaceKey = item.spaceKey;
214-
// codingide 是无来源创建的特殊项目名
215-
ws.ownerName = item.project.ownerName !== 'codingide' ? item.project.ownerName : item.owner.globalKey;
215+
ws.ownerGlobalKey = item.ownerGlobalKey;
216216
// 无远端仓库有一个 workspaceName 字段
217217
ws.projectName = item.workspaceName && item.workspaceName !== 'default' ? item.workspaceName : item.project.name;
218218
ws.repoUrl = item.projectHtmlUrl;

app/dashboard/view/workspace/card/Card.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { notify, NOTIFY_TYPE } from 'components/Notification/actions';
1212
class Card extends Component {
1313
render() {
1414
const { globalKey, hasWSOpend } = this.props;
15-
const { spaceKey, ownerName, projectName, repoUrl, createDate, deleteTime, lastModifiedDate, workingStatus, collaborative, invitedStatus } = this.props;
15+
const { spaceKey, ownerGlobalKey, projectName, repoUrl, createDate, deleteTime, lastModifiedDate, workingStatus, collaborative, invitedStatus } = this.props;
1616
const stopOption = {
1717
message: i18n('ws.stopNotice'),
1818
isWarn: true,
@@ -47,8 +47,8 @@ class Card extends Component {
4747
}
4848
const invalid = workingStatus === 'Invalid';
4949
const canotOpen = hasWSOpend && workingStatus !== 'Online';
50-
const title = `${ownerName}/${projectName}`;
51-
const attr = createDate ? `${ownerName}/${projectName}\n${getCreatedTime(createDate)}` : title;
50+
const title = `${ownerGlobalKey}/${projectName}`;
51+
const attr = createDate ? `${ownerGlobalKey}/${projectName}\n${getCreatedTime(createDate)}` : title;
5252
const hasRepo = (repoUrl && !repoUrl.includes('codingide')) ? true : false;
5353
return (
5454
<Href invalid={invalid} spaceKey={spaceKey} canotOpen={canotOpen} handleMask={this.handleMask} handleStop={this.handleStop}>
@@ -81,15 +81,15 @@ class Card extends Component {
8181
workingStatus !== 'Invalid' ? (
8282
<div className="control">
8383
{
84-
workingStatus === 'Online' && (globalKey === ownerName) && (
84+
workingStatus === 'Online' && (globalKey === ownerGlobalKey) && (
8585
<div className="act" onClick={(event) => this.handleMask(stopOption, event)}>
8686
<i className="fa fa-stop-circle-o"></i>
8787
<span>{i18n('global.stop')}</span>
8888
</div>
8989
)
9090
}
9191
{
92-
globalKey === ownerName ? (
92+
globalKey === ownerGlobalKey ? (
9393
<div className="act" onClick={(event) => this.handleMask(deleteOption, event)}>
9494
<i className="fa fa-trash-o"></i>
9595
<span>{i18n('global.delete')}</span>
@@ -118,8 +118,8 @@ class Card extends Component {
118118
handleRepoUrl = (event) => {
119119
event.preventDefault();
120120
event.stopPropagation();
121-
const { ownerName, repoUrl } = this.props;
122-
const repoHref = `${config.devOrigin}/u/${ownerName}/p/${repoUrl.split('/').pop().split('.').join('/')}`;
121+
const { ownerGlobalKey, repoUrl } = this.props;
122+
const repoHref = `${config.devOrigin}/u/}/p/${repoUrl.split('/').pop().split('.').join('/')}`;
123123
window.open(repoHref);
124124
}
125125

app/intro.html

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@
560560
position: relative;
561561
}
562562
.intro-banner img.pc-img {
563-
width: 100%;
563+
width: 2560px;
564564
height: 100%;
565565
vertical-align: middle;
566566
position: absolute;
@@ -1191,14 +1191,6 @@ <h2>最极客的云端开发体验</h2>
11911191
function stopBubble(event) {
11921192
event.stopPropagation();
11931193
}
1194-
// 插件比赛广告图片
1195-
const $campaignImg = document.querySelector('#campaign-img');
1196-
function handleCampaign() {
1197-
const imgWidth = 2560 / 1440 * document.documentElement.clientWidth;
1198-
$campaignImg.style.width = imgWidth + 'px';
1199-
}
1200-
handleCampaign();
1201-
window.addEventListener('resize', function() { handleCampaign(); });
12021194

12031195
getUserInfo();
12041196

0 commit comments

Comments
 (0)