book-source 0.3.7 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/brainstorming +3 -1
- package/lib/StructuredDocument.js +62 -37
- package/lib/documentParts.js +118 -47
- package/package.json +1 -1
package/brainstorming
CHANGED
|
@@ -40,7 +40,9 @@
|
|
|
40
40
|
(where style can be a color like red, green, black, or other style like bold, italic, oblique, separated by comma ",")
|
|
41
41
|
(generate a <span>)
|
|
42
42
|
|
|
43
|
-
✅
|
|
43
|
+
✅ Hint (title-style tooltip): [text][title text]
|
|
44
|
+
✅ Infotip (hover block-display tooltip): ?[text][some block of text]
|
|
45
|
+
✅ Infotip href-variant: ?[text](href)
|
|
44
46
|
|
|
45
47
|
✅ Link: [link text](href)
|
|
46
48
|
✅ Link+Title: [link text][title text](href)
|
|
@@ -199,23 +199,26 @@ StructuredDocument.prototype.autoTitle = function() {
|
|
|
199
199
|
|
|
200
200
|
if ( ! header ) { return ; }
|
|
201
201
|
|
|
202
|
-
str =
|
|
202
|
+
str = StructuredDocument.getText( header.parts ) ;
|
|
203
203
|
if ( str ) { this.title = str ; }
|
|
204
204
|
} ;
|
|
205
205
|
|
|
206
206
|
|
|
207
207
|
|
|
208
|
-
StructuredDocument.
|
|
208
|
+
StructuredDocument.getText = function( parts ) {
|
|
209
209
|
var str = '' ;
|
|
210
210
|
|
|
211
211
|
for ( let part of parts ) {
|
|
212
212
|
if ( part.text ) { str += part.text ; }
|
|
213
|
-
else if ( part.parts?.length ) { str +=
|
|
213
|
+
else if ( part.parts?.length ) { str += StructuredDocument.getText( part.parts ) ; }
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
return str ;
|
|
217
217
|
} ;
|
|
218
218
|
|
|
219
|
+
// Backqard compatibility/API
|
|
220
|
+
StructuredDocument.prototype.getText = function( parts = this.parts ) { return StructuredDocument.getText( parts ) ; } ;
|
|
221
|
+
|
|
219
222
|
|
|
220
223
|
|
|
221
224
|
StructuredDocument.prototype.textPostFilter = function( postFilterList , parts = this.parts ) {
|
|
@@ -747,41 +750,26 @@ function parseMedia( str , ctx , float = null ) {
|
|
|
747
750
|
|
|
748
751
|
ctx.i = end ;
|
|
749
752
|
ctx.iStartOfInlineChunk = ctx.i + 1 ;
|
|
753
|
+
|
|
750
754
|
var data = parseDataMark( str , ctx , MEDIA_DATA_MARK ) ;
|
|
751
755
|
if ( ! data ) { return ; }
|
|
752
756
|
|
|
753
757
|
if ( ! data.href?.[ 0 ] ) { return ; }
|
|
754
758
|
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
break ;
|
|
768
|
-
default :
|
|
769
|
-
return ;
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
var params = { type , altText: text , href: data.href[ 0 ] } ;
|
|
774
|
-
|
|
775
|
-
if ( float ) { params.float = float ; }
|
|
776
|
-
|
|
777
|
-
if ( data.text?.length ) {
|
|
778
|
-
params.caption = data.text[ 0 ] ;
|
|
779
|
-
if ( data.text[ 1 ] ) { params.title = data.text[ 1 ] ; }
|
|
759
|
+
switch ( data.href[ 1 ] || 'image' ) {
|
|
760
|
+
case 'image' :
|
|
761
|
+
ctx.parts.push( new documentParts.ImageBlock( data.href[ 0 ] , text , float , data.text?.[ 0 ] , data.text?.[ 1 ] ) ) ;
|
|
762
|
+
break ;
|
|
763
|
+
case 'audio' :
|
|
764
|
+
ctx.parts.push( new documentParts.AudioBlock( data.href[ 0 ] , text , float , data.text?.[ 0 ] , data.text?.[ 1 ] ) ) ;
|
|
765
|
+
break ;
|
|
766
|
+
case 'video' :
|
|
767
|
+
ctx.parts.push( new documentParts.VideoBlock( data.href[ 0 ] , text , float , data.text?.[ 0 ] , data.text?.[ 1 ] ) ) ;
|
|
768
|
+
break ;
|
|
769
|
+
default :
|
|
770
|
+
break ;
|
|
780
771
|
}
|
|
781
772
|
|
|
782
|
-
//if ( data.extra?.length ) { params.title = data.extra[ 0 ] ; }
|
|
783
|
-
|
|
784
|
-
ctx.parts.push( params ) ;
|
|
785
773
|
ctx.i ++ ;
|
|
786
774
|
}
|
|
787
775
|
|
|
@@ -1437,6 +1425,10 @@ function parseNestedInline( str , ctx , scanEnd , topLevel = false ) {
|
|
|
1437
1425
|
addInlineTextChunk( str , ctx ) ;
|
|
1438
1426
|
parseStyledText( str , ctx , scanEnd ) ;
|
|
1439
1427
|
}
|
|
1428
|
+
else if ( char === '?' && str[ ctx.i + 1 ] === '[' && lastWasSpace ) {
|
|
1429
|
+
addInlineTextChunk( str , ctx ) ;
|
|
1430
|
+
parseInfotipedText( str , ctx , scanEnd ) ;
|
|
1431
|
+
}
|
|
1440
1432
|
else if ( char === '!' && str[ ctx.i + 1 ] === '[' && lastWasSpace ) {
|
|
1441
1433
|
addInlineTextChunk( str , ctx ) ;
|
|
1442
1434
|
parseImage( str , ctx , scanEnd ) ;
|
|
@@ -1596,8 +1588,6 @@ function parseStyledText( str , ctx , scanEnd ) {
|
|
|
1596
1588
|
var end = searchCloser( str , ctx.i + 1 , '[' , ']' , false , scanEnd ) ;
|
|
1597
1589
|
if ( end < 0 ) { return ; }
|
|
1598
1590
|
|
|
1599
|
-
//var text = str.slice( ctx.i + 1 , end ) ;
|
|
1600
|
-
|
|
1601
1591
|
var start = ctx.i + 1 ;
|
|
1602
1592
|
ctx.i = end ;
|
|
1603
1593
|
var data = parseDataMark( str , ctx , STYLE_DATA_MARK , scanEnd ) ;
|
|
@@ -1607,13 +1597,13 @@ function parseStyledText( str , ctx , scanEnd ) {
|
|
|
1607
1597
|
|
|
1608
1598
|
var href = data.href?.[ 0 ] ,
|
|
1609
1599
|
style = data.style?.[ 0 ] ,
|
|
1610
|
-
|
|
1600
|
+
hint = data.text?.[ 0 ] ;
|
|
1611
1601
|
|
|
1612
1602
|
if ( href ) {
|
|
1613
|
-
ctx.parts.push( new documentParts.Link( href , style ,
|
|
1603
|
+
ctx.parts.push( new documentParts.Link( href , style , hint ) ) ;
|
|
1614
1604
|
}
|
|
1615
|
-
else if ( style ||
|
|
1616
|
-
ctx.parts.push( new documentParts.StyledText( style ,
|
|
1605
|
+
else if ( style || hint ) {
|
|
1606
|
+
ctx.parts.push( new documentParts.StyledText( style , hint ) ) ;
|
|
1617
1607
|
}
|
|
1618
1608
|
else {
|
|
1619
1609
|
return ;
|
|
@@ -1628,6 +1618,41 @@ function parseStyledText( str , ctx , scanEnd ) {
|
|
|
1628
1618
|
|
|
1629
1619
|
|
|
1630
1620
|
|
|
1621
|
+
const INFOTIP_DATA_MARK = {
|
|
1622
|
+
text: true , href: true , style: true , extra: false
|
|
1623
|
+
} ;
|
|
1624
|
+
|
|
1625
|
+
function parseInfotipedText( str , ctx , scanEnd ) {
|
|
1626
|
+
//console.error( "parseStyledText()" ) ;
|
|
1627
|
+
var end = searchCloser( str , ctx.i + 2 , '[' , ']' , false , scanEnd ) ;
|
|
1628
|
+
if ( end < 0 ) { return ; }
|
|
1629
|
+
|
|
1630
|
+
var start = ctx.i + 2 ;
|
|
1631
|
+
ctx.i = end ;
|
|
1632
|
+
var data = parseDataMark( str , ctx , INFOTIP_DATA_MARK , scanEnd ) ;
|
|
1633
|
+
|
|
1634
|
+
var fullMarkupEnd = ctx.i ;
|
|
1635
|
+
|
|
1636
|
+
var href = data?.href?.[ 0 ] ,
|
|
1637
|
+
style = data?.style?.[ 0 ] ,
|
|
1638
|
+
hint = data?.text?.[ 0 ] ;
|
|
1639
|
+
|
|
1640
|
+
var infotipedText = new documentParts.InfotipedText( hint , href , style ) ;
|
|
1641
|
+
ctx.parts.push( infotipedText ) ;
|
|
1642
|
+
|
|
1643
|
+
ctx.i = start ;
|
|
1644
|
+
parseNestedInline( str , ctx , end ) ;
|
|
1645
|
+
|
|
1646
|
+
ctx.i = fullMarkupEnd ;
|
|
1647
|
+
ctx.iStartOfInlineChunk = ctx.i + 1 ;
|
|
1648
|
+
|
|
1649
|
+
if ( ! href && ! hint ) {
|
|
1650
|
+
infotipedText.href = StructuredDocument.getText( infotipedText.parts ) ;
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
|
|
1655
|
+
|
|
1631
1656
|
const IMAGE_DATA_MARK = {
|
|
1632
1657
|
text: true , href: true , style: false , extra: false
|
|
1633
1658
|
} ;
|
package/lib/documentParts.js
CHANGED
|
@@ -67,9 +67,7 @@ documentParts.InlineTextPart = InlineTextPart ;
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
function BlockPart() {
|
|
71
|
-
this.parts = [] ;
|
|
72
|
-
}
|
|
70
|
+
function BlockPart() {}
|
|
73
71
|
|
|
74
72
|
BlockPart.prototype = Object.create( Part.prototype ) ;
|
|
75
73
|
BlockPart.prototype.constructor = BlockPart ;
|
|
@@ -77,6 +75,16 @@ documentParts.BlockPart = BlockPart ;
|
|
|
77
75
|
|
|
78
76
|
|
|
79
77
|
|
|
78
|
+
function BlockContainerPart() {
|
|
79
|
+
this.parts = [] ;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
BlockContainerPart.prototype = Object.create( Part.prototype ) ;
|
|
83
|
+
BlockContainerPart.prototype.constructor = BlockContainerPart ;
|
|
84
|
+
documentParts.BlockContainerPart = BlockContainerPart ;
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
80
88
|
// Inline Parts
|
|
81
89
|
|
|
82
90
|
function Text( text ) {
|
|
@@ -126,12 +134,12 @@ documentParts.Code = Code ;
|
|
|
126
134
|
|
|
127
135
|
|
|
128
136
|
|
|
129
|
-
function Link( href , style ,
|
|
137
|
+
function Link( href , style , hint ) {
|
|
130
138
|
this.type = 'link' ;
|
|
131
139
|
this.href = href ;
|
|
132
140
|
this.style = style || undefined ;
|
|
133
141
|
InlineContainerPart.call( this ) ;
|
|
134
|
-
this.
|
|
142
|
+
this.hint = hint || undefined ;
|
|
135
143
|
}
|
|
136
144
|
|
|
137
145
|
Link.prototype = Object.create( InlineContainerPart.prototype ) ;
|
|
@@ -140,11 +148,26 @@ documentParts.Link = Link ;
|
|
|
140
148
|
|
|
141
149
|
|
|
142
150
|
|
|
143
|
-
|
|
151
|
+
// Tooltip/Infotip/Hint displayed when hovering
|
|
152
|
+
function InfotipedText( hint , href , style ) {
|
|
153
|
+
this.type = 'infotipedText' ;
|
|
154
|
+
this.hint = hint || undefined ;
|
|
155
|
+
this.href = href || undefined ;
|
|
156
|
+
this.style = style || undefined ;
|
|
157
|
+
InlineContainerPart.call( this ) ;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
InfotipedText.prototype = Object.create( InlineContainerPart.prototype ) ;
|
|
161
|
+
InfotipedText.prototype.constructor = InfotipedText ;
|
|
162
|
+
documentParts.InfotipedText = InfotipedText ;
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
function StyledText( style , hint ) {
|
|
144
167
|
this.type = 'styledText' ;
|
|
145
168
|
this.style = style || undefined ;
|
|
146
169
|
InlineContainerPart.call( this ) ;
|
|
147
|
-
this.
|
|
170
|
+
this.hint = hint || undefined ;
|
|
148
171
|
}
|
|
149
172
|
|
|
150
173
|
StyledText.prototype = Object.create( InlineContainerPart.prototype ) ;
|
|
@@ -153,11 +176,11 @@ documentParts.StyledText = StyledText ;
|
|
|
153
176
|
|
|
154
177
|
|
|
155
178
|
|
|
156
|
-
function Image( href , altText ,
|
|
179
|
+
function Image( href , altText , hint ) {
|
|
157
180
|
this.type = 'image' ;
|
|
158
181
|
this.href = href ;
|
|
159
182
|
this.altText = altText ;
|
|
160
|
-
this.
|
|
183
|
+
this.hint = hint || undefined ;
|
|
161
184
|
InlinePart.call( this ) ;
|
|
162
185
|
}
|
|
163
186
|
|
|
@@ -169,7 +192,7 @@ documentParts.Image = Image ;
|
|
|
169
192
|
|
|
170
193
|
const emoji = require( 'string-kit/lib/emoji.js' ) ;
|
|
171
194
|
|
|
172
|
-
function Pictogram( code , altText ,
|
|
195
|
+
function Pictogram( code , altText , hint ) {
|
|
173
196
|
this.type = 'pictogram' ;
|
|
174
197
|
this.code = code ;
|
|
175
198
|
|
|
@@ -181,7 +204,7 @@ function Pictogram( code , altText , title ) {
|
|
|
181
204
|
emojiChar ? emoji.getCanonicalName( emojiChar ) :
|
|
182
205
|
undefined ;
|
|
183
206
|
|
|
184
|
-
this.
|
|
207
|
+
this.hint = hint || undefined ;
|
|
185
208
|
|
|
186
209
|
InlinePart.call( this ) ;
|
|
187
210
|
}
|
|
@@ -196,10 +219,10 @@ documentParts.Pictogram = Pictogram ;
|
|
|
196
219
|
|
|
197
220
|
function Paragraph() {
|
|
198
221
|
this.type = 'paragraph' ;
|
|
199
|
-
|
|
222
|
+
BlockContainerPart.call( this ) ;
|
|
200
223
|
}
|
|
201
224
|
|
|
202
|
-
Paragraph.prototype = Object.create(
|
|
225
|
+
Paragraph.prototype = Object.create( BlockContainerPart.prototype ) ;
|
|
203
226
|
Paragraph.prototype.constructor = Paragraph ;
|
|
204
227
|
documentParts.Paragraph = Paragraph ;
|
|
205
228
|
|
|
@@ -208,10 +231,10 @@ documentParts.Paragraph = Paragraph ;
|
|
|
208
231
|
function Header( level ) {
|
|
209
232
|
this.type = 'header' ;
|
|
210
233
|
this.level = level ;
|
|
211
|
-
|
|
234
|
+
BlockContainerPart.call( this ) ;
|
|
212
235
|
}
|
|
213
236
|
|
|
214
|
-
Header.prototype = Object.create(
|
|
237
|
+
Header.prototype = Object.create( BlockContainerPart.prototype ) ;
|
|
215
238
|
Header.prototype.constructor = Header ;
|
|
216
239
|
documentParts.Header = Header ;
|
|
217
240
|
|
|
@@ -219,10 +242,10 @@ documentParts.Header = Header ;
|
|
|
219
242
|
|
|
220
243
|
function Cite() {
|
|
221
244
|
this.type = 'cite' ;
|
|
222
|
-
|
|
245
|
+
BlockContainerPart.call( this ) ;
|
|
223
246
|
}
|
|
224
247
|
|
|
225
|
-
Cite.prototype = Object.create(
|
|
248
|
+
Cite.prototype = Object.create( BlockContainerPart.prototype ) ;
|
|
226
249
|
Cite.prototype.constructor = Cite ;
|
|
227
250
|
documentParts.Cite = Cite ;
|
|
228
251
|
|
|
@@ -231,10 +254,10 @@ documentParts.Cite = Cite ;
|
|
|
231
254
|
function List( indent ) {
|
|
232
255
|
this.type = 'list' ;
|
|
233
256
|
this.indent = indent ;
|
|
234
|
-
|
|
257
|
+
BlockContainerPart.call( this ) ;
|
|
235
258
|
}
|
|
236
259
|
|
|
237
|
-
List.prototype = Object.create(
|
|
260
|
+
List.prototype = Object.create( BlockContainerPart.prototype ) ;
|
|
238
261
|
List.prototype.constructor = List ;
|
|
239
262
|
documentParts.List = List ;
|
|
240
263
|
|
|
@@ -243,10 +266,10 @@ documentParts.List = List ;
|
|
|
243
266
|
function ListItem( indent ) {
|
|
244
267
|
this.type = 'listItem' ;
|
|
245
268
|
this.indent = indent ;
|
|
246
|
-
|
|
269
|
+
BlockContainerPart.call( this ) ;
|
|
247
270
|
}
|
|
248
271
|
|
|
249
|
-
ListItem.prototype = Object.create(
|
|
272
|
+
ListItem.prototype = Object.create( BlockContainerPart.prototype ) ;
|
|
250
273
|
ListItem.prototype.constructor = ListItem ;
|
|
251
274
|
documentParts.ListItem = ListItem ;
|
|
252
275
|
|
|
@@ -256,10 +279,10 @@ function OrderedList( indent ) {
|
|
|
256
279
|
this.type = 'orderedList' ;
|
|
257
280
|
this.indent = indent ;
|
|
258
281
|
this.autoIndex = 1 ;
|
|
259
|
-
|
|
282
|
+
BlockContainerPart.call( this ) ;
|
|
260
283
|
}
|
|
261
284
|
|
|
262
|
-
OrderedList.prototype = Object.create(
|
|
285
|
+
OrderedList.prototype = Object.create( BlockContainerPart.prototype ) ;
|
|
263
286
|
OrderedList.prototype.constructor = OrderedList ;
|
|
264
287
|
documentParts.OrderedList = OrderedList ;
|
|
265
288
|
|
|
@@ -270,10 +293,10 @@ function OrderedListItem( indent , order , index ) {
|
|
|
270
293
|
this.indent = indent ;
|
|
271
294
|
this.order = order ; // User order value
|
|
272
295
|
this.index = index ; // Real index, starting at 1, and auto-incrementing
|
|
273
|
-
|
|
296
|
+
BlockContainerPart.call( this ) ;
|
|
274
297
|
}
|
|
275
298
|
|
|
276
|
-
OrderedListItem.prototype = Object.create(
|
|
299
|
+
OrderedListItem.prototype = Object.create( BlockContainerPart.prototype ) ;
|
|
277
300
|
OrderedListItem.prototype.constructor = OrderedListItem ;
|
|
278
301
|
documentParts.OrderedListItem = OrderedListItem ;
|
|
279
302
|
|
|
@@ -282,10 +305,10 @@ documentParts.OrderedListItem = OrderedListItem ;
|
|
|
282
305
|
function Quote( indent ) {
|
|
283
306
|
this.type = 'quote' ;
|
|
284
307
|
this.indent = indent ;
|
|
285
|
-
|
|
308
|
+
BlockContainerPart.call( this ) ;
|
|
286
309
|
}
|
|
287
310
|
|
|
288
|
-
Quote.prototype = Object.create(
|
|
311
|
+
Quote.prototype = Object.create( BlockContainerPart.prototype ) ;
|
|
289
312
|
Quote.prototype.constructor = Quote ;
|
|
290
313
|
documentParts.Quote = Quote ;
|
|
291
314
|
|
|
@@ -294,10 +317,10 @@ documentParts.Quote = Quote ;
|
|
|
294
317
|
function HorizontalRule( clearFloat ) {
|
|
295
318
|
this.type = 'horizontalRule' ;
|
|
296
319
|
this.clearFloat = clearFloat ;
|
|
297
|
-
|
|
320
|
+
BlockContainerPart.call( this ) ;
|
|
298
321
|
}
|
|
299
322
|
|
|
300
|
-
HorizontalRule.prototype = Object.create(
|
|
323
|
+
HorizontalRule.prototype = Object.create( BlockContainerPart.prototype ) ;
|
|
301
324
|
HorizontalRule.prototype.constructor = HorizontalRule ;
|
|
302
325
|
documentParts.HorizontalRule = HorizontalRule ;
|
|
303
326
|
|
|
@@ -305,10 +328,10 @@ documentParts.HorizontalRule = HorizontalRule ;
|
|
|
305
328
|
|
|
306
329
|
function ClearFloat() {
|
|
307
330
|
this.type = 'clearFloat' ;
|
|
308
|
-
|
|
331
|
+
BlockContainerPart.call( this ) ;
|
|
309
332
|
}
|
|
310
333
|
|
|
311
|
-
ClearFloat.prototype = Object.create(
|
|
334
|
+
ClearFloat.prototype = Object.create( BlockContainerPart.prototype ) ;
|
|
312
335
|
ClearFloat.prototype.constructor = ClearFloat ;
|
|
313
336
|
documentParts.ClearFloat = ClearFloat ;
|
|
314
337
|
|
|
@@ -318,10 +341,10 @@ function CodeBlock( text , lang ) {
|
|
|
318
341
|
this.type = 'codeBlock' ;
|
|
319
342
|
this.lang = lang || undefined ;
|
|
320
343
|
this.text = text ;
|
|
321
|
-
|
|
344
|
+
BlockContainerPart.call( this ) ;
|
|
322
345
|
}
|
|
323
346
|
|
|
324
|
-
CodeBlock.prototype = Object.create(
|
|
347
|
+
CodeBlock.prototype = Object.create( BlockContainerPart.prototype ) ;
|
|
325
348
|
CodeBlock.prototype.constructor = CodeBlock ;
|
|
326
349
|
documentParts.CodeBlock = CodeBlock ;
|
|
327
350
|
|
|
@@ -330,15 +353,63 @@ documentParts.CodeBlock = CodeBlock ;
|
|
|
330
353
|
function Anchor( href ) {
|
|
331
354
|
this.type = 'anchor' ;
|
|
332
355
|
this.href = href ;
|
|
333
|
-
|
|
356
|
+
BlockContainerPart.call( this ) ;
|
|
334
357
|
}
|
|
335
358
|
|
|
336
|
-
Anchor.prototype = Object.create(
|
|
359
|
+
Anchor.prototype = Object.create( BlockContainerPart.prototype ) ;
|
|
337
360
|
Anchor.prototype.constructor = Anchor ;
|
|
338
361
|
documentParts.Anchor = Anchor ;
|
|
339
362
|
|
|
340
363
|
|
|
341
364
|
|
|
365
|
+
function ImageBlock( href , altText , float , caption , hint ) {
|
|
366
|
+
this.type = 'imageBlock' ;
|
|
367
|
+
this.href = href ;
|
|
368
|
+
this.altText = altText ;
|
|
369
|
+
this.float = float || undefined ;
|
|
370
|
+
this.caption = caption || undefined ;
|
|
371
|
+
this.hint = hint || undefined ;
|
|
372
|
+
BlockPart.call( this ) ;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
ImageBlock.prototype = Object.create( BlockPart.prototype ) ;
|
|
376
|
+
ImageBlock.prototype.constructor = ImageBlock ;
|
|
377
|
+
documentParts.ImageBlock = ImageBlock ;
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
function AudioBlock( href , altText , float , caption , hint ) {
|
|
382
|
+
this.type = 'audioBlock' ;
|
|
383
|
+
this.href = href ;
|
|
384
|
+
this.altText = altText ;
|
|
385
|
+
this.float = float || undefined ;
|
|
386
|
+
this.caption = caption || undefined ;
|
|
387
|
+
this.hint = hint || undefined ;
|
|
388
|
+
BlockPart.call( this ) ;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
AudioBlock.prototype = Object.create( BlockPart.prototype ) ;
|
|
392
|
+
AudioBlock.prototype.constructor = AudioBlock ;
|
|
393
|
+
documentParts.AudioBlock = AudioBlock ;
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
function VideoBlock( href , altText , float , caption , hint ) {
|
|
398
|
+
this.type = 'videoBlock' ;
|
|
399
|
+
this.href = href ;
|
|
400
|
+
this.altText = altText ;
|
|
401
|
+
this.float = float || undefined ;
|
|
402
|
+
this.caption = caption || undefined ;
|
|
403
|
+
this.hint = hint || undefined ;
|
|
404
|
+
BlockPart.call( this ) ;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
VideoBlock.prototype = Object.create( BlockPart.prototype ) ;
|
|
408
|
+
VideoBlock.prototype.constructor = VideoBlock ;
|
|
409
|
+
documentParts.VideoBlock = VideoBlock ;
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
|
|
342
413
|
function Table() {
|
|
343
414
|
this.type = 'table' ;
|
|
344
415
|
this.columns = [] ;
|
|
@@ -346,10 +417,10 @@ function Table() {
|
|
|
346
417
|
this.hasHeadSeparator = false ;
|
|
347
418
|
this.hasRowSeparator = false ;
|
|
348
419
|
this.hasRowSpan = false ; // Useful to disable background colors based on odd/even rows
|
|
349
|
-
|
|
420
|
+
BlockContainerPart.call( this ) ;
|
|
350
421
|
}
|
|
351
422
|
|
|
352
|
-
Table.prototype = Object.create(
|
|
423
|
+
Table.prototype = Object.create( BlockContainerPart.prototype ) ;
|
|
353
424
|
Table.prototype.constructor = Table ;
|
|
354
425
|
documentParts.Table = Table ;
|
|
355
426
|
|
|
@@ -358,10 +429,10 @@ documentParts.Table = Table ;
|
|
|
358
429
|
function TableCaption( style ) {
|
|
359
430
|
this.type = 'tableCaption' ;
|
|
360
431
|
this.style = style || undefined ;
|
|
361
|
-
|
|
432
|
+
BlockContainerPart.call( this ) ;
|
|
362
433
|
}
|
|
363
434
|
|
|
364
|
-
TableCaption.prototype = Object.create(
|
|
435
|
+
TableCaption.prototype = Object.create( BlockContainerPart.prototype ) ;
|
|
365
436
|
TableCaption.prototype.constructor = TableCaption ;
|
|
366
437
|
documentParts.TableCaption = TableCaption ;
|
|
367
438
|
|
|
@@ -372,10 +443,10 @@ function TableRow( style ) {
|
|
|
372
443
|
this.style = style || undefined ;
|
|
373
444
|
this.rowSeparator = false ;
|
|
374
445
|
this.continueRowSpan = undefined ;
|
|
375
|
-
|
|
446
|
+
BlockContainerPart.call( this ) ;
|
|
376
447
|
}
|
|
377
448
|
|
|
378
|
-
TableRow.prototype = Object.create(
|
|
449
|
+
TableRow.prototype = Object.create( BlockContainerPart.prototype ) ;
|
|
379
450
|
TableRow.prototype.constructor = TableRow ;
|
|
380
451
|
documentParts.TableRow = TableRow ;
|
|
381
452
|
|
|
@@ -394,10 +465,10 @@ function TableHeadRow( style ) {
|
|
|
394
465
|
this.style = style || undefined ;
|
|
395
466
|
this.rowSeparator = false ;
|
|
396
467
|
this.continueRowSpan = undefined ;
|
|
397
|
-
|
|
468
|
+
BlockContainerPart.call( this ) ;
|
|
398
469
|
}
|
|
399
470
|
|
|
400
|
-
TableHeadRow.prototype = Object.create(
|
|
471
|
+
TableHeadRow.prototype = Object.create( BlockContainerPart.prototype ) ;
|
|
401
472
|
TableHeadRow.prototype.constructor = TableHeadRow ;
|
|
402
473
|
documentParts.TableHeadRow = TableHeadRow ;
|
|
403
474
|
|
|
@@ -413,10 +484,10 @@ function TableCell( style ) {
|
|
|
413
484
|
this.sx = - 1 ;
|
|
414
485
|
this.ex = - 1 ;
|
|
415
486
|
this.masterCell = undefined ;
|
|
416
|
-
|
|
487
|
+
BlockContainerPart.call( this ) ;
|
|
417
488
|
}
|
|
418
489
|
|
|
419
|
-
TableCell.prototype = Object.create(
|
|
490
|
+
TableCell.prototype = Object.create( BlockContainerPart.prototype ) ;
|
|
420
491
|
TableCell.prototype.constructor = TableCell ;
|
|
421
492
|
documentParts.TableCell = TableCell ;
|
|
422
493
|
|
|
@@ -447,10 +518,10 @@ function TableHeadCell( style ) {
|
|
|
447
518
|
this.masterCell = undefined ;
|
|
448
519
|
this.isColumnHead = false ;
|
|
449
520
|
this.isRowHead = false ;
|
|
450
|
-
|
|
521
|
+
BlockContainerPart.call( this ) ;
|
|
451
522
|
}
|
|
452
523
|
|
|
453
|
-
TableHeadCell.prototype = Object.create(
|
|
524
|
+
TableHeadCell.prototype = Object.create( BlockContainerPart.prototype ) ;
|
|
454
525
|
TableHeadCell.prototype.constructor = TableHeadCell ;
|
|
455
526
|
documentParts.TableHeadCell = TableHeadCell ;
|
|
456
527
|
|