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

Use format-library in gutenberg-mobile #12249

Merged
merged 67 commits into from
Feb 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
30c1211
Store current selection in RichText state
koke Nov 22, 2018
c6d799c
Make native RichText use format-library
koke Nov 23, 2018
de19ff3
Fix bad merge
koke Nov 23, 2018
61dad8c
Don't use applyRecord for now
koke Nov 23, 2018
06be87e
Missing newlines
koke Nov 23, 2018
deb2b73
Do not change lastContent on formatChange, let the component rerender…
Tug Nov 27, 2018
af0bc81
Make sure the component rerenders when isSelected changes so FormatTo…
Tug Nov 27, 2018
8091ebf
Make a simple version of Link that displays on mobile
Tug Dec 13, 2018
0cf6ee3
Rerender on selection change to update record
Tug Dec 13, 2018
ac5fcda
Make it update onFormatChange when url changes
Tug Dec 14, 2018
8895197
Cleanup changes in Heading and Paragraph
Tug Dec 14, 2018
72031f0
Remove unnecessary components and styles added while testing
Tug Dec 14, 2018
74eb3ce
Improve link editing UI
Tug Dec 14, 2018
3950a52
Fix adding a new url without a selection
Tug Dec 14, 2018
2a53f53
Fix editing the text part of the url
Tug Dec 14, 2018
0202a8c
Fill modal URL to current value
Tug Dec 14, 2018
83f0117
Pressing Remove dismisses the popup. Improve styles
Tug Dec 17, 2018
24d970a
Bring back multilineTag prop
Tug Dec 17, 2018
0f5519a
Remove unused param in shouldComponentUpdate
Tug Dec 17, 2018
9e52938
Remove withBlockEditContext for now, it will need a better refactor t…
Tug Dec 17, 2018
0730670
Temporary fix for whitespace in HTML, will need to be addressed later
Tug Dec 17, 2018
7570e18
Make sure end is always greater than start for the text selection
Tug Dec 17, 2018
6f1b4da
Remove unsupported css property
Tug Dec 17, 2018
6dbbf47
Disable autoCapitalize and autoCorrect for URLInput
Tug Dec 18, 2018
2bcfa97
Fix lint errors in mobile and in rnmobile/rich-text-formats
Tug Dec 18, 2018
53149e0
Use a template string to generate html for Aztec in RichText
Tug Dec 19, 2018
a7bb67b
Preprocess the HTML value before sending it to Aztec, removing whites…
Tug Dec 19, 2018
b1cfafd
Use custom button instead of native provided by react-native
Tug Dec 19, 2018
14fe86b
Add some padding to our custom button
Tug Dec 19, 2018
da16547
Send active formats to RCTAztecView so we can type new words in a format
Tug Dec 21, 2018
a54783e
Handle multiple formats with format placeholder
Tug Dec 23, 2018
b7fb20f
Cleanup applyFormat
Tug Dec 23, 2018
942f217
Make applyFormat support applying multiple formats at once
Tug Dec 24, 2018
66f0dde
Keep formatting when onSelectionChange is emitted without changes
Tug Dec 24, 2018
afa1516
Keep the same order of formats
Tug Dec 24, 2018
85ed6fa
Prevent inserting anything other that a formatting element from the l…
Tug Dec 24, 2018
f666dbb
Make sure wrapping tags returned by aztec are removed so it's not add…
Tug Dec 26, 2018
586dca9
Improve styling of the modal
Tug Dec 26, 2018
43f39c9
Make sure we don't pass undefined values in activeFormats
Tug Dec 27, 2018
cf1eb47
Update formatPlaceholder when user decides to unselect a format in an…
Tug Jan 22, 2019
14e6d2a
Update props.value on format change
Tug Jan 23, 2019
381d40c
Force update native view onFormatChange by not setting this.lastContent
Tug Jan 23, 2019
f72bf46
Handle inserting a link
Tug Jan 23, 2019
250044a
Fix updating format properties
Tug Jan 23, 2019
6425c5d
Expand link selection automatically so we can edit a link without sel…
Tug Jan 24, 2019
0d5f396
Force an aztec text refresh on format change so we make sure the acti…
Tug Jan 24, 2019
dfdaecb
Add comment and make the code more consistent for debugging
Tug Jan 24, 2019
6efddf4
Make sure we don't use format ref inside the placeholder formats
Tug Jan 28, 2019
6a24f98
Make sure we don't use format ref inside the placeholder formats
Tug Jan 28, 2019
ecf4d34
Do not try to call valueToFormat on format change without selection
Tug Jan 29, 2019
8aa4b0d
Fix editing link url
Tug Jan 29, 2019
15cce30
Add the ability to remove a link without selection
Tug Jan 29, 2019
b98012c
Do not remove trailing whitespace characters
Tug Jan 30, 2019
d2b241b
Unescape spaces coming from Aztec
hypest Feb 1, 2019
5e864cc
Fix code styling issues
hypest Feb 1, 2019
2fbcafe
Merge branch 'master' into rnmobile/rich-text-formats
hypest Feb 4, 2019
16f0fb8
Merge branch 'master' into rnmobile/rich-text-formats
hypest Feb 6, 2019
b0fd2c0
Pick the formats of the first char when in text start
hypest Feb 6, 2019
e7d2587
Fix lint errors
hypest Feb 6, 2019
b6b38ba
RichText value may be undefined
hypest Feb 6, 2019
c843c20
Merge branch 'master' into rnmobile/rich-text-formats
hypest Feb 8, 2019
07482c4
Merge branch 'master' into rnmobile/rich-text-formats
hypest Feb 12, 2019
18f1795
Update lastEventCount on enter and selection changes
koke Feb 15, 2019
4147731
Merge branch 'master' into rnmobile/rich-text-formats
hypest Feb 15, 2019
f21f491
Update ModalLinkUI to avoid the keyboard
koke Feb 15, 2019
5d85b48
Lint fixes
koke Feb 15, 2019
e90a843
Merge branch 'master' into rnmobile/rich-text-formats
hypest Feb 18, 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
11 changes: 2 additions & 9 deletions packages/block-library/src/heading/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { View } from 'react-native';
import { __ } from '@wordpress/i18n';
import { Component } from '@wordpress/element';
import { RichText, BlockControls } from '@wordpress/editor';
import { parse, createBlock } from '@wordpress/blocks';
import { createBlock } from '@wordpress/blocks';

/**
* Internal dependencies
Expand Down Expand Up @@ -62,14 +62,7 @@ class HeadingEdit extends Component {
style={ {
minHeight: Math.max( minHeight, this.state.aztecHeight ),
} }
onChange={ ( event ) => {
// Create a React Tree from the new HTML
const newParaBlock = parse( `<!-- wp:heading {"level":${ level }} --><${ tagName }>${ event.content }</${ tagName }><!-- /wp:heading -->` )[ 0 ];
setAttributes( {
...this.props.attributes,
content: newParaBlock.attributes.content,
} );
} }
onChange={ ( value ) => setAttributes( { content: value } ) }
onMerge={ mergeBlocks }
onSplit={
insertBlocksAfter ?
Expand Down
9 changes: 3 additions & 6 deletions packages/block-library/src/paragraph/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { View } from 'react-native';
*/
import { __ } from '@wordpress/i18n';
import { Component } from '@wordpress/element';
import { parse, createBlock } from '@wordpress/blocks';
import { createBlock } from '@wordpress/blocks';
import { RichText } from '@wordpress/editor';

/**
Expand Down Expand Up @@ -99,12 +99,9 @@ class ParagraphEdit extends Component {
...style,
minHeight: Math.max( minHeight, this.state.aztecHeight ),
} }
onChange={ ( event ) => {
// Create a React Tree from the new HTML
const newParaBlock = parse( '<!-- wp:paragraph --><p>' + event.content + '</p><!-- /wp:paragraph -->' )[ 0 ];
onChange={ ( nextContent ) => {
setAttributes( {
...this.props.attributes,
content: newParaBlock.attributes.content,
content: nextContent,
} );
} }
onSplit={ this.splitBlock }
Expand Down
7 changes: 6 additions & 1 deletion packages/editor/src/components/index.native.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
export * from './colors';
export * from './font-sizes';
export { default as PlainText } from './plain-text';
export { default as RichText } from './rich-text';
export {
default as RichText,
RichTextShortcut,
RichTextToolbarButton,
} from './rich-text';
export { default as MediaPlaceholder } from './media-placeholder';
export { default as BlockFormatControls } from './block-format-controls';
export { default as BlockControls } from './block-controls';
Expand All @@ -13,3 +17,4 @@ export { default as EditorHistoryUndo } from './editor-history/undo';
export { default as InspectorControls } from './inspector-controls';
export { default as BottomSheet } from './mobile/bottom-sheet';
export { default as Picker } from './mobile/picker';
export { default as URLInput } from './url-input';
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* WordPress dependencies
*/

import { Toolbar, Slot } from '@wordpress/components';

const FormatToolbar = ( { controls } ) => {
Tug marked this conversation as resolved.
Show resolved Hide resolved
return (
<Toolbar>
{ controls.map( ( format ) =>
<Slot name={ `RichText.ToolbarControls.${ format }` } key={ format } />
) }
<Slot name="RichText.ToolbarControls" />
</Toolbar>
);
};

export default FormatToolbar;
Loading