コード例 #1
0
ファイル: index.js プロジェクト: comeoninc/gutenberg
				transform: ( { value, citation, ...attrs } ) => {
					// If there is no quote content, use the citation as the
					// content of the resulting heading. A nonexistent citation
					// will result in an empty heading.
					if ( value === '<p></p>' ) {
						return createBlock( 'core/heading', {
							content: citation,
						} );
					}

					const pieces = split( create( { html: value, multilineTag: 'p' } ), '\u2028' );
					const quotePieces = pieces.slice( 1 );

					return [
						createBlock( 'core/heading', {
							content: toHTMLString( { value: pieces[ 0 ] } ),
						} ),
						createBlock( 'core/quote', {
							...attrs,
							citation,
							value: toHTMLString( {
								value: quotePieces.length ? join( pieces.slice( 1 ), '\u2028' ) : create(),
								multilineTag: 'p',
							} ),
						} ),
					];
				},
コード例 #2
0
ファイル: index.js プロジェクト: comeoninc/gutenberg
				transform: ( attributes ) => {
					return createBlock( 'core/quote', {
						value: toHTMLString( {
							value: join( attributes.map( ( { content } ) =>
								create( { html: content } )
							), '\u2028' ),
							multilineTag: 'p',
						} ),
					} );
				},