-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update/list view outline information about post #50414
Open
n2erjo00
wants to merge
16
commits into
WordPress:trunk
Choose a base branch
from
n2erjo00:update/list-view-outline-information-about-post
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
e21624d
Added list-view outline to contain heading count, paragrapth count an…
n2erjo00 e638b1a
Added code refactors to make it look nicer, changed slightly html str…
n2erjo00 c6f1ca1
Updated styles to match new html structure
n2erjo00 83a69d2
Updated to use HTML table element for better screen reader access
n2erjo00 cd2e5e0
Updated styles to match new table element
n2erjo00 94596f3
Merge branch 'trunk' into update/list-view-outline-information-about-…
n2erjo00 9c8a770
Added new React component to show base information about the document
n2erjo00 60f8f2e
Removed table ui and heading, paragraphcount and blockCount from the …
n2erjo00 16a9903
Added third tab to inserter called Info
n2erjo00 f70b5b5
Style changes and additions since HTML uses <ul> structure
n2erjo00 45186d4
Merge branch 'trunk' into update/list-view-outline-information-about-…
n2erjo00 8efd549
Removed padding-right since added white-space to html to make screen-…
n2erjo00 62d78cf
Added white-space to html element to make screen readers read more cl…
n2erjo00 103cbee
Added styles to overview list element
n2erjo00 f46bd90
Added CharacterCount, WordCount, TimeToRead to info tab
n2erjo00 9429354
Removed CharacterCount, WordCount, TimeToRead from outline tab. Also …
n2erjo00 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
packages/edit-post/src/components/secondary-sidebar/list-view-info.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useSelect } from '@wordpress/data'; | ||
import { store as blockEditorStore } from '@wordpress/block-editor'; | ||
import { __experimentalText as Text } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { useInstanceId } from '@wordpress/compose'; | ||
|
||
export default function ListViewInfo() { | ||
const { headingCount, paragraphCount, blockCount } = useSelect( | ||
( select ) => { | ||
const { getGlobalBlockCount } = select( blockEditorStore ); | ||
return { | ||
headingCount: getGlobalBlockCount( 'core/heading' ), | ||
paragraphCount: getGlobalBlockCount( 'core/paragraph' ), | ||
blockCount: getGlobalBlockCount(), | ||
}; | ||
} | ||
); | ||
const instanceId = useInstanceId( ListViewInfo ); | ||
return ( | ||
<div className="edit-post-editor__list-view-overview__container"> | ||
<p | ||
id={ `edit-post-editor-list-view-overview-info-${ instanceId }` } | ||
> | ||
{ __( 'Document info' ) } | ||
</p> | ||
<ul | ||
className="edit-post-editor__list-view-overview" | ||
aria-describedby={ `edit-post-editor-list-view-overview-info-${ instanceId }` } | ||
> | ||
<li className="edit-post-editor__list-view-overview__item"> | ||
<Text>{ __( 'Headings:' ) }</Text> | ||
<Text>{ headingCount }</Text> | ||
</li> | ||
<li className="edit-post-editor__list-view-overview__item"> | ||
<Text>{ __( 'Paragraphs:' ) }</Text> | ||
<Text>{ paragraphCount }</Text> | ||
</li> | ||
<li className="edit-post-editor__list-view-overview__item"> | ||
<Text>{ __( 'Blocks:' ) }</Text> | ||
<Text>{ blockCount }</Text> | ||
</li> | ||
</ul> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -17,6 +17,7 @@ import { | |||||
Rect, | ||||||
} from '@wordpress/components'; | ||||||
import { __ } from '@wordpress/i18n'; | ||||||
import { useInstanceId } from '@wordpress/compose'; | ||||||
|
||||||
function EmptyOutlineIllustration() { | ||||||
return ( | ||||||
|
@@ -63,24 +64,37 @@ export default function ListViewOutline() { | |||||
headingCount: getGlobalBlockCount( 'core/heading' ), | ||||||
}; | ||||||
}, [] ); | ||||||
const instanceId = useInstanceId( ListViewOutline ); | ||||||
return ( | ||||||
<> | ||||||
<div className="edit-post-editor__list-view-overview"> | ||||||
<div> | ||||||
<div className="edit-post-editor__list-view-overview__container"> | ||||||
<p | ||||||
id={ `edit-post-editor-list-view-overview-outline-${ instanceId }` } | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
> | ||||||
{ __( 'Document outline' ) } | ||||||
</p> | ||||||
<ul | ||||||
className="edit-post-editor__list-view-overview" | ||||||
aria-describedby={ `edit-post-editor-list-view-overview-outline-${ instanceId }` } | ||||||
> | ||||||
<li className="edit-post-editor__list-view-overview__item"> | ||||||
<Text>{ __( 'Characters:' ) }</Text> | ||||||
<Text> | ||||||
<CharacterCount /> | ||||||
</Text> | ||||||
</div> | ||||||
<div> | ||||||
</li> | ||||||
<li className="edit-post-editor__list-view-overview__item"> | ||||||
<Text>{ __( 'Words:' ) }</Text> | ||||||
<WordCount /> | ||||||
</div> | ||||||
<div> | ||||||
<Text> | ||||||
<WordCount /> | ||||||
</Text> | ||||||
</li> | ||||||
<li className="edit-post-editor__list-view-overview__item"> | ||||||
<Text>{ __( 'Time to read:' ) }</Text> | ||||||
<TimeToRead /> | ||||||
</div> | ||||||
</div> | ||||||
<Text> | ||||||
<TimeToRead /> | ||||||
</Text> | ||||||
</li> | ||||||
</ul> | ||||||
{ headingCount > 0 ? ( | ||||||
<DocumentOutline /> | ||||||
) : ( | ||||||
|
@@ -93,6 +107,6 @@ export default function ListViewOutline() { | |||||
</p> | ||||||
</div> | ||||||
) } | ||||||
</> | ||||||
</div> | ||||||
); | ||||||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.