Skip to content

Commit 01c784e

Browse files
author
Igor Šimko
committedMay 7, 2019
Fix word match highliting
1 parent 975235e commit 01c784e

File tree

4 files changed

+41
-7
lines changed

4 files changed

+41
-7
lines changed
 

‎client/client-bundle.js

+16-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎client/client-bundle.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎client/module.js

+16-3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ function PluginService(eventBus, canvas) {
3333
setTimeout(assignOnElementShow, 50)
3434
});
3535

36+
eventBus.on('shape.move.end', function (event) {
37+
setTimeout(initCodeEditor, 50)
38+
setTimeout(assignOnClick, 50)
39+
setTimeout(assignOnElementShow, 50)
40+
});
41+
3642
function assignOnClick() {
3743
document.querySelectorAll('.bpp-properties-tab-link > a').forEach(e => {
3844
e.onclick = function () {
@@ -140,13 +146,20 @@ function PluginService(eventBus, canvas) {
140146
});
141147

142148
myCodeMirror.on('change', function (cMirror) {
143-
// get value right from instance
144-
document.querySelector('#cam-script-val[custom-id="' + cMirror.options.customId + '"]').value = cMirror.getValue();
145-
document.querySelector('#cam-script-val[custom-id="' + cMirror.options.customId + '"]').click()
149+
writeToNativeEditor(cMirror);
150+
});
151+
152+
myCodeMirror.on('paste', function (cMirror) {
153+
writeToNativeEditor(cMirror);
146154
});
147155
});
148156

149157
}
158+
159+
function writeToNativeEditor(cMirror) {
160+
document.querySelector('#cam-script-val[custom-id="' + cMirror.options.customId + '"]').value = cMirror.getValue();
161+
document.querySelector('#cam-script-val[custom-id="' + cMirror.options.customId + '"]').click();
162+
}
150163
}
151164

152165

‎style/style.css

+8
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,11 @@
44
@import '../client/addon/hint/show-hint.css';
55
@import '../client/addon/dialog/dialog.css';
66
@import '../client/addon/search/matchesonscrollbar.css';
7+
8+
.cm-matchhighlight {
9+
background-color: rgba(252, 212, 137, 0.322)
10+
}
11+
12+
.CodeMirror-selection-highlight-scrollbar {
13+
background-color: green
14+
}

0 commit comments

Comments
 (0)
Please sign in to comment.