REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 5.04 KB
Close
/home/nshryvcy/radiantskinclinics.org/wp-content/plugins/extendify_old/src/Draft/components/ToolbarMenu.jsx
Text
Base64
import { DropdownTranslate } from '@draft/components/TranslationDropdown'; import { magic, twoLines } from '@draft/svg'; import { BlockControls, store as blockEditorStore, } from '@wordpress/block-editor'; import { Dropdown, MenuGroup, MenuItem, NavigableMenu, ToolbarButton, ToolbarGroup, } from '@wordpress/components'; import { useDispatch, useSelect } from '@wordpress/data'; import { store as editPostStore } from '@wordpress/edit-post'; import { __, isRTL } from '@wordpress/i18n'; import { customPostType, Icon, paragraph, postContent, termDescription, } from '@wordpress/icons'; const supportedBlocks = [ 'core/paragraph', 'core/list-item', 'core/verse', 'core/preformatted', 'core/heading', 'core/site-logo', ]; export const ToolbarMenu = (CurrentMenuItems, props) => { const { clientId: blockId } = props; const { getBlockName, getBlock } = useSelect( (select) => select(blockEditorStore), [], ); const { getActiveGeneralSidebarName } = useSelect( (select) => select(editPostStore), [], ); const { openGeneralSidebar } = useDispatch(editPostStore); // TODO: Only paragraphs? if (!supportedBlocks.includes(getBlockName(blockId))) { return <CurrentMenuItems {...props} />; } const text = getBlock(blockId)?.attributes?.content || ''; const openDraft = () => openGeneralSidebar('extendify-draft/draft'); const closeDraft = () => openGeneralSidebar('edit-post/block'); const toggleDraft = () => getActiveGeneralSidebarName() === 'extendify-draft/draft' ? closeDraft() : openDraft(); const updatePrompt = (detail) => window.dispatchEvent( new CustomEvent('extendify-draft:set-prompt', { detail }), ); return ( <> <CurrentMenuItems {...props} /> <BlockControls> <ToolbarGroup className="extendify-draft"> <Dropdown renderContent={({ onClose }) => ( <DropdownActions text={text} closePopup={onClose} openDraft={openDraft} updatePrompt={updatePrompt} /> )} renderToggle={({ isOpen, onToggle }) => { const handleClick = () => { if (!text) return toggleDraft(); onToggle(); }; return ( <ToolbarButton className="py-1.5 pl-2 pr-3 text-white before:bg-editor-main before:content-[''] hover:before:bg-editor-main-darker" onClick={handleClick} aria-expanded={isOpen} aria-haspopup="true" iconPosition={isRTL() ? 'right' : 'left'} icon={magic} > {__('Ask AI', 'extendify-local')} </ToolbarButton> ); }} /> </ToolbarGroup> </BlockControls> </> ); }; const DropdownActions = ({ text, closePopup, openDraft, updatePrompt }) => { const actions = [ { label: __('Improve writing', 'extendify-local'), promptType: 'improve-writing', systemMessageKey: 'edit', icon: <Icon icon={customPostType} />, disabled: () => false, }, { label: __('Fix spelling & grammar', 'extendify-local'), promptType: 'fix-spelling-grammar', systemMessageKey: 'edit', icon: <Icon icon={termDescription} />, disabled: () => false, }, { label: __('Simplify language', 'extendify-local'), promptType: 'simplify-language', systemMessageKey: 'edit', icon: <Icon icon={paragraph} />, disabled: () => false, }, { label: __('Make shorter', 'extendify-local'), promptType: 'make-shorter', systemMessageKey: 'edit', icon: <Icon icon={twoLines} />, disabled: () => false, }, { label: __('Make longer', 'extendify-local'), promptType: 'make-longer', systemMessageKey: 'edit', icon: <Icon icon={postContent} />, disabled: () => false, }, ]; return ( <NavigableMenu orientation="vertical" role="menu" style={{ minWidth: '200px' }} > <MenuGroup className="extendify-draft"> <MenuItem key={'custom-prompt'} style={{ width: '100%' }} isSelected={false} disabled={false} iconPosition="left" icon={magic} variant={undefined} onClick={() => { openDraft?.(); closePopup?.(); window.requestAnimationFrame(() => window.requestAnimationFrame(() => document.getElementById('draft-ai-textarea').focus(), ), ); }} > {__('Custom prompt', 'extendify-local')} </MenuItem> {actions.map( ({ label, promptType, systemMessageKey, disabled, icon }) => ( <MenuItem key={`${promptType}-${promptType}-${systemMessageKey}`} style={{ width: '100%' }} isSelected={false} disabled={disabled()} iconPosition={isRTL() ? 'left' : 'right'} icon={icon} variant={undefined} onClick={() => { openDraft?.(); closePopup?.(); window.requestAnimationFrame(() => window.requestAnimationFrame(() => updatePrompt({ text, promptType, systemMessageKey }), ), ); }} > {label} </MenuItem> ), )} <DropdownTranslate text={text} closePopup={closePopup} openDraft={openDraft} updatePrompt={updatePrompt} /> </MenuGroup> </NavigableMenu> ); };
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 2 × Files: 11
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
image-generation
DIR
-
drwxr-xr-x
2026-04-28 02:40:01
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
stock-images
DIR
-
drwxr-xr-x
2026-04-28 02:40:01
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Completion.jsx
616 B
lrw-r--r--
2026-02-19 03:27:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ConsentSidebar.jsx
769 B
lrw-r--r--
2026-02-19 03:27:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
DraftMenu.jsx
1.22 KB
lrw-r--r--
2026-02-19 03:27:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
DynamicTextarea.jsx
2.15 KB
lrw-r--r--
2026-02-19 03:27:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
EditMenu.jsx
2.36 KB
lrw-r--r--
2026-02-19 03:27:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
GenerateImageButtons.jsx
5.11 KB
lrw-r--r--
2026-02-19 03:27:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Input.jsx
2.52 KB
lrw-r--r--
2026-02-19 03:27:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
InsertMenu.jsx
7.46 KB
lrw-r--r--
2026-02-19 03:27:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
SelectedText.jsx
1.69 KB
lrw-r--r--
2026-02-19 03:27:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ToolbarMenu.jsx
5.04 KB
lrw-r--r--
2026-02-19 03:27:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TranslationDropdown.jsx
6.34 KB
lrw-r--r--
2026-03-19 23:35:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).