UNPKG

@gechiui/block-editor

Version:
42 lines (37 loc) 1.01 kB
/** * GeChiUI dependencies */ import { __ } from '@gechiui/i18n'; import { createInterpolateElement, useState } from '@gechiui/element'; import { Tip } from '@gechiui/components'; const globalTips = [ createInterpolateElement( __( '在写作时,您可以按<kbd>/</kbd>键来快速插入新区块。' ), { kbd: <kbd /> } ), createInterpolateElement( __( '在行首按<kbd>空格键</kbd>缩进列表。' ), { kbd: <kbd /> } ), createInterpolateElement( __( '在行首按<kbd>退格键</kbd>减少缩进列表。' ), { kbd: <kbd /> } ), __( '将文件拖动至编辑器中,便会自动插入媒体区块。' ), __( "按下工具栏上的区块图标来更改区块的类型。" ), ]; function Tips() { const [ randomIndex ] = useState( // Disable Reason: I'm not generating an HTML id. // eslint-disable-next-line no-restricted-syntax Math.floor( Math.random() * globalTips.length ) ); return <Tip>{ globalTips[ randomIndex ] }</Tip>; } export default Tips;