Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
machuanjia committed Mar 22, 2016
1 parent 8b752b7 commit bb3c2b8
Show file tree
Hide file tree
Showing 7 changed files with 1,228 additions and 7 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.35",
"version": "1.0.36",
"homepage": "https://github.com/WorktileTech/angular-wt-editor",
"authors": [
"YCTech"
Expand Down
3 changes: 3 additions & 0 deletions dist/wt-editor-min.js

Large diffs are not rendered by default.

1,210 changes: 1,210 additions & 0 deletions dist/wt-editor.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/wt-editor.tpl-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.35",
"version": "1.0.36",
"description": "angular-wt-editor =================",
"main": "index.js",
"scripts": {
Expand Down
15 changes: 11 additions & 4 deletions src/js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ angular.module("wt-editor")
hideButtons : [],//要不显示的图标[]
additionalButtons: [],//扩展的图标 {title:'扩展',className:'fa fa-music',type:'custom',action:musicFn,before:2}
replaceButtons : [],//替换默认的图标 {title:'插入图片',className:'fa fa-file-image-o',type:'custom',action:imageFn,id:17}
locale : 'en-us',//国际化设置[未]
locale : 'zh-cn',//国际化设置[未]
language : {
'en-us': {
'heading' : 'H1',
Expand Down Expand Up @@ -282,7 +282,8 @@ angular.module("wt-editor")
'original' : 'Reduction',
'col' : 'col',
'row' : 'row',
'diagram' : 'sequenceDiagram\nA->>B: How are you?\nB->>A: I am fine!'
'diagram' : 'sequenceDiagram\nA->>B: How are you?\nB->>A: I am fine!',
'placeholder' : 'Content ...'
},
'zh-cn': {
'heading' : '标题',
Expand Down Expand Up @@ -318,7 +319,8 @@ angular.module("wt-editor")
'original' : '还原',
'col' : '列',
'row' : '行',
'diagram' : 'sequenceDiagram\nA->>B: 你好吗?\nB->>A: 我很好3!'
'diagram' : 'sequenceDiagram\nA->>B: 你好吗?\nB->>A: 我很好3!',
'placeholder' : '输入内容...'
},
'zh-tw': {
'heading' : '標題',
Expand Down Expand Up @@ -354,7 +356,8 @@ angular.module("wt-editor")
'original' : '還原',
'col' : '列',
'row' : '行',
'diagram' : 'sequenceDiagram\nA->>B: 你好嗎?\nB->>A: 我很好!'
'diagram' : 'sequenceDiagram\nA->>B: 你好嗎?\nB->>A: 我很好!',
'placeholder' : '輸入內容...'
}
},
onShow : null,//显示编辑器的时候调用
Expand Down Expand Up @@ -616,6 +619,10 @@ angular.module("wt-editor")
vm.isFullscreen = wtEditorConfig.isFullscreen;

vm.editor = $(element).find('.wt-editor-textarea')[0];
try{
vm.editor.setAttribute('placeholder',controller[0].getLocaleText('placeholder'));
}catch(e){}


//插入方法
function insert(flag, title, sel, keepSelection, search, replace) {
Expand Down
2 changes: 1 addition & 1 deletion src/tpl/editor.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<div class="wt-editor {{vm.className}}" ng-class="{true: 'wt-editor-full-screen', false: ''}[vm.isFullscreen]"> <div class="wt-editor-toobar"> <div class="noselect"> <ul class="wtEditorToolBarUl"> <li class="wtEditorToolBarli" ng-repeat="item in vm.toolbars track by $index" name="{{item.name}}" ng-class="(item.id == 0 && vm.header_action)?'active':''"> <!--自定义toolbar--> <i ng-if="item.type === 'custom'" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="item.action($event,vm)"></i> <i ng-if="item.type === 'headingFns'" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="vm.setHeaderLi(item.id)"></i> <div ng-if="item.type === 'headingFns'" ng-show="vm.header_action" class="toolbar-menu" flag="h"> <ul flag="h"> <li ng-repeat="n in vm.headers" ng-class="n.className" ng-click="vm.styleFn(n.name,$event)" flag="h"> {{n.title}} </li> </ul> </div> <i ng-if="item.type === 'styleFn'" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="vm.styleFn(item.name,$event)"></i> <!--<i ng-if="item.type === 'headingFn'" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="vm.styleFn(item.name,$event)">h{{item.level}}</i>--> <i ng-if="item.type === 'tableFn'" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="vm.styleFn(item.name,$event)"></i> <div ng-if="item.type === 'tableFn'" ng-show="vm.table_action" class="table-menu" flag="table" ng-mouseleave="vm.tableActiveX=1;vm.tableActiveY=1;vm.table_action=false"> <ul flag="table"> <li flag="table" ng-repeat="n in vm.tableMenu"> <i ng-repeat="s in n" flag="table" ng-click="vm.insertTable()" ng-mouseenter="vm.setTableMemu(s[0],s[1])" ng-mouseleave="" ng-class="{true: 'active', false: ''}[s[0]<=vm.tableActiveX && s[1] <= vm.tableActiveY]"></i> </li> </ul> </div> <i ng-if="item.type === 'emoji'" title="{{item.title}}" class="{{item.className}} toolbar-icon" data-toggle="modal" data-target="#{{item.target}}"></i> <i ng-if="item.type === 'mathFn'" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="vm.styleFn(item.name,$event)"></i> <i ng-if="item.type === 'flowchart'" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="vm.styleFn(item.name,$event)"></i> <i ng-if="item.type === 'diagram'" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="vm.styleFn(item.name,$event)"></i> <i ng-if="item.type === 'gantt'" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="vm.styleFn(item.name,$event)"></i> <i ng-if="item.type === 'help'" title="{{item.title}}" class="{{item.className}} toolbar-icon" data-toggle="modal" data-target="#{{item.target}}"></i> <i ng-if="item.type === 'preview' && vm.isPreviewButton" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="vm.togglePreview()"></i> <i ng-if="item.type === 'expand' && vm.isFullButton" title="{{vm.isFullscreen?item.title2:item.title}}" class="{{item.className}} toolbar-icon" ng-class="{true: 'fa-compress', false: 'fa-expand'}[vm.isFullscreen]" ng-click="vm.toggleFullScreen()"></i> <i ng-if="item.type === 'divider'" class="divider"></i> </li> </ul> </div> </div> <div class="wt-editor-container"> <div class="wt-editor-container-code" ng-style="vm.editorContainerCode"> <textarea ng-style="vm.editorHeight" placeholder="输入内容..." class="wt-editor-textarea" ng-model="value"></textarea> </div> <div class="wt-editor-container-preview" ng-show="vm.isPreview"> <article class="markdown-body" data-open-title="Hide Preview" data-closed-title="Show Preview"></article> <!-- 实时预览 --> </div> </div></div>
<div class="wt-editor {{vm.className}}" ng-class="{true: 'wt-editor-full-screen', false: ''}[vm.isFullscreen]"> <div class="wt-editor-toobar"> <div class="noselect"> <ul class="wtEditorToolBarUl"> <li class="wtEditorToolBarli" ng-repeat="item in vm.toolbars track by $index" name="{{item.name}}" ng-class="(item.id == 0 && vm.header_action)?'active':''"> <!--自定义toolbar--> <i ng-if="item.type === 'custom'" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="item.action($event,vm)"></i> <i ng-if="item.type === 'headingFns'" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="vm.setHeaderLi(item.id)"></i> <div ng-if="item.type === 'headingFns'" ng-show="vm.header_action" class="toolbar-menu" flag="h"> <ul flag="h"> <li ng-repeat="n in vm.headers" ng-class="n.className" ng-click="vm.styleFn(n.name,$event)" flag="h"> {{n.title}} </li> </ul> </div> <i ng-if="item.type === 'styleFn'" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="vm.styleFn(item.name,$event)"></i> <!--<i ng-if="item.type === 'headingFn'" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="vm.styleFn(item.name,$event)">h{{item.level}}</i>--> <i ng-if="item.type === 'tableFn'" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="vm.styleFn(item.name,$event)"></i> <div ng-if="item.type === 'tableFn'" ng-show="vm.table_action" class="table-menu" flag="table" ng-mouseleave="vm.tableActiveX=1;vm.tableActiveY=1;vm.table_action=false"> <ul flag="table"> <li flag="table" ng-repeat="n in vm.tableMenu"> <i ng-repeat="s in n" flag="table" ng-click="vm.insertTable()" ng-mouseenter="vm.setTableMemu(s[0],s[1])" ng-mouseleave="" ng-class="{true: 'active', false: ''}[s[0]<=vm.tableActiveX && s[1] <= vm.tableActiveY]"></i> </li> </ul> </div> <i ng-if="item.type === 'emoji'" title="{{item.title}}" class="{{item.className}} toolbar-icon" data-toggle="modal" data-target="#{{item.target}}"></i> <i ng-if="item.type === 'mathFn'" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="vm.styleFn(item.name,$event)"></i> <i ng-if="item.type === 'flowchart'" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="vm.styleFn(item.name,$event)"></i> <i ng-if="item.type === 'diagram'" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="vm.styleFn(item.name,$event)"></i> <i ng-if="item.type === 'gantt'" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="vm.styleFn(item.name,$event)"></i> <i ng-if="item.type === 'help'" title="{{item.title}}" class="{{item.className}} toolbar-icon" data-toggle="modal" data-target="#{{item.target}}"></i> <i ng-if="item.type === 'preview' && vm.isPreviewButton" title="{{item.title}}" class="{{item.className}} toolbar-icon" ng-click="vm.togglePreview()"></i> <i ng-if="item.type === 'expand' && vm.isFullButton" title="{{vm.isFullscreen?item.title2:item.title}}" class="{{item.className}} toolbar-icon" ng-class="{true: 'fa-compress', false: 'fa-expand'}[vm.isFullscreen]" ng-click="vm.toggleFullScreen()"></i> <i ng-if="item.type === 'divider'" class="divider"></i> </li> </ul> </div> </div> <div class="wt-editor-container"> <div class="wt-editor-container-code" ng-style="vm.editorContainerCode"> <textarea ng-style="vm.editorHeight" class="wt-editor-textarea" ng-model="value"></textarea> </div> <div class="wt-editor-container-preview" ng-show="vm.isPreview"> <article class="markdown-body" data-open-title="Hide Preview" data-closed-title="Show Preview"></article> <!-- 实时预览 --> </div> </div></div>
Expand Down

0 comments on commit bb3c2b8

Please sign in to comment.