Index: trunk/parsers/wikidom/lib/synth/models/es.CommentBlockModel.js |
— | — | @@ -44,6 +44,16 @@ |
45 | 45 | }; |
46 | 46 | |
47 | 47 | /** |
| 48 | + * Gets text content. |
| 49 | + * |
| 50 | + * @method |
| 51 | + * @returns {String} Plain text content |
| 52 | + */ |
| 53 | +es.CommentBlockModel.prototype.getText = function() { |
| 54 | + return this.text; |
| 55 | +}; |
| 56 | + |
| 57 | +/** |
48 | 58 | * Gets a plain comment block object. |
49 | 59 | * |
50 | 60 | * @method |
— | — | @@ -53,6 +63,24 @@ |
54 | 64 | return { 'type': 'comment', 'text': this.text }; |
55 | 65 | }; |
56 | 66 | |
| 67 | +/** |
| 68 | + * Gets HTML serialization of block. |
| 69 | + * |
| 70 | + * @method |
| 71 | + * @returns {String} HTML data |
| 72 | + */ |
| 73 | +es.CommentBlockModel.prototype.getHtml = function() { |
| 74 | + return '<!--' + comment.text + '-->'; |
| 75 | +}; |
| 76 | + |
| 77 | +/** |
| 78 | + * Gets Wikitext serialization of block. |
| 79 | + * |
| 80 | + * @method |
| 81 | + * @returns {String} Wikitext data |
| 82 | + */ |
| 83 | +es.CommentBlockModel.prototype.getWikitext = es.CommentBlockModel.prototype.getHtml; |
| 84 | + |
57 | 85 | // Register constructor |
58 | 86 | es.BlockModel.constructors['comment'] = es.CommentBlockModel; |
59 | 87 | |
Index: trunk/parsers/wikidom/lib/synth/models/es.DocumentModel.js |
— | — | @@ -51,6 +51,30 @@ |
52 | 52 | }; |
53 | 53 | |
54 | 54 | /** |
| 55 | + * Gets HTML serialization of document. |
| 56 | + * |
| 57 | + * @method |
| 58 | + * @returns {String} HTML data |
| 59 | + */ |
| 60 | +es.DocumentModel.prototype.getHtml = function() { |
| 61 | + return $.map( this.blocks, function( i, block ) { |
| 62 | + return block.getHtml( { 'index': i } ); |
| 63 | + } ).join( '\n' ); |
| 64 | +}; |
| 65 | + |
| 66 | +/** |
| 67 | + * Gets Wikitext serialization of document. |
| 68 | + * |
| 69 | + * @method |
| 70 | + * @returns {String} Wikitext data |
| 71 | + */ |
| 72 | +es.DocumentModel.prototype.getWikitext = function() { |
| 73 | + return $.map( this.blocks, function( i, block ) { |
| 74 | + return block.getWikitext( { 'index': i } ); |
| 75 | + } ).join( '\n' ); |
| 76 | +}; |
| 77 | + |
| 78 | +/** |
55 | 79 | * Gets the size of the of the contents of all blocks. |
56 | 80 | * |
57 | 81 | * @method |
Index: trunk/parsers/wikidom/lib/synth/models/es.ParagraphBlockModel.js |
— | — | @@ -15,6 +15,19 @@ |
16 | 16 | } ); |
17 | 17 | }; |
18 | 18 | |
| 19 | +/* Static Members */ |
| 20 | + |
| 21 | +/** |
| 22 | + * Registry of serializers, mapping symbolic format type names to serialization functions. |
| 23 | + * |
| 24 | + * Functions added to this object should accept block and options arguments. |
| 25 | + * |
| 26 | + * @member |
| 27 | + * @static |
| 28 | + * @type {Object} |
| 29 | + */ |
| 30 | +es.ParagraphBlockModel.serializers = {}; |
| 31 | + |
19 | 32 | /* Static Methods */ |
20 | 33 | |
21 | 34 | /** |
— | — | @@ -57,6 +70,30 @@ |
58 | 71 | return { 'type': 'paragraph', 'content': this.content.getPlainObject() }; |
59 | 72 | }; |
60 | 73 | |
| 74 | +/** |
| 75 | + * Gets HTML serialization of block. |
| 76 | + * |
| 77 | + * @method |
| 78 | + * @returns {String} HTML data |
| 79 | + */ |
| 80 | +es.ParagraphBlockModel.prototype.getHtml = function( index ) { |
| 81 | + var html = this.content.getWikitext();; |
| 82 | + if ( index === 0 ) { |
| 83 | + html = es.AnnotationSerializer.buildXmlTag( 'p', {}, html ); |
| 84 | + } |
| 85 | + return html; |
| 86 | +}; |
| 87 | + |
| 88 | +/** |
| 89 | + * Gets Wikitext serialization of block. |
| 90 | + * |
| 91 | + * @method |
| 92 | + * @returns {String} Wikitext data |
| 93 | + */ |
| 94 | +es.ParagraphBlockModel.prototype.getWikitext = function() { |
| 95 | + return this.content.getWikitext(); |
| 96 | +}; |
| 97 | + |
61 | 98 | // Register constructor |
62 | 99 | es.BlockModel.constructors['paragraph'] = es.ParagraphBlockModel.newFromPlainObject; |
63 | 100 | |
Index: trunk/parsers/wikidom/lib/synth/models/es.TableBlockCellModel.js |
— | — | @@ -68,6 +68,26 @@ |
69 | 69 | */ |
70 | 70 | }; |
71 | 71 | |
| 72 | +/** |
| 73 | + * Gets HTML serialization of cell. |
| 74 | + * |
| 75 | + * @method |
| 76 | + * @returns {String} HTML data |
| 77 | + */ |
| 78 | +es.TableBlockCellModel.prototype.getHtml = function() { |
| 79 | + |
| 80 | +}; |
| 81 | + |
| 82 | +/** |
| 83 | + * Gets Wikitext serialization of cell. |
| 84 | + * |
| 85 | + * @method |
| 86 | + * @returns {String} Wikitext data |
| 87 | + */ |
| 88 | +es.TableBlockCellModel.prototype.getWikitext = function() { |
| 89 | + |
| 90 | +}; |
| 91 | + |
72 | 92 | /* Inheritance */ |
73 | 93 | |
74 | 94 | es.extend( es.TableBlockCellModel, es.ModelContainerItem ); |
\ No newline at end of file |
Index: trunk/parsers/wikidom/lib/synth/models/es.TableBlockModel.js |
— | — | @@ -81,6 +81,26 @@ |
82 | 82 | */ |
83 | 83 | }; |
84 | 84 | |
| 85 | +/** |
| 86 | + * Gets HTML serialization of block. |
| 87 | + * |
| 88 | + * @method |
| 89 | + * @returns {String} HTML data |
| 90 | + */ |
| 91 | +es.TableBlockModel.prototype.getHtml = function() { |
| 92 | + |
| 93 | +}; |
| 94 | + |
| 95 | +/** |
| 96 | + * Gets Wikitext serialization of block. |
| 97 | + * |
| 98 | + * @method |
| 99 | + * @returns {String} Wikitext data |
| 100 | + */ |
| 101 | +es.TableBlockModel.prototype.getWikitext = function() { |
| 102 | + |
| 103 | +}; |
| 104 | + |
85 | 105 | // Register constructor |
86 | 106 | es.BlockModel.constructors['table'] = es.TableBlockModel.newFromPlainObject; |
87 | 107 | |
Index: trunk/parsers/wikidom/lib/synth/models/es.ListBlockItemModel.js |
— | — | @@ -55,6 +55,26 @@ |
56 | 56 | return { 'content': this.content.getPlainObject(), 'styles': this.styles.slice( 0 ) }; |
57 | 57 | }; |
58 | 58 | |
| 59 | +/** |
| 60 | + * Gets HTML serialization of item. |
| 61 | + * |
| 62 | + * @method |
| 63 | + * @returns {String} HTML data |
| 64 | + */ |
| 65 | +es.ListBlockItemModel.prototype.getHtml = function() { |
| 66 | + |
| 67 | +}; |
| 68 | + |
| 69 | +/** |
| 70 | + * Gets Wikitext serialization of item. |
| 71 | + * |
| 72 | + * @method |
| 73 | + * @returns {String} Wikitext data |
| 74 | + */ |
| 75 | +es.ListBlockItemModel.prototype.getWikitext = function() { |
| 76 | + |
| 77 | +}; |
| 78 | + |
59 | 79 | /* Inheritance */ |
60 | 80 | |
61 | 81 | es.extend( es.ListBlockItemModel, es.ModelContainerItem ); |
\ No newline at end of file |
Index: trunk/parsers/wikidom/lib/synth/models/es.ListBlockModel.js |
— | — | @@ -110,6 +110,26 @@ |
111 | 111 | return obj; |
112 | 112 | }; |
113 | 113 | |
| 114 | +/** |
| 115 | + * Gets HTML serialization of block. |
| 116 | + * |
| 117 | + * @method |
| 118 | + * @returns {String} HTML data |
| 119 | + */ |
| 120 | +es.ListBlockModel.prototype.getHtml = function() { |
| 121 | + |
| 122 | +}; |
| 123 | + |
| 124 | +/** |
| 125 | + * Gets Wikitext serialization of block. |
| 126 | + * |
| 127 | + * @method |
| 128 | + * @returns {String} Wikitext data |
| 129 | + */ |
| 130 | +es.ListBlockModel.prototype.getWikitext = function() { |
| 131 | + |
| 132 | +}; |
| 133 | + |
114 | 134 | // Register constructor |
115 | 135 | es.BlockModel.constructors['list'] = es.ListBlockModel.newFromPlainObject |
116 | 136 | |
Index: trunk/parsers/wikidom/lib/synth/models/es.ContentModel.js |
— | — | @@ -335,6 +335,26 @@ |
336 | 336 | }; |
337 | 337 | |
338 | 338 | /** |
| 339 | + * Gets HTML serialization of content. |
| 340 | + * |
| 341 | + * @method |
| 342 | + * @returns {String} HTML data |
| 343 | + */ |
| 344 | +es.ContentModel.prototype.getHtml = function() { |
| 345 | + // |
| 346 | +}; |
| 347 | + |
| 348 | +/** |
| 349 | + * Gets Wikitext serialization of content. |
| 350 | + * |
| 351 | + * @method |
| 352 | + * @returns {String} Wikitext data |
| 353 | + */ |
| 354 | +es.ContentModel.prototype.getWikitext = function() { |
| 355 | + |
| 356 | +}; |
| 357 | + |
| 358 | +/** |
339 | 359 | * Gets a list of indexes of annotated characters which have a given annotation applied to them. |
340 | 360 | * |
341 | 361 | * Comparison is done first by type, and optionally also by data values (strict), not by reference |
Index: trunk/parsers/wikidom/lib/synth/models/es.HeadingBlockModel.js |
— | — | @@ -56,6 +56,27 @@ |
57 | 57 | return { 'type': 'heading', 'content': this.content.getPlainObject(), 'level': this.level }; |
58 | 58 | }; |
59 | 59 | |
| 60 | +/** |
| 61 | + * Gets HTML serialization of block. |
| 62 | + * |
| 63 | + * @method |
| 64 | + * @returns {String} HTML data |
| 65 | + */ |
| 66 | +es.HeadingBlockModel.prototype.getHtml = function() { |
| 67 | + return es.AnnotationSerializer.buildXmlTag( 'h' + this.level, {}, this.content.getHtml() ); |
| 68 | +}; |
| 69 | + |
| 70 | +/** |
| 71 | + * Gets Wikitext serialization of block. |
| 72 | + * |
| 73 | + * @method |
| 74 | + * @returns {String} Wikitext data |
| 75 | + */ |
| 76 | +es.HeadingBlockModel.prototype.getWikitext = function() { |
| 77 | + var symbols = es.AnnotationSerializer.repeatString( '=', this.level ); |
| 78 | + return symbols + this.content.getHtml() + symbols; |
| 79 | +}; |
| 80 | + |
60 | 81 | // Register constructor |
61 | 82 | es.BlockModel.constructors['heading'] = es.HeadingBlockModel; |
62 | 83 | |
Index: trunk/parsers/wikidom/lib/synth/models/es.TableBlockRowModel.js |
— | — | @@ -80,6 +80,26 @@ |
81 | 81 | */ |
82 | 82 | }; |
83 | 83 | |
| 84 | +/** |
| 85 | + * Gets HTML serialization of row. |
| 86 | + * |
| 87 | + * @method |
| 88 | + * @returns {String} HTML data |
| 89 | + */ |
| 90 | +es.TableBlockRowModel.prototype.getHtml = function() { |
| 91 | + |
| 92 | +}; |
| 93 | + |
| 94 | +/** |
| 95 | + * Gets Wikitext serialization of row. |
| 96 | + * |
| 97 | + * @method |
| 98 | + * @returns {String} Wikitext data |
| 99 | + */ |
| 100 | +es.TableBlockRowModel.prototype.getWikitext = function() { |
| 101 | + |
| 102 | +}; |
| 103 | + |
84 | 104 | /* Inheritance */ |
85 | 105 | |
86 | 106 | es.extend( es.TableBlockRowModel, es.ModelContainerItem ); |
Index: trunk/parsers/wikidom/lib/synth/models/es.HorizontalRuleBlockModel.js |
— | — | @@ -50,6 +50,26 @@ |
51 | 51 | return { 'type': 'horizontal-rule' }; |
52 | 52 | }; |
53 | 53 | |
| 54 | +/** |
| 55 | + * Gets HTML serialization of block. |
| 56 | + * |
| 57 | + * @method |
| 58 | + * @returns {String} HTML data |
| 59 | + */ |
| 60 | +es.CommentBlockModel.prototype.getHtml = function() { |
| 61 | + return es.AnnotationSerializer.buildXmlTag( 'hr', {}, false ); |
| 62 | +}; |
| 63 | + |
| 64 | +/** |
| 65 | + * Gets Wikitext serialization of block. |
| 66 | + * |
| 67 | + * @method |
| 68 | + * @returns {String} Wikitext data |
| 69 | + */ |
| 70 | +es.CommentBlockModel.prototype.getWikitext = function() { |
| 71 | + return '----'; |
| 72 | +}; |
| 73 | + |
54 | 74 | // Register constructor |
55 | 75 | es.BlockModel.constructors['horizontal-rule'] = es.HorizontalRuleBlockModel; |
56 | 76 | |
Index: trunk/parsers/wikidom/lib/synth/es.JsonSerializer.js |
— | — | @@ -0,0 +1,100 @@ |
| 2 | +/** |
| 3 | + * Serializes a WikiDom into JSON. |
| 4 | + * |
| 5 | + * @class |
| 6 | + * @constructor |
| 7 | + * @extends {es.Serializer} |
| 8 | + * @property options {Object} List of options for serialization |
| 9 | + * @property options.indentWith {String} Text to use as indentation, such as \t or 4 spaces |
| 10 | + */ |
| 11 | +es.JsonSerializer = function( options ) { |
| 12 | + es.Serializer.call( this ); |
| 13 | + this.options = $.extend( { |
| 14 | + 'indentWith': '\t' |
| 15 | + }, options || {} ); |
| 16 | +}; |
| 17 | + |
| 18 | +/* Static Methods */ |
| 19 | + |
| 20 | +es.JsonSerializer.typeOf = function( value ) { |
| 21 | + if ( typeof value === 'object' ) { |
| 22 | + if ( value === null ) { |
| 23 | + return 'null'; |
| 24 | + } |
| 25 | + switch ( value.constructor ) { |
| 26 | + case ( new Array ).constructor: |
| 27 | + return 'array'; |
| 28 | + case ( new Date ).constructor: |
| 29 | + return 'date'; |
| 30 | + case ( new RegExp ).constructor: |
| 31 | + return 'regex'; |
| 32 | + default: |
| 33 | + return 'object'; |
| 34 | + } |
| 35 | + } |
| 36 | + return typeof value; |
| 37 | +}; |
| 38 | + |
| 39 | +es.JsonSerializer.prototype.encode = function( data, indention ) { |
| 40 | + if ( indention === undefined ) { |
| 41 | + indention = ''; |
| 42 | + } |
| 43 | + var type = es.JsonSerializer.typeOf( data ); |
| 44 | + |
| 45 | + // Open object/array |
| 46 | + var json = ''; |
| 47 | + if ( type === 'array' ) { |
| 48 | + if (data.length === 0) { |
| 49 | + // Empty array |
| 50 | + return '[]'; |
| 51 | + } |
| 52 | + json += '['; |
| 53 | + } else { |
| 54 | + var empty = true; |
| 55 | + for ( var i in data ) { |
| 56 | + if ( data.hasOwnProperty( i ) ) { |
| 57 | + empty = false; |
| 58 | + break; |
| 59 | + } |
| 60 | + } |
| 61 | + if ( empty ) { |
| 62 | + return '{}'; |
| 63 | + } |
| 64 | + json += '{'; |
| 65 | + } |
| 66 | + |
| 67 | + // Iterate over items |
| 68 | + var comma = false; |
| 69 | + for ( var i in data ) { |
| 70 | + if ( data.hasOwnProperty( i ) ) { |
| 71 | + json += ( comma ? ',' : '' ) + '\n' + indention + this.options.indentWith |
| 72 | + + ( type === 'array' ? '' : '"' + i + '"' + ': ' ); |
| 73 | + switch ( es.JsonSerializer.typeOf( data[i] ) ) { |
| 74 | + case 'array': |
| 75 | + case 'object': |
| 76 | + json += this.encode( data[i], indention + this.options.indentWith ); |
| 77 | + break; |
| 78 | + case 'boolean': |
| 79 | + case 'number': |
| 80 | + json += data[i].toString(); |
| 81 | + break; |
| 82 | + case 'null': |
| 83 | + json += 'null'; |
| 84 | + break; |
| 85 | + case 'string': |
| 86 | + json += '"' + data[i] |
| 87 | + .replace(/[\n]/g, '\\n') |
| 88 | + .replace(/[\t]/g, '\\t') |
| 89 | + + '"'; |
| 90 | + break; |
| 91 | + // Skip other types |
| 92 | + } |
| 93 | + comma = true; |
| 94 | + } |
| 95 | + } |
| 96 | + |
| 97 | + // Close object/array |
| 98 | + json += '\n' + indention + ( type === 'array' ? ']' : '}' ); |
| 99 | + |
| 100 | + return json; |
| 101 | +}; |
Index: trunk/parsers/wikidom/lib/synth/es.AnnotationSerializer.js |
— | — | @@ -0,0 +1,113 @@ |
| 2 | +/** |
| 3 | + * Creates an annotation renderer object. |
| 4 | + * |
| 5 | + * @class |
| 6 | + * @constructor |
| 7 | + * @property annotations {Object} List of annotations to be applied |
| 8 | + */ |
| 9 | +es.AnnotationSerializer = function() { |
| 10 | + this.annotations = {}; |
| 11 | +}; |
| 12 | + |
| 13 | +/* Static Methods */ |
| 14 | + |
| 15 | +es.AnnotationSerializer.repeatString = function( pattern, count ) { |
| 16 | + if ( count < 1 ) { |
| 17 | + return ''; |
| 18 | + } |
| 19 | + var result = ''; |
| 20 | + while ( count > 0 ) { |
| 21 | + if ( count & 1 ) { result += pattern; } |
| 22 | + count >>= 1; |
| 23 | + pattern += pattern; |
| 24 | + } |
| 25 | + return result; |
| 26 | +}; |
| 27 | + |
| 28 | +es.AnnotationSerializer.escapeXmlText = function( text ) { |
| 29 | + return text |
| 30 | + .replace( /&/g, '&' ) |
| 31 | + .replace( /</g, '<' ) |
| 32 | + .replace( />/g, '>' ) |
| 33 | + .replace( /"/g, '"' ) |
| 34 | + .replace( /'/g, ''' ); |
| 35 | +}; |
| 36 | + |
| 37 | +es.AnnotationSerializer.buildXmlAttributes = function( attributes, prespace ) { |
| 38 | + var attr = []; |
| 39 | + var name; |
| 40 | + if ( attributes ) { |
| 41 | + for ( name in attributes ) { |
| 42 | + attr.push( name + '="' + attributes[name] + '"' ); |
| 43 | + } |
| 44 | + } |
| 45 | + return ( prespace && attr.length ? ' ' : '' ) + attr.join( ' ' ); |
| 46 | +}; |
| 47 | + |
| 48 | +es.AnnotationSerializer.buildXmlOpeningTag = function( tag, attributes ) { |
| 49 | + return '<' + tag + es.Document.Serializer.buildXmlAttributes( attributes, true ) + '>'; |
| 50 | +}; |
| 51 | + |
| 52 | +es.AnnotationSerializer.buildXmlClosingTag = function( tag ) { |
| 53 | + return '</' + tag + '>'; |
| 54 | +}; |
| 55 | + |
| 56 | +es.AnnotationSerializer.buildXmlTag = function( tag, attributes, value, escape ) { |
| 57 | + if ( value === false ) { |
| 58 | + return '<' + tag + es.Document.Serializer.buildXmlAttributes( attributes, true ) + ' />'; |
| 59 | + } else { |
| 60 | + if ( escape ) { |
| 61 | + value = wiki.util.xml.esc( value ); |
| 62 | + } |
| 63 | + return '<' + tag + es.Document.Serializer.buildXmlAttributes( attributes, true ) + '>' |
| 64 | + + value + '</' + tag + '>'; |
| 65 | + } |
| 66 | +}; |
| 67 | + |
| 68 | +/** |
| 69 | + * Adds a set of annotations to be inserted around a range of text. |
| 70 | + * |
| 71 | + * Insertions for the same range will be nested in order of declaration. |
| 72 | + * @example |
| 73 | + * stack = new es.AnnotationSerializer(); |
| 74 | + * stack.add( new es.Range( 1, 2 ), '[', ']' ); |
| 75 | + * stack.add( new es.Range( 1, 2 ), '{', '}' ); |
| 76 | + * // Outputs: "a[{b}]c" |
| 77 | + * console.log( stack.render( 'abc' ) ); |
| 78 | + * |
| 79 | + * @param range {es.Range} Range to insert text around |
| 80 | + * @param pre {String} Text to insert before range |
| 81 | + * @param post {String} Text to insert after range |
| 82 | + */ |
| 83 | +es.AnnotationSerializer.prototype.add = function( range, pre, post ) { |
| 84 | + // TODO: Once we are using Range objects, we should do a range.normalize(); here |
| 85 | + if ( !( range.start in this.annotations ) ) { |
| 86 | + this.annotations[range.start] = [pre]; |
| 87 | + } else { |
| 88 | + this.annotations[range.start].push( pre ); |
| 89 | + } |
| 90 | + if ( !( range.end in this.annotations ) ) { |
| 91 | + this.annotations[range.end] = [post]; |
| 92 | + } else { |
| 93 | + this.annotations[range.end].unshift( post ); |
| 94 | + } |
| 95 | +}; |
| 96 | + |
| 97 | +/** |
| 98 | + * Renders annotations into text. |
| 99 | + * |
| 100 | + * @param text {String} Text to apply annotations to |
| 101 | + * @returns {String} Wrapped text |
| 102 | + */ |
| 103 | +es.AnnotationSerializer.prototype.render = function( text ) { |
| 104 | + var out = ''; |
| 105 | + for ( var i = 0, length = text.length; i <= length; i++ ) { |
| 106 | + if ( i in this.annotations ) { |
| 107 | + out += this.annotations[i].join( '' ); |
| 108 | + } |
| 109 | + if ( i < length ) { |
| 110 | + out += text[i]; |
| 111 | + } |
| 112 | + } |
| 113 | + return out; |
| 114 | +}; |
Index: trunk/parsers/wikidom/lib/synth/es.Surface.css |
— | — | @@ -0,0 +1,183 @@ |
| 2 | +.editSurface-input { |
| 3 | + position: absolute; |
| 4 | + z-index: -1; |
| 5 | + opacity: 0; |
| 6 | + color: white; |
| 7 | + background-color: white; |
| 8 | + border: none; |
| 9 | + padding: 0; |
| 10 | + margin: 0; |
| 11 | + width: 1px; |
| 12 | +} |
| 13 | + |
| 14 | +.editSurface-input:focus { |
| 15 | + outline: none; |
| 16 | +} |
| 17 | + |
| 18 | +.editSurface { |
| 19 | + overflow: hidden; |
| 20 | +} |
| 21 | + |
| 22 | +.editSurface-document { |
| 23 | + cursor: text; |
| 24 | + margin-top: 1em; |
| 25 | + overflow: hidden; |
| 26 | + -webkit-user-select: none; |
| 27 | +} |
| 28 | + |
| 29 | +.editSurface-block { |
| 30 | + margin: 1em; |
| 31 | + margin-top: 0; |
| 32 | + position: relative; |
| 33 | + min-height: 1.5em; |
| 34 | +} |
| 35 | + |
| 36 | +.editSurface-listItem { |
| 37 | + position: relative; |
| 38 | + padding: 0 0 0 1em; |
| 39 | + background-position: left 0.6em; |
| 40 | + background-repeat: no-repeat; |
| 41 | +} |
| 42 | + |
| 43 | +.editSurface-listItem-content { |
| 44 | + position: relative; |
| 45 | +} |
| 46 | + |
| 47 | +.editSurface-listItem-bullet { |
| 48 | + background-image: url(images/bullet.png); |
| 49 | +} |
| 50 | + |
| 51 | +.editSurface-listItem-number { |
| 52 | + /* */ |
| 53 | +} |
| 54 | + |
| 55 | +.editSurface-listItem-bullet .editSurface-listItem-icon { |
| 56 | + display: none; |
| 57 | +} |
| 58 | + |
| 59 | +.editSurface-listItem-number .editSurface-listItem-icon { |
| 60 | + position: absolute; |
| 61 | + right: 100%; |
| 62 | + margin-right: -0.5em; |
| 63 | + height: 1.5em; |
| 64 | + line-height: 1.5em; |
| 65 | +} |
| 66 | + |
| 67 | +.editSurface-listItem-level0 { |
| 68 | + margin-left: 0.5em; |
| 69 | +} |
| 70 | + |
| 71 | +.editSurface-listItem-level1 { |
| 72 | + margin-left: 2.5em; |
| 73 | +} |
| 74 | + |
| 75 | +.editSurface-listItem-level2 { |
| 76 | + margin-left: 4.5em; |
| 77 | +} |
| 78 | + |
| 79 | +.editSurface-listItem-level3 { |
| 80 | + margin-left: 6.5em; |
| 81 | +} |
| 82 | + |
| 83 | +.editSurface-listItem-level4 { |
| 84 | + margin-left: 8.5em; |
| 85 | +} |
| 86 | + |
| 87 | +.editSurface-listItem-level5 { |
| 88 | + margin-left: 10.5em; |
| 89 | +} |
| 90 | + |
| 91 | +.editSurface-listItem-level6 { |
| 92 | + margin-left: 12.5em; |
| 93 | +} |
| 94 | + |
| 95 | +.editSurface-line, |
| 96 | +.editSurface-ruler { |
| 97 | + line-height: 1.5em; |
| 98 | + cursor: text; |
| 99 | + white-space: nowrap; |
| 100 | + color: #000000; |
| 101 | +} |
| 102 | + |
| 103 | +.editSurface-ruler { |
| 104 | + position: absolute; |
| 105 | + top: 0; |
| 106 | + left: 0; |
| 107 | + display: inline-block; |
| 108 | + z-index: -1000; |
| 109 | +} |
| 110 | + |
| 111 | +.editSurface-line.empty { |
| 112 | + display: block; |
| 113 | + width: 0px; |
| 114 | +} |
| 115 | + |
| 116 | +.editSurface-whitespace { |
| 117 | + color: #ffffff; |
| 118 | +} |
| 119 | + |
| 120 | +.editSurface-range { |
| 121 | + display: none; |
| 122 | + position: absolute; |
| 123 | + background-color: #bbffcc; |
| 124 | + cursor: text; |
| 125 | + z-index: -1; |
| 126 | +} |
| 127 | + |
| 128 | +.editSurface-cursor { |
| 129 | + position: absolute; |
| 130 | + background-color: black; |
| 131 | + width: 1px; |
| 132 | + height: 1.5em; |
| 133 | + min-height: 1.5em; |
| 134 | + display: none; |
| 135 | +} |
| 136 | + |
| 137 | +.editSurface-format-object { |
| 138 | + background-color: rgba(0,0,0,0.05); |
| 139 | + border-radius: 0.25em; |
| 140 | + margin: 1px 0 1px 1px; |
| 141 | + padding: 0.25em 0; |
| 142 | + cursor: default; |
| 143 | +} |
| 144 | + |
| 145 | +.editSurface-format-object * { |
| 146 | + cursor: default !important; |
| 147 | +} |
| 148 | + |
| 149 | +.editSurface-format-object a:link, |
| 150 | +.editSurface-format-object a:visited, |
| 151 | +.editSurface-format-object a:active { |
| 152 | + color: blue; |
| 153 | +} |
| 154 | + |
| 155 | +.editSurface-format-italic { |
| 156 | + font-style: italic; |
| 157 | +} |
| 158 | + |
| 159 | +.editSurface-format-bold { |
| 160 | + font-weight: bold; |
| 161 | +} |
| 162 | + |
| 163 | +.editSurface-format-link { |
| 164 | + color: blue; |
| 165 | + text-decoration: underline; |
| 166 | +} |
| 167 | + |
| 168 | +.editSurface-format-big { |
| 169 | + font-size: 1.2em; |
| 170 | +} |
| 171 | + |
| 172 | +.editSurface-format-small, |
| 173 | +.editSurface-format-sub, |
| 174 | +.editSurface-format-super { |
| 175 | + font-size: .8em; |
| 176 | +} |
| 177 | + |
| 178 | +.editSurface-format-sub { |
| 179 | + vertical-align: sub; |
| 180 | +} |
| 181 | + |
| 182 | +.editSurface-format-super { |
| 183 | + vertical-align: super; |
| 184 | +} |
Index: trunk/parsers/wikidom/lib/synth/images/bullet.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/parsers/wikidom/lib/synth/images/bullet.png |
___________________________________________________________________ |
Added: svn:mime-type |
1 | 185 | + application/octet-stream |
Index: trunk/parsers/wikidom/lib/synth/views/es.ListBlockItemView.js |
— | — | @@ -57,4 +57,6 @@ |
58 | 58 | this.contentView.drawSelection( range ); |
59 | 59 | }; |
60 | 60 | |
| 61 | +/* Inheritance */ |
| 62 | + |
61 | 63 | es.extend( es.ListBlockItemView, es.ViewContainerItem ); |
Index: trunk/parsers/wikidom/lib/synth/views/es.ListBlockView.js |
— | — | @@ -69,5 +69,7 @@ |
70 | 70 | } |
71 | 71 | }; |
72 | 72 | |
| 73 | +/* Inheritance */ |
| 74 | + |
73 | 75 | es.extend( es.ListBlockView, es.ViewContainer ); |
74 | 76 | es.extend( es.ListBlockView, es.BlockView ); |
Index: trunk/parsers/wikidom/lib/synth/views/es.SurfaceView.js |
— | — | @@ -108,6 +108,8 @@ |
109 | 109 | |
110 | 110 | }; |
111 | 111 | |
| 112 | +/* Inheritance */ |
| 113 | + |
112 | 114 | es.SurfaceView.prototype.getLocationFromPosition = function( position ) { |
113 | 115 | |
114 | 116 | }; |
Index: trunk/parsers/wikidom/lib/synth/views/es.BlockView.js |
— | — | @@ -48,4 +48,6 @@ |
49 | 49 | throw 'BlockView.getRenderedLineRange not implemented in this subclass.'; |
50 | 50 | }; |
51 | 51 | |
| 52 | +/* Inheritance */ |
| 53 | + |
52 | 54 | es.extend( es.BlockView, es.ViewContainerItem ); |
Index: trunk/parsers/wikidom/lib/synth/views/es.ContentView.js |
— | — | @@ -805,4 +805,6 @@ |
806 | 806 | return out; |
807 | 807 | }; |
808 | 808 | |
| 809 | +/* Inheritance */ |
| 810 | + |
809 | 811 | es.extend( es.ContentView, es.EventEmitter ); |
Index: trunk/parsers/wikidom/lib/synth/views/es.TableBlockRowView.js |
— | — | @@ -34,5 +34,7 @@ |
35 | 35 | } |
36 | 36 | }; |
37 | 37 | |
| 38 | +/* Inheritance */ |
| 39 | + |
38 | 40 | es.extend( es.TableBlockRowView, es.ViewContainer ); |
39 | 41 | es.extend( es.TableBlockRowView, es.ViewContainerItem ); |
Index: trunk/parsers/wikidom/lib/synth/views/es.ParagraphBlockView.js |
— | — | @@ -46,4 +46,6 @@ |
47 | 47 | this.contentView.drawSelection( range ); |
48 | 48 | }; |
49 | 49 | |
| 50 | +/* Inheritance */ |
| 51 | + |
50 | 52 | es.extend( es.ParagraphBlockView, es.BlockView ); |
Index: trunk/parsers/wikidom/lib/synth/views/es.TableBlockCellView.js |
— | — | @@ -29,5 +29,6 @@ |
30 | 30 | this.documentView.drawSelection( range ); |
31 | 31 | }; |
32 | 32 | |
| 33 | +/* Inheritance */ |
33 | 34 | |
34 | 35 | es.extend( es.TableBlockCellView, es.ViewContainerItem ); |
Index: trunk/parsers/wikidom/lib/synth/views/es.TableBlockView.js |
— | — | @@ -34,5 +34,7 @@ |
35 | 35 | } |
36 | 36 | }; |
37 | 37 | |
| 38 | +/* Inheritance */ |
| 39 | + |
38 | 40 | es.extend( es.TableBlockView, es.ViewContainer ); |
39 | 41 | es.extend( es.TableBlockView, es.BlockView ); |
Index: trunk/parsers/wikidom/demos/synth/es.js |
— | — | @@ -258,5 +258,6 @@ |
259 | 259 | ] |
260 | 260 | } |
261 | 261 | ] } ); |
262 | | - var surface = new es.SurfaceView( $('#es-editor'), new es.SurfaceModel( doc ) ); |
| 262 | + // Use the global space for debugging purposes |
| 263 | + window.surface = new es.SurfaceView( $('#es-editor'), new es.SurfaceModel( doc ) ); |
263 | 264 | } ); |
Index: trunk/parsers/wikidom/demos/synth/index.html |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | <html> |
5 | 5 | <head> |
6 | 6 | <title>EditSurface Demo</title> |
7 | | - <link rel="stylesheet" href="../../lib/es/es.Surface.css"> |
| 7 | + <link rel="stylesheet" href="../../lib/synth/es.Surface.css"> |
8 | 8 | <link rel="stylesheet" href="es.css"> |
9 | 9 | </head> |
10 | 10 | <body> |