Skip to content

Commit

Permalink
trigger valuechanged event after html changed
Browse files Browse the repository at this point in the history
  • Loading branch information
farthinker committed May 27, 2015
1 parent 86e4e89 commit a6c1561
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simditor-html",
"version": "0.0.1",
"version": "1.0.1",
"homepage": "https://github.com/mycolorway/simditor-html",
"authors": [
"farthinker <farthinker@gmail.com>"
Expand All @@ -24,7 +24,7 @@
"umd.hbs"
],
"dependencies": {
"jquery": "2.x",
"jquery": "~2.1.4",
"simditor": "~2.1.9",
"js-beautify": "~1.5.5"
}
Expand Down
16 changes: 8 additions & 8 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ <h1>Simditor HTML Editing</h3>
</header>
<section>
<textarea id="txt-editor">
<p>Simditor 是团队协作工具 <a href="http://tower.im">Tower</a> 使用的富文本编辑器。</p>
<p>相比传统的编辑器它的特点是:</p>
<ul>
<li>功能精简,加载快速</li>
<li>输出格式化的标准 HTML</li>
<li>每一个功能都有非常优秀的使用体验</li>
</ul>
<p>兼容的浏览器:IE10+、Chrome、Firefox、Safari。</p>
<p>Simditor 是团队协作工具 <a href="http://tower.im">Tower</a> 使用的富文本编辑器。</p>
<p>相比传统的编辑器它的特点是:</p>
<ul>
<li>功能精简,加载快速</li>
<li>输出格式化的标准 HTML</li>
<li>每一个功能都有非常优秀的使用体验</li>
</ul>
<p>兼容的浏览器:IE10+、Chrome、Firefox、Safari。</p>
</textarea>
</section>
</div>
Expand Down
3 changes: 2 additions & 1 deletion lib/simditor-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ HTMLButton = (function(superClass) {
this.editor.textarea.on('blur', (function(_this) {
return function(e) {
_this.editor.el.removeClass('focus');
return _this.editor.setValue(_this.editor.textarea.val());
_this.editor.setValue(_this.editor.textarea.val());
return _this.editor.trigger('valuechanged');
};
})(this));
return this.editor.textarea.on('input', (function(_this) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "simditor-html",
"description": "HTML source editing plugin for simditor",
"version": "0.0.1",
"version": "1.0.1",
"homepage": "https://github.com/mycolorway/simditor-html",
"author": {
"name": "farthinker",
Expand All @@ -26,7 +26,7 @@
"grunt-umd": "2.x"
},
"dependencies": {
"jquery": "2.x",
"jquery": "~2.1.4",
"simditor": "~2.1.9",
"js-beautify": "~1.5.5"
},
Expand Down
1 change: 1 addition & 0 deletions src/simditor-html.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class HTMLButton extends Simditor.Button
@editor.textarea.on 'blur', (e) =>
@editor.el.removeClass 'focus'
@editor.setValue @editor.textarea.val()
@editor.trigger 'valuechanged'

@editor.textarea.on 'input', (e) =>
@_resizeTextarea()
Expand Down

0 comments on commit a6c1561

Please sign in to comment.