File tree Expand file tree Collapse file tree 4 files changed +19
-26
lines changed
src/components/copy-handler
src/components/visual-editor Expand file tree Collapse file tree 4 files changed +19
-26
lines changed Original file line number Diff line number Diff line change 1+ ## 2.0.0 (Unreleased)
2+
3+ ### Breaking Changes
4+
5+ - ` CopyHandler ` will now only catch cut/copy events coming from its ` props.children ` , instead of from anywhere in the ` document ` .
6+
17## 1.0.0 (2019-03-06)
28
39### New Features
Original file line number Diff line number Diff line change 11/**
22 * WordPress dependencies
33 */
4- import { Component } from '@wordpress/element' ;
54import { serialize } from '@wordpress/blocks' ;
65import { documentHasSelection } from '@wordpress/dom' ;
76import { withDispatch } from '@wordpress/data' ;
87import { compose } from '@wordpress/compose' ;
98
10- class CopyHandler extends Component {
11- constructor ( ) {
12- super ( ...arguments ) ;
13-
14- this . onCopy = ( event ) => this . props . onCopy ( event ) ;
15- this . onCut = ( event ) => this . props . onCut ( event ) ;
16- }
17-
18- componentDidMount ( ) {
19- document . addEventListener ( 'copy' , this . onCopy ) ;
20- document . addEventListener ( 'cut' , this . onCut ) ;
21- }
22-
23- componentWillUnmount ( ) {
24- document . removeEventListener ( 'copy' , this . onCopy ) ;
25- document . removeEventListener ( 'cut' , this . onCut ) ;
26- }
27-
28- render ( ) {
29- return null ;
30- }
9+ function CopyHandler ( { children, onCopy, onCut } ) {
10+ return (
11+ < div onCopy = { onCopy } onCut = { onCut } >
12+ { children }
13+ </ div >
14+ ) ;
3115}
3216
3317export default compose ( [
Original file line number Diff line number Diff line change 55* Expose the ` className ` property to style the ` PluginSidebar ` component.
66
77### Bug Fixes
8- - Fix 'save' keyboard shortcut not functioning in the Code Editor.
8+
9+ - Fix 'save' keyboard shortcut not functioning in the Code Editor.
10+ - Prevent ` ClipboardButton ` from incorrectly copying a serialized block string instead of the intended text in Safari.
911
1012## 3.1.7 (2019-01-03)
1113
Original file line number Diff line number Diff line change @@ -26,12 +26,13 @@ function VisualEditor() {
2626 return (
2727 < BlockSelectionClearer className = "edit-post-visual-editor editor-styles-wrapper" >
2828 < VisualEditorGlobalKeyboardShortcuts />
29- < CopyHandler />
3029 < MultiSelectScrollIntoView />
3130 < WritingFlow >
3231 < ObserveTyping >
33- < PostTitle />
34- < BlockList />
32+ < CopyHandler >
33+ < PostTitle />
34+ < BlockList />
35+ </ CopyHandler >
3536 </ ObserveTyping >
3637 </ WritingFlow >
3738 < _BlockSettingsMenuFirstItem >
You can’t perform that action at this time.
0 commit comments