@flozy/editor 10.6.0 → 10.6.1
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.
@@ -164,7 +164,10 @@ export default function LinkSettings(props) {
|
|
164
164
|
setNav(navOption);
|
165
165
|
setNavValue("");
|
166
166
|
},
|
167
|
-
translation: translation
|
167
|
+
translation: translation,
|
168
|
+
radioProps: {
|
169
|
+
disableRipple: true
|
170
|
+
}
|
168
171
|
})
|
169
172
|
})
|
170
173
|
}), /*#__PURE__*/_jsx(Grid, {
|
@@ -124,14 +124,39 @@ const isOverLapLine = ({
|
|
124
124
|
export function getClosestDraggable(x, y, className, activeClassName) {
|
125
125
|
const draggables = document.querySelectorAll(className);
|
126
126
|
const activeDragEle = document.querySelectorAll(activeClassName)[0];
|
127
|
+
const container = document.querySelector("#slate-wrapper-scroll-container");
|
128
|
+
if (!activeDragEle || !container) return [];
|
129
|
+
const containerRect = container.getBoundingClientRect();
|
127
130
|
const {
|
128
131
|
left: aLeft,
|
129
132
|
top: aTop,
|
130
133
|
width: aWidth,
|
131
134
|
height: aHeight
|
132
135
|
} = activeDragEle?.getBoundingClientRect() || {};
|
133
|
-
|
136
|
+
const lines = [];
|
137
|
+
const clampLine = ({
|
138
|
+
x,
|
139
|
+
y,
|
140
|
+
width,
|
141
|
+
height
|
142
|
+
}) => {
|
143
|
+
if (width > 1) {
|
144
|
+
if (x < containerRect.left) x = containerRect.left;
|
145
|
+
if (x + width > containerRect.right) width = containerRect.right - x;
|
146
|
+
}
|
147
|
+
if (height > 1) {
|
148
|
+
if (y < containerRect.top) y = containerRect.top;
|
149
|
+
if (y + height > containerRect.bottom) height = containerRect.bottom - y;
|
150
|
+
}
|
151
|
+
return {
|
152
|
+
x,
|
153
|
+
y,
|
154
|
+
width,
|
155
|
+
height
|
156
|
+
};
|
157
|
+
};
|
134
158
|
draggables.forEach(draggable => {
|
159
|
+
if (draggable === activeDragEle) return;
|
135
160
|
const {
|
136
161
|
left,
|
137
162
|
top,
|
@@ -148,42 +173,45 @@ export function getClosestDraggable(x, y, className, activeClassName) {
|
|
148
173
|
x: xVal,
|
149
174
|
y: yVal
|
150
175
|
}, lines)) {
|
151
|
-
|
152
|
-
y: top,
|
176
|
+
const line = {
|
153
177
|
x: xVal,
|
178
|
+
y: yVal,
|
154
179
|
width: x > left ? Math.abs(aLeft + aWidth - left) : Math.abs(aLeft - (left + width)),
|
155
180
|
height: 1
|
156
|
-
}
|
181
|
+
};
|
182
|
+
lines.push(clampLine(line));
|
157
183
|
}
|
158
184
|
|
159
185
|
// bottom match
|
160
186
|
xVal = x < left ? aLeft : left;
|
161
187
|
yVal = top + height;
|
162
|
-
if (Math.abs(
|
188
|
+
if (Math.abs(yVal - (aTop + aHeight)) <= GUIDE_LINE_THRESHOLD && !isOverLapLine({
|
163
189
|
x: xVal,
|
164
190
|
y: yVal
|
165
191
|
}, lines)) {
|
166
|
-
|
167
|
-
y: yVal,
|
192
|
+
const line = {
|
168
193
|
x: xVal,
|
194
|
+
y: yVal,
|
169
195
|
width: x > left ? Math.abs(aLeft + aWidth - left) : Math.abs(aLeft - (left + width)),
|
170
196
|
height: 1
|
171
|
-
}
|
197
|
+
};
|
198
|
+
lines.push(clampLine(line));
|
172
199
|
}
|
173
200
|
|
174
|
-
// center match
|
201
|
+
// center match (horizontal)
|
175
202
|
xVal = x < left ? aLeft : left;
|
176
203
|
yVal = top + height / 2;
|
177
|
-
if (Math.abs(
|
204
|
+
if (Math.abs(yVal - (aTop + aHeight / 2)) <= GUIDE_LINE_THRESHOLD && !isOverLapLine({
|
178
205
|
x: xVal,
|
179
206
|
y: yVal
|
180
207
|
}, lines, "y")) {
|
181
|
-
|
182
|
-
y: yVal,
|
208
|
+
const line = {
|
183
209
|
x: xVal,
|
210
|
+
y: yVal,
|
184
211
|
width: x > left ? Math.abs(aLeft + aWidth - left) : Math.abs(aLeft - (left + width)),
|
185
212
|
height: 1
|
186
|
-
}
|
213
|
+
};
|
214
|
+
lines.push(clampLine(line));
|
187
215
|
}
|
188
216
|
|
189
217
|
// right match
|
@@ -193,12 +221,13 @@ export function getClosestDraggable(x, y, className, activeClassName) {
|
|
193
221
|
x: xVal,
|
194
222
|
y: yVal
|
195
223
|
}, lines)) {
|
196
|
-
|
197
|
-
y: yVal,
|
224
|
+
const line = {
|
198
225
|
x: xVal,
|
226
|
+
y: yVal,
|
199
227
|
width: 1,
|
200
228
|
height: Math.abs(aTop - top)
|
201
|
-
}
|
229
|
+
};
|
230
|
+
lines.push(clampLine(line));
|
202
231
|
}
|
203
232
|
|
204
233
|
// left match
|
@@ -208,27 +237,29 @@ export function getClosestDraggable(x, y, className, activeClassName) {
|
|
208
237
|
x: xVal,
|
209
238
|
y: yVal
|
210
239
|
}, lines)) {
|
211
|
-
|
212
|
-
y: yVal,
|
240
|
+
const line = {
|
213
241
|
x: xVal,
|
242
|
+
y: yVal,
|
214
243
|
width: 1,
|
215
244
|
height: Math.abs(aTop - top)
|
216
|
-
}
|
245
|
+
};
|
246
|
+
lines.push(clampLine(line));
|
217
247
|
}
|
218
248
|
|
219
|
-
// middle match
|
249
|
+
// middle match (vertical)
|
220
250
|
xVal = left + width / 2;
|
221
251
|
yVal = top < aTop ? top : aTop;
|
222
|
-
if (Math.abs(aLeft + aWidth / 2 -
|
252
|
+
if (Math.abs(aLeft + aWidth / 2 - xVal) <= GUIDE_LINE_THRESHOLD && !isOverLapLine({
|
223
253
|
x: xVal,
|
224
254
|
y: yVal
|
225
255
|
}, lines)) {
|
226
|
-
|
227
|
-
y: yVal,
|
256
|
+
const line = {
|
228
257
|
x: xVal,
|
258
|
+
y: yVal,
|
229
259
|
width: 1,
|
230
260
|
height: Math.abs(aTop - top)
|
231
|
-
}
|
261
|
+
};
|
262
|
+
lines.push(clampLine(line));
|
232
263
|
}
|
233
264
|
});
|
234
265
|
return lines;
|
@@ -158,8 +158,11 @@ const RnD = props => {
|
|
158
158
|
const textElement = currElement?.querySelector(".fgi_type_text");
|
159
159
|
if (breakpoint && textElement && childType === "text" && !enable) {
|
160
160
|
timerId.current = setTimeout(() => {
|
161
|
-
|
162
|
-
|
161
|
+
const {
|
162
|
+
clientHeight
|
163
|
+
} = textElement;
|
164
|
+
// const clientHeight = getTextElementHeight(textElement);
|
165
|
+
|
163
166
|
const {
|
164
167
|
height
|
165
168
|
} = delta || {};
|