mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-24 15:47:08 +00:00
Add paste button on mobile + update copy icon (#610)
This commit is contained in:
@@ -349,7 +349,7 @@ export function SchemaGenerator({ gen, allowedVersions }: Props) {
|
||||
{Octicon.download}
|
||||
</div>
|
||||
<div class={`popup-action action-copy${sourceShown ? ' shown' : ''}${copyActive ? ' active' : ''} tooltipped tip-nw`} aria-label={locale(copyActive ? 'copied' : 'copy')} onClick={copySource}>
|
||||
{copyActive ? Octicon.check : Octicon.clippy}
|
||||
{copyActive ? Octicon.check : Octicon.copy}
|
||||
</div>
|
||||
<div class={'popup-action action-code shown tooltipped tip-nw'} aria-label={locale(sourceShown ? 'hide_output' : 'show_output')} onClick={toggleSource}>
|
||||
{sourceShown ? Octicon.chevron_right : Octicon.code}
|
||||
@@ -363,7 +363,7 @@ export function SchemaGenerator({ gen, allowedVersions }: Props) {
|
||||
</div>
|
||||
<div class={`popup-share${shareShown ? ' shown' : ''}`}>
|
||||
<TextInput value={shareUrl} readonly />
|
||||
<Btn icon={shareCopyActive ? 'check' : 'clippy'} onClick={copySharedId} tooltip={locale(shareCopyActive ? 'copied' : 'copy_share')} tooltipLoc="nw" active={shareCopyActive} />
|
||||
<Btn icon={shareCopyActive ? 'check' : 'copy'} onClick={copySharedId} tooltip={locale(shareCopyActive ? 'copied' : 'copy_share')} tooltipLoc="nw" active={shareCopyActive} />
|
||||
</div>
|
||||
<div class="popup-actions left-actions" style="--offset: 50px;">
|
||||
<div class={'popup-action action-project shown tooltipped tip-ne'} aria-label={locale(projectShown ? 'hide_project' : 'show_project')} onClick={toggleProjectShown}>
|
||||
|
||||
@@ -202,8 +202,18 @@ export function SourcePanel({ name, model, blockStates, doCopy, doDownload, doIm
|
||||
setHighlighting(value)
|
||||
}
|
||||
|
||||
const importFromClipboard = useCallback(async () => {
|
||||
if (editor.current) {
|
||||
const text = await navigator.clipboard.readText()
|
||||
editor.current.setValue(text)
|
||||
}
|
||||
}, [])
|
||||
|
||||
return <>
|
||||
<div class="controls source-controls">
|
||||
{window.matchMedia('(pointer: coarse)').matches && <>
|
||||
<Btn icon="paste" onClick={importFromClipboard} />
|
||||
</>}
|
||||
<BtnMenu icon="gear" tooltip={locale('output_settings')} data-cy="source-controls">
|
||||
{getSourceIndents().map(key =>
|
||||
<Btn label={locale(`indentation.${key}`)} active={indent === key}
|
||||
|
||||
Reference in New Issue
Block a user