mirror of
https://github.com/salexdv/bsl_console.git
synced 2025-02-19 19:10:09 +02:00
Изменение механизма создания событий.
Вместо программного клика на скрытой кнопки создается событие и вызывается dispatchEvent
This commit is contained in:
parent
7f1c39262f
commit
6619e13463
@ -1,17 +1,13 @@
|
|||||||
define(['bslGlobals', 'bslMetadata', 'snippets', 'bsl_language', 'vs/editor/editor.main', 'actions'], function () {
|
define(['bslGlobals', 'bslMetadata', 'snippets', 'bsl_language', 'vs/editor/editor.main', 'actions'], function () {
|
||||||
|
|
||||||
selectionText = '';
|
selectionText = '';
|
||||||
lastEvent = {};
|
|
||||||
|
|
||||||
getEvent = function() {
|
|
||||||
let e = lastEvent;
|
|
||||||
lastEvent = {};
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
sendEvent = function(eventName, eventParams) {
|
sendEvent = function(eventName, eventParams) {
|
||||||
lastEvent = {event : eventName, params: eventParams};
|
|
||||||
document.getElementById("event_producer").click();
|
let lastEvent = new MouseEvent('click');
|
||||||
|
lastEvent.eventData1C = {event : eventName, params: eventParams};
|
||||||
|
return dispatchEvent(lastEvent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setText = function(txt, range) {
|
setText = function(txt, range) {
|
||||||
|
@ -19,8 +19,7 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div id="container"></div>
|
<div id="container"></div>
|
||||||
<button id="event_producer" style="display: none"></button>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function getCode() {
|
function getCode() {
|
||||||
|
@ -73,8 +73,7 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="container" style="width:100%;height:400px;border:1px solid grey"></div>
|
<div id="container" style="width:100%;height:400px;border:1px solid grey"></div>
|
||||||
<button id="event_button" style="display: none"></button>
|
|
||||||
|
|
||||||
<script src="./vs/loader.js"></script>
|
<script src="./vs/loader.js"></script>
|
||||||
<script src="./bsl_helper.js"></script>
|
<script src="./bsl_helper.js"></script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user