-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add copy and paste control strip buttons (#241)
Technically browser copy and paste controls work, but this is hard to discover and sometimes inaccessible. Attempts to address issues like #239. Future work would be to allow copying the graphics screen. Not sure how hard that would be.
- Loading branch information
Showing
7 changed files
with
96 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { h } from 'preact'; | ||
import cs from 'classnames'; | ||
import { VideoModes } from 'js/videomodes'; | ||
|
||
import styles from './css/ControlButton.module.scss'; | ||
|
||
export interface ClipboardCopyProps { | ||
vm: VideoModes | undefined; | ||
} | ||
|
||
export function ClipboardCopy({ vm }: ClipboardCopyProps) { | ||
const doCopy = function () { | ||
const asyncCopy = async function () { | ||
if (vm) { | ||
await navigator.clipboard.writeText(vm.getText()); | ||
} | ||
}; | ||
void asyncCopy(); | ||
}; | ||
return ( | ||
<button className={styles.iconButton} onClick={doCopy} title="Copy"> | ||
<i className={cs('fa', 'fa-copy')} /> | ||
</button> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { h } from 'preact'; | ||
import cs from 'classnames'; | ||
import Apple2IO from 'js/apple2io'; | ||
|
||
import styles from './css/ControlButton.module.scss'; | ||
|
||
export interface ClipboardPasteProps { | ||
io: Apple2IO | undefined; | ||
} | ||
|
||
export function ClipboardPaste({ io }: ClipboardPasteProps) { | ||
function doPaste() { | ||
const asyncPaste = async function () { | ||
if (io) { | ||
const text = await navigator.clipboard.readText(); | ||
io.setKeyBuffer(text); | ||
} | ||
}; | ||
void asyncPaste(); | ||
} | ||
return ( | ||
<button className={styles.iconButton} onClick={doPaste} title="Paste"> | ||
<i className={cs('fa', 'fa-paste')} /> | ||
</button> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters