@lvce-editor/about-view 4.7.0 → 4.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/aboutWorkerMain.js +30 -20
- package/package.json +1 -1
package/dist/aboutWorkerMain.js
CHANGED
@@ -1424,6 +1424,11 @@ const getAboutVirtualDom = (productName, lines, closeMessage, okMessage, copyMes
|
|
1424
1424
|
}, ...getDialogVirtualDom(content, closeMessage, infoMessage, okMessage, copyMessage, productName)];
|
1425
1425
|
};
|
1426
1426
|
|
1427
|
+
const commandIds = ['handleClickClose', 'handleClickOk', 'handleClickCopy', 'handleFocusIn', 'focusNext', 'focusPrevious'];
|
1428
|
+
const getCommandIds = () => {
|
1429
|
+
return commandIds;
|
1430
|
+
};
|
1431
|
+
|
1427
1432
|
const Tab = 2;
|
1428
1433
|
const Escape = 8;
|
1429
1434
|
|
@@ -1470,6 +1475,11 @@ const handleClickOk = async state => {
|
|
1470
1475
|
return state;
|
1471
1476
|
};
|
1472
1477
|
|
1478
|
+
const handleFocusIn = async state => {
|
1479
|
+
await invoke('Focus.setFocus', FocusAbout);
|
1480
|
+
return state;
|
1481
|
+
};
|
1482
|
+
|
1473
1483
|
const loadContent = state => {
|
1474
1484
|
const lines = getDetailStringWeb();
|
1475
1485
|
return {
|
@@ -1509,23 +1519,17 @@ const getFocusSelector = focusId => {
|
|
1509
1519
|
}
|
1510
1520
|
};
|
1511
1521
|
|
1512
|
-
const renderDialog = {
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
const dom = getAboutVirtualDom(newState.productName, newState.lines, closeMessage, okMessage, copyMessage, infoMessage);
|
1520
|
-
return ['Viewlet.setDom2', dom];
|
1521
|
-
}
|
1522
|
+
const renderDialog = (oldState, newState) => {
|
1523
|
+
const okMessage = ok();
|
1524
|
+
const copyMessage = copy();
|
1525
|
+
const closeMessage = closeDialog();
|
1526
|
+
const infoMessage = info();
|
1527
|
+
const dom = getAboutVirtualDom(newState.productName, newState.lines, closeMessage, okMessage, copyMessage, infoMessage);
|
1528
|
+
return ['Viewlet.setDom2', dom];
|
1522
1529
|
};
|
1523
|
-
const renderFocus = {
|
1524
|
-
|
1525
|
-
|
1526
|
-
const name = getFocusSelector(newState.focusId);
|
1527
|
-
return ['Viewlet.focusElementByName', name];
|
1528
|
-
}
|
1530
|
+
const renderFocus = (oldState, newState) => {
|
1531
|
+
const name = getFocusSelector(newState.focusId);
|
1532
|
+
return ['Viewlet.focusElementByName', name];
|
1529
1533
|
};
|
1530
1534
|
const getRenderer = diffType => {
|
1531
1535
|
switch (diffType) {
|
@@ -1538,16 +1542,20 @@ const getRenderer = diffType => {
|
|
1538
1542
|
}
|
1539
1543
|
};
|
1540
1544
|
|
1541
|
-
const
|
1542
|
-
const diffResult = diff(oldState, newState);
|
1545
|
+
const applyRender = (oldState, newState, diffResult) => {
|
1543
1546
|
const commands = [];
|
1544
1547
|
for (const item of diffResult) {
|
1545
1548
|
const fn = getRenderer(item);
|
1546
|
-
commands.push(fn
|
1549
|
+
commands.push(fn(oldState, newState));
|
1547
1550
|
}
|
1548
1551
|
return commands;
|
1549
1552
|
};
|
1550
1553
|
|
1554
|
+
const doRender = (oldState, newState) => {
|
1555
|
+
const diffResult = diff(oldState, newState);
|
1556
|
+
return applyRender(oldState, newState, diffResult);
|
1557
|
+
};
|
1558
|
+
|
1551
1559
|
const renderEventListeners = () => {
|
1552
1560
|
return [{
|
1553
1561
|
name: HandleClickOk,
|
@@ -1610,9 +1618,10 @@ const showAboutElectron = async () => {
|
|
1610
1618
|
};
|
1611
1619
|
|
1612
1620
|
const commandMap = {
|
1613
|
-
'About.focusNext': focusNext,
|
1614
1621
|
'About.diff': diff,
|
1622
|
+
'About.focusNext': focusNext,
|
1615
1623
|
'About.focusPrevious': focusPrevious,
|
1624
|
+
'About.getCommandIds': getCommandIds,
|
1616
1625
|
'About.getDetailString': getDetailString,
|
1617
1626
|
'About.getDetailStringWeb': getDetailStringWeb,
|
1618
1627
|
'About.getKeyBindings': getKeyBindings,
|
@@ -1620,6 +1629,7 @@ const commandMap = {
|
|
1620
1629
|
'About.handleClickClose': handleClickClose,
|
1621
1630
|
'About.handleClickCopy': handleClickCopy,
|
1622
1631
|
'About.handleClickOk': handleClickOk,
|
1632
|
+
'About.handleFocusIn': handleFocusIn,
|
1623
1633
|
'About.loadContent': loadContent,
|
1624
1634
|
'About.render': doRender,
|
1625
1635
|
'About.renderEventListeners': renderEventListeners,
|