@logicflow/core 2.1.5 → 2.1.6
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/.turbo/turbo-build$colon$dev.log +2 -2
- package/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +6 -0
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/view/node/BaseNode.js +9 -1
- package/lib/view/node/BaseNode.js +8 -0
- package/package.json +1 -1
- package/src/view/node/BaseNode.tsx +10 -1
- package/stats.html +1 -1
package/es/view/node/BaseNode.js
CHANGED
|
@@ -54,7 +54,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
54
54
|
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
55
55
|
import { Component } from 'preact/compat';
|
|
56
56
|
import { reaction } from 'mobx';
|
|
57
|
-
import { map } from 'lodash-es';
|
|
57
|
+
import { map, isNil, isFunction } from 'lodash-es';
|
|
58
58
|
import Anchor from '../Anchor';
|
|
59
59
|
import { BaseText } from '../text';
|
|
60
60
|
import { ElementState, EventType, TextMode } from '../../constant';
|
|
@@ -239,6 +239,14 @@ var BaseNode = /** @class */ (function (_super) {
|
|
|
239
239
|
else {
|
|
240
240
|
graphModel.eventCenter.emit(EventType.ELEMENT_CLICK, eventOptions);
|
|
241
241
|
graphModel.eventCenter.emit(EventType.NODE_CLICK, eventOptions);
|
|
242
|
+
// 复制粘贴后会出现点击节点时,节点会失去焦点的问题,这里手动让节点获焦以解决这个问题
|
|
243
|
+
var el_1 = e.currentTarget;
|
|
244
|
+
var rAF = !isNil(window) && isFunction(window.requestAnimationFrame)
|
|
245
|
+
? window.requestAnimationFrame.bind(window)
|
|
246
|
+
: function (fn) { return setTimeout(fn, 0); };
|
|
247
|
+
rAF(function () {
|
|
248
|
+
el_1.focus();
|
|
249
|
+
});
|
|
242
250
|
}
|
|
243
251
|
};
|
|
244
252
|
_this.handleContextMenu = function (ev) {
|
|
@@ -243,6 +243,14 @@ var BaseNode = /** @class */ (function (_super) {
|
|
|
243
243
|
else {
|
|
244
244
|
graphModel.eventCenter.emit(constant_1.EventType.ELEMENT_CLICK, eventOptions);
|
|
245
245
|
graphModel.eventCenter.emit(constant_1.EventType.NODE_CLICK, eventOptions);
|
|
246
|
+
// 复制粘贴后会出现点击节点时,节点会失去焦点的问题,这里手动让节点获焦以解决这个问题
|
|
247
|
+
var el_1 = e.currentTarget;
|
|
248
|
+
var rAF = !(0, lodash_es_1.isNil)(window) && (0, lodash_es_1.isFunction)(window.requestAnimationFrame)
|
|
249
|
+
? window.requestAnimationFrame.bind(window)
|
|
250
|
+
: function (fn) { return setTimeout(fn, 0); };
|
|
251
|
+
rAF(function () {
|
|
252
|
+
el_1.focus();
|
|
253
|
+
});
|
|
246
254
|
}
|
|
247
255
|
};
|
|
248
256
|
_this.handleContextMenu = function (ev) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createElement as h, Component } from 'preact/compat'
|
|
2
2
|
import { reaction, IReactionDisposer } from 'mobx'
|
|
3
|
-
import { map } from 'lodash-es'
|
|
3
|
+
import { map, isNil, isFunction } from 'lodash-es'
|
|
4
4
|
import Anchor from '../Anchor'
|
|
5
5
|
import { BaseText } from '../text'
|
|
6
6
|
import LogicFlow from '../../LogicFlow'
|
|
@@ -403,6 +403,15 @@ export abstract class BaseNode<P extends IProps = IProps> extends Component<
|
|
|
403
403
|
} else {
|
|
404
404
|
graphModel.eventCenter.emit(EventType.ELEMENT_CLICK, eventOptions)
|
|
405
405
|
graphModel.eventCenter.emit(EventType.NODE_CLICK, eventOptions)
|
|
406
|
+
// 复制粘贴后会出现点击节点时,节点会失去焦点的问题,这里手动让节点获焦以解决这个问题
|
|
407
|
+
const el = e.currentTarget as HTMLElement
|
|
408
|
+
const rAF =
|
|
409
|
+
!isNil(window) && isFunction(window.requestAnimationFrame)
|
|
410
|
+
? window.requestAnimationFrame.bind(window)
|
|
411
|
+
: (fn: () => void) => setTimeout(fn, 0)
|
|
412
|
+
rAF(() => {
|
|
413
|
+
el.focus()
|
|
414
|
+
})
|
|
406
415
|
}
|
|
407
416
|
}
|
|
408
417
|
|