forked from textAngular/textAngular
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started Work on textAngular#33 (use grunt, runs tests and compression…
… if tests successful, no notes in README or anything yet) Fixes into textAngular#42 Changed .bower.json to bower.json as in textAngular#66, also included devDependancies for running the tests
- Loading branch information
Simeon
authored and
Simeon
committed
Jan 10, 2014
1 parent
1286d87
commit 3b755d1
Showing
13 changed files
with
824 additions
and
39 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.idea | ||
coverage/* | ||
lib-cov | ||
bower_components/* | ||
node_modules/* | ||
*.seed | ||
*.log | ||
*.csv | ||
*.dat | ||
*.out | ||
*.pid | ||
*.gz | ||
*.iml | ||
|
||
pids | ||
logs | ||
results | ||
|
||
npm-debug.log |
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
module.exports = function (grunt) { | ||
|
||
// load all grunt tasks | ||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks('grunt-istanbul-coverage'); | ||
grunt.loadNpmTasks('grunt-karma'); | ||
|
||
// Default task. | ||
grunt.registerTask('default', ['test', 'uglify']); | ||
grunt.registerTask('test', ['jshint', 'karma', 'coverage']); | ||
|
||
var testConfig = function (configFile, customOptions) { | ||
var options = { configFile: configFile, keepalive: true }; | ||
var travisOptions = process.env.TRAVIS && { browsers: ['Firefox'], reporters: 'dots' }; | ||
return grunt.util._.extend(options, customOptions, travisOptions); | ||
}; | ||
|
||
// Project configuration. | ||
grunt.initConfig({ | ||
coverage: { | ||
options: { | ||
thresholds: { | ||
'statements': 100, | ||
'branches': 95, | ||
'lines': 100, | ||
'functions': 100 | ||
}, | ||
dir: 'coverage', | ||
root: '' | ||
} | ||
}, | ||
karma: { | ||
unit: { | ||
options: testConfig('karma.conf.js') | ||
} | ||
}, | ||
jshint: { | ||
files: ['textAngular.js', 'test/**/*.spec.js'], | ||
options: { | ||
eqeqeq: true, | ||
immed: true, | ||
latedef: true, | ||
newcap: true, | ||
noarg: true, | ||
sub: true, | ||
boss: true, | ||
eqnull: true, | ||
globals: {} | ||
} | ||
}, | ||
uglify: { | ||
options: { | ||
mangle: true, | ||
compress: true | ||
}, | ||
my_target: { | ||
files: { | ||
'textAngular.min.js': ['textAngular.js'] | ||
} | ||
} | ||
} | ||
}); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "textAngular", | ||
"version": "1.2.0-pre1", | ||
"main": "./textAngular.js", | ||
"description": "A radically powerful Text-Editor/Wysiwyg editor for Angular.js", | ||
"keywords": [ | ||
"editor", | ||
"angular", | ||
"wysiwyg", | ||
"jquery" | ||
], | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"test*", | ||
"demo*", | ||
"Gruntfile.js", | ||
"package.json" | ||
], | ||
"dependencies": { | ||
"angular": "~1.2.x", | ||
"angular-sanitize": "~1.2.x" | ||
}, | ||
"devDependencies": { | ||
"angular-mocks": "~1.x", | ||
"jquery": ">= 1.9", | ||
"bootstrap": "3.0.x", | ||
"font-awesome": "4.0.x" | ||
}, | ||
"license": "MIT", | ||
"homepage": "https://github.com/fraywing/textAngular" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,133 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
|
||
<meta charset="UTF-8"> | ||
|
||
<title>textAngular 1.2.0 Demo</title> | ||
|
||
<meta name="robots" content="noindex"> | ||
|
||
<link rel='stylesheet prefetch' href='../bower_components/bootstrap/dist/css/bootstrap.min.css'> | ||
<link rel='stylesheet prefetch' href='../bower_components/font-awesome/css/font-awesome.css'> | ||
|
||
|
||
<style> | ||
.ta-editor { | ||
min-height: 300px; | ||
height: auto; | ||
overflow: auto; | ||
font-family: inherit; | ||
font-size: 100%; | ||
} | ||
.red{ | ||
color: red; | ||
} | ||
|
||
.statictoolbar{ | ||
position: fixed; | ||
top: 12px; | ||
} | ||
</style> | ||
|
||
</head> | ||
|
||
<body> | ||
|
||
<div ng-app="textAngularTest" ng-controller="wysiwygeditor" class="container app"> | ||
<text-angular-toolbar name="statictoolbar" class="statictoolbar"></text-angular-toolbar> | ||
<h1>Toolbar</h1> | ||
<p><button type="button" ng-click="changetesth1()">Test Change H1 Text</button><button type="button" ng-click="changeallh2()">All Change H2 Text</button><button type="button" ng-click="changeallh()">All H* Text</button><button type="button" ng-click="iconsallh()">Change H* Icons</button><button type="button" ng-click="resettoolbar()">Reset All Toolbar Buttons</button></p> | ||
<text-angular-toolbar name="test"></text-angular-toolbar> | ||
<h1>Editor</h1> | ||
<button ng-click="disabled = !disabled" unselectable>Disable text-angular Toggle</button> | ||
<text-angular-toolbar name="htmlcontenttools"></text-angular-toolbar> | ||
<div text-angular="text-angular" name="htmlcontent" ng-model="data.htmlcontent" ta-disabled='disabled' ta-target-toolbars='test,htmlcontenttools,statictoolbar'></div> | ||
<h1>Raw HTML in a text area</h1> | ||
<textarea ng-model="data.htmlcontent" style="width: 100%"></textarea> | ||
<h1>Bound with ng-bind-html</h1> | ||
<div ng-bind-html="data.htmlcontent"></div> | ||
<h1>Bound with ta-bind, our internal html-binding directive</h1> | ||
<div ta-bind="text" ng-model="data.htmlcontent" ta-readonly='disabled'></div> | ||
<button type="button" ng-click="data.htmlcontent = data.orightml">Reset</button> | ||
<button type="button" ng-click="clear()">clear</button> | ||
<p>Note: although we support classes and styles, angularjs' ng-bind-html directive will strip out all style attributes.</p> | ||
|
||
<h1>Option to masquerade as a fancy text-area - complete with form submission and optional ngModel</h1> | ||
<text-angular name="htmlcontent_nomodel"><p>Any <b>HTML</b> we put in-between the text-angular tags gets automatically put into the editor if there <strong style="font-size: 12pt;"><u><em>is not</em></u></strong> a ngModel</p></text-angular> | ||
</div> | ||
<script src='../bower_components/angular/angular.min.js'></script> | ||
<script src='../bower_components/angular-sanitize/angular-sanitize.min.js'></script> | ||
<script src='../textAngular.js'></script> | ||
|
||
<script type="text/javascript"> | ||
angular.module("textAngularTest", ['textAngular']) | ||
// this demonstrates how to register a new tool and add it to the default toolbar | ||
.decorator('taOptions', ['taRegisterTool', '$delegate', function(taRegisterTool, taOptions){ // $delegate is the taOptions we are decorating | ||
taRegisterTool('test', { | ||
display: "<button type='button' ng-click='action()' ng-class='displayActiveToolClass(active)'>Test</button>", | ||
action: function(){ alert('Test Pressed') } | ||
}); | ||
taOptions.toolbar[1].push('test'); | ||
return taOptions; | ||
}]) | ||
// this demonstrates changing the classes of the icons for the tools | ||
.decorator('taTools', ['$delegate', function(taTools){ | ||
taTools.bold.iconclass = 'icon-bold'; | ||
taTools.italics.iconclass = 'icon-italic'; | ||
taTools.underline.iconclass = 'icon-underline'; | ||
taTools.ul.iconclass = 'icon-list-ul'; | ||
taTools.ol.iconclass = 'icon-list-ol'; | ||
taTools.undo.iconclass = 'icon-undo'; | ||
taTools.redo.iconclass = 'icon-repeat'; | ||
taTools.justifyLeft.iconclass = 'icon-align-left'; | ||
taTools.justifyRight.iconclass = 'icon-align-right'; | ||
taTools.justifyCenter.iconclass = 'icon-align-center'; | ||
taTools.clear.iconclass = 'icon-ban-circle'; | ||
taTools.insertLink.iconclass = 'icon-link'; | ||
taTools.unlink.iconclass = 'icon-link red'; | ||
taTools.insertImage.iconclass = 'icon-picture'; | ||
// there is no quote icon in old font-awesome so we change to text as follows | ||
delete taTools.quote.iconclass; | ||
taTools.quote.buttontext = 'quote'; | ||
return taTools; | ||
}]); | ||
function wysiwygeditor($scope, taToolbarEditorLinker) { | ||
$scope.data = {orightml: '<h2>Try me!</h2><p>textAngular is a super cool WYSIWYG Text Editor directive for AngularJS</p><p><b>Features:</b></p><ol><li>Automatic Seamless Two-Way-Binding</li><li>Super Easy <b>Theming</b> Options</li><li style="color: green;">Simple Editor Instance Creation</li><li>Safely Parses Html for Custom Toolbar Icons</li><li class="text-danger">Doesn't Use an iFrame</li><li>Works with Firefox, Chrome, and IE8+</li></ol><p><b>Code at GitHub:</b> <a href="https://github.com/fraywing/textAngular">Here</a> </p>'}; | ||
$scope.data.htmlcontent = $scope.data.orightml; | ||
$scope.disabled = false; | ||
$scope.changetesth1 = function(){ | ||
taToolbarEditorLinker.updateToolbarTool('test', 'h1', {buttontext: 'Heading 1'}); | ||
}; | ||
$scope.changeallh2 = function(){ | ||
taToolbarEditorLinker.updateTool('h2', {buttontext: 'Heading 2'}); | ||
}; | ||
$scope.changeallh = function(){ | ||
var data = {}; | ||
for(var i = 1; i < 7; i++){ | ||
data['h' + i] = {buttontext: 'Heading ' + i}; | ||
} | ||
taToolbarEditorLinker.updateTools(data); | ||
}; | ||
$scope.resettoolbar = function(){ | ||
taToolbarEditorLinker.resetTools(); | ||
}; | ||
$scope.iconsallh = function(){ | ||
var data = {}; | ||
for(var i = 1; i < 7; i++){ | ||
data['h' + i] = { | ||
iconclass: 'icon-bold' | ||
}; | ||
} | ||
taToolbarEditorLinker.updateTools(data); | ||
}; | ||
$scope.clear = function(){ | ||
$scope.data = {orightml: '<h2>Try me!</h2><p>textAngular is a super cool WYSIWYG Text Editor directive for AngularJS</p><p><b>Features:</b></p><ol><li>Automatic Seamless Two-Way-Binding</li><li>Super Easy <b>Theming</b> Options</li><li style="color: green;">Simple Editor Instance Creation</li><li>Safely Parses Html for Custom Toolbar Icons</li><li class="text-danger">Doesn't Use an iFrame</li><li>Works with Firefox, Chrome, and IE8+</li></ol><p><b>Code at GitHub:</b> <a href="https://github.com/fraywing/textAngular">Here</a> </p>'}; | ||
}; | ||
}; | ||
</script> | ||
|
||
</body> | ||
|
||
</html> |
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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
|
||
module.exports = function (config) { | ||
'use strict'; | ||
config.set({ | ||
|
||
frameworks: ['jasmine'], | ||
|
||
plugins: [ | ||
'karma-jasmine', | ||
'karma-chrome-launcher', | ||
'karma-firefox-launcher', | ||
'karma-coverage' | ||
], | ||
|
||
files: [ | ||
'bower_components/jquery/jquery.min.js', | ||
'bower_components/angular/angular.min.js', | ||
'bower_components/angular-mocks/angular-mocks.js', | ||
'bower_components/angular-sanitize/angular-sanitize.min.js', | ||
'textAngular.js', | ||
'test/*.spec.js' | ||
], | ||
|
||
// list of files to exclude | ||
exclude: [ | ||
|
||
], | ||
|
||
preprocessors: { | ||
'textAngular.js': ['coverage'] | ||
}, | ||
|
||
// test results reporter to use | ||
// possible values: 'dots', 'progress', 'junit' | ||
reporters: ['progress', 'coverage'], | ||
|
||
// web server port | ||
port: 9876, | ||
|
||
|
||
// cli runner port | ||
runnerPort: 9100, | ||
|
||
|
||
// enable / disable colors in the output (reporters and logs) | ||
colors: true, | ||
|
||
|
||
// level of logging | ||
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG | ||
logLevel: config.LOG_INFO, | ||
|
||
|
||
// enable / disable watching file and executing tests whenever any file changes | ||
autoWatch: false, | ||
|
||
|
||
// Start these browsers, currently available: | ||
// - Chrome | ||
// - ChromeCanary | ||
// - Firefox | ||
// - Opera | ||
// - Safari (only Mac) | ||
// - PhantomJS | ||
// - IE (only Windows) | ||
browsers: ['Chrome'], | ||
|
||
|
||
// If browser does not capture in given timeout [ms], kill it | ||
captureTimeout: 60000, | ||
|
||
|
||
// Continuous Integration mode | ||
// if true, it capture browsers, run tests and exit | ||
singleRun: true | ||
}); | ||
}; |
Oops, something went wrong.