@wordpress/editor 12.11.0 → 12.14.0
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/CHANGELOG.md +6 -0
- package/build/components/document-outline/index.js +7 -9
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/editor-history/redo.js +2 -1
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/error-boundary/index.js +3 -0
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +11 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/index.js +49 -8
- package/build/components/index.js.map +1 -1
- package/build/components/page-attributes/order.js +3 -7
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/parent.js +7 -3
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-format/index.js +5 -8
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +1 -1
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +2 -4
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-schedule/label.js +3 -3
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-slug/index.js +8 -13
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +1 -0
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +1 -0
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +3 -1
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-template/index.js +1 -2
- package/build/components/post-template/index.js.map +1 -1
- package/build/components/post-title/index.js +8 -2
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-url/check.js +54 -0
- package/build/components/post-url/check.js.map +1 -0
- package/build/components/post-url/index.js +115 -0
- package/build/components/post-url/index.js.map +1 -0
- package/build/components/post-url/label.js +30 -0
- package/build/components/post-url/label.js.map +1 -0
- package/build/components/post-visibility/label.js +5 -0
- package/build/components/post-visibility/label.js.map +1 -1
- package/build/components/provider/index.native.js +3 -1
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +2 -2
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/table-of-contents/panel.js +5 -1
- package/build/components/table-of-contents/panel.js.map +1 -1
- package/build/components/time-to-read/index.js +60 -0
- package/build/components/time-to-read/index.js.map +1 -0
- package/build/store/selectors.js +3 -3
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/document-outline/index.js +7 -8
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/editor-history/redo.js +3 -2
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/error-boundary/index.js +2 -0
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +10 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/index.js +6 -3
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/page-attributes/order.js +3 -6
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +5 -4
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-format/index.js +5 -8
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +1 -1
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +2 -4
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-schedule/label.js +3 -3
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-slug/index.js +8 -14
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +1 -2
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +1 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +4 -1
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-template/index.js +1 -2
- package/build-module/components/post-template/index.js.map +1 -1
- package/build-module/components/post-title/index.js +8 -2
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-url/check.js +44 -0
- package/build-module/components/post-url/check.js.map +1 -0
- package/build-module/components/post-url/index.js +102 -0
- package/build-module/components/post-url/index.js.map +1 -0
- package/build-module/components/post-url/label.js +18 -0
- package/build-module/components/post-url/label.js.map +1 -0
- package/build-module/components/post-visibility/label.js +3 -0
- package/build-module/components/post-visibility/label.js.map +1 -1
- package/build-module/components/provider/index.native.js +3 -1
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +2 -2
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/table-of-contents/panel.js +4 -1
- package/build-module/components/table-of-contents/panel.js.map +1 -1
- package/build-module/components/time-to-read/index.js +50 -0
- package/build-module/components/time-to-read/index.js.map +1 -0
- package/build-module/store/selectors.js +4 -4
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +18 -17
- package/build-style/style.css +22 -17
- package/package.json +30 -29
- package/src/components/README.md +1 -1
- package/src/components/document-outline/index.js +9 -8
- package/src/components/editor-history/redo.js +6 -2
- package/src/components/error-boundary/index.js +3 -0
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +13 -0
- package/src/components/index.js +9 -3
- package/src/components/page-attributes/order.js +1 -9
- package/src/components/page-attributes/parent.js +5 -11
- package/src/components/post-format/index.js +13 -19
- package/src/components/post-format/style.scss +2 -17
- package/src/components/post-locked-modal/index.js +1 -1
- package/src/components/post-publish-panel/maybe-category-panel.js +3 -5
- package/src/components/post-schedule/label.js +1 -1
- package/src/components/post-slug/index.js +7 -13
- package/src/components/post-slug/test/index.js +7 -6
- package/src/components/post-taxonomies/flat-term-selector.js +1 -1
- package/src/components/post-taxonomies/hierarchical-term-selector.js +1 -1
- package/src/components/post-taxonomies/index.js +3 -1
- package/src/components/post-template/index.js +1 -1
- package/src/components/post-title/index.js +8 -2
- package/src/components/post-trash/style.scss +3 -0
- package/src/components/post-url/check.js +38 -0
- package/src/components/post-url/index.js +122 -0
- package/src/components/post-url/label.js +22 -0
- package/src/components/post-url/style.scss +16 -0
- package/src/components/post-visibility/label.js +4 -0
- package/src/components/provider/index.native.js +3 -1
- package/src/components/provider/use-block-editor-settings.js +5 -1
- package/src/components/table-of-contents/panel.js +7 -2
- package/src/components/time-to-read/index.js +59 -0
- package/src/store/selectors.js +5 -6
- package/src/store/test/selectors.js +1 -1
- package/src/style.scss +1 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.editor-post-url__link-label {
|
|
2
|
+
font-size: $default-font-size;
|
|
3
|
+
font-weight: 400;
|
|
4
|
+
margin: 0;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/* rtl:begin:ignore */
|
|
8
|
+
.editor-post-url__link {
|
|
9
|
+
direction: ltr;
|
|
10
|
+
word-break: break-word;
|
|
11
|
+
}
|
|
12
|
+
/* rtl:end:ignore */
|
|
13
|
+
|
|
14
|
+
.editor-post-url__link-slug {
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
}
|
|
@@ -10,6 +10,10 @@ import { visibilityOptions } from './utils';
|
|
|
10
10
|
import { store as editorStore } from '../../store';
|
|
11
11
|
|
|
12
12
|
export default function PostVisibilityLabel() {
|
|
13
|
+
return usePostVisibilityLabel();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function usePostVisibilityLabel() {
|
|
13
17
|
const visibility = useSelect( ( select ) =>
|
|
14
18
|
select( editorStore ).getEditedPostVisibility()
|
|
15
19
|
);
|
|
@@ -91,12 +91,14 @@ class NativeEditorProvider extends Component {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
componentDidMount() {
|
|
94
|
-
const { capabilities, locale, updateSettings } =
|
|
94
|
+
const { capabilities, locale, hostAppNamespace, updateSettings } =
|
|
95
|
+
this.props;
|
|
95
96
|
|
|
96
97
|
updateSettings( {
|
|
97
98
|
...capabilities,
|
|
98
99
|
...this.getThemeColors( this.props ),
|
|
99
100
|
locale,
|
|
101
|
+
hostAppNamespace,
|
|
100
102
|
} );
|
|
101
103
|
|
|
102
104
|
this.subscriptionParentGetHtml = subscribeParentGetHtml( () => {
|
|
@@ -41,7 +41,9 @@ function useBlockEditorSettings( settings, hasTemplate ) {
|
|
|
41
41
|
const isWeb = Platform.OS === 'web';
|
|
42
42
|
const { canUser, getEntityRecord } = select( coreStore );
|
|
43
43
|
|
|
44
|
-
const siteSettings =
|
|
44
|
+
const siteSettings = canUser( 'read', 'settings' )
|
|
45
|
+
? getEntityRecord( 'root', 'site' )
|
|
46
|
+
: undefined;
|
|
45
47
|
|
|
46
48
|
return {
|
|
47
49
|
canUseUnfilteredHTML: canUserUseUnfilteredHTML(),
|
|
@@ -127,6 +129,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
|
|
|
127
129
|
'disableCustomColors',
|
|
128
130
|
'disableCustomFontSizes',
|
|
129
131
|
'disableCustomGradients',
|
|
132
|
+
'disableLayoutStyles',
|
|
130
133
|
'enableCustomLineHeight',
|
|
131
134
|
'enableCustomSpacing',
|
|
132
135
|
'enableCustomUnits',
|
|
@@ -136,6 +139,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
|
|
|
136
139
|
'generateAnchors',
|
|
137
140
|
'hasFixedToolbar',
|
|
138
141
|
'hasReducedUI',
|
|
142
|
+
'hasInlineToolbar',
|
|
139
143
|
'imageDefaultSize',
|
|
140
144
|
'imageDimensions',
|
|
141
145
|
'imageEditing',
|
|
@@ -9,6 +9,7 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
11
|
import WordCount from '../word-count';
|
|
12
|
+
import TimeToRead from '../time-to-read';
|
|
12
13
|
import DocumentOutline from '../document-outline';
|
|
13
14
|
import CharacterCount from '../character-count';
|
|
14
15
|
|
|
@@ -38,6 +39,10 @@ function TableOfContentsPanel( { hasOutlineItemsDisabled, onRequestClose } ) {
|
|
|
38
39
|
tabIndex="0"
|
|
39
40
|
>
|
|
40
41
|
<ul role="list" className="table-of-contents__counts">
|
|
42
|
+
<li className="table-of-contents__count">
|
|
43
|
+
{ __( 'Words' ) }
|
|
44
|
+
<WordCount />
|
|
45
|
+
</li>
|
|
41
46
|
<li className="table-of-contents__count">
|
|
42
47
|
{ __( 'Characters' ) }
|
|
43
48
|
<span className="table-of-contents__number">
|
|
@@ -45,8 +50,8 @@ function TableOfContentsPanel( { hasOutlineItemsDisabled, onRequestClose } ) {
|
|
|
45
50
|
</span>
|
|
46
51
|
</li>
|
|
47
52
|
<li className="table-of-contents__count">
|
|
48
|
-
{ __( '
|
|
49
|
-
<
|
|
53
|
+
{ __( 'Time to read' ) }
|
|
54
|
+
<TimeToRead />
|
|
50
55
|
</li>
|
|
51
56
|
<li className="table-of-contents__count">
|
|
52
57
|
{ __( 'Headings' ) }
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import { _x, _n, __, sprintf } from '@wordpress/i18n';
|
|
6
|
+
import { count as wordCount } from '@wordpress/wordcount';
|
|
7
|
+
import { createInterpolateElement } from '@wordpress/element';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import { store as editorStore } from '../../store';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Average reading rate - based on average taken from
|
|
16
|
+
* https://irisreading.com/average-reading-speed-in-various-languages/
|
|
17
|
+
* (Characters/minute used for Chinese rather than words).
|
|
18
|
+
*
|
|
19
|
+
* @type {number} A rough estimate of the average reading rate across multiple languages.
|
|
20
|
+
*/
|
|
21
|
+
const AVERAGE_READING_RATE = 189;
|
|
22
|
+
|
|
23
|
+
export default function TimeToRead() {
|
|
24
|
+
const content = useSelect(
|
|
25
|
+
( select ) => select( editorStore ).getEditedPostAttribute( 'content' ),
|
|
26
|
+
[]
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
* translators: If your word count is based on single characters (e.g. East Asian characters),
|
|
31
|
+
* enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
|
|
32
|
+
* Do not translate into your own language.
|
|
33
|
+
*/
|
|
34
|
+
const wordCountType = _x( 'words', 'Word count type. Do not translate!' );
|
|
35
|
+
const minutesToRead = Math.round(
|
|
36
|
+
wordCount( content, wordCountType ) / AVERAGE_READING_RATE
|
|
37
|
+
);
|
|
38
|
+
const minutesToReadString =
|
|
39
|
+
minutesToRead === 0
|
|
40
|
+
? createInterpolateElement( __( '<span>< 1</span> minute' ), {
|
|
41
|
+
span: <span className="table-of-contents__number" />,
|
|
42
|
+
} )
|
|
43
|
+
: createInterpolateElement(
|
|
44
|
+
sprintf(
|
|
45
|
+
/* translators: %s is the number of minutes the post will take to read. */
|
|
46
|
+
_n(
|
|
47
|
+
'<span>%d</span> minute',
|
|
48
|
+
'<span>%d</span> minutes',
|
|
49
|
+
minutesToRead
|
|
50
|
+
),
|
|
51
|
+
minutesToRead
|
|
52
|
+
),
|
|
53
|
+
{
|
|
54
|
+
span: <span className="table-of-contents__number" />,
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
return <span className="time-to-read">{ minutesToReadString }</span>;
|
|
59
|
+
}
|
package/src/store/selectors.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { find, get, has,
|
|
4
|
+
import { find, get, has, includes, some } from 'lodash';
|
|
5
5
|
import createSelector from 'rememo';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -534,7 +534,7 @@ export function isEditedPostEmpty( state ) {
|
|
|
534
534
|
|
|
535
535
|
if ( blocks.length ) {
|
|
536
536
|
// Pierce the abstraction of the serializer in knowing that blocks are
|
|
537
|
-
// joined with
|
|
537
|
+
// joined with newlines such that even if every individual block
|
|
538
538
|
// produces an empty save result, the serialized content is non-empty.
|
|
539
539
|
if ( blocks.length > 1 ) {
|
|
540
540
|
return false;
|
|
@@ -1605,10 +1605,9 @@ export function __experimentalGetTemplateInfo( state, template ) {
|
|
|
1605
1605
|
const { title: defaultTitle, description: defaultDescription } =
|
|
1606
1606
|
__experimentalGetDefaultTemplateType( state, slug );
|
|
1607
1607
|
|
|
1608
|
-
const templateTitle =
|
|
1609
|
-
const templateDescription =
|
|
1610
|
-
? description
|
|
1611
|
-
: description?.raw;
|
|
1608
|
+
const templateTitle = typeof title === 'string' ? title : title?.rendered;
|
|
1609
|
+
const templateDescription =
|
|
1610
|
+
typeof description === 'string' ? description : description?.raw;
|
|
1612
1611
|
const templateIcon =
|
|
1613
1612
|
__experimentalGetDefaultTemplatePartAreas( state ).find(
|
|
1614
1613
|
( item ) => area === item.area
|
package/src/style.scss
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
@import "./components/post-saved-state/style.scss";
|
|
15
15
|
@import "./components/post-taxonomies/style.scss";
|
|
16
16
|
@import "./components/post-text-editor/style.scss";
|
|
17
|
+
@import "./components/post-url/style.scss";
|
|
17
18
|
@import "./components/post-visibility/style.scss";
|
|
18
19
|
@import "./components/post-title/style.scss";
|
|
19
20
|
@import "./components/post-trash/style.scss";
|