@wordpress/block-editor 12.18.1 → 12.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/global-styles/hooks.js +2 -3
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +14 -31
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/rich-text/index.js +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +55 -34
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/url-popover/index.js +3 -1
- package/build/components/url-popover/index.js.map +1 -1
- package/build/components/url-popover/link-editor.js +2 -1
- package/build/components/url-popover/link-editor.js.map +1 -1
- package/build/components/url-popover/link-viewer.js +2 -1
- package/build/components/url-popover/link-viewer.js.map +1 -1
- package/build/hooks/index.js +0 -6
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +0 -6
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +2 -2
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/use-shadow-props.js +0 -15
- package/build/hooks/use-shadow-props.js.map +1 -1
- package/build/hooks/utils.js +3 -6
- package/build/hooks/utils.js.map +1 -1
- package/build/index.js +0 -7
- package/build/index.js.map +1 -1
- package/build/utils/object.js +0 -17
- package/build/utils/object.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +2 -3
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +15 -32
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +57 -36
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/url-popover/index.js +3 -1
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/components/url-popover/link-editor.js +2 -1
- package/build-module/components/url-popover/link-editor.js.map +1 -1
- package/build-module/components/url-popover/link-viewer.js +2 -1
- package/build-module/components/url-popover/link-viewer.js.map +1 -1
- package/build-module/hooks/index.js +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -1
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +2 -2
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/use-shadow-props.js +0 -14
- package/build-module/hooks/use-shadow-props.js.map +1 -1
- package/build-module/hooks/utils.js +3 -6
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/utils/object.js +0 -16
- package/build-module/utils/object.js.map +1 -1
- package/build-style/style-rtl.css +48 -31
- package/build-style/style.css +48 -31
- package/package.json +2 -2
- package/src/components/block-canvas/style.scss +2 -2
- package/src/components/global-styles/hooks.js +0 -2
- package/src/components/global-styles/typography-panel.js +13 -45
- package/src/components/media-replace-flow/style.scss +1 -1
- package/src/components/rich-text/index.js +1 -2
- package/src/components/url-popover/image-url-input-ui.js +86 -37
- package/src/components/url-popover/index.js +2 -0
- package/src/components/url-popover/link-editor.js +1 -0
- package/src/components/url-popover/link-viewer.js +1 -0
- package/src/components/url-popover/style.scss +51 -31
- package/src/hooks/index.js +1 -1
- package/src/hooks/index.native.js +1 -1
- package/src/hooks/use-bindings-attributes.js +2 -5
- package/src/hooks/use-shadow-props.js +0 -14
- package/src/hooks/utils.js +4 -16
- package/src/index.js +0 -1
- package/src/utils/object.js +0 -16
|
@@ -128,11 +128,11 @@ iframe[name=editor-canvas] {
|
|
|
128
128
|
display: block;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
iframe[name=editor-canvas]:not(.has-
|
|
131
|
+
iframe[name=editor-canvas]:not(.has-editor-padding) {
|
|
132
132
|
background-color: #fff;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
iframe[name=editor-canvas].has-
|
|
135
|
+
iframe[name=editor-canvas].has-editor-padding {
|
|
136
136
|
padding: 48px 48px 0;
|
|
137
137
|
}
|
|
138
138
|
|
|
@@ -2692,7 +2692,7 @@ iframe[name=editor-canvas].has-history {
|
|
|
2692
2692
|
margin-bottom: 8px;
|
|
2693
2693
|
}
|
|
2694
2694
|
.block-editor-media-flow__url-input .block-editor-link-control {
|
|
2695
|
-
width:
|
|
2695
|
+
width: 200px;
|
|
2696
2696
|
}
|
|
2697
2697
|
.block-editor-media-flow__url-input .block-editor-link-control .block-editor-url-input {
|
|
2698
2698
|
padding: 0;
|
|
@@ -3094,47 +3094,37 @@ iframe[name=editor-canvas].has-history {
|
|
|
3094
3094
|
}
|
|
3095
3095
|
|
|
3096
3096
|
.block-editor-url-popover__additional-controls {
|
|
3097
|
-
border-top: 1px solid #
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
.block-editor-url-popover__additional-controls > div[role=menu] .components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary) > svg {
|
|
3101
|
-
box-shadow: none;
|
|
3097
|
+
border-top: 1px solid #1e1e1e;
|
|
3098
|
+
padding: 8px 8px;
|
|
3102
3099
|
}
|
|
3103
3100
|
|
|
3104
|
-
.block-editor-url-
|
|
3105
|
-
padding
|
|
3101
|
+
.block-editor-url-popover__input-container {
|
|
3102
|
+
padding: 8px;
|
|
3103
|
+
padding-right: 16px;
|
|
3106
3104
|
}
|
|
3107
3105
|
|
|
3108
3106
|
.block-editor-url-popover__row {
|
|
3109
3107
|
display: flex;
|
|
3108
|
+
gap: 4px;
|
|
3110
3109
|
}
|
|
3111
3110
|
|
|
3112
3111
|
.block-editor-url-popover__row > :not(.block-editor-url-popover__settings-toggle) {
|
|
3113
3112
|
flex-grow: 1;
|
|
3113
|
+
gap: 4px;
|
|
3114
3114
|
}
|
|
3115
3115
|
|
|
3116
|
-
.block-editor-url-
|
|
3117
|
-
padding:
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
border-radius: 2px;
|
|
3122
|
-
height: 30px;
|
|
3123
|
-
width: 30px;
|
|
3124
|
-
}
|
|
3125
|
-
.block-editor-url-popover .components-button.has-icon:not(:disabled):focus {
|
|
3126
|
-
box-shadow: none;
|
|
3116
|
+
.block-editor-url-popover__additional-controls .components-button.has-icon {
|
|
3117
|
+
padding-right: 8px;
|
|
3118
|
+
padding-left: 8px;
|
|
3119
|
+
height: auto;
|
|
3120
|
+
text-align: right;
|
|
3127
3121
|
}
|
|
3128
|
-
.block-editor-url-
|
|
3129
|
-
|
|
3130
|
-
outline: 2px solid transparent;
|
|
3122
|
+
.block-editor-url-popover__additional-controls .components-button.has-icon > svg {
|
|
3123
|
+
margin-left: 8px;
|
|
3131
3124
|
}
|
|
3132
3125
|
|
|
3133
3126
|
.block-editor-url-popover__settings-toggle {
|
|
3134
3127
|
flex-shrink: 0;
|
|
3135
|
-
border-radius: 0;
|
|
3136
|
-
border-right: 1px solid #ddd;
|
|
3137
|
-
margin-right: 1px;
|
|
3138
3128
|
}
|
|
3139
3129
|
.block-editor-url-popover__settings-toggle[aria-expanded=true] .dashicon {
|
|
3140
3130
|
transform: rotate(-180deg);
|
|
@@ -3143,7 +3133,7 @@ iframe[name=editor-canvas].has-history {
|
|
|
3143
3133
|
.block-editor-url-popover__settings {
|
|
3144
3134
|
display: block;
|
|
3145
3135
|
padding: 16px;
|
|
3146
|
-
border-top: 1px solid #
|
|
3136
|
+
border-top: 1px solid #1e1e1e;
|
|
3147
3137
|
}
|
|
3148
3138
|
|
|
3149
3139
|
.block-editor-url-popover__link-editor,
|
|
@@ -3152,19 +3142,46 @@ iframe[name=editor-canvas].has-history {
|
|
|
3152
3142
|
}
|
|
3153
3143
|
|
|
3154
3144
|
.block-editor-url-popover__link-viewer-url {
|
|
3155
|
-
|
|
3145
|
+
display: flex;
|
|
3146
|
+
align-items: center;
|
|
3156
3147
|
flex-grow: 1;
|
|
3157
3148
|
flex-shrink: 1;
|
|
3158
3149
|
overflow: hidden;
|
|
3159
3150
|
text-overflow: ellipsis;
|
|
3160
3151
|
white-space: nowrap;
|
|
3161
|
-
|
|
3162
|
-
max-width: 500px;
|
|
3152
|
+
margin-left: 8px;
|
|
3163
3153
|
}
|
|
3164
3154
|
.block-editor-url-popover__link-viewer-url.has-invalid-link {
|
|
3165
3155
|
color: #cc1818;
|
|
3166
3156
|
}
|
|
3167
3157
|
|
|
3158
|
+
.block-editor-url-popover__expand-on-click {
|
|
3159
|
+
display: flex;
|
|
3160
|
+
align-items: center;
|
|
3161
|
+
min-width: 350px;
|
|
3162
|
+
overflow: hidden;
|
|
3163
|
+
white-space: nowrap;
|
|
3164
|
+
}
|
|
3165
|
+
.block-editor-url-popover__expand-on-click .fullscreen-icon {
|
|
3166
|
+
padding-left: 4px;
|
|
3167
|
+
}
|
|
3168
|
+
.block-editor-url-popover__expand-on-click .fullscreen-icon > svg {
|
|
3169
|
+
width: 24px;
|
|
3170
|
+
height: 24px;
|
|
3171
|
+
}
|
|
3172
|
+
.block-editor-url-popover__expand-on-click .text {
|
|
3173
|
+
flex-grow: 1;
|
|
3174
|
+
}
|
|
3175
|
+
.block-editor-url-popover__expand-on-click .text p {
|
|
3176
|
+
margin: 0;
|
|
3177
|
+
}
|
|
3178
|
+
.block-editor-url-popover__expand-on-click .description {
|
|
3179
|
+
color: #949494;
|
|
3180
|
+
}
|
|
3181
|
+
.block-editor-url-popover__expand-on-click .remove-link {
|
|
3182
|
+
margin-left: 8px;
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3168
3185
|
.html-anchor-control .components-external-link {
|
|
3169
3186
|
display: block;
|
|
3170
3187
|
margin-top: 8px;
|
package/build-style/style.css
CHANGED
|
@@ -128,11 +128,11 @@ iframe[name=editor-canvas] {
|
|
|
128
128
|
display: block;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
iframe[name=editor-canvas]:not(.has-
|
|
131
|
+
iframe[name=editor-canvas]:not(.has-editor-padding) {
|
|
132
132
|
background-color: #fff;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
iframe[name=editor-canvas].has-
|
|
135
|
+
iframe[name=editor-canvas].has-editor-padding {
|
|
136
136
|
padding: 48px 48px 0;
|
|
137
137
|
}
|
|
138
138
|
|
|
@@ -2693,7 +2693,7 @@ iframe[name=editor-canvas].has-history {
|
|
|
2693
2693
|
margin-bottom: 8px;
|
|
2694
2694
|
}
|
|
2695
2695
|
.block-editor-media-flow__url-input .block-editor-link-control {
|
|
2696
|
-
width:
|
|
2696
|
+
width: 200px;
|
|
2697
2697
|
}
|
|
2698
2698
|
.block-editor-media-flow__url-input .block-editor-link-control .block-editor-url-input {
|
|
2699
2699
|
padding: 0;
|
|
@@ -3095,47 +3095,37 @@ iframe[name=editor-canvas].has-history {
|
|
|
3095
3095
|
}
|
|
3096
3096
|
|
|
3097
3097
|
.block-editor-url-popover__additional-controls {
|
|
3098
|
-
border-top: 1px solid #
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
.block-editor-url-popover__additional-controls > div[role=menu] .components-button:not(:disabled):not([aria-disabled=true]):not(.is-secondary) > svg {
|
|
3102
|
-
box-shadow: none;
|
|
3098
|
+
border-top: 1px solid #1e1e1e;
|
|
3099
|
+
padding: 8px 8px;
|
|
3103
3100
|
}
|
|
3104
3101
|
|
|
3105
|
-
.block-editor-url-
|
|
3106
|
-
padding
|
|
3102
|
+
.block-editor-url-popover__input-container {
|
|
3103
|
+
padding: 8px;
|
|
3104
|
+
padding-left: 16px;
|
|
3107
3105
|
}
|
|
3108
3106
|
|
|
3109
3107
|
.block-editor-url-popover__row {
|
|
3110
3108
|
display: flex;
|
|
3109
|
+
gap: 4px;
|
|
3111
3110
|
}
|
|
3112
3111
|
|
|
3113
3112
|
.block-editor-url-popover__row > :not(.block-editor-url-popover__settings-toggle) {
|
|
3114
3113
|
flex-grow: 1;
|
|
3114
|
+
gap: 4px;
|
|
3115
3115
|
}
|
|
3116
3116
|
|
|
3117
|
-
.block-editor-url-
|
|
3118
|
-
padding:
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
border-radius: 2px;
|
|
3123
|
-
height: 30px;
|
|
3124
|
-
width: 30px;
|
|
3125
|
-
}
|
|
3126
|
-
.block-editor-url-popover .components-button.has-icon:not(:disabled):focus {
|
|
3127
|
-
box-shadow: none;
|
|
3117
|
+
.block-editor-url-popover__additional-controls .components-button.has-icon {
|
|
3118
|
+
padding-left: 8px;
|
|
3119
|
+
padding-right: 8px;
|
|
3120
|
+
height: auto;
|
|
3121
|
+
text-align: left;
|
|
3128
3122
|
}
|
|
3129
|
-
.block-editor-url-
|
|
3130
|
-
|
|
3131
|
-
outline: 2px solid transparent;
|
|
3123
|
+
.block-editor-url-popover__additional-controls .components-button.has-icon > svg {
|
|
3124
|
+
margin-right: 8px;
|
|
3132
3125
|
}
|
|
3133
3126
|
|
|
3134
3127
|
.block-editor-url-popover__settings-toggle {
|
|
3135
3128
|
flex-shrink: 0;
|
|
3136
|
-
border-radius: 0;
|
|
3137
|
-
border-left: 1px solid #ddd;
|
|
3138
|
-
margin-left: 1px;
|
|
3139
3129
|
}
|
|
3140
3130
|
.block-editor-url-popover__settings-toggle[aria-expanded=true] .dashicon {
|
|
3141
3131
|
transform: rotate(180deg);
|
|
@@ -3144,7 +3134,7 @@ iframe[name=editor-canvas].has-history {
|
|
|
3144
3134
|
.block-editor-url-popover__settings {
|
|
3145
3135
|
display: block;
|
|
3146
3136
|
padding: 16px;
|
|
3147
|
-
border-top: 1px solid #
|
|
3137
|
+
border-top: 1px solid #1e1e1e;
|
|
3148
3138
|
}
|
|
3149
3139
|
|
|
3150
3140
|
.block-editor-url-popover__link-editor,
|
|
@@ -3153,19 +3143,46 @@ iframe[name=editor-canvas].has-history {
|
|
|
3153
3143
|
}
|
|
3154
3144
|
|
|
3155
3145
|
.block-editor-url-popover__link-viewer-url {
|
|
3156
|
-
|
|
3146
|
+
display: flex;
|
|
3147
|
+
align-items: center;
|
|
3157
3148
|
flex-grow: 1;
|
|
3158
3149
|
flex-shrink: 1;
|
|
3159
3150
|
overflow: hidden;
|
|
3160
3151
|
text-overflow: ellipsis;
|
|
3161
3152
|
white-space: nowrap;
|
|
3162
|
-
|
|
3163
|
-
max-width: 500px;
|
|
3153
|
+
margin-right: 8px;
|
|
3164
3154
|
}
|
|
3165
3155
|
.block-editor-url-popover__link-viewer-url.has-invalid-link {
|
|
3166
3156
|
color: #cc1818;
|
|
3167
3157
|
}
|
|
3168
3158
|
|
|
3159
|
+
.block-editor-url-popover__expand-on-click {
|
|
3160
|
+
display: flex;
|
|
3161
|
+
align-items: center;
|
|
3162
|
+
min-width: 350px;
|
|
3163
|
+
overflow: hidden;
|
|
3164
|
+
white-space: nowrap;
|
|
3165
|
+
}
|
|
3166
|
+
.block-editor-url-popover__expand-on-click .fullscreen-icon {
|
|
3167
|
+
padding-right: 4px;
|
|
3168
|
+
}
|
|
3169
|
+
.block-editor-url-popover__expand-on-click .fullscreen-icon > svg {
|
|
3170
|
+
width: 24px;
|
|
3171
|
+
height: 24px;
|
|
3172
|
+
}
|
|
3173
|
+
.block-editor-url-popover__expand-on-click .text {
|
|
3174
|
+
flex-grow: 1;
|
|
3175
|
+
}
|
|
3176
|
+
.block-editor-url-popover__expand-on-click .text p {
|
|
3177
|
+
margin: 0;
|
|
3178
|
+
}
|
|
3179
|
+
.block-editor-url-popover__expand-on-click .description {
|
|
3180
|
+
color: #949494;
|
|
3181
|
+
}
|
|
3182
|
+
.block-editor-url-popover__expand-on-click .remove-link {
|
|
3183
|
+
margin-right: 8px;
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3169
3186
|
.html-anchor-control .components-external-link {
|
|
3170
3187
|
display: block;
|
|
3171
3188
|
margin-top: 8px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "12.18.
|
|
3
|
+
"version": "12.18.2",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"publishConfig": {
|
|
88
88
|
"access": "public"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "fefb6f718fbfd5df9390f366d5733369f613084a"
|
|
91
91
|
}
|
|
@@ -4,10 +4,10 @@ iframe[name="editor-canvas"] {
|
|
|
4
4
|
display: block;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
iframe[name="editor-canvas"]:not(.has-
|
|
7
|
+
iframe[name="editor-canvas"]:not(.has-editor-padding) {
|
|
8
8
|
background-color: $white;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
iframe[name="editor-canvas"].has-
|
|
11
|
+
iframe[name="editor-canvas"].has-editor-padding {
|
|
12
12
|
padding: $grid-unit-60 $grid-unit-60 0;
|
|
13
13
|
}
|
|
@@ -67,7 +67,6 @@ const VALID_SETTINGS = [
|
|
|
67
67
|
'spacing.units',
|
|
68
68
|
'typography.fluid',
|
|
69
69
|
'typography.customFontSize',
|
|
70
|
-
'typography.defaultFontSizes',
|
|
71
70
|
'typography.dropCap',
|
|
72
71
|
'typography.fontFamilies',
|
|
73
72
|
'typography.fontSizes',
|
|
@@ -240,7 +239,6 @@ export function useSettingsForBlockElement(
|
|
|
240
239
|
...updatedSettings.typography,
|
|
241
240
|
fontSizes: {},
|
|
242
241
|
customFontSize: false,
|
|
243
|
-
defaultFontSizes: false,
|
|
244
242
|
};
|
|
245
243
|
}
|
|
246
244
|
|
|
@@ -22,7 +22,7 @@ import TextTransformControl from '../text-transform-control';
|
|
|
22
22
|
import TextDecorationControl from '../text-decoration-control';
|
|
23
23
|
import WritingModeControl from '../writing-mode-control';
|
|
24
24
|
import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';
|
|
25
|
-
import { setImmutably
|
|
25
|
+
import { setImmutably } from '../../utils/object';
|
|
26
26
|
|
|
27
27
|
const MIN_TEXT_COLUMNS = 1;
|
|
28
28
|
const MAX_TEXT_COLUMNS = 6;
|
|
@@ -53,10 +53,7 @@ export function useHasTypographyPanel( settings ) {
|
|
|
53
53
|
|
|
54
54
|
function useHasFontSizeControl( settings ) {
|
|
55
55
|
return (
|
|
56
|
-
( settings?.typography?.
|
|
57
|
-
settings?.typography?.fontSizes?.default?.length ) ||
|
|
58
|
-
settings?.typography?.fontSizes?.theme?.length ||
|
|
59
|
-
settings?.typography?.fontSizes?.custom?.length ||
|
|
56
|
+
hasMergedOrigins( settings?.typography?.fontSizes ) ||
|
|
60
57
|
settings?.typography?.customFontSize
|
|
61
58
|
);
|
|
62
59
|
}
|
|
@@ -103,45 +100,16 @@ function useHasTextColumnsControl( settings ) {
|
|
|
103
100
|
return settings?.typography?.textColumns;
|
|
104
101
|
}
|
|
105
102
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
* @param {Object} settings The global styles settings.
|
|
117
|
-
*
|
|
118
|
-
* @return {Array} The merged font sizes.
|
|
119
|
-
*/
|
|
120
|
-
function getMergedFontSizes( settings ) {
|
|
121
|
-
// The font size presets are merged in reverse order so that the duplicates
|
|
122
|
-
// that may defined later in the array have higher priority to match the CSS.
|
|
123
|
-
const mergedFontSizesAll = uniqByProperty(
|
|
124
|
-
[
|
|
125
|
-
settings?.typography?.fontSizes?.custom,
|
|
126
|
-
settings?.typography?.fontSizes?.theme,
|
|
127
|
-
settings?.typography?.fontSizes?.default,
|
|
128
|
-
].flatMap( ( presets ) => presets?.toReversed() ?? [] ),
|
|
129
|
-
'slug'
|
|
130
|
-
).reverse();
|
|
131
|
-
|
|
132
|
-
// Default presets exist in the global styles CSS no matter the setting, so
|
|
133
|
-
// filtering them out in the UI has to be done after merging.
|
|
134
|
-
const mergedFontSizes =
|
|
135
|
-
settings?.typography?.defaultFontSizes === false
|
|
136
|
-
? mergedFontSizesAll.filter(
|
|
137
|
-
( { slug } ) =>
|
|
138
|
-
! [ 'small', 'medium', 'large', 'x-large' ].includes(
|
|
139
|
-
slug
|
|
140
|
-
)
|
|
141
|
-
)
|
|
142
|
-
: mergedFontSizesAll;
|
|
143
|
-
|
|
144
|
-
return mergedFontSizes;
|
|
103
|
+
function getUniqueFontSizesBySlug( settings ) {
|
|
104
|
+
const fontSizes = settings?.typography?.fontSizes;
|
|
105
|
+
const mergedFontSizes = fontSizes ? mergeOrigins( fontSizes ) : [];
|
|
106
|
+
const uniqueSizes = [];
|
|
107
|
+
for ( const currentSize of mergedFontSizes ) {
|
|
108
|
+
if ( ! uniqueSizes.some( ( { slug } ) => slug === currentSize.slug ) ) {
|
|
109
|
+
uniqueSizes.push( currentSize );
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return uniqueSizes;
|
|
145
113
|
}
|
|
146
114
|
|
|
147
115
|
function TypographyToolsPanel( {
|
|
@@ -217,7 +185,7 @@ export default function TypographyPanel( {
|
|
|
217
185
|
// Font Size
|
|
218
186
|
const hasFontSizeEnabled = useHasFontSizeControl( settings );
|
|
219
187
|
const disableCustomFontSizes = ! settings?.typography?.customFontSize;
|
|
220
|
-
const mergedFontSizes =
|
|
188
|
+
const mergedFontSizes = getUniqueFontSizesBySlug( settings );
|
|
221
189
|
|
|
222
190
|
const fontSize = decodeValue( inheritedValue?.typography?.fontSize );
|
|
223
191
|
const setFontSize = ( newValue, metadata ) => {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.block-editor-link-control {
|
|
30
|
-
width:
|
|
30
|
+
width: 200px; // Hardcoded width avoids resizing of control when switching between preview/edit.
|
|
31
31
|
|
|
32
32
|
.block-editor-url-input {
|
|
33
33
|
padding: 0; // Cancel unnecessary default 1px padding in this case.
|
|
@@ -160,8 +160,7 @@ export function RichTextWrapper(
|
|
|
160
160
|
if (
|
|
161
161
|
blockTypeAttributes?.[ attribute ]?.source ===
|
|
162
162
|
'rich-text' &&
|
|
163
|
-
getBlockBindingsSource( args.source
|
|
164
|
-
?.lockAttributesEditing
|
|
163
|
+
getBlockBindingsSource( args.source )?.lockAttributesEditing
|
|
165
164
|
) {
|
|
166
165
|
shouldDisableEditing = true;
|
|
167
166
|
break;
|
|
@@ -6,15 +6,19 @@ import { useRef, useState } from '@wordpress/element';
|
|
|
6
6
|
import {
|
|
7
7
|
ToolbarButton,
|
|
8
8
|
Button,
|
|
9
|
-
NavigableMenu,
|
|
10
9
|
MenuItem,
|
|
11
10
|
ToggleControl,
|
|
12
11
|
TextControl,
|
|
13
|
-
|
|
14
|
-
Path,
|
|
12
|
+
MenuGroup,
|
|
15
13
|
__experimentalVStack as VStack,
|
|
16
14
|
} from '@wordpress/components';
|
|
17
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
link as linkIcon,
|
|
17
|
+
image,
|
|
18
|
+
page,
|
|
19
|
+
fullscreen,
|
|
20
|
+
linkOff,
|
|
21
|
+
} from '@wordpress/icons';
|
|
18
22
|
|
|
19
23
|
/**
|
|
20
24
|
* Internal dependencies
|
|
@@ -27,14 +31,6 @@ const LINK_DESTINATION_MEDIA = 'media';
|
|
|
27
31
|
const LINK_DESTINATION_ATTACHMENT = 'attachment';
|
|
28
32
|
const NEW_TAB_REL = [ 'noreferrer', 'noopener' ];
|
|
29
33
|
|
|
30
|
-
const icon = (
|
|
31
|
-
<SVG viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
32
|
-
<Path d="M0,0h24v24H0V0z" fill="none" />
|
|
33
|
-
<Path d="m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z" />
|
|
34
|
-
<Path d="m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z" />
|
|
35
|
-
</SVG>
|
|
36
|
-
);
|
|
37
|
-
|
|
38
34
|
const ImageURLInputUI = ( {
|
|
39
35
|
linkDestination,
|
|
40
36
|
onChangeUrl,
|
|
@@ -45,6 +41,9 @@ const ImageURLInputUI = ( {
|
|
|
45
41
|
linkTarget,
|
|
46
42
|
linkClass,
|
|
47
43
|
rel,
|
|
44
|
+
showLightboxSetting,
|
|
45
|
+
lightboxEnabled,
|
|
46
|
+
onSetLightbox,
|
|
48
47
|
} ) => {
|
|
49
48
|
const [ isOpen, setIsOpen ] = useState( false );
|
|
50
49
|
// Use internal state instead of a ref to make sure that the component
|
|
@@ -138,6 +137,7 @@ const ImageURLInputUI = ( {
|
|
|
138
137
|
onChangeUrl( {
|
|
139
138
|
href: urlInput,
|
|
140
139
|
linkDestination: selectedDestination,
|
|
140
|
+
lightbox: { enabled: false },
|
|
141
141
|
} );
|
|
142
142
|
}
|
|
143
143
|
stopEditLink();
|
|
@@ -157,22 +157,17 @@ const ImageURLInputUI = ( {
|
|
|
157
157
|
const linkDestinations = [
|
|
158
158
|
{
|
|
159
159
|
linkDestination: LINK_DESTINATION_MEDIA,
|
|
160
|
-
title: __( '
|
|
160
|
+
title: __( 'Link to image file' ),
|
|
161
161
|
url: mediaType === 'image' ? mediaUrl : undefined,
|
|
162
|
-
icon,
|
|
162
|
+
icon: image,
|
|
163
163
|
},
|
|
164
164
|
];
|
|
165
165
|
if ( mediaType === 'image' && mediaLink ) {
|
|
166
166
|
linkDestinations.push( {
|
|
167
167
|
linkDestination: LINK_DESTINATION_ATTACHMENT,
|
|
168
|
-
title: __( '
|
|
168
|
+
title: __( 'Link to attachment page' ),
|
|
169
169
|
url: mediaType === 'image' ? mediaLink : undefined,
|
|
170
|
-
icon:
|
|
171
|
-
<SVG viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
172
|
-
<Path d="M0 0h24v24H0V0z" fill="none" />
|
|
173
|
-
<Path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z" />
|
|
174
|
-
</SVG>
|
|
175
|
-
),
|
|
170
|
+
icon: page,
|
|
176
171
|
} );
|
|
177
172
|
}
|
|
178
173
|
return linkDestinations;
|
|
@@ -225,7 +220,7 @@ const ImageURLInputUI = ( {
|
|
|
225
220
|
/>
|
|
226
221
|
<TextControl
|
|
227
222
|
__nextHasNoMarginBottom
|
|
228
|
-
label={ __( 'Link CSS
|
|
223
|
+
label={ __( 'Link CSS class' ) }
|
|
229
224
|
value={ linkClass || '' }
|
|
230
225
|
onChange={ onSetLinkClass }
|
|
231
226
|
/>
|
|
@@ -233,6 +228,7 @@ const ImageURLInputUI = ( {
|
|
|
233
228
|
);
|
|
234
229
|
|
|
235
230
|
const linkEditorValue = urlInput !== null ? urlInput : url;
|
|
231
|
+
const showLinkEditor = ( ! linkEditorValue && ! lightboxEnabled ) === true;
|
|
236
232
|
|
|
237
233
|
const urlLabel = (
|
|
238
234
|
getLinkDestinations().find(
|
|
@@ -245,7 +241,7 @@ const ImageURLInputUI = ( {
|
|
|
245
241
|
<ToolbarButton
|
|
246
242
|
icon={ linkIcon }
|
|
247
243
|
className="components-toolbar__control"
|
|
248
|
-
label={ url ? __( 'Edit link' ) : __( '
|
|
244
|
+
label={ url ? __( 'Edit link' ) : __( 'Add link' ) }
|
|
249
245
|
aria-expanded={ isOpen }
|
|
250
246
|
onClick={ openLinkUI }
|
|
251
247
|
ref={ setPopoverAnchor }
|
|
@@ -256,14 +252,17 @@ const ImageURLInputUI = ( {
|
|
|
256
252
|
anchor={ popoverAnchor }
|
|
257
253
|
onFocusOutside={ onFocusOutside() }
|
|
258
254
|
onClose={ closeLinkUI }
|
|
259
|
-
renderSettings={
|
|
255
|
+
renderSettings={
|
|
256
|
+
! lightboxEnabled ? () => advancedOptions : null
|
|
257
|
+
}
|
|
260
258
|
additionalControls={
|
|
261
|
-
|
|
262
|
-
<
|
|
259
|
+
showLinkEditor && (
|
|
260
|
+
<MenuGroup>
|
|
263
261
|
{ getLinkDestinations().map( ( link ) => (
|
|
264
262
|
<MenuItem
|
|
265
263
|
key={ link.linkDestination }
|
|
266
264
|
icon={ link.icon }
|
|
265
|
+
iconPosition="left"
|
|
267
266
|
onClick={ () => {
|
|
268
267
|
setUrlInput( null );
|
|
269
268
|
onSetHref( link.url );
|
|
@@ -273,20 +272,45 @@ const ImageURLInputUI = ( {
|
|
|
273
272
|
{ link.title }
|
|
274
273
|
</MenuItem>
|
|
275
274
|
) ) }
|
|
276
|
-
|
|
275
|
+
{ showLightboxSetting && (
|
|
276
|
+
<MenuItem
|
|
277
|
+
key="expand-on-click"
|
|
278
|
+
className="block-editor-url-popover__expand-on-click"
|
|
279
|
+
icon={ fullscreen }
|
|
280
|
+
info={ __(
|
|
281
|
+
'Scale the image with a lightbox effect.'
|
|
282
|
+
) }
|
|
283
|
+
iconPosition="left"
|
|
284
|
+
onClick={ () => {
|
|
285
|
+
setUrlInput( null );
|
|
286
|
+
onChangeUrl( {
|
|
287
|
+
linkDestination:
|
|
288
|
+
LINK_DESTINATION_NONE,
|
|
289
|
+
href: '',
|
|
290
|
+
} );
|
|
291
|
+
onSetLightbox( true );
|
|
292
|
+
stopEditLink();
|
|
293
|
+
} }
|
|
294
|
+
>
|
|
295
|
+
{ __( 'Expand on click' ) }
|
|
296
|
+
</MenuItem>
|
|
297
|
+
) }
|
|
298
|
+
</MenuGroup>
|
|
277
299
|
)
|
|
278
300
|
}
|
|
279
301
|
>
|
|
280
|
-
{ ( ! url || isEditingLink ) && (
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
302
|
+
{ ( ! url || isEditingLink ) && ! lightboxEnabled && (
|
|
303
|
+
<>
|
|
304
|
+
<URLPopover.LinkEditor
|
|
305
|
+
className="block-editor-format-toolbar__link-container-content"
|
|
306
|
+
value={ linkEditorValue }
|
|
307
|
+
onChangeInputValue={ setUrlInput }
|
|
308
|
+
onSubmit={ onSubmitLinkChange() }
|
|
309
|
+
autocompleteRef={ autocompleteRef }
|
|
310
|
+
/>
|
|
311
|
+
</>
|
|
288
312
|
) }
|
|
289
|
-
{ url && ! isEditingLink && (
|
|
313
|
+
{ url && ! isEditingLink && ! lightboxEnabled && (
|
|
290
314
|
<>
|
|
291
315
|
<URLPopover.LinkViewer
|
|
292
316
|
className="block-editor-format-toolbar__link-container-content"
|
|
@@ -295,12 +319,37 @@ const ImageURLInputUI = ( {
|
|
|
295
319
|
urlLabel={ urlLabel }
|
|
296
320
|
/>
|
|
297
321
|
<Button
|
|
298
|
-
icon={
|
|
322
|
+
icon={ linkOff }
|
|
299
323
|
label={ __( 'Remove link' ) }
|
|
300
324
|
onClick={ onLinkRemove }
|
|
325
|
+
size="compact"
|
|
301
326
|
/>
|
|
302
327
|
</>
|
|
303
328
|
) }
|
|
329
|
+
{ ! url && ! isEditingLink && lightboxEnabled && (
|
|
330
|
+
<div className="block-editor-url-popover__expand-on-click">
|
|
331
|
+
<div className="fullscreen-icon">
|
|
332
|
+
{ fullscreen }
|
|
333
|
+
</div>
|
|
334
|
+
<div className="text">
|
|
335
|
+
<p>{ __( 'Expand on click' ) }</p>
|
|
336
|
+
<p className="description">
|
|
337
|
+
{ __(
|
|
338
|
+
'Scales the image with a lightbox effect'
|
|
339
|
+
) }
|
|
340
|
+
</p>
|
|
341
|
+
</div>
|
|
342
|
+
<Button
|
|
343
|
+
icon={ linkOff }
|
|
344
|
+
className="remove-link"
|
|
345
|
+
label={ __( 'Disable expand on click' ) }
|
|
346
|
+
onClick={ () => {
|
|
347
|
+
onSetLightbox( false );
|
|
348
|
+
} }
|
|
349
|
+
size="compact"
|
|
350
|
+
/>
|
|
351
|
+
</div>
|
|
352
|
+
) }
|
|
304
353
|
</URLPopover>
|
|
305
354
|
) }
|
|
306
355
|
</>
|
|
@@ -70,6 +70,7 @@ function URLPopover( {
|
|
|
70
70
|
focusOnMount={ focusOnMount }
|
|
71
71
|
placement={ computedPlacement }
|
|
72
72
|
shift
|
|
73
|
+
variant="toolbar"
|
|
73
74
|
{ ...popoverProps }
|
|
74
75
|
>
|
|
75
76
|
<div className="block-editor-url-popover__input-container">
|
|
@@ -82,6 +83,7 @@ function URLPopover( {
|
|
|
82
83
|
label={ __( 'Link settings' ) }
|
|
83
84
|
onClick={ toggleSettingsVisibility }
|
|
84
85
|
aria-expanded={ isSettingsExpanded }
|
|
86
|
+
size="compact"
|
|
85
87
|
/>
|
|
86
88
|
) }
|
|
87
89
|
</div>
|