@lvce-editor/find-widget-worker 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/findWidgetWorkerMain.js +75 -5
- package/package.json +1 -1
|
@@ -910,7 +910,7 @@ const isEqual$2 = (oldState, newState) => {
|
|
|
910
910
|
};
|
|
911
911
|
|
|
912
912
|
const isEqual$1 = (oldState, newState) => {
|
|
913
|
-
return oldState.version === newState.version;
|
|
913
|
+
return oldState.version === newState.version && oldState.replaceExpanded === newState.replaceExpanded && oldState.matchCount === newState.matchCount && oldState.matchIndex === newState.matchIndex;
|
|
914
914
|
};
|
|
915
915
|
|
|
916
916
|
const isEqual = (oldState, newState) => {
|
|
@@ -1012,6 +1012,11 @@ const handleBlur = async state => {
|
|
|
1012
1012
|
};
|
|
1013
1013
|
};
|
|
1014
1014
|
|
|
1015
|
+
const handleClickClose = state => {
|
|
1016
|
+
// TODO ask editor worker to dispose widget
|
|
1017
|
+
return state;
|
|
1018
|
+
};
|
|
1019
|
+
|
|
1015
1020
|
const findRegexMatches = (lines, regex) => {
|
|
1016
1021
|
if (!regex.global) {
|
|
1017
1022
|
throw new Error('regex must be global');
|
|
@@ -1082,6 +1087,23 @@ const handleInput = (state, value) => {
|
|
|
1082
1087
|
return refresh(state, value);
|
|
1083
1088
|
};
|
|
1084
1089
|
|
|
1090
|
+
const getFindWidgetHeight = replaceExpanded => {
|
|
1091
|
+
const collapsedHeight = 30;
|
|
1092
|
+
const expandedHeight = 60;
|
|
1093
|
+
const newHeight = replaceExpanded ? expandedHeight : collapsedHeight;
|
|
1094
|
+
return newHeight;
|
|
1095
|
+
};
|
|
1096
|
+
|
|
1097
|
+
const toggleReplace = state => {
|
|
1098
|
+
const newExpanded = !state.replaceExpanded;
|
|
1099
|
+
const newHeight = getFindWidgetHeight(newExpanded);
|
|
1100
|
+
return {
|
|
1101
|
+
...state,
|
|
1102
|
+
replaceExpanded: !state.replaceExpanded,
|
|
1103
|
+
height: newHeight
|
|
1104
|
+
};
|
|
1105
|
+
};
|
|
1106
|
+
|
|
1085
1107
|
const commandIds = ['handleSliderPointerDown', 'handleSliderPointerMove'];
|
|
1086
1108
|
|
|
1087
1109
|
const getCommandIds = () => {
|
|
@@ -1216,14 +1238,19 @@ const renderBounds = (oldState, newState) => {
|
|
|
1216
1238
|
return [SetBounds, uid, x, y, width, height];
|
|
1217
1239
|
};
|
|
1218
1240
|
|
|
1241
|
+
const HandleBlur = 'handleBlur';
|
|
1219
1242
|
const HandleClickClose = 'handleClickClose';
|
|
1243
|
+
const HandleClickFocusPreviousMatch = 'handleClickFocusPreviousMatch';
|
|
1220
1244
|
const HandleClickNextMatch = 'handleClickNextMatch';
|
|
1221
1245
|
const HandleClickPreviousMatch = 'handleClickPreviousMatch';
|
|
1222
1246
|
const HandleClickReplace = 'handleClickReplace';
|
|
1247
|
+
const HandleClickToggleReplace = 'handleClickToggleReplace';
|
|
1223
1248
|
const HandleClickReplaceAll = 'handleClickReplaceAll';
|
|
1224
1249
|
const HandleFocus = 'handleFocus';
|
|
1225
1250
|
const HandleInput = 'handleInput';
|
|
1226
1251
|
const HandleReplaceFocus = 'handleReplaceFocus';
|
|
1252
|
+
const HandleFocusPrevious = 'handleFocusPrevious';
|
|
1253
|
+
const HandleFocusNext = 'handleFocusNext';
|
|
1227
1254
|
const HandleReplaceInput = 'handleReplaceInput';
|
|
1228
1255
|
|
|
1229
1256
|
const emptyObject = {};
|
|
@@ -1557,15 +1584,56 @@ const renderContent = (oldState, newState) => {
|
|
|
1557
1584
|
return [SetDom2, uid, dom];
|
|
1558
1585
|
};
|
|
1559
1586
|
|
|
1560
|
-
const getEventListeners = uid => {
|
|
1561
|
-
return [
|
|
1587
|
+
const getEventListeners = (uid, widgetId) => {
|
|
1588
|
+
return [{
|
|
1589
|
+
name: HandleInput,
|
|
1590
|
+
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleInput', 0, widgetId, 'event.target.value']
|
|
1591
|
+
}, {
|
|
1592
|
+
name: HandleClickClose,
|
|
1593
|
+
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleClickClose', 0, widgetId]
|
|
1594
|
+
}, {
|
|
1595
|
+
name: HandleClickFocusPreviousMatch,
|
|
1596
|
+
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleClickPreviousMatch', 0, widgetId]
|
|
1597
|
+
}, {
|
|
1598
|
+
name: HandleClickNextMatch,
|
|
1599
|
+
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleClickNextMatch', 0, widgetId]
|
|
1600
|
+
}, {
|
|
1601
|
+
name: HandleClickReplace,
|
|
1602
|
+
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleClickReplace', 0, widgetId]
|
|
1603
|
+
}, {
|
|
1604
|
+
name: HandleClickReplace,
|
|
1605
|
+
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleClickReplaceAll', 0, widgetId]
|
|
1606
|
+
}, {
|
|
1607
|
+
name: HandleClickToggleReplace,
|
|
1608
|
+
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.toggleReplace', 0, widgetId]
|
|
1609
|
+
}, {
|
|
1610
|
+
name: HandleBlur,
|
|
1611
|
+
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleBlur', 0, widgetId]
|
|
1612
|
+
}, {
|
|
1613
|
+
name: HandleReplaceInput,
|
|
1614
|
+
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleReplaceInput', 0, widgetId]
|
|
1615
|
+
}, {
|
|
1616
|
+
name: HandleReplaceFocus,
|
|
1617
|
+
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleReplaceFocus', 0, widgetId]
|
|
1618
|
+
}, {
|
|
1619
|
+
name: HandleFocusPrevious,
|
|
1620
|
+
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleFocusPrevious', 0, widgetId]
|
|
1621
|
+
}, {
|
|
1622
|
+
name: HandleFocusNext,
|
|
1623
|
+
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleFocusNext', 0, widgetId]
|
|
1624
|
+
}, {
|
|
1625
|
+
name: HandleClickReplaceAll,
|
|
1626
|
+
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleClickReplaceAll', 0, widgetId]
|
|
1627
|
+
}];
|
|
1562
1628
|
};
|
|
1563
1629
|
|
|
1630
|
+
const Find = 5;
|
|
1631
|
+
|
|
1564
1632
|
const renderEventListeners = state => {
|
|
1565
1633
|
const {
|
|
1566
1634
|
uid
|
|
1567
1635
|
} = state;
|
|
1568
|
-
const eventListeners = getEventListeners();
|
|
1636
|
+
const eventListeners = getEventListeners(uid, Find);
|
|
1569
1637
|
return [SetEventListeners, uid, eventListeners];
|
|
1570
1638
|
};
|
|
1571
1639
|
|
|
@@ -1633,10 +1701,12 @@ const commandMap = {
|
|
|
1633
1701
|
'FindWidget.focusPrevious': focusPrevious,
|
|
1634
1702
|
'FindWidget.getCommandIds': getCommandIds,
|
|
1635
1703
|
'FindWidget.handleBlur': handleBlur,
|
|
1704
|
+
'FindWidget.handleClickClose': handleClickClose,
|
|
1636
1705
|
'FindWidget.handleInput': handleInput,
|
|
1637
1706
|
'FindWidget.loadContent': wrapCommand(loadContent),
|
|
1638
1707
|
'FindWidget.render2': render2,
|
|
1639
|
-
'FindWidget.terminate': terminate
|
|
1708
|
+
'FindWidget.terminate': terminate,
|
|
1709
|
+
'FindWidget.toggleReplace': toggleReplace
|
|
1640
1710
|
};
|
|
1641
1711
|
|
|
1642
1712
|
const listen = async () => {
|