mirror of
https://github.com/He4eT/elseifplayer.git
synced 2026-05-05 01:17:22 +00:00
Player: add the singleWindow option
This commit is contained in:
parent
7240be1120
commit
18da26dc20
4 changed files with 45 additions and 18 deletions
|
|
@ -37,7 +37,9 @@ const Handlers = ({
|
|||
setInputType,
|
||||
setInbox
|
||||
}) => ({
|
||||
onInit: _ => setStatus({ stage: 'ready' }),
|
||||
onInit: _ => {
|
||||
setStatus({ stage: 'ready' })
|
||||
},
|
||||
/* */
|
||||
onUpdateWindows: windows => {
|
||||
setWindows(windows)
|
||||
|
|
@ -49,8 +51,12 @@ const Handlers = ({
|
|||
setCurrentWindowId(id)
|
||||
setInputType(type)
|
||||
},
|
||||
onUpdateContent: setInbox,
|
||||
onDisable: _ => setInputType(null),
|
||||
onUpdateContent: inbox => {
|
||||
setInbox(inbox)
|
||||
},
|
||||
onDisable: _ => {
|
||||
setInputType(null)
|
||||
},
|
||||
/* */
|
||||
onFileNameRequest: (tosave, usage, _, setFileName) => {
|
||||
setFileName({
|
||||
|
|
@ -66,10 +72,14 @@ const Handlers = ({
|
|||
localStorage.setItem(`fake-fs/${filename}`, encode(content))
|
||||
},
|
||||
/* */
|
||||
onExit: _ => setInputType(null)
|
||||
onExit: _ => {
|
||||
setInputType(null)
|
||||
}
|
||||
})
|
||||
|
||||
export default function ({ vmParts: { file, engine } }) {
|
||||
export default function ({
|
||||
vmParts: { file, engine }, singleWindow
|
||||
}) {
|
||||
const [status, setStatus] = useState(INITIAL_STATUS)
|
||||
|
||||
const [windows, setWindows] = useState([])
|
||||
|
|
@ -123,7 +133,9 @@ export default function ({ vmParts: { file, engine } }) {
|
|||
<section className='output'>{
|
||||
windows
|
||||
.sort(byTop)
|
||||
// .filter(({id}) => id === currentWindowId)
|
||||
.filter(singleWindow
|
||||
? ({id}) => id === currentWindowId
|
||||
: _ => true)
|
||||
.map(textWindow(inbox))}
|
||||
</section>
|
||||
<InputBox {...{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue