-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from WordPress/tinymce-single/mimic-ui-prototype
TinyMCE single/mimic ui prototype
- Loading branch information
Showing
14 changed files
with
218 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ window.wp.blocks.register( { | |
// // body... | ||
// } | ||
// }, | ||
'block-options' | ||
{ | ||
icon: 'gridicons-cog' | ||
} | ||
] | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
window.wp.blocks.register( { | ||
name: 'image', | ||
namespace: 'core', | ||
type: 'image', | ||
icon: 'gridicons-image', | ||
buttons: [ | ||
'block-align-left', | ||
'block-align-center', | ||
'block-align-right', | ||
'togglefigcaption' | ||
] | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
window.wp.blocks.register( { | ||
elements: [ 'blockquote' ], | ||
type: 'text', | ||
icon: 'gridicons-quote', | ||
buttons: [ | ||
{ | ||
icon: 'gridicons-posts', | ||
onClick: function( editor ) { | ||
editor.formatter.remove( 'blockquote' ); | ||
} | ||
} | ||
] | ||
} ); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
( function( register ) { | ||
function getButtons() { | ||
var buttons = [ | ||
'alignleft', | ||
'aligncenter', | ||
'alignright' | ||
]; | ||
|
||
'123456'.split( '' ).forEach( function( level ) { | ||
buttons.push( { | ||
text: level, | ||
stateSelector: 'h' + level, | ||
onClick: function( editor, element ) { | ||
editor.formatter.apply( 'h' + level, element ); | ||
} | ||
} ); | ||
} ); | ||
|
||
buttons.push( { | ||
icon: 'gridicons-posts', | ||
onClick: function( editor, element ) { | ||
editor.formatter.apply( 'p', element ); | ||
} | ||
} ); | ||
|
||
return buttons; | ||
} | ||
|
||
register( { | ||
elements: [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ], | ||
type: 'text', | ||
icon: 'gridicons-heading', | ||
buttons: getButtons() | ||
} ); | ||
} )( window.wp.blocks.register ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
window.wp.blocks.register( { | ||
elements: [ 'ul', 'ol' ], | ||
type: 'text', | ||
icon: 'gridicons-list-unordered', | ||
buttons: [ | ||
'bullist', | ||
'numlist', | ||
{ | ||
icon: 'gridicons-posts', | ||
onClick: function( editor, element ) { | ||
editor.selection.select( element ); | ||
|
||
if ( element.nodeName === 'UL' ) { | ||
editor.execCommand( 'InsertUnorderedList' ); | ||
} else if ( element.nodeName === 'OL' ) { | ||
editor.execCommand( 'InsertOrderedList' ); | ||
} | ||
|
||
editor.nodeChanged(); | ||
} | ||
} | ||
] | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
window.wp.blocks.register( { | ||
elements: [ 'p' ], | ||
type: 'text', | ||
icon: 'gridicons-posts', | ||
buttons: [ | ||
'alignleft', | ||
'aligncenter', | ||
'alignright', | ||
{ | ||
icon: 'gridicons-heading', | ||
onClick: function( editor ) { | ||
editor.formatter.apply( 'h1' ); | ||
} | ||
}, | ||
{ | ||
icon: 'gridicons-quote', | ||
onClick: function( editor ) { | ||
editor.formatter.apply( 'blockquote' ); | ||
} | ||
}, | ||
'bullist', | ||
{ | ||
icon: 'gridicons-code', | ||
onClick: function( editor ) { | ||
editor.formatter.apply( 'pre' ); | ||
} | ||
} | ||
] | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
window.wp.blocks.register( { | ||
elements: [ 'pre' ], | ||
type: 'text', | ||
icon: 'gridicons-code', | ||
buttons: [ | ||
{ | ||
text: 'syntax' | ||
}, | ||
{ | ||
icon: 'gridicons-posts', | ||
onClick: function( editor ) { | ||
editor.formatter.remove( 'pre' ); | ||
} | ||
} | ||
] | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
( function( wp ) { | ||
var _settings = {}; | ||
|
||
wp.blocks = { | ||
register: function( settings ) { | ||
// Note, elements should probably only be registered by core. | ||
// Maybe for each block, we should offer to extend the settings (add buttons). | ||
|
||
if ( settings.elements ) { | ||
settings.elements.forEach( function( element ) { | ||
_settings[ 'element:' + element ] = settings; | ||
_settings[ 'element:' + element ]._id = 'element:' + element; | ||
} ); | ||
} else if ( settings.namespace && settings.name ) { | ||
_settings[ settings.namespace + ':' + settings.name ] = settings; | ||
_settings[ settings.namespace + ':' + settings.name ]._id = settings.namespace + ':' + settings.name; | ||
} | ||
}, | ||
getSettings: function( id ) { | ||
return _settings[ id ]; | ||
}, | ||
getSettingsByElement( element ) { | ||
var blockType = element.getAttribute( 'data-wp-block-type' ); | ||
var nodeName = element.nodeName.toLowerCase(); | ||
|
||
return this.getSettings( blockType || 'element:' + nodeName ); | ||
} | ||
}; | ||
} )( window.wp = window.wp || {} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.