@lvce-editor/find-widget-worker 1.1.0 → 1.2.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.
@@ -887,7 +887,11 @@ const create$1 = (uid, x, y, width, height, parentUid) => {
887
887
  focus: 0,
888
888
  version: 0,
889
889
  lines: [],
890
- selections: []
890
+ selections: [],
891
+ editorX: x,
892
+ editorY: y,
893
+ editorWidth: width,
894
+ editorHeight: height
891
895
  };
892
896
  set$1(uid, state, state);
893
897
  return state;
@@ -1084,6 +1088,21 @@ const getCommandIds = () => {
1084
1088
  return commandIds;
1085
1089
  };
1086
1090
 
1091
+ const getFindWidgetPosition = (editorX, editorY, editorWidth) => {
1092
+ const width = 300;
1093
+ const height = 30;
1094
+ const paddingTop = 10;
1095
+ const paddingRight = 20;
1096
+ const x = editorX + editorWidth - width - paddingRight;
1097
+ const y = editorY + paddingTop;
1098
+ return {
1099
+ y,
1100
+ x,
1101
+ width,
1102
+ height
1103
+ };
1104
+ };
1105
+
1087
1106
  const rpcs = Object.create(null);
1088
1107
  const set$a = (id, rpc) => {
1089
1108
  rpcs[id] = rpc;
@@ -1144,10 +1163,19 @@ const getSelections = async editorUid => {
1144
1163
 
1145
1164
  const loadContent = async state => {
1146
1165
  const {
1147
- editorUid
1166
+ editorUid,
1167
+ editorWidth,
1168
+ editorX,
1169
+ editorY
1148
1170
  } = state;
1149
1171
  const lines = await getLines(editorUid);
1150
1172
  const selections = await getSelections(editorUid);
1173
+ const {
1174
+ x,
1175
+ y,
1176
+ width,
1177
+ height
1178
+ } = getFindWidgetPosition(editorX, editorY, editorWidth);
1151
1179
  if (lines.length === 0) {
1152
1180
  return state;
1153
1181
  }
@@ -1164,7 +1192,11 @@ const loadContent = async state => {
1164
1192
  matches,
1165
1193
  matchIndex: 0,
1166
1194
  matchCount,
1167
- version: 1
1195
+ version: 1,
1196
+ x,
1197
+ y,
1198
+ width,
1199
+ height
1168
1200
  };
1169
1201
  };
1170
1202
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/find-widget-worker",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Web Worker for the find widget in Lvce Editor",
5
5
  "repository": {
6
6
  "type": "git",