/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/block-library/src/image/editor.scss
137 строк
3 KB
Ramon
Media Editor: Show a loading state while the cropped file loads (#80460)
23 июл 2026, 06:45
Не верифицирован
23 июл 2026, 06:45
ba1392d
Код
Авторство
О чём код?
@use "@wordpress/base-styles/colors" as *; @use "@wordpress/base-styles/mixins" as *; @use "@wordpress/base-styles/variables" as *; // Provide special styling for the placeholder. // @todo this particular minimal style of placeholder could be componentized further. .wp-block-image.wp-block-image { .block-editor-media-placeholder.is-small { min-height: 60px; } } figure.wp-block-image:not(.wp-block) { margin: 0; } .wp-block-image { position: relative; // While uploading or processing client-side, hug the preview so the // centered spinner lands on the image. A preview narrower than the content // width (e.g. a small animated GIF being transcoded to a video) otherwise // leaves the spinner off to one side. Wide and full alignments keep their // own width. // The media editor swap state marks the img rather than the figure (its // state lives alongside the img's load handlers), hence the :has() variant. &.is-transient:not(.alignwide):not(.alignfull), &:has(img.is-swapping-media):not(.alignwide):not(.alignfull) { width: fit-content; } .is-applying img, &.is-transient img, img.is-swapping-media { opacity: 0.3; } figcaption img { display: inline; } // Shown while image is being uploaded. .components-spinner { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0; } } // Shown while image is being uploaded but cannot be previewed. .wp-block-image__placeholder { aspect-ratio: 4 / 3; // Make placeholder background white so that you can see the spinner on top of it. &.has-illustration::before { background: $white; opacity: 0.8; } // Reduce opacity of diagonal stroke so that it doesn't obscure the spinner. .components-placeholder__illustration { opacity: 0.1; } } // Disable any duotone filter applied in the selected state. .wp-block-image.is-selected .block-editor-media-placeholder { filter: none !important; } .block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal { position: absolute; left: 0; right: 0; margin: -$border-width 0; @include break-small() { margin: -$border-width; } } [data-align="wide"] > .wp-block-image, [data-align="full"] > .wp-block-image { img { height: auto; width: 100%; } } .wp-block[data-align="left"], .wp-block[data-align="center"], .wp-block[data-align="right"] { > .wp-block-image { display: table; > figcaption { display: table-caption; caption-side: bottom; } } } .wp-block[data-align="left"] > .wp-block-image { margin-right: 1em; margin-left: 0; margin-top: 0.5em; margin-bottom: 0.5em; } .wp-block[data-align="right"] > .wp-block-image { margin-left: 1em; margin-right: 0; margin-top: 0.5em; margin-bottom: 0.5em; } .wp-block[data-align="center"] > .wp-block-image { margin-left: auto; margin-right: auto; text-align: center; } // Relatively position the alignment container to support the content resizer. .wp-block[data-align]:has(> .wp-block-image) { position: relative; } .wp-block-image__toolbar_content_textarea__container { padding: $grid-unit; } .wp-block-image__toolbar_content_textarea { // Corresponds to the size of the textarea in the block inspector. width: 250px; }