Skip to content

Commit

Permalink
1.0.8 Final
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbrg committed Nov 28, 2017
1 parent 8afe27e commit f92c35d
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 30 deletions.
100 changes: 90 additions & 10 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"version": "1.0.79",
"version": "1.0.8",
"manifest_version": 2,
"minimum_chrome_version": "51",
"name": "Code Pad IDE",
"short_name": "Code Pad IDE",
"description": "An awesome multi-language programming IDE (editor), crafted for ChromeOS & released under GPL3.0!",
"description": "An multi-language code IDE / text editor crafted for ChromeOS, built as a hobby free to use and amend!",
"author": "Andrew Borg",
"homepage_url": "https://github.com/andrewbrg/codepad-chrome-app",
"offline_enabled": true,
Expand All @@ -18,17 +18,97 @@
},
"file_handlers": {
"text": {
"extensions": [
"as",
"as3",
"asm",
"bat",
"c",
"cc",
"cfc",
"cfm",
"cgi",
"coffee",
"conf",
"cpp",
"cs",
"csh",
"css",
"csv",
"dart",
"diff",
"do",
"ejs",
"el",
"erb",
"glsl",
"go",
"h",
"haml",
"handlebars",
"haxe",
"hs",
"htm",
"html",
"htmls",
"ini",
"jade",
"java",
"js",
"json",
"ksh",
"less",
"log",
"love",
"lua",
"m",
"make",
"man",
"manifest",
"markdown",
"mat",
"md",
"mdoc",
"me",
"micro",
"obc",
"patch",
"php",
"pkb",
"pkg",
"pks",
"pl",
"pls",
"pm",
"ps",
"py",
"r",
"rake",
"rb",
"sass",
"scala",
"scss",
"sh",
"shtml",
"sql",
"styl",
"svg",
"tex",
"text",
"ts",
"tsv",
"txt",
"vbs",
"vcf",
"xml",
"yaml",
"yml",
"zsh"
],
"types": [
"text/*",
"image/svg+xml",
"application/x-sh",
"application/x-csh",
"application/x-shellscript",
"application/javascript",
"application/typescript",
"application/json",
"application/xhtml+xml",
"application/xml"
"application/*"
]
}
},
Expand Down
10 changes: 6 additions & 4 deletions src/js/handlers/editors.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var EditorsHandler = function () {
this.IdeSettings = undefined;
this.Files = undefined;
this.Modelist = ace.require("ace/ext/modelist");
this.Modelist = ace.require("ace/ext/chromevox");
this.StatusBar = ace.require('ace/ext/statusbar').StatusBar;

this.idx = 0;
Expand Down Expand Up @@ -665,8 +664,8 @@ var EditorsHandler = function () {
}
});
});


ace.require("ace/ext/chromevox");
};

/*######################################################
Expand Down Expand Up @@ -784,7 +783,8 @@ var EditorsHandler = function () {
this.editorDataObjs.forEach(function (editorDataObj) {
if (editorDataObj.idx === idx) {
editorDataObj.fileEntry = fileEntry;
found = true;

found = true;
}
});

Expand Down Expand Up @@ -973,6 +973,8 @@ var EditorsHandler = function () {
var obj = this._getNewTabObject(fileExt, fileName, nodeId);
this.getTabsNavContainer().append(obj.nav);
this.getTabsContentContainer().append(obj.content);


this._bootAceEditor(obj.idx, fileContent, fileEntry).then(function () {
that.setTabNavFocus(obj.idx);
that._sortableTabsInit();
Expand Down
40 changes: 24 additions & 16 deletions src/js/handlers/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,27 @@ var FilesHandler = function () {
return deferred.promise();
};

this._isValidFileMime = function (file) {

var valid = false;

console.log(file.type);

if (typeof file.type === typeof undefined ||
file.type === 'undefined' ||
file.type === '') {
return true;
}

this.allowedMimeTypes.forEach(function (mime) {
if (file.type.match(mime)) {
valid = true;
}
});

return valid;
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////


Expand Down Expand Up @@ -197,19 +218,13 @@ var FilesHandler = function () {
var files = event.originalEvent.dataTransfer.items;
for (var i = 0; i < files.length; i++) {

var valid = false;
var file = files[i];
var file = files[i];

// noinspection JSUnresolvedFunction
var fileEntry = file.webkitGetAsEntry();
if (file.kind === 'file' && fileEntry) {
that.allowedMimeTypes.forEach(function (mime) {
if (file.type === '' || file.type.match(mime)) {
valid = true;
}
});

if (valid) {
if (that._isValidFileMime(file)) {
promises.push(that.fileOpen(fileEntry));
}
else {
Expand Down Expand Up @@ -255,16 +270,9 @@ var FilesHandler = function () {
else {
fileEntry.file(function (file) {

var valid = false;
var reader = new FileReader();

that.allowedMimeTypes.forEach(function (mime) {
if (file.type === '' || file.type.match(mime)) {
valid = true;
}
});

if (!valid) {
if (!that._isValidFileMime(file)) {
onError(file.name + ' has an unsupported file type (' + file.type + ') and will not be opened');
} else {
reader.readAsText(file);
Expand Down

0 comments on commit f92c35d

Please sign in to comment.