Skip to content

Commit ad3081f

Browse files
committed
WIP (44)
1 parent ced8b03 commit ad3081f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/WinWebDiffLib/WebDiffWindow.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -682,12 +682,16 @@ class CWebDiffWindow : public IWebDiffWindow
682682
ComPtr<IWebDiffCallback> callback2(callback);
683683
const wchar_t* script =
684684
LR"(
685+
(function() {
685686
const elms = document.querySelectorAll('.wwd-diff');
686-
elms.forEach(function(el) {
687-
el.addEventListener('dblclick', function() {
688-
window.chrome.webview.postMessage('wwdid=' + el.dataset['wwdid']);
687+
if (elms) {
688+
elms.forEach(function(el) {
689+
el.addEventListener('dblclick', function() {
690+
window.chrome.webview.postMessage('wwdid=' + el.dataset['wwdid']);
691+
});
689692
});
690-
});
693+
}
694+
})();
691695
)";
692696
HRESULT hr = m_webWindow[pane].ExecuteScriptInAllFrames(script,
693697
Callback<IWebDiffCallback>([this, pane, callback2](const WebDiffCallbackResult& result) -> HRESULT

0 commit comments

Comments
 (0)