Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

k-form-design.umd.js 中有一行代码与Monaco-editor发生事件注册冲突 #32

Closed
ghost opened this issue Nov 22, 2020 · 1 comment

Comments

@ghost
Copy link

ghost commented Nov 22, 2020

背景

使用k-form-design的同时,我在项目中以Monaco-editor作为SQL语句的编辑器,在收集k-form-build的数据之后触发SQL增强来达到我使用表单编辑器的目的。
但是在昨天,我准备将完成的功能整合时,发现Monaco-editormouseEntermouseMovemouseLeave均在抛出异常,排查一段时间后发现系由引入的k-form-design.umd.js中的有对这三个事件做了一定的处理后导致的异常。

有问题的代码

!function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var o={};t.m=e,t.c=o,t.d=function(e,o,n){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,o){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=o(1),u={passive:!0,capture:!1},i=["scroll","wheel","touchstart","touchmove","touchenter","touchend","touchleave","mouseout","mouseleave","mouseup","mousedown","mousemove","mouseenter","mousewheel","mouseover"],s=function(e,t){return void 0!==e?e:-1!==i.indexOf(t)&&u.passive},c=function(e){var t=Object.getOwnPropertyDescriptor(e,"passive");return t&&!0!==t.writable&&void 0===t.set?Object.assign({},e):e};if((0,r.eventListenerOptionsSupported)()){var p=EventTarget.prototype.addEventListener;!function(e){EventTarget.prototype.addEventListener=function(t,o,r){var i="object"===(void 0===r?"undefined":n(r))&&null!==r,p=i?r.capture:r;r=i?c(r):{},r.passive=s(r.passive,t),r.capture=void 0===p?u.capture:p,e.call(this,t,o,r)},EventTarget.prototype.addEventListener._original=e}(p)}},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.eventListenerOptionsSupported=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e}}]);

由于k-form-design.umd.js存在一定程度的压缩代码的关系,这种问题出现了是真的不好找,我几度想放弃。不过由于是周末,房间也正在喊人收拾,就闲着蛋疼搜事件注册的地方一个个看了。

该行代码位于文件的第9614行,应该是作者借鉴的vue-form-making的代码

@Kchengz
Copy link
Owner

Kchengz commented Nov 22, 2020

源码里面没有用到 mouseEnter、mouseMove、mouseLeave 事件,至于上述的代码可能是某个依赖里面的,代码方面没有借鉴或者直接用vue-form-making的,只是在界面布局与操作方式方面有参考

@Kchengz Kchengz closed this as completed Nov 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant