@mui/icons-material APIs
- Close
- Add
- Delete
- ExpandMore
- Settings
- Check
- Update
- GitHub
- MoreVert
- HelpOutline
- ChevronRight
- ExpandLess
- Menu
- FileCopy
- CheckBox
- CheckBoxOutlineBlank
- ArrowBack
- DeleteForever
- Visibility
- VisibilityOff
- Save
- Person
- Edit
- People
- ChevronLeft
- PlayArrow
- Home
- ExitToApp
- MoreHoriz
- WbSunny
- Download
- Upload
- Search
- HighlightOffOutlined
- ContentCopy
- Calculate
- ShoppingCart
- AccountBalance
- BarChart
- Paid
- Clear
- Cancel
- ArrowDownward
- ArrowUpward
- PhotoCamera
- Folder
- InfoOutlined
- Code
- KeyboardArrowDown
- Lock
- LockOpen
- Replay
- Favorite
- Build
- Refresh
- AssignmentInd
- Pets
- Public
- Group
- Brush
- KeyboardTab
- Phone
- HelpOutlineOutlined
- NetworkWifi
- CompareArrows
- AdminPanelSettings
- BugReport
- Logout
- Message
- AddCircle
- LockOutlined
- HomeOutlined
- BarChartOutlined
- MusicNote
- MusicNoteOutlined
- Album
- AlbumOutlined
- PersonOutlined
- SettingsOutlined
- Share
- ShareOutlined
- FastRewind
- Help
- Loop
- VolumeDown
- VolumeUp
- PauseCircle
- PlayCircle
- VolumeOff
- ChatBubbleOutline
- LockRounded
- WifiOffRounded
- VideocamOutlined
- AddRounded
- MoreVertRounded
- SyncProblem
- VideoCallOutlined
- GetAppRounded
- SaveAlt
- ErrorRounded
- InsertDriveFileRounded
- CheckCircleOutline
- CloudOff
- ClearAll
- CloseOutlined
- Link
- AttachmentOutlined
- CodeOutlined
- MailOutlineRounded
- Brightness7Rounded
- MenuRounded
- NightsStayRounded
- ArrowForward
- BrushRounded
- VisibilityRounded
- FileCopyRounded
- FavoriteRounded
- DesktopMacRounded
- PhoneAndroidRounded
- TabletMac
- ThumbUpOutlined
- ThumbDownOutlined
- AssistantPhotoOutlined
- Publish
- Create
- WbCloudy
- Computer
- KeyboardArrowUp
- BusinessCenter
- FavoriteBorder
- Groups
- Shuffle
- Difference
- SwapHoriz
- Info
- KeyboardDoubleArrowDown
- KeyboardDoubleArrowUp
- PersonAdd
- Checkroom
- FactCheck
- ArrowRightAlt
- Scanner
- Brightness4
- Brightness7
- Translate
- Backpack
- SettingsBrightness
- Equalizer
- Handyman
- SentimentVerySatisfied
- SentimentDissatisfied
- SentimentSatisfied
- AccessTime
- Remove
- ArrowDropDown
- ArrowRight
- Undo
- Redo
- CreateNewFolder
- Description
- Outbox
- Inbox
- DriveFileRenameOutline
- ContentPaste
- Block
- Star
- StarBorder
- Security
- Today
- Event
- Login
- Sick
- FaceRetouchingOff
- Fireplace
- ErrorOutline
- Stop
- ViewList
- Send
- PlayCircleFilledWhite
- PlaylistAddCheck
- Telegram
- VerifiedUser
- Notifications
- MenuOpen
- GppGood
- ContactPhone
- Payment
- FolderShared
- Class
- Shield
- MoveUp
- VolunteerActivism
- DisplaySettings
- Apartment
- BusAlert
- Category
- FilterNone
- Forest
- MedicalServices
- School
- SportsTennis
- TheaterComedy
- ReportGmailerrorred
- ArrowCircleUp
- UploadFile
- YouTube
- Web
- AccountCircle
- AccessibilityNew
- Chat
- FolderOpen
- FileCopyOutlined
- KeyboardBackspace
- CheckCircleOutlined
- ReportProblemOutlined
- ManageAccounts
- PhotoLibrary
- SettingsBackupRestore
- SupervisorAccount
- Api
- FeaturedPlayList
- BugReportOutlined
- NewReleases
- ColorLens
- FolderOutlined
- Apps
- SpeakerNotes
- LocalCafe
- BurstModeSharp
- DevicesOther
- VideoLibrary
- AddOutlined
- DeleteOutlineOutlined
- EditOutlined
- MoreHorizOutlined
- Bookmarks
- CopyAll
- InsertComment
- KeyboardArrowRight
- FileDownload
- Done
- PendingOutlined
- HelpOutlineRounded
- ReportProblem
- HelpOutlined
Other Related APIs
- react#useState
- react#useEffect
- react#useRef
- @mui/material#Box
- @mui/material#IconButton
- @mui/material#Tooltip
- @mui/material#CardContent
- @mui/material#Container
- @mui/material#Divider
- @mui/material#Menu
- @mui/material#MenuItem
- @mui/material#Grid
- @mui/material#Toolbar
- @mui/material#Card
- @mui/material#CardHeader
- @mui/material#Icon
- @mui/material/styles#alpha
- @mui/material/styles#styled
- @mui/material/styles#useTheme
- @mui/lab#TreeView
- @mui/lab#TreeItem
@mui/icons-material#Undo TypeScript Examples
The following examples show how to use
@mui/icons-material#Undo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Files.tsx From NekoMaid with MIT License | 4 votes |
Editor: React.FC<{ plugin: Plugin, editorRef: React.Ref<UnControlled>, loading: { '!#LOADING'?: boolean },
dirs: Record<string, boolean>, refresh: () => void }> = React.memo(({ plugin, editorRef, loading, dirs, refresh }) => {
const doc = (editorRef as any).current?.editor?.doc
const theme = useTheme()
const his = useHistory()
const lnText = useRef('')
const path = useLocation().pathname.replace(/^\/NekoMaid\/files\/?/, '')
const [text, setText] = useState<string | null>(null)
const [error, setError] = useState('')
const [saving, setSaving] = useState(false)
const [notUndo, setNotUndo] = useState(true)
const [notRedo, setNotRedo] = useState(true)
const [notSave, setNotSave] = useState(true)
const [isNewFile, setIsNewFile] = useState(false)
useEffect(() => {
setText(null)
setError('')
setIsNewFile(false)
lnText.current = ''
if (!path || dirs[path] || path.endsWith('/')) return
loading['!#LOADING'] = true
plugin.emit('files:content', (data: number | string | null) => {
loading['!#LOADING'] = false
switch (data) {
case null: return setError(lang.files.unsupportedFormat)
case 0: return setError(lang.files.notExists)
case 1:
setIsNewFile(true)
setText('')
setNotSave(true)
break
case 2: return his.replace('./')
case 3: return setError(lang.files.tooBig)
default:
if (typeof data !== 'string') return
setText(data)
lnText.current = data.replace(/\r/g, '')
setNotSave(true)
}
}, path)
}, [path])
return <Card sx={{
position: 'relative',
'& .CodeMirror-dialog, .CodeMirror-scrollbar-filler': { backgroundColor: theme.palette.background.paper + '!important' }
}}>
<CardHeader
title={<span style={{ fontWeight: 'normal' }}>
{lang.files.editor}{path && ': ' + path}{path && isNewFile && <span className='bold'> ({lang.files.newFile})</span>}</span>}
sx={{ position: 'relative' }}
action={!error && path && text != null
? <Box sx={cardActionStyles}>
<Tooltip title={lang.files.undo}>
<span><IconButton size='small' disabled={notUndo} onClick={() => doc?.undo()}><Undo /></IconButton></span>
</Tooltip>
<Tooltip title={lang.files.undo}>
<span><IconButton size='small' disabled={notRedo} onClick={() => doc?.redo()}><Redo /></IconButton></span>
</Tooltip>
<Tooltip title={lang.files.save}>{saving
? <CircularProgress size={24} sx={{ margin: '5px' }} />
: <span><IconButton
size='small'
disabled={notSave}
onClick={() => {
if (!doc) return
setSaving(true)
const data = doc.getValue(text?.includes('\r\n') ? '\r\n' : '\n')
plugin.emit('files:update', (res: boolean) => {
setSaving(false)
if (!res) failed()
lnText.current = data.replace(/\r/g, '')
setText(data)
setNotSave(true)
if (isNewFile) {
setIsNewFile(false)
success()
refresh()
}
}, path, data)
}}
><Save /></IconButton></span>}</Tooltip>
</Box>
: undefined}
/>
<Divider />
{(error || !path) && <CardContent><Empty title={error || lang.files.notSelected} /></CardContent>}
<div style={{ position: text == null ? 'absolute' : undefined }}>
<UnControlled
ref={editorRef}
value={text == null ? EMPTY : text}
options={{
phrases: lang.codeMirrorPhrases,
mode: text == null ? '' : getMode(path),
theme: theme.palette.mode === 'dark' ? 'material' : 'one-light',
lineNumbers: true
}}
onChange={(_: any, { removed }: { removed: string[] }, newText: string) => {
setNotSave(lnText.current === newText)
if (removed?.[0] === EMPTY) doc?.clearHistory()
const histroy = doc?.historySize()
if (!histroy) return
setNotUndo(!histroy.undo)
setNotRedo(!histroy.redo)
}}
/>
</div>
</Card>
})