From 47ac9c3223f669305fb6f2d322d3914ddc6825c7 Mon Sep 17 00:00:00 2001 From: farthinker Date: Tue, 17 Nov 2015 21:29:15 +0800 Subject: [PATCH] FIX: formatting bug when switch between html mode and normal mode --- bower.json | 4 ++-- lib/simditor-html.js | 5 +++-- package.json | 4 ++-- src/simditor-html.coffee | 3 ++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/bower.json b/bower.json index e353dfc..11e5199 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "simditor-html", - "version": "1.1.0", + "version": "1.1.1", "homepage": "https://github.com/mycolorway/simditor-html", "authors": [ "farthinker " @@ -25,7 +25,7 @@ ], "dependencies": { "jquery": "~2.1.4", - "simditor": "~2.2.0", + "simditor": "~2.3.4", "js-beautify": "~1.5.5" } } diff --git a/lib/simditor-html.js b/lib/simditor-html.js index d85ebc9..a48d3ad 100644 --- a/lib/simditor-html.js +++ b/lib/simditor-html.js @@ -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) { @@ -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++) { diff --git a/package.json b/package.json index ec2d814..1e32895 100644 --- a/package.json +++ b/package.json @@ -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", @@ -27,7 +27,7 @@ }, "dependencies": { "jquery": "~2.1.4", - "simditor": "~2.2.0", + "simditor": "~2.3.4", "js-beautify": "~1.5.5" } } diff --git a/src/simditor-html.coffee b/src/simditor-html.coffee index 8ebfce6..c9e50ea 100644 --- a/src/simditor-html.coffee +++ b/src/simditor-html.coffee @@ -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() @@ -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'