Permalink
Browse files

do not clear formatting in plugins

  • Loading branch information...
1 parent 36925f4 commit 556ac444b7ecb1254e4c5db0ab76f8a8efd6f298 @jankuca committed Feb 26, 2012
Showing with 14 additions and 6 deletions.
  1. +14 −6 src/editor.js
View
@@ -488,27 +488,35 @@ takeNote.Editor.prototype.clearFormatting = function () {
var end_offset = range.getEndOffset();
var in_range = false;
blocks.some(function (block) {
+ var is_plugin = goog.dom.dataset.get(block, 'plugin');
+
var cont = block.firstChild;
var r = range.clone();
var native_r = r.getBrowserRangeObject();
if (!in_range) {
if (goog.dom.contains(cont, start_node)) {
if (goog.dom.contains(cont, end_node)) {
- this.clearRangeFormatting_(r);
+ if (!is_plugin) {
+ this.clearRangeFormatting_(r);
+ }
return true;
}
in_range = true;
- native_r.setEnd(cont, cont.childNodes.length);
- this.clearRangeFormatting_(r);
+ if (!is_plugin) {
+ native_r.setEnd(cont, cont.childNodes.length);
+ this.clearRangeFormatting_(r);
+ }
}
} else {
native_r.setStart(cont, 0);
if (goog.dom.contains(cont, end_node)) {
- native_r.setEnd(end_node, end_offset);
- this.clearRangeFormatting_(r);
+ if (!is_plugin) {
+ native_r.setEnd(end_node, end_offset);
+ this.clearRangeFormatting_(r);
+ }
return true;
- } else {
+ } else if (!is_plugin) {
native_r.setEnd(cont, cont.childNodes.length);
this.clearRangeFormatting_(r);
}

0 comments on commit 556ac44

Please sign in to comment.