Skip to content

Commit

Permalink
Merge pull request #192 from WordPress/try/tinymce-single/full-bleed
Browse files Browse the repository at this point in the history
Try full bleed for objects
  • Loading branch information
ellatrix authored Mar 6, 2017
2 parents d75934e + 8537c46 commit 399bdcf
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 9 deletions.
7 changes: 6 additions & 1 deletion shared/gridicons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions shared/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,22 @@ body {
width: 50%;
}

#editor figure.alignfull {
margin-left: -100px;
margin-right: -100px;
width: calc( 100% + 200px );
}

#editor figure.alignfull figcaption {
margin-left: 0.5em;
margin-right: 0.5em;
}

#editor figure.alignfull > figcaption {
margin-left: 100px;
margin-right: 100px;
}

#editor figure.alignleft,
#editor figure.alignright {
clear: none;
Expand Down
1 change: 1 addition & 0 deletions tinymce-single/blocks/core/gallery/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ window.wp.blocks.registerBlock( {
'block-align-left',
'block-align-center',
'block-align-right',
'block-align-full',
// {
// type: 'select',
// label: 'Columns'
Expand Down
1 change: 1 addition & 0 deletions tinymce-single/blocks/core/image/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ window.wp.blocks.registerBlock( {
'block-align-left',
'block-align-center',
'block-align-right',
'block-align-full',
'togglefigcaption'
]
} );
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ window.wp.blocks.registerBlock( {
'block-align-left',
'block-align-center',
'block-align-right',
'block-align-full',
{
icon: 'gridicons-cog'
}
Expand Down
5 changes: 5 additions & 0 deletions tinymce-single/blocks/my-awesome-plugin/youtube/structure.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@
width: 375px;
height: 211px;
}

#editor figure[data-wp-block-type="my-awesome-plugin:youtube"].alignfull iframe {
width: 950px;
height: 534px;
}
2 changes: 1 addition & 1 deletion tinymce-single/controls/align.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
};
}

[ 'left', 'center', 'right' ].forEach( function( position ) {
[ 'left', 'center', 'right', 'full' ].forEach( function( position ) {
wp.blocks.registerControl( 'text-align-' + position, {
icon: 'gridicons-align-' + position,
onClick: createOnClick( 'text-align-', position ),
Expand Down
6 changes: 1 addition & 5 deletions tinymce-single/tinymce/block.css
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,7 @@ div.mce-inline-toolbar-grp.block-toolbar > div.mce-stack-layout {
position: absolute;
top: -12px;
right: -12px;
bottom: -9px;
bottom: -12px;
left: -12px;
border: 2px solid #e0e5e9;
}

.insert-toolbar button {
background: #fff;
}
5 changes: 3 additions & 2 deletions tinymce-single/tinymce/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@
DOM.setStyles( toolbar, {
position: 'absolute',
left: left + 'px',
top: blockRect.top + Math.max( blockRect.height, 48 ) - 4 + window.pageYOffset + 'px'
top: blockRect.top + Math.max( blockRect.height, 48 ) - 1 + window.pageYOffset + 'px'
} );
}

Expand Down Expand Up @@ -360,10 +360,11 @@
var toolbar = this.getEl();
var toolbarRect = toolbar.getBoundingClientRect();
var elementRect = getSelectedBlock().getBoundingClientRect();
var contentRect = editor.getBody().getBoundingClientRect();

DOM.setStyles( toolbar, {
position: 'absolute',
left: elementRect.left + 'px',
left: Math.max( contentRect.left + 100, elementRect.left ) + 'px',
top: elementRect.top + window.pageYOffset - toolbarRect.height - 8 + 'px'
} );

Expand Down

0 comments on commit 399bdcf

Please sign in to comment.