File size: 858 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { registerBlockType } from '@wordpress/blocks';
import { RichText } from '@wordpress/editor';

import './editor.scss';

const attributes = {
	notes: {
		type: 'string',
	},
};

const edit = ( { attributes: { notes }, className, isSelected, setAttributes } ) => (
	<div className={ isSelected ? 'is-selected' : '' }>
		{ ! isSelected && (
			<span className="editor-notes__editor-indicator">
				<span role="img" aria-label="notebook">
					📔
				</span>
				Editor's Notes: hidden from rendered page
			</span>
		) }
		<RichText
			tagName="p"
			className={ className }
			value={ notes }
			onChange={ ( newNotes ) => setAttributes( { notes: newNotes } ) }
		/>
	</div>
);

const save = () => null;

registerBlockType( 'a8c/editor-notes', {
	title: "Editor's Notes",
	icon: 'welcome-write-blog',
	category: 'a8c',
	attributes,
	edit,
	save,
} );