-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add file type on server side #132
Merged
Merged
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
9c13f58
init implementation
thatkookooguy 83e8774
fix lint
thatkookooguy c80eeb7
avoid binary files
thatkookooguy d9d6357
lint
thatkookooguy d138546
lint!
thatkookooguy 786751d
check if file info exists
thatkookooguy 1f9f5d2
Merge branch 'master' into add-file-type
thatkookooguy a49421e
fix placement of assignment
thatkookooguy 76781bc
fix some nits in settingsService.js
thatkookooguy fa53486
Make code more organized
thatkookooguy 25448e1
combine error messages constants
thatkookooguy c5ce087
formatting + lint errors
thatkookooguy f770355
little nit :-)
thatkookooguy ea52d79
remove unused dependency
thatkookooguy e2a0789
comment to make current solution more clear
thatkookooguy 99960f5
lint
thatkookooguy 73702af
fix error on unsupported files
thatkookooguy ee27dc8
final fix -__-
thatkookooguy 4cb5662
Merge branch 'master' into add-file-type
thatkookooguy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,58 @@ | ||
{ | ||
"name": "kibibit-code-editor", | ||
"version": "0.0.0", | ||
"description": "code editor on the cloud", | ||
"main": "server.js", | ||
"scripts": { | ||
"postinstall": "node ./node_modules/bower/lib/bin/bower install && node ./node_modules/gulp/bin/gulp styles", | ||
"start": "node server.js", | ||
"test": "gulp test" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/Kibibit/kibibit-code-editor.git" | ||
}, | ||
"author": "[email protected]", | ||
"license": "BSD-2-Clause", | ||
"engines": { | ||
"node": "4.2.3", | ||
"npm": "3.8.2" | ||
}, | ||
"dependencies": { | ||
"bcrypt-nodejs": "0.0.3", | ||
"body-parser": "^1.14.2", | ||
"colors": "~1.1.2", | ||
"directory-tree": "~0.1.1", | ||
"express": "~4.13.3", | ||
"scribe-js": "~2.0.4", | ||
"serve-favicon": "~2.3.0", | ||
"user-home": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"bower": "^1.7.2", | ||
"gulp": "~3.9.0", | ||
"gulp-cached": "^1.1.0", | ||
"gulp-concat": "~2.6.0", | ||
"gulp-cssnano": "^2.1.0", | ||
"gulp-depcheck": "^1.1.0", | ||
"gulp-develop-server": "~0.5.0", | ||
"gulp-help": "^1.6.1", | ||
"gulp-jsbeautifier": "~1.0.1", | ||
"gulp-jscs": "~3.0.2", | ||
"gulp-livereload": "~3.8.1", | ||
"gulp-rename": "~1.2.2", | ||
"gulp-sass": "~2.1.1", | ||
"gulp-shell": "~0.5.1", | ||
"gulp-sourcemaps": "~1.6.0", | ||
"gulp-util": "~3.0.7", | ||
"jasmine-core": "~2.4.1", | ||
"jscs": "~2.9.0", | ||
"jscs-angular": "~1.2.1", | ||
"karma": "~0.13.16", | ||
"karma-jasmine": "~0.3.6", | ||
"karma-phantomjs-launcher": "~1.0.0", | ||
"phantomjs-prebuilt": "^2.1.3", | ||
"yargs": "~3.32.0" | ||
} | ||
} | ||
"name": "kibibit-code-editor", | ||
"version": "0.0.0", | ||
"description": "code editor on the cloud", | ||
"main": "server.js", | ||
"scripts": { | ||
"postinstall": "node ./node_modules/bower/lib/bin/bower install && node ./node_modules/gulp/bin/gulp styles", | ||
"start": "node server.js", | ||
"test": "gulp test" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/Kibibit/kibibit-code-editor.git" | ||
}, | ||
"author": "[email protected]", | ||
"license": "BSD-2-Clause", | ||
"engines": { | ||
"node": "4.2.3", | ||
"npm": "3.8.2" | ||
}, | ||
"dependencies": { | ||
"bcrypt-nodejs": "0.0.3", | ||
"body-parser": "^1.14.2", | ||
"colors": "~1.1.2", | ||
"directory-tree": "~0.1.1", | ||
"express": "~4.13.3", | ||
"mime-types": "^2.1.11", | ||
"scribe-js": "~2.0.4", | ||
"serve-favicon": "~2.3.0", | ||
"user-home": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"bower": "^1.7.2", | ||
"gulp": "~3.9.0", | ||
"gulp-cached": "^1.1.0", | ||
"gulp-concat": "~2.6.0", | ||
"gulp-cssnano": "^2.1.0", | ||
"gulp-depcheck": "^1.1.0", | ||
"gulp-develop-server": "~0.5.0", | ||
"gulp-help": "^1.6.1", | ||
"gulp-jsbeautifier": "~1.0.1", | ||
"gulp-jscs": "~3.0.2", | ||
"gulp-livereload": "~3.8.1", | ||
"gulp-rename": "~1.2.2", | ||
"gulp-sass": "~2.1.1", | ||
"gulp-shell": "~0.5.1", | ||
"gulp-sourcemaps": "~1.6.0", | ||
"gulp-util": "~3.0.7", | ||
"jasmine-core": "~2.4.1", | ||
"jscs": "~2.9.0", | ||
"jscs-angular": "~1.2.1", | ||
"karma": "~0.13.16", | ||
"karma-jasmine": "~0.3.6", | ||
"karma-phantomjs-launcher": "~1.0.0", | ||
"phantomjs-prebuilt": "^2.1.3", | ||
"yargs": "~3.32.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,9 @@ angular.module('kibibitCodeEditor') | |
// save the content of the editor on-change | ||
vm.aceChanged = function(_editor) { | ||
vm.aceDocumentValue = vm.aceSession.getDocument().getValue(); | ||
var fileMode = getModeFromMimeType(vm.fileInfo); | ||
editorSettings.syntaxMode = fileMode; | ||
console.debug('changed mode to ' + fileMode); | ||
}; | ||
|
||
vm.attachedEditorFunctions = { | ||
|
@@ -73,43 +76,16 @@ angular.module('kibibitCodeEditor') | |
|
||
vm.updateFileContent = function(filePath) { | ||
if (filePath !== '') { | ||
FileService.getFile(filePath, function(fileContent) { | ||
vm.code = fileContent.data; | ||
FileService.getFile(filePath, function(fileInfo) { | ||
vm.fileInfo = fileInfo.data; | ||
vm.code = vm.fileInfo.content; | ||
}); | ||
} | ||
}; | ||
} | ||
]) | ||
|
||
.directive('kbChangeAceScroll', function() { | ||
return { | ||
scope: false, | ||
link: function(scope, element, attrs) { | ||
var scrollbarY = element.parent().find('.ace_scrollbar.ace_scrollbar-v'); | ||
var scrollbarX = element.parent().find('.ace_scrollbar.ace_scrollbar-h'); | ||
scope.$watch(function() { | ||
return scrollbarY.find('.ace_scrollbar-inner').height(); | ||
}, updateY); | ||
scope.$watch(function() { | ||
return scrollbarX.find('.ace_scrollbar-inner').width(); | ||
}, updateX); | ||
scope.config = { | ||
scrollButtons: { | ||
scrollAmount: 'auto', // scroll amount when button pressed | ||
enable: false // enable scrolling buttons by default | ||
}, | ||
scrollInertia: 400, // adjust however you want | ||
axis: 'yx', // enable 2 axis scrollbars by default, | ||
theme: 'minimal', | ||
autoHideScrollbar: true | ||
}; | ||
function updateY(newVal, oldVal) { | ||
console.log('update scroll Y'); | ||
} | ||
|
||
function updateX(newVal, oldVal) { | ||
console.log('update scroll X'); | ||
} | ||
function getModeFromMimeType(file) { | ||
var getModeRegex = /\/(x-)?(.*)$/; | ||
return file && file.mimeType ? file.mimeType.match(getModeRegex)[2] : 'text'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line must be at most 80 characters |
||
} | ||
}; | ||
}); | ||
} | ||
]); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@thatkookooguy
What about this directive?
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.
It wasn't attached anywhere. It was a leftover from an experiment I did in a previous PR