Skip to content
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

Implement list block in React Native #14636

Merged
merged 31 commits into from
Apr 5, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
bd83d8f
Make sure multiline property is filtered out of props on save.
SergioEstevao Mar 5, 2019
8ed9cc0
Send block edit parameters using the context.
SergioEstevao Mar 5, 2019
e0d7cf6
Add multiline variables to allow proper parsing and saving of propert…
SergioEstevao Mar 5, 2019
eb33f84
Add list edit toolbar options
SergioEstevao Mar 5, 2019
c64dd5a
Add multiline property.
SergioEstevao Mar 25, 2019
f0a1e21
Add list block to mobile gb.
SergioEstevao Mar 4, 2019
73aaa4f
Move list-edit.native.js to new location.
SergioEstevao Mar 20, 2019
b6938aa
Make block edit send down the onFocus property.
SergioEstevao Mar 26, 2019
74f77cf
Handle case where unstableSplit is passed has prop.
SergioEstevao Mar 26, 2019
79f408c
Pass multiline tags to serialiser.
SergioEstevao Mar 27, 2019
1f12a9f
Use the format-lib for handling "Enter" in lists
hypest Mar 28, 2019
cc8a4e8
Merge branch 'master' into rnmobile/lists2
SergioEstevao Mar 29, 2019
ca338c2
Force selection reset on split
hypest Mar 29, 2019
076936f
Add multiline wrapper tags to formatToValue.
SergioEstevao Mar 29, 2019
6ff97b8
Merge branch 'rnmobile/lists2' of https://github.com/WordPress/gutenb…
SergioEstevao Mar 29, 2019
73fbd38
Remove unnecessary code.
SergioEstevao Mar 29, 2019
e07498e
Force rich-text text update on list type change
hypest Mar 29, 2019
f40852c
Merge branch 'master' into rnmobile/lists2
SergioEstevao Apr 2, 2019
7fb36f6
Merge branch 'master' into rnmobile/lists2
SergioEstevao Apr 3, 2019
9145a6d
Merge branch 'master' into rnmobile/lists2
SergioEstevao Apr 4, 2019
58eae26
Disable indent and outdent.
SergioEstevao Apr 4, 2019
08318ca
Enable toggling list type of nested lists
hypest Apr 4, 2019
9dcd23b
Update list type toolbar button on native mobile
hypest Apr 4, 2019
fd62f01
Include diff missed by previous commit
hypest Apr 4, 2019
66e971d
Rename to denote that it's about lines
hypest Apr 5, 2019
da0e1a7
Split into separate functions and mark unstable
hypest Apr 5, 2019
eb009e8
Add missing JSDoc param
Tug Apr 5, 2019
cc5666e
Update snapshot for BlockControls
Tug Apr 5, 2019
91f790c
Merge branch 'master' into rnmobile/lists2
SergioEstevao Apr 5, 2019
4451cb3
Move isActiveListType, isListRootSelected to rich-text package
hypest Apr 5, 2019
97ac0fb
Remove excess empty line
hypest Apr 5, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Toolbar } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import {
changeListType,
getStartListFormat,
getLineListFormat,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant to rename it as getLineNestingLevel, back when it was only about the nesting. I think it's better to export two functions instead of overloading one for multiple purposes. 66e971d#r272474533

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, I see. I will work on that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed da0e1a7, splitting the function into separate ones and marking them as unstable. Let me know what you think @ellatrix , thanks!

} from '@wordpress/rich-text';

/**
Expand All @@ -22,7 +22,7 @@ import BlockFormatControls from '../block-format-controls';
* inner list is selected.
*/
function isListRootSelected( value ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not replace getStartListFormat with both isListRootSelected and isActiveListType? This seems weird to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 @ellatrix , not sure I follow. Do you mean to completely remove getStartListFormat and implement its pieces inside isListRootSelected and isActiveListType?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, export isListRootSelected and isActiveListType from rich-text as unstable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done with 4451cb3.

return getStartListFormat( value ).nestingLevel < 1;
return getLineListFormat( value ).nestingLevel < 1;
}

/**
Expand All @@ -35,7 +35,7 @@ function isListRootSelected( value ) {
* @return {boolean} [description]
*/
function isActiveListType( tagName, rootTagName, value ) {
const listFormat = getStartListFormat( value );
const listFormat = getLineListFormat( value );

if ( ! listFormat || ! listFormat.type ) {
return tagName === rootTagName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getLineIndex } from './get-line-index';
*
* @return {Object} Object with { nestingLevel, listFormat }.
*/
export function getStartListFormat( value ) {
export function getLineListFormat( value ) {
const { text, replacements, start, end } = value;
const startingLineIndex = getLineIndex( value, start );
const startLineFormats = replacements[ startingLineIndex ] || [];
Expand Down
2 changes: 1 addition & 1 deletion packages/rich-text/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export { getActiveObject } from './get-active-object';
export { getSelectionEnd } from './get-selection-end';
export { getSelectionStart } from './get-selection-start';
export { getTextContent } from './get-text-content';
export { getStartListFormat } from './get-start-list-format';
export { getLineListFormat } from './get-line-list-format';
export { isCollapsed } from './is-collapsed';
export { isEmpty, isEmptyLine } from './is-empty';
export { join } from './join';
Expand Down