Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
aad05a6
[squashed] RichText structure:
ellatrix Sep 14, 2018
6de0653
Test deprecated node matcher
ellatrix Sep 14, 2018
0f64289
Fix equality check for deprecated node matcher value
ellatrix Sep 14, 2018
be8ddbd
Deprecate wp.blocks.node and wp.blocks.children
ellatrix Sep 14, 2018
6491282
Value manipulation: ensure passed value is not mutated
ellatrix Sep 17, 2018
d8cd31b
Fix initial selection RichText field
ellatrix Sep 17, 2018
b417549
Represent object format in text string
ellatrix Sep 17, 2018
89c9287
Reduce this.editor dependency
ellatrix Sep 17, 2018
d4295bb
Adjust e2e test expected output
ellatrix Sep 19, 2018
5bb7b12
More docs, rename things
ellatrix Sep 20, 2018
ec01348
Make mobile tests pass
ellatrix Sep 20, 2018
112f42b
Fix richTextValue dependency in test plugin
ellatrix Sep 20, 2018
3a879fd
Remove web logic from native format toolbar
ellatrix Sep 20, 2018
29cf891
Mobile: drop custom formatters as well
ellatrix Sep 20, 2018
aa82875
Mobile: absort formatting toolbar into RichText to reuse formatting m…
ellatrix Sep 20, 2018
209fd38
RN entrypoints for escape-html, rich-text-value packages
hypest Sep 20, 2018
817de47
Rewrite multiline splitting
ellatrix Sep 20, 2018
ce6d906
Rebase: correct new tests
ellatrix Sep 21, 2018
18c41bc
Bump deprecation version and add to deprecated.md
ellatrix Sep 21, 2018
e432f8b
Adjust wrong isEmpty check in cover image block
ellatrix Sep 21, 2018
fb33b33
Update package.json
gziolo Sep 24, 2018
ed4a9ec
Prepare packages for the intial release
gziolo Sep 24, 2018
3274ab5
Fix package-lock.json file for the new packages
gziolo Sep 24, 2018
228264b
Fix typo in pattern transform
ellatrix Sep 25, 2018
cd518dd
Rebase: fix new failing test #9454
ellatrix Sep 25, 2018
be16be0
Abstract tree creation
ellatrix Sep 25, 2018
0607230
Restore children and node sources
ellatrix Sep 25, 2018
2def469
Clean up
ellatrix Sep 25, 2018
c9369ff
Fix isEmptyLine
ellatrix Sep 25, 2018
5cdc4ee
Adjust merge functions
ellatrix Sep 25, 2018
3e4c01a
Clean up
ellatrix Sep 25, 2018
48b8963
Polish: make create() easier to read
ellatrix Sep 26, 2018
d8c35e9
Inline pasted text should be parsed as HTML
ellatrix Sep 26, 2018
e2a9fa2
Fix create() call after 9a754dc
ellatrix Sep 26, 2018
6e6e910
children and node sources should work without default set
ellatrix Sep 26, 2018
13ee0e3
Cast default values of children and node sources as array
ellatrix Sep 26, 2018
445ab90
Fix verse transform
ellatrix Sep 26, 2018
6596b4f
List merging: don't merge empty line
ellatrix Sep 26, 2018
e000668
Use line separator to separate multiline values, instead of double li…
ellatrix Sep 26, 2018
6855216
Change deprecation removal version
ellatrix Sep 26, 2018
a3b7745
Update quote to use line separators
ellatrix Sep 26, 2018
9bc2dd4
Guard against blocks passing null value to RichText
ellatrix Sep 27, 2018
b25545d
Ensure formats with different reference are reduced to different node…
ellatrix Sep 28, 2018
94352e7
rich-text-value => rich-text, better deprecation messages, cast strin…
ellatrix Oct 1, 2018
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
Prev Previous commit
Next Next commit
Fix initial selection RichText field
  • Loading branch information
ellatrix committed Oct 1, 2018
commit d8cd31b31643cc068d98b2cd9bd8f21a1f78f3df
11 changes: 9 additions & 2 deletions packages/editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ export class RichText extends Component {
this.deprecatedMultilineArrayFormat = Array.isArray( value );
}

componentDidMount() {
document.addEventListener( 'selectionchange', this.onSelectionChange );
}

componentWillUnmount() {
document.removeEventListener( 'selectionchange', this.onSelectionChange );
}

/**
* Retrieves the settings for this block.
*
Expand Down Expand Up @@ -160,10 +168,8 @@ export class RichText extends Component {
editor.on( 'keyup', this.onKeyUp );
editor.on( 'BeforeExecCommand', this.onPropagateUndo );
editor.on( 'focus', this.onFocus );
editor.on( 'input', this.onInput );
// The change event in TinyMCE fires every time an undo level is added.
editor.on( 'change', this.onCreateUndoLevel );
editor.on( 'selectionchange', this.onSelectionChange );

const { unstableOnSetup } = this.props;
if ( unstableOnSetup ) {
Expand Down Expand Up @@ -916,6 +922,7 @@ export class RichText extends Component {
className={ className }
key={ key }
onPaste={ this.onPaste }
onInput={ this.onInput }
multilineTag={ MultilineTag }
/>
{ isPlaceholderVisible &&
Expand Down
12 changes: 11 additions & 1 deletion packages/editor/src/components/rich-text/tinymce.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,17 @@ export default class TinyMCE extends Component {
}

render() {
const { tagName = 'div', style, defaultValue, className, isPlaceholderVisible, onPaste, multilineTag } = this.props;
const ariaProps = pickAriaProps( this.props );
const {
tagName = 'div',
style,
defaultValue,
className,
isPlaceholderVisible,
onPaste,
onInput,
multilineTag,
} = this.props;

/*
* The role=textbox and aria-multiline=true must always be used together
Expand Down Expand Up @@ -238,6 +247,7 @@ export default class TinyMCE extends Component {
suppressContentEditableWarning: true,
dangerouslySetInnerHTML: { __html: initialHTML },
onPaste,
onInput,
} );
}
}
1 change: 1 addition & 0 deletions packages/rich-text-structure/src/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ function createRecord( element, range, settings = {} ) {
const accumulator = getEmptyRecord();

if ( ! element || ! element.hasChildNodes() ) {
accumulateSelection( accumulator, element, range, getEmptyRecord() );
return accumulator;
}

Expand Down
4 changes: 3 additions & 1 deletion packages/rich-text-structure/src/test/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ describe( 'create', () => {
createRange: ( element ) => ( {
startOffset: 0,
startContainer: element,
endOffset: 1,
endOffset: 0,
endContainer: element,
} ),
record: {
start: 0,
end: 0,
formats: [],
text: '',
},
Expand Down