Skip to content

Commit

Permalink
TinyMCE per block: Allow rich quote cites (with links ...)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Mar 6, 2017
1 parent defa286 commit 60d9224
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions tinymce-per-block/src/blocks/quote-block/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default class QuoteBlockForm extends Component {
{ isFocused &&
<div className="block-list__block-controls">
<div className="block-list__block-controls-group">
<EditableFormatToolbar editable={ this.content } ref={ this.bindFormatToolbar } />
<EditableFormatToolbar editable={ focusInput === 'content' ? this.content : this.cite } ref={ this.bindFormatToolbar } />
</div>
</div>
}
Expand All @@ -93,24 +93,27 @@ export default class QuoteBlockForm extends Component {
mergeWithPrevious={ mergeWithPrevious }
remove={ remove }
onChange={ ( value ) => change( { content: value } ) }
setToolbarState={ this.setToolbarState }
setToolbarState={ focusInput === 'content' ? this.setToolbarState : undefined }
focusConfig={ focusInput === 'content' ? focusConfig : null }
onFocusChange={ ( config ) => focus( Object.assign( { input: 'content' }, config ) ) }
inline
/>
</div>
<div className="quote-block__cite">
<EnhancedInputComponent
<EditableComponent
ref={ this.bindCite }
moveUp={ this.moveToContent }
removePrevious={ this.moveToContent }
moveDown={ moveDown }
value={ block.cite }
mergeWithPrevious={ this.moveToContent }
remove={ this.moveToContent }
content={ block.cite }
splitValue={ splitValue }
onChange={ ( value ) => change( { cite: value } ) }
setToolbarState={ focusInput === 'cite' ? this.setToolbarState : undefined }
focusConfig={ focusInput === 'cite' ? focusConfig : null }
onFocusChange={ ( config ) => focus( Object.assign( { input: 'cite' }, config ) ) }
placeholder="Enter a cite"
inline
single
/>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion tinymce-per-block/src/blocks/quote-block/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ registerBlock( 'quote', {
: div.firstChild.firstChild.outerHTML;

const cite = div.firstChild.childNodes.length > 1
? div.firstChild.lastChild.textContent
? div.firstChild.lastChild.innerHTML
: '';

return {
Expand Down

0 comments on commit 60d9224

Please sign in to comment.