Browse files

fix data-list attributes

  • Loading branch information...
1 parent f1a1ea8 commit 885f600ac4df46e94a61841fa02f4c062ee729ea @jankuca committed Nov 6, 2011
Showing with 2 additions and 2 deletions.
  1. +1 −1 dist/take-note.js
  2. +1 −1 src/editor.js
View
2 dist/take-note.js
@@ -82,7 +82,7 @@ r.yb=function(a){var b=Z(this);if(b.length){var c=ec(),d=c.d(),e=c.g(),f=c.k(),h
function nd(a,b){var c=B[b];if(a.isCollapsed())alert("not implemented");else{var d=a.v(),e=a.C().cloneContents();if(d.nodeType===d.TEXT_NODE&&(d=d.parentNode,d.tagName===c.tagName&&(d.className||m)===(c.className||m)))e=document.createDocumentFragment(),e.appendChild(d);d=Array.prototype.slice.call(ib(c.tagName,c.className,e));if(d.length){for(var f=0;c=d[f];++f){for(;c.firstChild;)c.parentNode.insertBefore(c.firstChild,c);c.parentNode.removeChild(c)}a.wa(e)}else{d=mb(c.tagName);if(c.className)d.className=
c.className;d.appendChild(e);a.wa(d)}}}r.xb=function(a){var b=B[a],c=dc();Z(this).forEach(function(c){var e=c.firstChild,f=mb(b.tagName,m);bc(cc(e),i).C();z(c,"type",a);qb(f,e.childNodes);rb(f,e);K(e)});this.aa=a;c.restore()};r.ab=function(a,b){var c=dc();Z(this).forEach(function(c){var e=A(c,"list");if(!b||!e)a===m?c.dataset?delete c.dataset.list:c.removeAttribute("data-"+sa("list")):z(c,"list",a),c.className+=" a",c.className=""});c.restore()};
r.setActive=function(a){if(a){if(!this.l.innerHTML)this.l.innerHTML="",this.zb="text",this.O(this.aa);hd(this.l,"keydown",this.rb,!1,this);hd(this.l,"keyup",this.sb,!1,this)}jb(this.l,{contentEditable:a});this.eb=a};
-r.O=function(a,b){var c;if(!(c=a))c=B[this.aa],c=c.Y?c.Y:this.aa;var a=c,d=B[a];c=mb("li");d=mb(d.tagName);c.appendChild(d);z(c,"type",a);var e=Z(this)[0];if(e){z(c,"list",A(e,"list")||"");var f=e.firstChild;if(f.lastChild){var h=ec().C();h.setEnd(f,f.childNodes.length);f=h.extractContents();d.appendChild(f)}sb(c,e)}else this.l.appendChild(c);b||Yb(d,0,d,0).select();return c};
+r.O=function(a,b){var c;if(!(c=a))c=B[this.aa],c=c.Y?c.Y:this.aa;var a=c,d=B[a];c=mb("li");d=mb(d.tagName);c.appendChild(d);z(c,"type",a);var e=Z(this)[0];if(e){z(c,"list",A(e,"list")||m);var f=e.firstChild;if(f.lastChild){var h=ec().C();h.setEnd(f,f.childNodes.length);f=h.extractContents();d.appendChild(f)}sb(c,e)}else this.l.appendChild(c);b||Yb(d,0,d,0).select();return c};
r.fb=function(a,b,c){a=this.O(a,!0);a.setAttribute("contenteditable",!1);b&&z(a,"plugin",b);c&&(b=this.ub++,this.Wa[b]=c,z(a,"plugin_id",String(b)));od(this);return a};r.La=function(){var a=dc();Z(this).forEach(function(a){var c=a.previousSibling;if(c){var d=c.lastChild;d.tagName!=="UL"&&(d=mb("ul"),d.setAttribute("contenteditable",!0),c.appendChild(d));d.appendChild(a)}});a.restore()};
r.Ua=function(){var a=dc(),b=this;Z(this).forEach(function(a){var d=a.parentNode;d!==b.l&&(sb(a,d.parentNode),d.childNodes.length===0&&K(d))});a.restore()};function pd(a){var b=dc();Z(a).forEach(function(a){var b=a.previousSibling;b&&rb(a,b)});b.restore()}function qd(a){var b=dc();Z(a).forEach(function(a){var b=a.nextSibling;b&&sb(a,b)});b.restore()}function Z(a){var b=ec();return b===m?[]:rd(a,b)}
function rd(a,b){var c=b.v();if(!L(a.l,c))return[];if(c===a.l&&a.l.childNodes.length===0)return[];if(c.tagName==="UL"){var d=[],c=c.getElementsByTagName("LI"),e=!1,f=b.d(),h=b.g();Array.prototype.some.call(c,function(a){if(e)return d.push(a),L(a,h);else L(a,f)&&(e=!0,d.push(a))});return d}do{if(c.tagName==="LI")return[c];c=c.parentNode}while(c!==a.l);return[]}
View
2 src/editor.js
@@ -473,7 +473,7 @@ takeNote.Editor.prototype.addBlock = function (key, dont_move_caret) {
if (current_block) {
// Keep previous list type
goog.dom.dataset.set(block, 'list',
- goog.dom.dataset.get(current_block, 'list') || '');
+ goog.dom.dataset.get(current_block, 'list') || null);
var current_cnt = current_block.firstChild;
if (current_cnt.lastChild) {

0 comments on commit 885f600

Please sign in to comment.