Skip to content

Commit 80f639f

Browse files
committed
Working on editor
1 parent 078d7c3 commit 80f639f

File tree

6 files changed

+214
-60
lines changed

6 files changed

+214
-60
lines changed

manifest.json

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
11
{
22
"version": "1.0.0",
33
"manifest_version": 2,
4+
"minimum_chrome_version": "31",
45
"name": "Code Pad",
5-
"description": "An awesome, feature rich, multi-language IDE crafted for Chrome OS",
6+
"description": "An awesome multi-language IDE crafted for Chrome OS",
67
"app": {
78
"background": {
89
"scripts": [
910
"/src/js/app.js"
1011
]
1112
}
1213
},
13-
"file_browser_handlers": [
14-
{
15-
"id": "action-open-file",
16-
"default_title": "Open file"
14+
"file_handlers": {
15+
"text": {
16+
"types": [
17+
"text/*"
18+
]
1719
}
18-
],
20+
},
1921
"permissions": [
20-
"fileSystem",
22+
{
23+
"fileSystem": [
24+
"write",
25+
"retainEntries",
26+
"directory"
27+
]
28+
},
2129
"storage"
2230
]
2331
}

src/css/main.css

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,17 @@ input.cmn-tgl-rnd-flt:checked + label:after {
156156
.editor {
157157
position: relative;
158158
width: 100%;
159+
}
160+
161+
.tab-content,
162+
.tab-pane {
159163
height: 100%;
160164
}
161165

166+
.editor {
167+
height: calc(100% - 20px);
168+
}
169+
162170
.ace_gutter-cell {
163171
font-size: 1.1rem !important;
164172
}
@@ -226,6 +234,29 @@ input.cmn-tgl-rnd-flt:checked + label:after {
226234
color: #dfdfdf !important;
227235
}
228236

237+
/*******************************************************************************/
238+
/********************************* Status bar **********************************/
239+
/*******************************************************************************/
240+
.ace-status-bar {
241+
position: fixed;
242+
left: 0;
243+
bottom: 0;
244+
width: 100%;
245+
height: 20px;
246+
z-index: 99;
247+
}
248+
249+
.ace_status-info,
250+
.ace_status-indicator {
251+
float: right;
252+
}
253+
254+
.ace_status-info span,
255+
.ace_status-indicator {;
256+
padding: 0 5px;
257+
border-left: 1px solid rgba(255, 255, 255, 0.08);
258+
}
259+
229260
/*******************************************************************************/
230261
/************************************* Tabs ************************************/
231262
/*******************************************************************************/
@@ -415,5 +446,5 @@ select:focus,
415446
}
416447

417448
.dropdown-divider {
418-
border-top: 1px solid rgba(255, 255, 255, 0.18);
449+
border-top: 1px solid rgba(255, 255, 255, 0.08);
419450
}

src/html/app.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ <h4 class="modal-title"></h4>
258258
<script src="/vendor/ace/ext-modelist.js"></script>
259259
<script src="/vendor/ace/ext-beautify.js"></script>
260260
<script src="/vendor/ace/ext-language_tools.js"></script>
261+
<script src="/vendor/ace/ext-statusbar.js"></script>
261262

262263
<!-- Tree -->
263264
<script src="/vendor/bootstrap-treeview/bootstrap-treeview.js"></script>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Title</title>
6+
</head>
7+
<body>
8+
9+
</body>
10+
</html>

src/js/app.js

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ $(document).ready(function () {
4646
Editors.init();
4747
IdeSettings.init(Editors);
4848

49-
var $header = $('header');
50-
var $editorsContentContainer = Editors.getTabsContentContainer();
51-
5249
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5350

5451

@@ -76,8 +73,13 @@ $(document).ready(function () {
7673
});
7774

7875
// Handle resize of window (keep editor under navigation)
76+
var $header = $('header');
77+
var $tabsContentContainer = Editors.getTabsContentContainer();
78+
var statusBarHeight = $tabsContentContainer.find('.ace-status-bar').first().height();
79+
7980
$(window).on('resize', function () {
80-
$editorsContentContainer.css('top', Math.ceil($header.height()) + 'px');
81+
$tabsContentContainer.css('top', Math.ceil($header.height()) + 'px');
82+
$tabsContentContainer.find('.editor').css('height', Math.ceil($tabsContentContainer.height() - statusBarHeight) + 'px');
8183
}).resize();
8284

8385
// New ace editor
@@ -130,37 +132,24 @@ $(document).ready(function () {
130132

131133

132134
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
133-
/// Actions
135+
/// File Actions
134136
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
135137

136138
// Add new tab (editor)
137139
$(document).on('click', '.action-add-tab', function () {
138140
Editors.onAddNewTab($(this).attr('data-type'));
139141
});
140142

141-
// Perform copy on current active editor
142-
$(document).on('click', '.action-copy', function () {
143-
var ace = Editors.getCurrentAceEditor();
144-
if (typeof ace !== typeof undefined) {
145-
ace.execCommand('copy');
146-
}
147-
});
148143

149-
// Perform paste to current active editor
150-
$(document).on('click', '.action-paste', function () {
151-
var ace = Editors.getCurrentAceEditor();
152-
if (typeof ace !== typeof undefined && Editors.aceClipboard.length > 0) {
153-
ace.execCommand('paste', Editors.aceClipboard);
154-
}
144+
// Open new file
145+
$(document).on('click', '.action-file-open', function () {
146+
Editors.onOpenFile();
155147
});
156148

157-
// Perform cut on current active editor
158-
$(document).on('click', '.action-cut', function () {
159-
var ace = Editors.getCurrentAceEditor();
160-
if (typeof ace !== typeof undefined) {
161-
ace.execCommand('cut');
162-
}
163-
});
149+
150+
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
151+
/// Edit Actions
152+
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
164153

165154
// Perform search on current active editor
166155
$(document).on('click', '.action-search', function () {
@@ -186,6 +175,30 @@ $(document).ready(function () {
186175
}
187176
});
188177

178+
// Perform cut on current active editor
179+
$(document).on('click', '.action-cut', function () {
180+
var ace = Editors.getCurrentAceEditor();
181+
if (typeof ace !== typeof undefined) {
182+
ace.execCommand('cut');
183+
}
184+
});
185+
186+
// Perform copy on current active editor
187+
$(document).on('click', '.action-copy', function () {
188+
var ace = Editors.getCurrentAceEditor();
189+
if (typeof ace !== typeof undefined) {
190+
ace.execCommand('copy');
191+
}
192+
});
193+
194+
// Perform paste to current active editor
195+
$(document).on('click', '.action-paste', function () {
196+
var ace = Editors.getCurrentAceEditor();
197+
if (typeof ace !== typeof undefined && Editors.aceClipboard.length > 0) {
198+
ace.execCommand('paste', Editors.aceClipboard);
199+
}
200+
});
201+
189202
// Perform fold all current active editor
190203
$(document).on('click', '.action-fold-all', function () {
191204
var ace = Editors.getCurrentAceEditor();

0 commit comments

Comments
 (0)