Media: Update admin image editor design.
Significant restructure of the admin image editor interface, but no new functionality. Reorganize editing buttons into a common region at the top of the editor. Move image rotation tools into a pop-out menu. Add 180 degree rotation option. Add scale button to control group. Move sidebar tools next to the editing canvas to improve visual proximity between action and result. Enlarge editing canvas and crop handles. Separate activating crop functions from applying crop. Add numeric inputs for crop & scale values. A long term goal is to move undo/redo and cancel/save into the modal title bar, but that is not feasible without significant updates to the modal framework. Props afercia, karmatosed, nrqsnchz, antpb, chaion07, costdev, peterwilsoncc, antpb, sabernhardt, prashantbhivsane, joedolson. Fixes #50523. Built from https://develop.svn.wordpress.org/trunk@55919 git-svn-id: http://core.svn.wordpress.org/trunk@55431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7f247349b6
commit
9b15db20d3
|
@ -192,7 +192,6 @@ p.popular-tags,
|
||||||
.wp-editor-container,
|
.wp-editor-container,
|
||||||
.popular-tags,
|
.popular-tags,
|
||||||
.feature-filter,
|
.feature-filter,
|
||||||
.imgedit-group,
|
|
||||||
.comment-ays {
|
.comment-ays {
|
||||||
border: 1px solid #c3c4c7;
|
border: 1px solid #c3c4c7;
|
||||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
|
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
|
||||||
|
@ -205,7 +204,6 @@ p.popular-tags,
|
||||||
.widgets-holder-wrap,
|
.widgets-holder-wrap,
|
||||||
.popular-tags,
|
.popular-tags,
|
||||||
.feature-filter,
|
.feature-filter,
|
||||||
.imgedit-group,
|
|
||||||
.comment-ays {
|
.comment-ays {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -191,7 +191,6 @@ p.popular-tags,
|
||||||
.wp-editor-container,
|
.wp-editor-container,
|
||||||
.popular-tags,
|
.popular-tags,
|
||||||
.feature-filter,
|
.feature-filter,
|
||||||
.imgedit-group,
|
|
||||||
.comment-ays {
|
.comment-ays {
|
||||||
border: 1px solid #c3c4c7;
|
border: 1px solid #c3c4c7;
|
||||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
|
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
|
||||||
|
@ -204,7 +203,6 @@ p.popular-tags,
|
||||||
.widgets-holder-wrap,
|
.widgets-holder-wrap,
|
||||||
.popular-tags,
|
.popular-tags,
|
||||||
.feature-filter,
|
.feature-filter,
|
||||||
.imgedit-group,
|
|
||||||
.comment-ays {
|
.comment-ays {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -878,16 +878,16 @@ border color while dragging a file over the uploader drop area */
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-settings p,
|
.image-editor p,
|
||||||
.imgedit-settings fieldset {
|
.image-editor fieldset {
|
||||||
margin: 8px 0;
|
margin: 8px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-settings legend {
|
.image-editor legend {
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.describe .imgedit-wrap .imgedit-settings {
|
.describe .imgedit-wrap .image-editor {
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -899,19 +899,36 @@ border color while dragging a file over the uploader drop area */
|
||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wp_attachment_holder .imgedit-wrap .imgedit-panel-content {
|
.imgedit-panel-content {
|
||||||
float: right;
|
display: grid;
|
||||||
padding: 3px 0 0 16px;
|
grid-template-columns: 640px 1fr;
|
||||||
min-width: 400px;
|
gap: 20px;
|
||||||
max-width: calc( 100% - 266px );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.wp_attachment_holder .imgedit-wrap .imgedit-settings {
|
@media screen and (max-width: 1120px) {
|
||||||
|
.imgedit-panel-content {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.imgedit-settings {
|
||||||
|
max-width: 400px; /* Prevent reflow when help info is expanded. */
|
||||||
|
}
|
||||||
|
|
||||||
|
.imgedit-group-controls > * {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.imgedit-panel-active .imgedit-group-controls > * {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp_attachment_holder .imgedit-wrap .image-editor {
|
||||||
float: left;
|
float: left;
|
||||||
width: 250px;
|
width: 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-settings input {
|
.image-editor input {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
@ -946,7 +963,7 @@ border color while dragging a file over the uploader drop area */
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-disabled,
|
.media-disabled,
|
||||||
.imgedit-settings .disabled {
|
.image-editor .disabled {
|
||||||
/* WCAG 1.4.3 Text or images of text that are part of an inactive user
|
/* WCAG 1.4.3 Text or images of text that are part of an inactive user
|
||||||
interface component ... have no contrast requirement. */
|
interface component ... have no contrast requirement. */
|
||||||
color: #a7aaad;
|
color: #a7aaad;
|
||||||
|
@ -970,10 +987,6 @@ border color while dragging a file over the uploader drop area */
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-menu {
|
|
||||||
margin: 0 0 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.imgedit-menu .note-no-rotate {
|
.imgedit-menu .note-no-rotate {
|
||||||
clear: both;
|
clear: both;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -986,7 +999,6 @@ border color while dragging a file over the uploader drop area */
|
||||||
min-height: 28px;
|
min-height: 28px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
line-height: 2;
|
line-height: 2;
|
||||||
margin: 0 0 8px 8px;
|
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1015,22 +1027,14 @@ border color while dragging a file over the uploader drop area */
|
||||||
content: "\f165";
|
content: "\f165";
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-rleft:before {
|
.imgedit-scale:before {
|
||||||
content: "\f166";
|
content: "\f211";
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-rright:before {
|
.imgedit-rotate:before {
|
||||||
content: "\f167";
|
content: "\f167";
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-flipv:before {
|
|
||||||
content: "\f168";
|
|
||||||
}
|
|
||||||
|
|
||||||
.imgedit-fliph:before {
|
|
||||||
content: "\f169";
|
|
||||||
}
|
|
||||||
|
|
||||||
.imgedit-undo:before {
|
.imgedit-undo:before {
|
||||||
content: "\f171";
|
content: "\f171";
|
||||||
}
|
}
|
||||||
|
@ -1049,23 +1053,19 @@ border color while dragging a file over the uploader drop area */
|
||||||
background-size: 20px 20px;
|
background-size: 20px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.imgedit-crop-wrap {
|
||||||
|
padding: 20px;
|
||||||
|
background-image: linear-gradient(-45deg, #c3c4c7 25%, transparent 25%, transparent 75%, #c3c4c7 75%, #c3c4c7), linear-gradient(-45deg, #c3c4c7 25%, transparent 25%, transparent 75%, #c3c4c7 75%, #c3c4c7);
|
||||||
|
background-position: 100% 0, 10px 10px;
|
||||||
|
background-size: 20px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.imgedit-crop {
|
.imgedit-crop {
|
||||||
margin: 0 0 0 8px;
|
margin: 0 0 0 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-rleft {
|
.imgedit-rotate {
|
||||||
margin: 0 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.imgedit-rright {
|
|
||||||
margin: 0 3px 0 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.imgedit-flipv {
|
|
||||||
margin: 0 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.imgedit-fliph {
|
|
||||||
margin: 0 3px 0 8px;
|
margin: 0 3px 0 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1077,6 +1077,12 @@ border color while dragging a file over the uploader drop area */
|
||||||
margin: 0 3px 0 8px;
|
margin: 0 3px 0 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.imgedit-thumbnail-preview-group {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
column-gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.imgedit-thumbnail-preview {
|
.imgedit-thumbnail-preview {
|
||||||
margin: 10px 0 0 8px;
|
margin: 10px 0 0 8px;
|
||||||
}
|
}
|
||||||
|
@ -1103,11 +1109,35 @@ border color while dragging a file over the uploader drop area */
|
||||||
padding: .5em 0 0;
|
padding: .5em 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.imgedit-popup-menu,
|
||||||
.imgedit-help {
|
.imgedit-help {
|
||||||
display: none;
|
display: none;
|
||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.imgedit-panel-tools > .imgedit-menu {
|
||||||
|
display: flex;
|
||||||
|
column-gap: 4px;
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.imgedit-popup-menu {
|
||||||
|
width: fit-content;
|
||||||
|
position: absolute;
|
||||||
|
right: calc( 100% + 4px );
|
||||||
|
top: -3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-editor .imgedit-menu .imgedit-popup-menu button {
|
||||||
|
display: block;
|
||||||
|
margin: 2px 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.imgedit-rotate-menu-container {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
.imgedit-help.imgedit-restore {
|
.imgedit-help.imgedit-restore {
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
}
|
}
|
||||||
|
@ -1140,10 +1170,6 @@ border color while dragging a file over the uploader drop area */
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-submit {
|
|
||||||
margin: 8px 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.imgedit-submit-btn {
|
.imgedit-submit-btn {
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
}
|
}
|
||||||
|
@ -1174,17 +1200,16 @@ span.imgedit-scale-warn {
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-group {
|
.imgedit-group {
|
||||||
margin-bottom: 8px;
|
margin-bottom: 20px;
|
||||||
padding: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-settings .imgedit-original-dimensions {
|
.image-editor .imgedit-original-dimensions {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-settings .imgedit-scale input[type="text"],
|
.image-editor .imgedit-scale-controls input[type="text"],
|
||||||
.imgedit-settings .imgedit-crop-ratio input[type="text"],
|
.image-editor .imgedit-crop-ratio input[type="text"],
|
||||||
.imgedit-settings .imgedit-crop-sel input[type="text"] {
|
.image-editor .imgedit-crop-sel input[type="text"] {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
|
@ -1198,12 +1223,12 @@ span.imgedit-scale-warn {
|
||||||
color: #3c434a;
|
color: #3c434a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-settings .imgedit-scale-button-wrapper {
|
.image-editor .imgedit-scale-button-wrapper {
|
||||||
margin-top: 0.3077em;
|
margin-top: 0.3077em;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-settings .imgedit-scale .button {
|
.image-editor .imgedit-scale-controls .button {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1272,15 +1297,15 @@ audio, video {
|
||||||
padding: 10px 12px 10px 0;
|
padding: 10px 12px 10px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-settings .imgedit-scale input[type="text"],
|
.image-editor .imgedit-scale input[type="text"],
|
||||||
.imgedit-settings .imgedit-crop-ratio input[type="text"],
|
.image-editor .imgedit-crop-ratio input[type="text"],
|
||||||
.imgedit-settings .imgedit-crop-sel input[type="text"] {
|
.image-editor .imgedit-crop-sel input[type="text"] {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
padding: 6px 10px;
|
padding: 6px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wp_attachment_holder .imgedit-wrap .imgedit-panel-content,
|
.wp_attachment_holder .imgedit-wrap .imgedit-panel-content,
|
||||||
.wp_attachment_holder .imgedit-wrap .imgedit-settings {
|
.wp_attachment_holder .imgedit-wrap .image-editor {
|
||||||
float: none;
|
float: none;
|
||||||
width: auto;
|
width: auto;
|
||||||
max-width: none;
|
max-width: none;
|
||||||
|
@ -1297,16 +1322,16 @@ audio, video {
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-modal .imgedit-wrap .imgedit-panel-content,
|
.media-modal .imgedit-wrap .imgedit-panel-content,
|
||||||
.media-modal .imgedit-wrap .imgedit-settings {
|
.media-modal .imgedit-wrap .image-editor {
|
||||||
position: initial !important;
|
position: initial !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-modal .imgedit-wrap .imgedit-settings {
|
.media-modal .imgedit-wrap .image-editor {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-settings .imgedit-scale-button-wrapper {
|
.image-editor .imgedit-scale-button-wrapper {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -877,16 +877,16 @@ border color while dragging a file over the uploader drop area */
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-settings p,
|
.image-editor p,
|
||||||
.imgedit-settings fieldset {
|
.image-editor fieldset {
|
||||||
margin: 8px 0;
|
margin: 8px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-settings legend {
|
.image-editor legend {
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.describe .imgedit-wrap .imgedit-settings {
|
.describe .imgedit-wrap .image-editor {
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -898,19 +898,36 @@ border color while dragging a file over the uploader drop area */
|
||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wp_attachment_holder .imgedit-wrap .imgedit-panel-content {
|
.imgedit-panel-content {
|
||||||
float: left;
|
display: grid;
|
||||||
padding: 3px 16px 0 0;
|
grid-template-columns: 640px 1fr;
|
||||||
min-width: 400px;
|
gap: 20px;
|
||||||
max-width: calc( 100% - 266px );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.wp_attachment_holder .imgedit-wrap .imgedit-settings {
|
@media screen and (max-width: 1120px) {
|
||||||
|
.imgedit-panel-content {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.imgedit-settings {
|
||||||
|
max-width: 400px; /* Prevent reflow when help info is expanded. */
|
||||||
|
}
|
||||||
|
|
||||||
|
.imgedit-group-controls > * {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.imgedit-panel-active .imgedit-group-controls > * {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp_attachment_holder .imgedit-wrap .image-editor {
|
||||||
float: right;
|
float: right;
|
||||||
width: 250px;
|
width: 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-settings input {
|
.image-editor input {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
@ -945,7 +962,7 @@ border color while dragging a file over the uploader drop area */
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-disabled,
|
.media-disabled,
|
||||||
.imgedit-settings .disabled {
|
.image-editor .disabled {
|
||||||
/* WCAG 1.4.3 Text or images of text that are part of an inactive user
|
/* WCAG 1.4.3 Text or images of text that are part of an inactive user
|
||||||
interface component ... have no contrast requirement. */
|
interface component ... have no contrast requirement. */
|
||||||
color: #a7aaad;
|
color: #a7aaad;
|
||||||
|
@ -969,10 +986,6 @@ border color while dragging a file over the uploader drop area */
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-menu {
|
|
||||||
margin: 0 0 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.imgedit-menu .note-no-rotate {
|
.imgedit-menu .note-no-rotate {
|
||||||
clear: both;
|
clear: both;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -985,7 +998,6 @@ border color while dragging a file over the uploader drop area */
|
||||||
min-height: 28px;
|
min-height: 28px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
line-height: 2;
|
line-height: 2;
|
||||||
margin: 0 8px 8px 0;
|
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1014,22 +1026,14 @@ border color while dragging a file over the uploader drop area */
|
||||||
content: "\f165";
|
content: "\f165";
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-rleft:before {
|
.imgedit-scale:before {
|
||||||
content: "\f166";
|
content: "\f211";
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-rright:before {
|
.imgedit-rotate:before {
|
||||||
content: "\f167";
|
content: "\f167";
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-flipv:before {
|
|
||||||
content: "\f168";
|
|
||||||
}
|
|
||||||
|
|
||||||
.imgedit-fliph:before {
|
|
||||||
content: "\f169";
|
|
||||||
}
|
|
||||||
|
|
||||||
.imgedit-undo:before {
|
.imgedit-undo:before {
|
||||||
content: "\f171";
|
content: "\f171";
|
||||||
}
|
}
|
||||||
|
@ -1048,23 +1052,19 @@ border color while dragging a file over the uploader drop area */
|
||||||
background-size: 20px 20px;
|
background-size: 20px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.imgedit-crop-wrap {
|
||||||
|
padding: 20px;
|
||||||
|
background-image: linear-gradient(45deg, #c3c4c7 25%, transparent 25%, transparent 75%, #c3c4c7 75%, #c3c4c7), linear-gradient(45deg, #c3c4c7 25%, transparent 25%, transparent 75%, #c3c4c7 75%, #c3c4c7);
|
||||||
|
background-position: 0 0, 10px 10px;
|
||||||
|
background-size: 20px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.imgedit-crop {
|
.imgedit-crop {
|
||||||
margin: 0 8px 0 0;
|
margin: 0 8px 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-rleft {
|
.imgedit-rotate {
|
||||||
margin: 0 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.imgedit-rright {
|
|
||||||
margin: 0 8px 0 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.imgedit-flipv {
|
|
||||||
margin: 0 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.imgedit-fliph {
|
|
||||||
margin: 0 8px 0 3px;
|
margin: 0 8px 0 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1076,6 +1076,12 @@ border color while dragging a file over the uploader drop area */
|
||||||
margin: 0 8px 0 3px;
|
margin: 0 8px 0 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.imgedit-thumbnail-preview-group {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
column-gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.imgedit-thumbnail-preview {
|
.imgedit-thumbnail-preview {
|
||||||
margin: 10px 8px 0 0;
|
margin: 10px 8px 0 0;
|
||||||
}
|
}
|
||||||
|
@ -1102,11 +1108,35 @@ border color while dragging a file over the uploader drop area */
|
||||||
padding: .5em 0 0;
|
padding: .5em 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.imgedit-popup-menu,
|
||||||
.imgedit-help {
|
.imgedit-help {
|
||||||
display: none;
|
display: none;
|
||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.imgedit-panel-tools > .imgedit-menu {
|
||||||
|
display: flex;
|
||||||
|
column-gap: 4px;
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.imgedit-popup-menu {
|
||||||
|
width: fit-content;
|
||||||
|
position: absolute;
|
||||||
|
left: calc( 100% + 4px );
|
||||||
|
top: -3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-editor .imgedit-menu .imgedit-popup-menu button {
|
||||||
|
display: block;
|
||||||
|
margin: 2px 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.imgedit-rotate-menu-container {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
.imgedit-help.imgedit-restore {
|
.imgedit-help.imgedit-restore {
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
}
|
}
|
||||||
|
@ -1139,10 +1169,6 @@ border color while dragging a file over the uploader drop area */
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-submit {
|
|
||||||
margin: 8px 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.imgedit-submit-btn {
|
.imgedit-submit-btn {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
@ -1173,17 +1199,16 @@ span.imgedit-scale-warn {
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-group {
|
.imgedit-group {
|
||||||
margin-bottom: 8px;
|
margin-bottom: 20px;
|
||||||
padding: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-settings .imgedit-original-dimensions {
|
.image-editor .imgedit-original-dimensions {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-settings .imgedit-scale input[type="text"],
|
.image-editor .imgedit-scale-controls input[type="text"],
|
||||||
.imgedit-settings .imgedit-crop-ratio input[type="text"],
|
.image-editor .imgedit-crop-ratio input[type="text"],
|
||||||
.imgedit-settings .imgedit-crop-sel input[type="text"] {
|
.image-editor .imgedit-crop-sel input[type="text"] {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
|
@ -1197,12 +1222,12 @@ span.imgedit-scale-warn {
|
||||||
color: #3c434a;
|
color: #3c434a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-settings .imgedit-scale-button-wrapper {
|
.image-editor .imgedit-scale-button-wrapper {
|
||||||
margin-top: 0.3077em;
|
margin-top: 0.3077em;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-settings .imgedit-scale .button {
|
.image-editor .imgedit-scale-controls .button {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1271,15 +1296,15 @@ audio, video {
|
||||||
padding: 10px 0 10px 12px;
|
padding: 10px 0 10px 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-settings .imgedit-scale input[type="text"],
|
.image-editor .imgedit-scale input[type="text"],
|
||||||
.imgedit-settings .imgedit-crop-ratio input[type="text"],
|
.image-editor .imgedit-crop-ratio input[type="text"],
|
||||||
.imgedit-settings .imgedit-crop-sel input[type="text"] {
|
.image-editor .imgedit-crop-sel input[type="text"] {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
padding: 6px 10px;
|
padding: 6px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wp_attachment_holder .imgedit-wrap .imgedit-panel-content,
|
.wp_attachment_holder .imgedit-wrap .imgedit-panel-content,
|
||||||
.wp_attachment_holder .imgedit-wrap .imgedit-settings {
|
.wp_attachment_holder .imgedit-wrap .image-editor {
|
||||||
float: none;
|
float: none;
|
||||||
width: auto;
|
width: auto;
|
||||||
max-width: none;
|
max-width: none;
|
||||||
|
@ -1296,16 +1321,16 @@ audio, video {
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-modal .imgedit-wrap .imgedit-panel-content,
|
.media-modal .imgedit-wrap .imgedit-panel-content,
|
||||||
.media-modal .imgedit-wrap .imgedit-settings {
|
.media-modal .imgedit-wrap .image-editor {
|
||||||
position: initial !important;
|
position: initial !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-modal .imgedit-wrap .imgedit-settings {
|
.media-modal .imgedit-wrap .image-editor {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.imgedit-settings .imgedit-scale-button-wrapper {
|
.image-editor .imgedit-scale-button-wrapper {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -28,7 +28,7 @@ function wp_image_editor( $post_id, $msg = false ) {
|
||||||
die( __( 'Image data does not exist. Please re-upload the image.' ) );
|
die( __( 'Image data does not exist. Please re-upload the image.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
$sizer = $big > 400 ? 400 / $big : 1;
|
$sizer = $big > 600 ? 600 / $big : 1;
|
||||||
|
|
||||||
$backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
|
$backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
|
||||||
$can_restore = false;
|
$can_restore = false;
|
||||||
|
@ -55,13 +55,15 @@ function wp_image_editor( $post_id, $msg = false ) {
|
||||||
?>
|
?>
|
||||||
<div class="imgedit-wrap wp-clearfix">
|
<div class="imgedit-wrap wp-clearfix">
|
||||||
<div id="imgedit-panel-<?php echo $post_id; ?>">
|
<div id="imgedit-panel-<?php echo $post_id; ?>">
|
||||||
|
|
||||||
<div class="imgedit-panel-content wp-clearfix">
|
|
||||||
<?php echo $note; ?>
|
<?php echo $note; ?>
|
||||||
|
<div class="imgedit-panel-content imgedit-panel-tools wp-clearfix">
|
||||||
<div class="imgedit-menu wp-clearfix">
|
<div class="imgedit-menu wp-clearfix">
|
||||||
<button type="button" onclick="imageEdit.handleCropToolClick( <?php echo "$post_id, '$nonce'"; ?>, this )" class="imgedit-crop button disabled" disabled><?php esc_html_e( 'Crop' ); ?></button>
|
<button type="button" onclick="imageEdit.toggleCropTool( <?php echo "$post_id, '$nonce'"; ?>, this );" aria-expanded="false" aria-controls="imgedit-crop" class="imgedit-crop button disabled" disabled><?php esc_html_e( 'Crop' ); ?></button>
|
||||||
|
<button type="button" class="imgedit-scale button" onclick="imageEdit.toggleControls(this);" aria-expanded="false" aria-controls="imgedit-scale"><?php esc_html_e( 'Scale' ); ?></button>
|
||||||
|
<div class="imgedit-rotate-menu-container">
|
||||||
|
<button type="button" aria-controls="imgedit-rotate-menu" class="imgedit-rotate button" onclick="imageEdit.togglePopup(this)"><?php esc_html_e( 'Image Rotation' ); ?></button>
|
||||||
|
<div id="imgedit-rotate-menu" class="imgedit-popup-menu">
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// On some setups GD library does not provide imagerotate() - Ticket #11536.
|
// On some setups GD library does not provide imagerotate() - Ticket #11536.
|
||||||
if ( wp_image_editor_supports(
|
if ( wp_image_editor_supports(
|
||||||
array(
|
array(
|
||||||
|
@ -71,25 +73,36 @@ function wp_image_editor( $post_id, $msg = false ) {
|
||||||
) ) {
|
) ) {
|
||||||
$note_no_rotate = '';
|
$note_no_rotate = '';
|
||||||
?>
|
?>
|
||||||
<button type="button" class="imgedit-rleft button" onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)"><?php esc_html_e( 'Rotate left' ); ?></button>
|
<button type="button" class="imgedit-rleft button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)"><?php esc_html_e( 'Rotate 90° left' ); ?></button>
|
||||||
<button type="button" class="imgedit-rright button" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)"><?php esc_html_e( 'Rotate right' ); ?></button>
|
<button type="button" class="imgedit-rright button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)"><?php esc_html_e( 'Rotate 90° right' ); ?></button>
|
||||||
|
<button type="button" class="imgedit-rfull button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate(180, <?php echo "$post_id, '$nonce'"; ?>, this)"><?php esc_html_e( 'Rotate 180°' ); ?></button>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
$note_no_rotate = '<p class="note-no-rotate"><em>' . __( 'Image rotation is not supported by your web host.' ) . '</em></p>';
|
$note_no_rotate = '<p class="note-no-rotate"><em>' . __( 'Image rotation is not supported by your web host.' ) . '</em></p>';
|
||||||
?>
|
?>
|
||||||
<button type="button" class="imgedit-rleft button disabled" disabled></button>
|
<button type="button" class="imgedit-rleft button disabled" disabled></button>
|
||||||
<button type="button" class="imgedit-rright button disabled" disabled></button>
|
<button type="button" class="imgedit-rright button disabled" disabled></button>
|
||||||
<?php } ?>
|
<?php
|
||||||
|
}
|
||||||
<button type="button" onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-flipv button"><?php esc_html_e( 'Flip vertical' ); ?></button>
|
?>
|
||||||
<button type="button" onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-fliph button"><?php esc_html_e( 'Flip horizontal' ); ?></button>
|
<hr />
|
||||||
|
<button type="button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-flipv button"><?php esc_html_e( 'Flip vertical' ); ?></button>
|
||||||
<br class="imgedit-undo-redo-separator" />
|
<button type="button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-fliph button"><?php esc_html_e( 'Flip horizontal' ); ?></button>
|
||||||
<button type="button" id="image-undo-<?php echo $post_id; ?>" onclick="imageEdit.undo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-undo button disabled" disabled><?php esc_html_e( 'Undo' ); ?></button>
|
|
||||||
<button type="button" id="image-redo-<?php echo $post_id; ?>" onclick="imageEdit.redo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-redo button disabled" disabled><?php esc_html_e( 'Redo' ); ?></button>
|
|
||||||
<?php echo $note_no_rotate; ?>
|
<?php echo $note_no_rotate; ?>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="imgedit-submit imgedit-menu">
|
||||||
|
<button type="button" id="image-undo-<?php echo $post_id; ?>" onclick="imageEdit.undo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-undo button disabled" disabled><?php esc_html_e( 'Undo' ); ?></button>
|
||||||
|
<button type="button" id="image-redo-<?php echo $post_id; ?>" onclick="imageEdit.redo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-redo button disabled" disabled><?php esc_html_e( 'Redo' ); ?></button>
|
||||||
|
<button type="button" onclick="imageEdit.close(<?php echo $post_id; ?>, 1)" class="button imgedit-cancel-btn"><?php esc_html_e( 'Cancel Editing' ); ?></button>
|
||||||
|
<button type="button" onclick="imageEdit.save(<?php echo "$post_id, '$nonce'"; ?>)" disabled="disabled" class="button button-primary imgedit-submit-btn"><?php esc_html_e( 'Save Edits' ); ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="imgedit-panel-content wp-clearfix">
|
||||||
|
<div class="imgedit-tools">
|
||||||
|
<input type="hidden" id="imgedit-nonce-<?php echo $post_id; ?>" value="<?php echo $nonce; ?>" />
|
||||||
<input type="hidden" id="imgedit-sizer-<?php echo $post_id; ?>" value="<?php echo $sizer; ?>" />
|
<input type="hidden" id="imgedit-sizer-<?php echo $post_id; ?>" value="<?php echo $sizer; ?>" />
|
||||||
<input type="hidden" id="imgedit-history-<?php echo $post_id; ?>" value="" />
|
<input type="hidden" id="imgedit-history-<?php echo $post_id; ?>" value="" />
|
||||||
<input type="hidden" id="imgedit-undone-<?php echo $post_id; ?>" value="0" />
|
<input type="hidden" id="imgedit-undone-<?php echo $post_id; ?>" value="0" />
|
||||||
|
@ -98,18 +111,15 @@ function wp_image_editor( $post_id, $msg = false ) {
|
||||||
<input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
|
<input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
|
||||||
|
|
||||||
<div id="imgedit-crop-<?php echo $post_id; ?>" class="imgedit-crop-wrap">
|
<div id="imgedit-crop-<?php echo $post_id; ?>" class="imgedit-crop-wrap">
|
||||||
|
<div class="imgedit-crop-grid"></div>
|
||||||
<img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')"
|
<img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')"
|
||||||
src="<?php echo esc_url( admin_url( 'admin-ajax.php', 'relative' ) ) . '?action=imgedit-preview&_ajax_nonce=' . $nonce . '&postid=' . $post_id . '&rand=' . rand( 1, 99999 ); ?>" alt="" />
|
src="<?php echo esc_url( admin_url( 'admin-ajax.php', 'relative' ) ) . '?action=imgedit-preview&_ajax_nonce=' . $nonce . '&postid=' . $post_id . '&rand=' . rand( 1, 99999 ); ?>" alt="" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="imgedit-submit">
|
|
||||||
<input type="button" onclick="imageEdit.close(<?php echo $post_id; ?>, 1)" class="button imgedit-cancel-btn" value="<?php esc_attr_e( 'Cancel' ); ?>" />
|
|
||||||
<input type="button" onclick="imageEdit.save(<?php echo "$post_id, '$nonce'"; ?>)" disabled="disabled" class="button button-primary imgedit-submit-btn" value="<?php esc_attr_e( 'Save' ); ?>" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="imgedit-settings">
|
<div class="imgedit-settings">
|
||||||
|
<div class="imgedit-tool-active">
|
||||||
<div class="imgedit-group">
|
<div class="imgedit-group">
|
||||||
|
<div id="imgedit-scale" tabindex="-1" class="imgedit-group-controls">
|
||||||
<div class="imgedit-group-top">
|
<div class="imgedit-group-top">
|
||||||
<h2><?php _e( 'Scale Image' ); ?></h2>
|
<h2><?php _e( 'Scale Image' ); ?></h2>
|
||||||
<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text">
|
<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text">
|
||||||
|
@ -133,37 +143,29 @@ function wp_image_editor( $post_id, $msg = false ) {
|
||||||
</p>
|
</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="imgedit-submit">
|
<div class="imgedit-submit">
|
||||||
|
<fieldset class="imgedit-scale-controls">
|
||||||
<fieldset class="imgedit-scale">
|
|
||||||
<legend><?php _e( 'New dimensions:' ); ?></legend>
|
<legend><?php _e( 'New dimensions:' ); ?></legend>
|
||||||
<div class="nowrap">
|
<div class="nowrap">
|
||||||
<label for="imgedit-scale-width-<?php echo $post_id; ?>" class="screen-reader-text">
|
<label for="imgedit-scale-width-<?php echo $post_id; ?>" class="screen-reader-text">
|
||||||
<?php
|
|
||||||
/* translators: Hidden accessibility text. */
|
|
||||||
_e( 'scale width' );
|
|
||||||
?>
|
|
||||||
</label>
|
|
||||||
<input type="number" aria-describedby="imgedit-scale-warn-<?php echo $post_id; ?>" min="1" max="<?php echo isset( $meta['width'] ) ? $meta['width'] : ''; ?>" step="1" id="imgedit-scale-width-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1, this)" onchange="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1, this)" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" />
|
|
||||||
<span class="imgedit-separator" aria-hidden="true">×</span>
|
|
||||||
<label for="imgedit-scale-height-<?php echo $post_id; ?>" class="screen-reader-text">
|
|
||||||
<?php
|
<?php
|
||||||
/* translators: Hidden accessibility text. */
|
/* translators: Hidden accessibility text. */
|
||||||
_e( 'scale height' );
|
_e( 'scale height' );
|
||||||
?>
|
?>
|
||||||
</label>
|
</label>
|
||||||
<input type="number" aria-describedby="imgedit-scale-warn-<?php echo $post_id; ?>" min="1" max="<?php echo isset( $meta['height'] ) ? $meta['height'] : ''; ?>" step="1" id="imgedit-scale-height-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" onchange="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
|
<input type="number" step="1" min="0" max="<?php echo isset( $meta['width'] ) ? $meta['width'] : ''; ?>" aria-describedby="imgedit-scale-warn-<?php echo $post_id; ?>" id="imgedit-scale-width-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1, this)" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" />
|
||||||
<div class="imgedit-scale-button-wrapper"><input id="imgedit-scale-button" type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'scale')" class="button button-primary" value="<?php esc_attr_e( 'Scale' ); ?>" /></div>
|
<span class="imgedit-separator" aria-hidden="true">×</span>
|
||||||
</div>
|
<label for="imgedit-scale-height-<?php echo $post_id; ?>" class="screen-reader-text"><?php _e( 'scale height' ); ?></label>
|
||||||
|
<input type="number" step="1" min="0" max="<?php echo isset( $meta['height'] ) ? $meta['width'] : ''; ?>" aria-describedby="imgedit-scale-warn-<?php echo $post_id; ?>" id="imgedit-scale-height-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
|
||||||
|
<button id="imgedit-scale-button" type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'scale')" class="button button-primary"><?php esc_html_e( 'Scale' ); ?></button>
|
||||||
<span class="imgedit-scale-warn" id="imgedit-scale-warn-<?php echo $post_id; ?>"><span class="dashicons dashicons-warning" aria-hidden="true"></span><?php esc_html_e( 'Images cannot be scaled to a size larger than the original.' ); ?></span>
|
<span class="imgedit-scale-warn" id="imgedit-scale-warn-<?php echo $post_id; ?>"><span class="dashicons dashicons-warning" aria-hidden="true"></span><?php esc_html_e( 'Images cannot be scaled to a size larger than the original.' ); ?></span>
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ( $can_restore ) { ?>
|
<?php if ( $can_restore ) { ?>
|
||||||
|
|
||||||
<div class="imgedit-group">
|
<div class="imgedit-group">
|
||||||
<div class="imgedit-group-top">
|
<div class="imgedit-group-top">
|
||||||
<h2><button type="button" onclick="imageEdit.toggleHelp(this);" class="button-link" aria-expanded="false"><?php _e( 'Restore original image' ); ?> <span class="dashicons dashicons-arrow-down imgedit-help-toggle"></span></button></h2>
|
<h2><button type="button" onclick="imageEdit.toggleHelp(this);" class="button-link" aria-expanded="false"><?php _e( 'Restore original image' ); ?> <span class="dashicons dashicons-arrow-down imgedit-help-toggle"></span></button></h2>
|
||||||
|
@ -171,7 +173,6 @@ function wp_image_editor( $post_id, $msg = false ) {
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
_e( 'Discard any changes and restore the original image.' );
|
_e( 'Discard any changes and restore the original image.' );
|
||||||
|
|
||||||
if ( ! defined( 'IMAGE_EDIT_OVERWRITE' ) || ! IMAGE_EDIT_OVERWRITE ) {
|
if ( ! defined( 'IMAGE_EDIT_OVERWRITE' ) || ! IMAGE_EDIT_OVERWRITE ) {
|
||||||
echo ' ' . __( 'Previously edited copies of the image will not be deleted.' );
|
echo ' ' . __( 'Previously edited copies of the image will not be deleted.' );
|
||||||
}
|
}
|
||||||
|
@ -183,22 +184,19 @@ function wp_image_editor( $post_id, $msg = false ) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<div class="imgedit-group">
|
<div class="imgedit-group">
|
||||||
|
<div id="imgedit-crop" tabindex="-1" class="imgedit-group-controls">
|
||||||
<div class="imgedit-group-top">
|
<div class="imgedit-group-top">
|
||||||
<h2><?php _e( 'Image Crop' ); ?></h2>
|
<h2><?php _e( 'Crop Image' ); ?></h2>
|
||||||
<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text">
|
<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text">
|
||||||
<?php
|
<?php
|
||||||
/* translators: Hidden accessibility text. */
|
/* translators: Hidden accessibility text. */
|
||||||
esc_html_e( 'Image Crop Help' );
|
_e( 'Image Crop Help' );
|
||||||
?>
|
?>
|
||||||
</span></button>
|
</span></button>
|
||||||
|
|
||||||
<div class="imgedit-help">
|
<div class="imgedit-help">
|
||||||
<p><?php _e( 'To crop the image, click on it and drag to make your selection.' ); ?></p>
|
<p><?php _e( 'To crop the image, click on it and drag to make your selection.' ); ?></p>
|
||||||
|
|
||||||
<p><strong><?php _e( 'Crop Aspect Ratio' ); ?></strong><br />
|
<p><strong><?php _e( 'Crop Aspect Ratio' ); ?></strong><br />
|
||||||
<?php _e( 'The aspect ratio is the relationship between the width and height. You can preserve the aspect ratio by holding down the shift key while resizing your selection. Use the input box to specify the aspect ratio, e.g. 1:1 (square), 4:3, 16:9, etc.' ); ?></p>
|
<?php _e( 'The aspect ratio is the relationship between the width and height. You can preserve the aspect ratio by holding down the shift key while resizing your selection. Use the input box to specify the aspect ratio, e.g. 1:1 (square), 4:3, 16:9, etc.' ); ?></p>
|
||||||
|
|
||||||
|
@ -206,7 +204,6 @@ function wp_image_editor( $post_id, $msg = false ) {
|
||||||
<?php _e( 'Once you have made your selection, you can adjust it by entering the size in pixels. The minimum selection size is the thumbnail size as set in the Media settings.' ); ?></p>
|
<?php _e( 'Once you have made your selection, you can adjust it by entering the size in pixels. The minimum selection size is the thumbnail size as set in the Media settings.' ); ?></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<fieldset class="imgedit-crop-ratio">
|
<fieldset class="imgedit-crop-ratio">
|
||||||
<legend><?php _e( 'Aspect ratio:' ); ?></legend>
|
<legend><?php _e( 'Aspect ratio:' ); ?></legend>
|
||||||
<div class="nowrap">
|
<div class="nowrap">
|
||||||
|
@ -216,7 +213,7 @@ function wp_image_editor( $post_id, $msg = false ) {
|
||||||
_e( 'crop ratio width' );
|
_e( 'crop ratio width' );
|
||||||
?>
|
?>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="imgedit-crop-width-<?php echo $post_id; ?>" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 0, this)" onblur="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 0, this)" />
|
<input type="number" step="1" min="1" id="imgedit-crop-width-<?php echo $post_id; ?>" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 0, this)" onblur="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 0, this)" />
|
||||||
<span class="imgedit-separator" aria-hidden="true">:</span>
|
<span class="imgedit-separator" aria-hidden="true">:</span>
|
||||||
<label for="imgedit-crop-height-<?php echo $post_id; ?>" class="screen-reader-text">
|
<label for="imgedit-crop-height-<?php echo $post_id; ?>" class="screen-reader-text">
|
||||||
<?php
|
<?php
|
||||||
|
@ -224,10 +221,9 @@ function wp_image_editor( $post_id, $msg = false ) {
|
||||||
_e( 'crop ratio height' );
|
_e( 'crop ratio height' );
|
||||||
?>
|
?>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="imgedit-crop-height-<?php echo $post_id; ?>" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 1, this)" onblur="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 1, this)" />
|
<input type="number" step="1" min="0" id="imgedit-crop-height-<?php echo $post_id; ?>" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 1, this)" onblur="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 1, this)" />
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset id="imgedit-crop-sel-<?php echo $post_id; ?>" class="imgedit-crop-sel">
|
<fieldset id="imgedit-crop-sel-<?php echo $post_id; ?>" class="imgedit-crop-sel">
|
||||||
<legend><?php _e( 'Selection:' ); ?></legend>
|
<legend><?php _e( 'Selection:' ); ?></legend>
|
||||||
<div class="nowrap">
|
<div class="nowrap">
|
||||||
|
@ -237,7 +233,7 @@ function wp_image_editor( $post_id, $msg = false ) {
|
||||||
_e( 'selection width' );
|
_e( 'selection width' );
|
||||||
?>
|
?>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="imgedit-sel-width-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" />
|
<input type="number" step="1" min="0" id="imgedit-sel-width-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" />
|
||||||
<span class="imgedit-separator" aria-hidden="true">×</span>
|
<span class="imgedit-separator" aria-hidden="true">×</span>
|
||||||
<label for="imgedit-sel-height-<?php echo $post_id; ?>" class="screen-reader-text">
|
<label for="imgedit-sel-height-<?php echo $post_id; ?>" class="screen-reader-text">
|
||||||
<?php
|
<?php
|
||||||
|
@ -245,10 +241,34 @@ function wp_image_editor( $post_id, $msg = false ) {
|
||||||
_e( 'selection height' );
|
_e( 'selection height' );
|
||||||
?>
|
?>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="imgedit-sel-height-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" />
|
<input type="number" step="1" min="0" id="imgedit-sel-height-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" />
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
<fieldset id="imgedit-crop-sel-<?php echo $post_id; ?>" class="imgedit-crop-sel">
|
||||||
|
<legend><?php _e( 'Starting Coordinates:' ); ?></legend>
|
||||||
|
<div class="nowrap">
|
||||||
|
<label for="imgedit-start-x-<?php echo $post_id; ?>" class="screen-reader-text">
|
||||||
|
<?php
|
||||||
|
/* translators: Hidden accessibility text. */
|
||||||
|
_e( 'horizontal start position' );
|
||||||
|
?>
|
||||||
|
</label>
|
||||||
|
<input type="number" step="1" min="0" id="imgedit-start-x-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" value="0" />
|
||||||
|
<span class="imgedit-separator" aria-hidden="true">×</span>
|
||||||
|
<label for="imgedit-start-y-<?php echo $post_id; ?>" class="screen-reader-text">
|
||||||
|
<?php
|
||||||
|
/* translators: Hidden accessibility text. */
|
||||||
|
_e( 'vertical start position' );
|
||||||
|
?>
|
||||||
|
</label>
|
||||||
|
<input type="number" step="1" min="0" id="imgedit-start-y-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" value="0" />
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<div class="imgedit-crop-apply imgedit-menu container">
|
||||||
|
<button class="button-primary" type="button" onclick="imageEdit.handleCropToolClick( <?php echo "$post_id, '$nonce'"; ?>, this );" class="imgedit-crop-apply button"><?php esc_html_e( 'Apply Crop' ); ?></button> <button type="button" onclick="imageEdit.handleCropToolClick( <?php echo "$post_id, '$nonce'"; ?>, this );" class="imgedit-crop-clear button" disabled="disabled"><?php esc_html_e( 'Clear Crop' ); ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
@ -269,12 +289,11 @@ function wp_image_editor( $post_id, $msg = false ) {
|
||||||
<p><?php _e( 'You can edit the image while preserving the thumbnail. For example, you may wish to have a square thumbnail that displays just a section of the image.' ); ?></p>
|
<p><?php _e( 'You can edit the image while preserving the thumbnail. For example, you may wish to have a square thumbnail that displays just a section of the image.' ); ?></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="imgedit-thumbnail-preview-group">
|
||||||
<figure class="imgedit-thumbnail-preview">
|
<figure class="imgedit-thumbnail-preview">
|
||||||
<img src="<?php echo $thumb['url']; ?>" width="<?php echo $thumb_img[0]; ?>" height="<?php echo $thumb_img[1]; ?>" class="imgedit-size-preview" alt="" draggable="false" />
|
<img src="<?php echo $thumb['url']; ?>" width="<?php echo $thumb_img[0]; ?>" height="<?php echo $thumb_img[1]; ?>" class="imgedit-size-preview" alt="" draggable="false" />
|
||||||
<figcaption class="imgedit-thumbnail-preview-caption"><?php _e( 'Current thumbnail' ); ?></figcaption>
|
<figcaption class="imgedit-thumbnail-preview-caption"><?php _e( 'Current thumbnail' ); ?></figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
|
|
||||||
<div id="imgedit-save-target-<?php echo $post_id; ?>" class="imgedit-save-target">
|
<div id="imgedit-save-target-<?php echo $post_id; ?>" class="imgedit-save-target">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend><?php _e( 'Apply changes to:' ); ?></legend>
|
<legend><?php _e( 'Apply changes to:' ); ?></legend>
|
||||||
|
@ -293,6 +312,7 @@ function wp_image_editor( $post_id, $msg = false ) {
|
||||||
<input type="radio" id="imgedit-target-nothumb" name="imgedit-target-<?php echo $post_id; ?>" value="nothumb" />
|
<input type="radio" id="imgedit-target-nothumb" name="imgedit-target-<?php echo $post_id; ?>" value="nothumb" />
|
||||||
<label for="imgedit-target-nothumb"><?php _e( 'All sizes except thumbnail' ); ?></label>
|
<label for="imgedit-target-nothumb"><?php _e( 'All sizes except thumbnail' ); ?></label>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ( $edit_custom_sizes ) {
|
if ( $edit_custom_sizes ) {
|
||||||
if ( ! is_array( $edit_custom_sizes ) ) {
|
if ( ! is_array( $edit_custom_sizes ) ) {
|
||||||
|
@ -316,10 +336,14 @@ function wp_image_editor( $post_id, $msg = false ) {
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="imgedit-wait" id="imgedit-wait-<?php echo $post_id; ?>"></div>
|
||||||
|
<div class="hidden" id="imgedit-leaving-<?php echo $post_id; ?>"><?php _e( "There are unsaved changes that will be lost. 'OK' to continue, 'Cancel' to return to the Image Editor." ); ?></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="imgedit-wait" id="imgedit-wait-<?php echo $post_id; ?>"></div>
|
<div class="imgedit-wait" id="imgedit-wait-<?php echo $post_id; ?>"></div>
|
||||||
|
@ -509,7 +533,7 @@ function wp_save_image_file( $filename, $image, $mime_type, $post_id ) {
|
||||||
*/
|
*/
|
||||||
function _image_get_preview_ratio( $w, $h ) {
|
function _image_get_preview_ratio( $w, $h ) {
|
||||||
$max = max( $w, $h );
|
$max = max( $w, $h );
|
||||||
return $max > 400 ? ( 400 / $max ) : 1;
|
return $max > 600 ? ( 600 / $max ) : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,15 +22,30 @@
|
||||||
_view : false,
|
_view : false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle crop tool clicks.
|
* Enable crop tool.
|
||||||
*/
|
*/
|
||||||
handleCropToolClick: function( postid, nonce, cropButton ) {
|
toggleCropTool: function( postid, nonce, cropButton ) {
|
||||||
var img = $( '#image-preview-' + postid ),
|
var img = $( '#image-preview-' + postid ),
|
||||||
selection = this.iasapi.getSelection();
|
selection = this.iasapi.getSelection();
|
||||||
|
|
||||||
|
imageEdit.toggleControls( cropButton );
|
||||||
|
var $el = $( cropButton );
|
||||||
|
var state = ( $el.attr( 'aria-expanded' ) === 'true' ) ? 'true' : 'false';
|
||||||
|
// Crop tools have been closed.
|
||||||
|
if ( 'false' === state ) {
|
||||||
|
// Cancel selection, but do not unset inputs.
|
||||||
|
this.iasapi.cancelSelection();
|
||||||
|
imageEdit.setDisabled($('.imgedit-crop-clear'), 0);
|
||||||
|
} else {
|
||||||
|
imageEdit.setDisabled($('.imgedit-crop-clear'), 1);
|
||||||
|
// Get values from inputs to restore previous selection.
|
||||||
|
var startX = ( $( '#imgedit-start-x-' + postid ).val() ) ? $('#imgedit-start-x-' + postid).val() : 0;
|
||||||
|
var startY = ( $( '#imgedit-start-y-' + postid ).val() ) ? $('#imgedit-start-y-' + postid).val() : 0;
|
||||||
|
var width = ( $( '#imgedit-sel-width-' + postid ).val() ) ? $('#imgedit-sel-width-' + postid).val() : img.innerWidth();
|
||||||
|
var height = ( $( '#imgedit-sel-height-' + postid ).val() ) ? $('#imgedit-sel-height-' + postid).val() : img.innerHeight();
|
||||||
// Ensure selection is available, otherwise reset to full image.
|
// Ensure selection is available, otherwise reset to full image.
|
||||||
if ( isNaN( selection.x1 ) ) {
|
if ( isNaN( selection.x1 ) ) {
|
||||||
this.setCropSelection( postid, { 'x1': 0, 'y1': 0, 'x2': img.innerWidth(), 'y2': img.innerHeight(), 'width': img.innerWidth(), 'height': img.innerHeight() } );
|
this.setCropSelection( postid, { 'x1': startX, 'y1': startY, 'x2': width, 'y2': height, 'width': width, 'height': height } );
|
||||||
selection = this.iasapi.getSelection();
|
selection = this.iasapi.getSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +55,28 @@
|
||||||
this.iasapi.setOptions( { show: true } );
|
this.iasapi.setOptions( { show: true } );
|
||||||
this.iasapi.update();
|
this.iasapi.update();
|
||||||
} else {
|
} else {
|
||||||
|
this.iasapi.setSelection( startX, startY, width, height, true );
|
||||||
|
this.iasapi.setOptions( { show: true } );
|
||||||
|
this.iasapi.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle crop tool clicks.
|
||||||
|
*/
|
||||||
|
handleCropToolClick: function( postid, nonce, cropButton ) {
|
||||||
|
|
||||||
|
if ( cropButton.classList.contains( 'imgedit-crop-clear' ) ) {
|
||||||
|
this.iasapi.cancelSelection();
|
||||||
|
imageEdit.setDisabled($('.imgedit-crop-apply'), 0);
|
||||||
|
|
||||||
|
$('#imgedit-sel-width-' + postid).val('');
|
||||||
|
$('#imgedit-sel-height-' + postid).val('');
|
||||||
|
$('#imgedit-start-x-' + postid).val('0');
|
||||||
|
$('#imgedit-start-y-' + postid).val('0');
|
||||||
|
$('#imgedit-selection-' + postid).val('');
|
||||||
|
} else {
|
||||||
// Otherwise, perform the crop.
|
// Otherwise, perform the crop.
|
||||||
imageEdit.crop( postid, nonce , cropButton );
|
imageEdit.crop( postid, nonce , cropButton );
|
||||||
}
|
}
|
||||||
|
@ -122,6 +158,17 @@
|
||||||
t.postid = postid;
|
t.postid = postid;
|
||||||
$('#imgedit-response-' + postid).empty();
|
$('#imgedit-response-' + postid).empty();
|
||||||
|
|
||||||
|
$('#imgedit-panel-' + postid).on( 'keypress', function(e) {
|
||||||
|
var nonce = $( '#imgedit-nonce-' + postid ).val();
|
||||||
|
if ( e.which === 26 && e.ctrlKey ) {
|
||||||
|
imageEdit.undo( postid, nonce );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( e.which === 25 && e.ctrlKey ) {
|
||||||
|
imageEdit.redo( postid, nonce );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$('#imgedit-panel-' + postid).on( 'keypress', 'input[type="text"]', function(e) {
|
$('#imgedit-panel-' + postid).on( 'keypress', 'input[type="text"]', function(e) {
|
||||||
var k = e.keyCode;
|
var k = e.keyCode;
|
||||||
|
|
||||||
|
@ -169,6 +216,93 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows or hides image menu popup.
|
||||||
|
*
|
||||||
|
* @since 6.3.0
|
||||||
|
*
|
||||||
|
* @memberof imageEdit
|
||||||
|
*
|
||||||
|
* @param {HTMLElement} el The activated control element.
|
||||||
|
*
|
||||||
|
* @return {boolean} Always returns false.
|
||||||
|
*/
|
||||||
|
togglePopup : function(el) {
|
||||||
|
var $el = $( el );
|
||||||
|
var $targetEl = $( el ).attr( 'aria-controls' );
|
||||||
|
var $target = $( '#' + $targetEl );
|
||||||
|
$el
|
||||||
|
.attr( 'aria-expanded', 'false' === $el.attr( 'aria-expanded' ) ? 'true' : 'false' );
|
||||||
|
// Open menu and set z-index to appear above image crop area if it is enabled.
|
||||||
|
$target
|
||||||
|
.toggleClass( 'imgedit-popup-menu-open' ).slideToggle( 'fast' ).css( { 'z-index' : 200000 } );
|
||||||
|
// Move focus to first item in menu.
|
||||||
|
$target.find( 'button' ).first().trigger( 'focus' );
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navigate popup menu by arrow keys.
|
||||||
|
*
|
||||||
|
* @since 6.3.0
|
||||||
|
*
|
||||||
|
* @memberof imageEdit
|
||||||
|
*
|
||||||
|
* @param {HTMLElement} el The current element.
|
||||||
|
*
|
||||||
|
* @return {boolean} Always returns false.
|
||||||
|
*/
|
||||||
|
browsePopup : function(el) {
|
||||||
|
var $el = $( el );
|
||||||
|
var $collection = $( el ).parent( '.imgedit-popup-menu' ).find( 'button' );
|
||||||
|
var $index = $collection.index( $el );
|
||||||
|
var $prev = $index - 1;
|
||||||
|
var $next = $index + 1;
|
||||||
|
var $last = $collection.length;
|
||||||
|
if ( $prev < 0 ) {
|
||||||
|
$prev = $last - 1;
|
||||||
|
}
|
||||||
|
if ( $next === $last ) {
|
||||||
|
$next = 0;
|
||||||
|
}
|
||||||
|
var $target = false;
|
||||||
|
if ( event.keyCode === 40 ) {
|
||||||
|
$target = $collection.get( $next );
|
||||||
|
} else if ( event.keyCode === 38 ) {
|
||||||
|
$target = $collection.get( $prev );
|
||||||
|
}
|
||||||
|
if ( $target ) {
|
||||||
|
$target.focus();
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close popup menu and reset focus on feature activation.
|
||||||
|
*
|
||||||
|
* @since 6.3.0
|
||||||
|
*
|
||||||
|
* @memberof imageEdit
|
||||||
|
*
|
||||||
|
* @param {HTMLElement} el The current element.
|
||||||
|
*
|
||||||
|
* @return {boolean} Always returns false.
|
||||||
|
*/
|
||||||
|
closePopup : function(el) {
|
||||||
|
var $parent = $(el).parent( '.imgedit-popup-menu' );
|
||||||
|
var $controlledID = $parent.attr( 'id' );
|
||||||
|
var $target = $( 'button[aria-controls="' + $controlledID + '"]' );
|
||||||
|
$target
|
||||||
|
.attr( 'aria-expanded', 'false' ).trigger( 'focus' );
|
||||||
|
$parent
|
||||||
|
.toggleClass( 'imgedit-popup-menu-open' ).slideToggle( 'fast' );
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows or hides the image edit help box.
|
* Shows or hides the image edit help box.
|
||||||
*
|
*
|
||||||
|
@ -189,6 +323,28 @@
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows or hides image edit input fields when enabled.
|
||||||
|
*
|
||||||
|
* @since 6.3.0
|
||||||
|
*
|
||||||
|
* @memberof imageEdit
|
||||||
|
*
|
||||||
|
* @param {HTMLElement} el The element to trigger the edit panel.
|
||||||
|
*
|
||||||
|
* @return {boolean} Always returns false.
|
||||||
|
*/
|
||||||
|
toggleControls : function(el) {
|
||||||
|
var $el = $( el );
|
||||||
|
var $target = $( '#' + $el.attr( 'aria-controls' ) );
|
||||||
|
$el
|
||||||
|
.attr( 'aria-expanded', 'false' === $el.attr( 'aria-expanded' ) ? 'true' : 'false' );
|
||||||
|
$target
|
||||||
|
.parent( '.imgedit-group' ).toggleClass( 'imgedit-panel-active' );
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value from the image edit target.
|
* Gets the value from the image edit target.
|
||||||
*
|
*
|
||||||
|
@ -405,12 +561,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $('#imgedit-history-' + postid).val() && $('#imgedit-undone-' + postid).val() === '0' ) {
|
if ( $('#imgedit-history-' + postid).val() && $('#imgedit-undone-' + postid).val() === '0' ) {
|
||||||
$('input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', false);
|
$('button.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', false);
|
||||||
} else {
|
} else {
|
||||||
$('input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true);
|
$('button.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true);
|
||||||
}
|
}
|
||||||
|
var successMessage = __( 'Image updated.' );
|
||||||
|
|
||||||
t.toggleEditor(postid, 0);
|
t.toggleEditor(postid, 0);
|
||||||
|
wp.a11y.speak( successMessage, 'assertive' );
|
||||||
})
|
})
|
||||||
.on( 'error', function() {
|
.on( 'error', function() {
|
||||||
var errorMessage = __( 'Could not load the preview image. Please reload the page and try again.' );
|
var errorMessage = __( 'Could not load the preview image. Please reload the page and try again.' );
|
||||||
|
@ -713,6 +871,8 @@
|
||||||
var t = this,
|
var t = this,
|
||||||
selW = $('#imgedit-sel-width-' + postid),
|
selW = $('#imgedit-sel-width-' + postid),
|
||||||
selH = $('#imgedit-sel-height-' + postid),
|
selH = $('#imgedit-sel-height-' + postid),
|
||||||
|
selX = $('#imgedit-start-x-' + postid),
|
||||||
|
selY = $('#imgedit-start-y-' + postid),
|
||||||
$image = $( image ),
|
$image = $( image ),
|
||||||
$img;
|
$img;
|
||||||
|
|
||||||
|
@ -771,6 +931,8 @@
|
||||||
*/
|
*/
|
||||||
onSelectStart: function() {
|
onSelectStart: function() {
|
||||||
imageEdit.setDisabled($('#imgedit-crop-sel-' + postid), 1);
|
imageEdit.setDisabled($('#imgedit-crop-sel-' + postid), 1);
|
||||||
|
imageEdit.setDisabled($('.imgedit-crop-clear'), 1);
|
||||||
|
imageEdit.setDisabled($('.imgedit-crop-apply'), 1);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Event triggered when the selection is ended.
|
* Event triggered when the selection is ended.
|
||||||
|
@ -784,6 +946,9 @@
|
||||||
*/
|
*/
|
||||||
onSelectEnd: function(img, c) {
|
onSelectEnd: function(img, c) {
|
||||||
imageEdit.setCropSelection(postid, c);
|
imageEdit.setCropSelection(postid, c);
|
||||||
|
if ( ! $('#imgedit-crop > *').is(':visible') ) {
|
||||||
|
imageEdit.toggleControls($('.imgedit-crop.button'));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -800,6 +965,8 @@
|
||||||
var sizer = imageEdit.hold.sizer;
|
var sizer = imageEdit.hold.sizer;
|
||||||
selW.val( imageEdit.round(c.width / sizer) );
|
selW.val( imageEdit.round(c.width / sizer) );
|
||||||
selH.val( imageEdit.round(c.height / sizer) );
|
selH.val( imageEdit.round(c.height / sizer) );
|
||||||
|
selX.val( imageEdit.round(c.x1 / sizer) );
|
||||||
|
selY.val( imageEdit.round(c.y1 / sizer) );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -826,6 +993,8 @@
|
||||||
this.setDisabled( $( '#imgedit-crop-sel-' + postid ), 1 );
|
this.setDisabled( $( '#imgedit-crop-sel-' + postid ), 1 );
|
||||||
$('#imgedit-sel-width-' + postid).val('');
|
$('#imgedit-sel-width-' + postid).val('');
|
||||||
$('#imgedit-sel-height-' + postid).val('');
|
$('#imgedit-sel-height-' + postid).val('');
|
||||||
|
$('#imgedit-start-x-' + postid).val('0');
|
||||||
|
$('#imgedit-start-y-' + postid).val('0');
|
||||||
$('#imgedit-selection-' + postid).val('');
|
$('#imgedit-selection-' + postid).val('');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -956,7 +1125,7 @@
|
||||||
if ( $(t).hasClass('disabled') ) {
|
if ( $(t).hasClass('disabled') ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
this.closePopup(t);
|
||||||
this.addStep({ 'r': { 'r': angle, 'fw': this.hold.h, 'fh': this.hold.w }}, postid, nonce);
|
this.addStep({ 'r': { 'r': angle, 'fw': this.hold.h, 'fh': this.hold.w }}, postid, nonce);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -978,7 +1147,7 @@
|
||||||
if ( $(t).hasClass('disabled') ) {
|
if ( $(t).hasClass('disabled') ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
this.closePopup(t);
|
||||||
this.addStep({ 'f': { 'f': axis, 'fw': this.hold.w, 'fh': this.hold.h }}, postid, nonce);
|
this.addStep({ 'f': { 'f': axis, 'fw': this.hold.w, 'fh': this.hold.h }}, postid, nonce);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1014,6 +1183,8 @@
|
||||||
// Clear the selection fields after cropping.
|
// Clear the selection fields after cropping.
|
||||||
$('#imgedit-sel-width-' + postid).val('');
|
$('#imgedit-sel-width-' + postid).val('');
|
||||||
$('#imgedit-sel-height-' + postid).val('');
|
$('#imgedit-sel-height-' + postid).val('');
|
||||||
|
$('#imgedit-start-x-' + postid).val('0');
|
||||||
|
$('#imgedit-start-y-' + postid).val('0');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1097,6 +1268,8 @@
|
||||||
*/
|
*/
|
||||||
setNumSelection : function( postid, el ) {
|
setNumSelection : function( postid, el ) {
|
||||||
var sel, elX = $('#imgedit-sel-width-' + postid), elY = $('#imgedit-sel-height-' + postid),
|
var sel, elX = $('#imgedit-sel-width-' + postid), elY = $('#imgedit-sel-height-' + postid),
|
||||||
|
elX1 = $('#imgedit-start-x-' + postid), elY1 = $('#imgedit-start-y-' + postid),
|
||||||
|
xS = this.intval( elX1.val() ), yS = this.intval( elY1.val() ),
|
||||||
x = this.intval( elX.val() ), y = this.intval( elY.val() ),
|
x = this.intval( elX.val() ), y = this.intval( elY.val() ),
|
||||||
img = $('#image-preview-' + postid), imgh = img.height(), imgw = img.width(),
|
img = $('#image-preview-' + postid), imgh = img.height(), imgw = img.width(),
|
||||||
sizer = this.hold.sizer, x1, y1, x2, y2, ias = this.iasapi;
|
sizer = this.hold.sizer, x1, y1, x2, y2, ias = this.iasapi;
|
||||||
|
@ -1115,11 +1288,11 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( x && y && ( sel = ias.getSelection() ) ) {
|
if ( ( ( x && y ) || ( xS && yS ) ) && ( sel = ias.getSelection() ) ) {
|
||||||
x2 = sel.x1 + Math.round( x * sizer );
|
x2 = sel.x1 + Math.round( x * sizer );
|
||||||
y2 = sel.y1 + Math.round( y * sizer );
|
y2 = sel.y1 + Math.round( y * sizer );
|
||||||
x1 = sel.x1;
|
x1 = ( xS === sel.x1 ) ? sel.x1 : Math.round( xS * sizer );
|
||||||
y1 = sel.y1;
|
y1 = ( yS === sel.y1 ) ? sel.y1 : Math.round( yS * sizer );
|
||||||
|
|
||||||
if ( x2 > imgw ) {
|
if ( x2 > imgw ) {
|
||||||
x1 = 0;
|
x1 = 0;
|
||||||
|
@ -1205,11 +1378,22 @@
|
||||||
|
|
||||||
if ( r > h ) {
|
if ( r > h ) {
|
||||||
r = h;
|
r = h;
|
||||||
|
var errorMessage = __( 'Selected crop ratio exceeds the boundaries of the image. Try a different ratio.' );
|
||||||
|
|
||||||
|
$( '#imgedit-crop-' + postid )
|
||||||
|
.prepend( '<div class="notice notice-error" tabindex="-1" role="alert"><p>' + errorMessage + '</p></div>' );
|
||||||
|
|
||||||
|
wp.a11y.speak( errorMessage, 'assertive' );
|
||||||
if ( n ) {
|
if ( n ) {
|
||||||
$('#imgedit-crop-height-' + postid).val( '' );
|
$('#imgedit-crop-height-' + postid).val( '' );
|
||||||
} else {
|
} else {
|
||||||
$('#imgedit-crop-width-' + postid).val( '');
|
$('#imgedit-crop-width-' + postid).val( '');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
var error = $( '#imgedit-crop-' + postid ).find( '.notice-error' );
|
||||||
|
if ( 'undefined' !== typeof( error ) ) {
|
||||||
|
error.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.iasapi.setSelection( sel.x1, sel.y1, sel.x2, r );
|
this.iasapi.setSelection( sel.x1, sel.y1, sel.x2, r );
|
||||||
|
@ -1231,7 +1415,7 @@
|
||||||
* void when it is.
|
* void when it is.
|
||||||
*/
|
*/
|
||||||
validateNumeric: function( el ) {
|
validateNumeric: function( el ) {
|
||||||
if ( ! this.intval( $( el ).val() ) ) {
|
if ( false === this.intval( $( el ).val() ) ) {
|
||||||
$( el ).val( '' );
|
$( el ).val( '' );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1958,32 +1958,7 @@
|
||||||
|
|
||||||
.media-modal .imgedit-wrap .imgedit-panel-content {
|
.media-modal .imgedit-wrap .imgedit-panel-content {
|
||||||
padding: 16px 16px 0;
|
padding: 16px 16px 0;
|
||||||
position: absolute;
|
overflow: visible;
|
||||||
top: 0;
|
|
||||||
left: 282px;
|
|
||||||
bottom: 0;
|
|
||||||
right: 0;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Implementation of bottom padding in overflow content differs across browsers.
|
|
||||||
* We need a different method. See https://github.com/w3c/csswg-drafts/issues/129
|
|
||||||
*/
|
|
||||||
.media-modal .imgedit-wrap .imgedit-submit {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.media-modal .imgedit-wrap .imgedit-settings {
|
|
||||||
background: #f6f7f7;
|
|
||||||
border-right: 1px solid #dcdcde;
|
|
||||||
padding: 20px 16px 0;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
width: 250px;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1997,19 +1972,15 @@
|
||||||
.media-modal .imgedit-group {
|
.media-modal .imgedit-group {
|
||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
border-bottom: 1px solid #dcdcde;
|
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
margin-bottom: 16px;
|
|
||||||
padding: 0;
|
padding: 0;
|
||||||
padding-bottom: 16px;
|
|
||||||
position: relative; /* RTL fix, #WP29352 */
|
position: relative; /* RTL fix, #WP29352 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-modal .imgedit-group:last-of-type {
|
.media-modal .imgedit-group.imgedit-panel-active {
|
||||||
border: none;
|
margin-bottom: 16px;
|
||||||
margin: 0;
|
padding-bottom: 16px;
|
||||||
padding: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-modal .imgedit-group-top {
|
.media-modal .imgedit-group-top {
|
||||||
|
@ -2078,8 +2049,7 @@
|
||||||
|
|
||||||
.media-modal .imgedit-wrap div.updated, /* Back-compat for pre-5.5 */
|
.media-modal .imgedit-wrap div.updated, /* Back-compat for pre-5.5 */
|
||||||
.media-modal .imgedit-wrap .notice {
|
.media-modal .imgedit-wrap .notice {
|
||||||
margin: 0;
|
margin: 0 16px;
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2828,6 +2798,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 782px) {
|
@media screen and (max-width: 782px) {
|
||||||
|
.imgedit-panel-content {
|
||||||
|
grid-template-columns: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.media-frame-toolbar .media-toolbar {
|
.media-frame-toolbar .media-toolbar {
|
||||||
bottom: -54px;
|
bottom: -54px;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1957,32 +1957,7 @@
|
||||||
|
|
||||||
.media-modal .imgedit-wrap .imgedit-panel-content {
|
.media-modal .imgedit-wrap .imgedit-panel-content {
|
||||||
padding: 16px 16px 0;
|
padding: 16px 16px 0;
|
||||||
position: absolute;
|
overflow: visible;
|
||||||
top: 0;
|
|
||||||
right: 282px;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Implementation of bottom padding in overflow content differs across browsers.
|
|
||||||
* We need a different method. See https://github.com/w3c/csswg-drafts/issues/129
|
|
||||||
*/
|
|
||||||
.media-modal .imgedit-wrap .imgedit-submit {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.media-modal .imgedit-wrap .imgedit-settings {
|
|
||||||
background: #f6f7f7;
|
|
||||||
border-left: 1px solid #dcdcde;
|
|
||||||
padding: 20px 16px 0;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
width: 250px;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1996,19 +1971,15 @@
|
||||||
.media-modal .imgedit-group {
|
.media-modal .imgedit-group {
|
||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
border-bottom: 1px solid #dcdcde;
|
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
margin-bottom: 16px;
|
|
||||||
padding: 0;
|
padding: 0;
|
||||||
padding-bottom: 16px;
|
|
||||||
position: relative; /* RTL fix, #WP29352 */
|
position: relative; /* RTL fix, #WP29352 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-modal .imgedit-group:last-of-type {
|
.media-modal .imgedit-group.imgedit-panel-active {
|
||||||
border: none;
|
margin-bottom: 16px;
|
||||||
margin: 0;
|
padding-bottom: 16px;
|
||||||
padding: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-modal .imgedit-group-top {
|
.media-modal .imgedit-group-top {
|
||||||
|
@ -2077,8 +2048,7 @@
|
||||||
|
|
||||||
.media-modal .imgedit-wrap div.updated, /* Back-compat for pre-5.5 */
|
.media-modal .imgedit-wrap div.updated, /* Back-compat for pre-5.5 */
|
||||||
.media-modal .imgedit-wrap .notice {
|
.media-modal .imgedit-wrap .notice {
|
||||||
margin: 0;
|
margin: 0 16px;
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2827,6 +2797,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 782px) {
|
@media screen and (max-width: 782px) {
|
||||||
|
.imgedit-panel-content {
|
||||||
|
grid-template-columns: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.media-frame-toolbar .media-toolbar {
|
.media-frame-toolbar .media-toolbar {
|
||||||
bottom: -54px;
|
bottom: -54px;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -956,7 +956,7 @@ $.imgAreaSelect = function (img, options) {
|
||||||
* default 5px
|
* default 5px
|
||||||
*/
|
*/
|
||||||
if (!parseInt($handles.css('width')) >= 0)
|
if (!parseInt($handles.css('width')) >= 0)
|
||||||
$handles.width(5).height(5);
|
$handles.width(10).height(10);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the borderWidth option is in use, add a solid border to
|
* If the borderWidth option is in use, add a solid border to
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.3-alpha-55918';
|
$wp_version = '6.3-alpha-55919';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue