PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.3.2
Block Animations, Motion & Scroll Effects – Ghost Kit v3.3.2
3.7.2 3.7.1 3.7.0 3.6.1 trunk 1.6.3 2.25.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.6.0
ghostkit / gutenberg / formats / deprecated-mark / index.js

index.js in Block Animations, Motion & Scroll Effects – Ghost Kit 3.3.2, at gutenberg/formats/deprecated-mark/index.js

51 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import {
2 RichTextShortcut,
3 RichTextToolbarButton,
4 } from '@wordpress/block-editor';
5 import { __ } from '@wordpress/i18n';
6 import { toggleFormat } from '@wordpress/rich-text';
7
8 import getIcon from '../../utils/get-icon';
9
10 export const name = 'ghostkit/mark';
11
12 export const settings = {
13 title: __('Highlight', 'ghostkit'),
14 tagName: 'mark',
15 className: 'ghostkit-highlight',
16 edit: function HighlightFormat(props) {
17 const { value, onChange, isActive } = props;
18
19 function toggleMark() {
20 onChange(
21 toggleFormat(value, {
22 type: name,
23 })
24 );
25 }
26
27 // Since this format is deprecated, we don't need to display it in UI.
28 if (!isActive) {
29 return null;
30 }
31
32 return (
33 <>
34 <RichTextShortcut
35 type="access"
36 character="m"
37 onUse={() => toggleMark()}
38 />
39 <RichTextToolbarButton
40 shortcutCharacter="m"
41 shortcutType="access"
42 title={__('Highlight', 'ghostkit')}
43 icon={getIcon('icon-felt-pen')}
44 onClick={() => toggleMark()}
45 isActive={isActive}
46 />
47 </>
48 );
49 },
50 };
51