Skip to content

Commit

Permalink
add simple
Browse files Browse the repository at this point in the history
  • Loading branch information
machuanjia committed Jan 11, 2016
1 parent 2f9f741 commit d56c107
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-wt-editor",
"version": "1.0.14",
"version": "1.0.15",
"homepage": "https://github.com/WorktileTech/angular-wt-editor",
"authors": [
"YCTech"
Expand Down
2 changes: 1 addition & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html ng-app="demoApp"><head lang="en"> <meta charset="UTF-8"> <title>wt-editor</title> <link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.css"/> <link rel="stylesheet" href="../bower_components/fontawesome/css/font-awesome.min.css"/> <link rel="stylesheet" href="../bower_components/katex-build/katex.min.css"/> <link rel="stylesheet" href="../bower_components/mermaid-min/mermaid.css"/> <link rel="stylesheet" href="../src/css/markdown.css"/> <link rel="stylesheet" href="../src/css/main.css"/> <style> html,body{ height: 100%; padding: 0; margin: 0; overflow: hidden; } </style></head><body ng-controller="demoCtrl"><div style="width: 1200px;height: 400px;margin: auto;margin-top: 150px"> <!--&#45;&#45;{{content}}--> <!--<wt-editor ng-model="content" config="{hideButtons:[],type:'all',onShow:onShow,onPreview:onPreview,onChange:onChange,replaceButtons:[{title:'插入图片',className:'fa fa-file-image-o',type:'custom',action:imageFn,id:17}],additionalButtons:[{title:'扩展',className:'fa fa-music',type:'custom',action:musicFn,before:2}]}"></wt-editor>--> <wt-editor ng-model="content" config="{hideButtons:[],type:'all',onShow:onShow,onPreview:onPreview,onChange:onChange}"></wt-editor></div><script src="../bower_components/angular/angular.js"></script><script src="../bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script><script src="../bower_components/jquery/dist/jquery.js"></script><script src="../bower_components/bootstrap/dist/js/bootstrap.js"></script><script src="../bower_components/lodash/lodash.js"></script><script src="../bower_components/Caret.js/dist/jquery.caret.js"></script><!--<script src="../bower_components/markedown/markedown.min.js"></script>--><script src="../bower_components/marked/marked.min.js"></script><script src="../bower_components/katex-build/katex.min.js"></script><script src="../bower_components/mermaid-min/mermaid.full.min.js"></script><script src="../src/wt-editor.tpl.js"></script><script src="../src/wt-editor.js"></script><script> angular.module("demoApp",['wt-editor']). controller('demoCtrl',['$scope','$http',function($scope,$http){ $scope.content = ""; $scope.musicFn = function($event,vmobj){ alert(vmobj.getContent()); vmobj.insertContent("-----我的祖国------"); } $scope.imageFn = function($event,vmobj){ alert(vmobj.getContent()); vmobj.insertContent("--------这是个图片--------"); } $scope.onShow = function(){console.log("-----onshow事件")} $scope.onPreview = function(value){console.log("-----onPreview事件:"+value)} $scope.onChange = function(value){ console.log("-----onChange事件:"+$scope.content) } $http({method:'GET', url:'sample.md'}).success(function(rv){ $scope.content = rv; }); }]);</script></body></html>
<!DOCTYPE html><html ng-app="demoApp"><head lang="en"> <meta charset="UTF-8"> <title>wt-editor</title> <link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.css"/> <link rel="stylesheet" href="../bower_components/fontawesome/css/font-awesome.min.css"/> <link rel="stylesheet" href="../bower_components/katex-build/katex.min.css"/> <link rel="stylesheet" href="../bower_components/mermaid-min/mermaid.css"/> <link rel="stylesheet" href="../src/css/markdown.css"/> <link rel="stylesheet" href="../src/css/main.css"/> <style> html,body{ height: 100%; padding: 0; margin: 0; overflow: hidden; } </style></head><body ng-controller="demoCtrl"><div style="width: 1200px;height: 400px;margin: auto;margin-top: 150px"> <!--&#45;&#45;{{content}}--> <!--<wt-editor ng-model="content" config="{hideButtons:[],type:'all',onShow:onShow,onPreview:onPreview,onChange:onChange,replaceButtons:[{title:'插入图片',className:'fa fa-file-image-o',type:'custom',action:imageFn,id:17}],additionalButtons:[{title:'扩展',className:'fa fa-music',type:'custom',action:musicFn,before:2}]}"></wt-editor>--> <!--<wt-editor ng-model="content" config="{hideButtons:[],type:'all',onShow:onShow,onPreview:onPreview,onChange:onChange}"></wt-editor>--> <wt-editor ng-model="content" config="{hideButtons:[],type:'simple',onShow:onShow,onPreview:onPreview,onChange:onChange}"></wt-editor></div><script src="../bower_components/angular/angular.js"></script><script src="../bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script><script src="../bower_components/jquery/dist/jquery.js"></script><script src="../bower_components/bootstrap/dist/js/bootstrap.js"></script><script src="../bower_components/lodash/lodash.js"></script><script src="../bower_components/Caret.js/dist/jquery.caret.js"></script><!--<script src="../bower_components/markedown/markedown.min.js"></script>--><script src="../bower_components/marked/marked.min.js"></script><script src="../bower_components/katex-build/katex.min.js"></script><script src="../bower_components/mermaid-min/mermaid.full.min.js"></script><script src="../src/wt-editor.tpl.js"></script><script src="../src/wt-editor.js"></script><script> angular.module("demoApp",['wt-editor']). controller('demoCtrl',['$scope','$http',function($scope,$http){ $scope.content = ""; $scope.musicFn = function($event,vmobj){ alert(vmobj.getContent()); vmobj.insertContent("-----我的祖国------"); } $scope.imageFn = function($event,vmobj){ alert(vmobj.getContent()); vmobj.insertContent("--------这是个图片--------"); } $scope.onShow = function(){console.log("-----onshow事件")} $scope.onPreview = function(value){console.log("-----onPreview事件:"+value)} $scope.onChange = function(value){ console.log("-----onChange事件:"+$scope.content) } $http({method:'GET', url:'sample.md'}).success(function(rv){ $scope.content = rv; }); }]);</script></body></html>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-wt-editor",
"version": "1.0.14",
"version": "1.0.15",
"description": "angular-wt-editor =================",
"main": "index.js",
"scripts": {
Expand Down
50 changes: 49 additions & 1 deletion src/js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,54 @@ angular.module("wt-editor")
//继承设置
angular.extend(wtEditorConfig, scope.config);
if (wtEditorConfig.type === 'simple') {
vm.toolbars = _.union(
[{
id : 1,
title : '粗体',
className: 'fa fa-bold',
modifier : '**',
type : 'styleFn',
name : 'bold'
}, {
id : 2,
title : '斜体',
className: 'fa fa-italic',
modifier : '*',
type : 'styleFn',
name : 'italic'
}],[{
id : 16,
title : '链接',
className: 'fa fa-link',
text : '链接文字',
url : 'http://example.com',
type : 'styleFn',
name : 'link'
}], [{id:'d1',type: 'dividor'}],
wtEditorConfig.horizonToolbar,
[{
id : 11,
title : '引用',
className: 'fa fa-quote-left',
prefix : '> ',
type : 'styleFn',
name : 'quote'
}, {
id : 12,
title : '无序列表',
className: 'fa fa-list-ul',
prefix : '- ',
type : 'styleFn',
name : 'list'
}, {
id : 13,
title : '有序列表',
className: 'fa fa-list-ol',
prefix : '1. ',
type : 'styleFn',
name : 'list-2'
}]);
}else if(wtEditorConfig.type === 'complex'){
vm.toolbars = _.union(
wtEditorConfig.hToolbars,
wtEditorConfig.styleToolBar, [{id:'d1',type: 'dividor'}],
Expand All @@ -576,7 +624,7 @@ angular.module("wt-editor")
wtEditorConfig.listToolbar, [{id:'d3',type: 'dividor'}],
wtEditorConfig.linkToolbar, [{id:'d4',type: 'dividor'}],
wtEditorConfig.expandToolbar);
} else if (wtEditorConfig.type === 'all') {
}else if (wtEditorConfig.type === 'all') {
vm.toolbars = _.union(
wtEditorConfig.hToolbars,
wtEditorConfig.styleToolBar, [{id:'d1',type: 'dividor'}],
Expand Down

0 comments on commit d56c107

Please sign in to comment.