Index: trunk/parsers/wikidom/lib/hype/es.Surface.css |
— | — | @@ -40,36 +40,37 @@ |
41 | 41 | font-size: 1em; |
42 | 42 | } |
43 | 43 | |
44 | | -h1.editSurface-headingBlock, h2.editSurface-headingBlock { |
| 44 | +.editSurface-headingBlock-level1, |
| 45 | +.editSurface-headingBlock-level2 { |
45 | 46 | border-bottom: 1px solid #AAA; |
46 | 47 | } |
47 | 48 | |
48 | | -h1.editSurface-headingBlock > * { |
| 49 | +.editSurface-headingBlock-level1 > * { |
49 | 50 | font-size:188%; |
50 | 51 | font-weight: normal; |
51 | 52 | } |
52 | 53 | |
53 | | -h2.editSurface-headingBlock > * { |
| 54 | +.editSurface-headingBlock-level2 > * { |
54 | 55 | font-size:150%; |
55 | 56 | font-weight: normal; |
56 | 57 | } |
57 | 58 | |
58 | | -h3.editSurface-headingBlock > * { |
| 59 | +.editSurface-headingBlock-level3 > * { |
59 | 60 | font-size:132%; |
60 | 61 | font-weight: bold; |
61 | 62 | } |
62 | 63 | |
63 | | -h4.editSurface-headingBlock > * { |
| 64 | +.editSurface-headingBlock-level4 > * { |
64 | 65 | font-size:116%; |
65 | 66 | font-weight: bold; |
66 | 67 | } |
67 | 68 | |
68 | | -h5.editSurface-headingBlock > * { |
| 69 | +.editSurface-headingBlock-level5 > * { |
69 | 70 | font-size:100%; |
70 | 71 | font-weight: bold; |
71 | 72 | } |
72 | 73 | |
73 | | -h6.editSurface-headingBlock > * { |
| 74 | +.editSurface-headingBlock-level6 > * { |
74 | 75 | font-size:80%; |
75 | 76 | font-weight: bold; |
76 | 77 | } |
Index: trunk/parsers/wikidom/lib/hype/views/es.ListItemView.js |
— | — | @@ -24,10 +24,19 @@ |
25 | 25 | }; |
26 | 26 | |
27 | 27 | es.ListItemView.prototype.setClasses = function() { |
28 | | - // TODO: Unset previously set classes in case of switching from bullet list to numbered list |
29 | | - // or changing indentation level |
30 | | - var styles = this.model.getElementAttribute( 'styles' ); |
31 | | - this.$.addClass( 'editSurface-listItem-' + styles[ styles.length - 1 ] ) |
| 28 | + var classes = this.$.attr( 'class' ), |
| 29 | + styles = this.model.getElementAttribute( 'styles' ); |
| 30 | + this.$ |
| 31 | + // Remove any existing level classes |
| 32 | + .attr( |
| 33 | + 'class', |
| 34 | + classes |
| 35 | + .replace( /editSurface-listItem-level[0-9]+/, '' ) |
| 36 | + .replace( /editSurface-listItem-(bullet|number)/, '' ) |
| 37 | + ) |
| 38 | + // Set the list style class from the style on top of the stack |
| 39 | + .addClass( 'editSurface-listItem-' + styles[styles.length - 1] ) |
| 40 | + // Set the list level class from the length of the stack |
32 | 41 | .addClass( 'editSurface-listItem-level' + ( styles.length - 1 ) ); |
33 | 42 | }; |
34 | 43 | |
Index: trunk/parsers/wikidom/lib/hype/views/es.HeadingView.js |
— | — | @@ -12,8 +12,26 @@ |
13 | 13 | |
14 | 14 | // DOM Changes |
15 | 15 | this.$.addClass( 'editSurface-headingBlock' ); |
| 16 | + |
| 17 | + // Events |
| 18 | + this.on( 'update', this.setClasses ); |
| 19 | + |
| 20 | + // Initialization |
| 21 | + this.setClasses(); |
16 | 22 | }; |
17 | 23 | |
| 24 | +/* Methods */ |
| 25 | + |
| 26 | +es.HeadingView.prototype.setClasses = function() { |
| 27 | + var classes = this.$.attr( 'class' ), |
| 28 | + level = this.model.getElementAttribute( 'level' ); |
| 29 | + this.$ |
| 30 | + // Remove any existing level classes |
| 31 | + .attr( 'class', classes.replace( /editSurface-headingBlock-level[1-6]/, '' ) ) |
| 32 | + // Add a new level class |
| 33 | + .addClass( 'editSurface-headingBlock-level' + level ); |
| 34 | +}; |
| 35 | + |
18 | 36 | /* Inheritance */ |
19 | 37 | |
20 | 38 | es.extendClass( es.HeadingView, es.DocumentViewLeafNode ); |