Skip to content

Commit

Permalink
FIX: formatting bug when switch between html mode and normal mode
Browse files Browse the repository at this point in the history
  • Loading branch information
farthinker committed Nov 17, 2015
1 parent 7b51994 commit 47ac9c3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 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": "1.1.0",
"version": "1.1.1",
"homepage": "https://github.com/mycolorway/simditor-html",
"authors": [
"farthinker <[email protected]>"
Expand All @@ -25,7 +25,7 @@
],
"dependencies": {
"jquery": "~2.1.4",
"simditor": "~2.2.0",
"simditor": "~2.3.4",
"js-beautify": "~1.5.5"
}
}
5 changes: 3 additions & 2 deletions lib/simditor-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ HTMLButton = (function(superClass) {
this.editor.textarea.on('blur', (function(_this) {
return function(e) {
_this.editor.el.removeClass('focus');
_this.editor.setValue(_this.editor.textarea.val());
return _this.editor.trigger('valuechanged');
return _this.editor.setValue(_this.editor.textarea.val());
};
})(this));
return this.editor.textarea.on('input', (function(_this) {
Expand All @@ -64,6 +63,8 @@ HTMLButton = (function(superClass) {
this.editor.hidePopover();
this.editor.textarea.val(this.beautifyHTML(this.editor.textarea.val()));
this._resizeTextarea();
} else {
this.editor.setValue(this.editor.textarea.val());
}
ref = this.editor.toolbar.buttons;
for (i = 0, len = ref.length; i < len; i++) {
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": "1.1.0",
"version": "1.1.1",
"homepage": "https://github.com/mycolorway/simditor-html",
"author": {
"name": "farthinker",
Expand All @@ -27,7 +27,7 @@
},
"dependencies": {
"jquery": "~2.1.4",
"simditor": "~2.2.0",
"simditor": "~2.3.4",
"js-beautify": "~1.5.5"
}
}
3 changes: 2 additions & 1 deletion src/simditor-html.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ 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 All @@ -34,6 +33,8 @@ class HTMLButton extends Simditor.Button
@editor.hidePopover()
@editor.textarea.val @beautifyHTML(@editor.textarea.val())
@_resizeTextarea()
else
@editor.setValue @editor.textarea.val()

for button in @editor.toolbar.buttons
if button.name == 'html'
Expand Down

0 comments on commit 47ac9c3

Please sign in to comment.