Index: trunk/parsers/wikidom/lib/es/es.ParagraphBlock.js |
— | — | @@ -10,6 +10,8 @@ |
11 | 11 | .data( 'block', this ); |
12 | 12 | this.flow = new TextFlow( this.$ ); |
13 | 13 | this.updateText(); |
| 14 | + this.rendering = false; |
| 15 | + this.reRender = false; |
14 | 16 | } |
15 | 17 | |
16 | 18 | Block.prototype.getLength = function() { |
— | — | @@ -45,7 +47,7 @@ |
46 | 48 | lineOffset += this.lines[i].text.length; |
47 | 49 | } |
48 | 50 | this.updateText(); |
49 | | - this.flow.render(); |
| 51 | + this.renderContent(); |
50 | 52 | }; |
51 | 53 | |
52 | 54 | /** |
— | — | @@ -96,7 +98,7 @@ |
97 | 99 | this.lines.splice( from.index + 1, to.index - from.index ); |
98 | 100 | } |
99 | 101 | this.updateText(); |
100 | | - this.flow.render(); |
| 102 | + this.renderContent(); |
101 | 103 | }; |
102 | 104 | |
103 | 105 | /** |
— | — | @@ -105,7 +107,20 @@ |
106 | 108 | * @param $container {jQuery Selection} Container to render into |
107 | 109 | */ |
108 | 110 | ParagraphBlock.prototype.renderContent = function() { |
109 | | - this.flow.render(); |
| 111 | + if ( !this.rendering ) { |
| 112 | + this.rendering = true; |
| 113 | + var block = this; |
| 114 | + this.flow.render( 0, function() { |
| 115 | + block.rendering = false; |
| 116 | + var reRender = block.reRender; |
| 117 | + block.reRender = false; |
| 118 | + if ( reRender ) { |
| 119 | + block.renderContent(); |
| 120 | + } |
| 121 | + }); |
| 122 | + } else { |
| 123 | + this.reRender = true; |
| 124 | + } |
110 | 125 | }; |
111 | 126 | |
112 | 127 | /** |