From b7098c2e1825755862e27d89fb5e97dd122ecc9d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 3 Jun 2022 09:52:15 +0200 Subject: [PATCH] Re-add search addon to CodeMirror The browser search does not work well with CodeMirror, re-add the search addon to make Ctrl+F work more or less as expected. This got lost when CodeMirror was adjusted to make use of require.js in 480b6b11d0822015d4fe4515e7a72b495fe78a69. --- wcfsetup/install/files/acp/templates/codemirror.tpl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/codemirror.tpl b/wcfsetup/install/files/acp/templates/codemirror.tpl index a383947801..1abaf8ffa5 100644 --- a/wcfsetup/install/files/acp/templates/codemirror.tpl +++ b/wcfsetup/install/files/acp/templates/codemirror.tpl @@ -15,24 +15,31 @@ 'codemirror/mode/{@$codemirrorMode}/{@$codemirrorMode}', {/if} {/if} + 'codemirror/addon/search/search', 'EventHandler', 'Dom/Traverse', 'Dom/Util' ], ( CodeMirror, {if $codemirrorMode|isset} - CoreMirrorMode, + CodeMirrorMode, {/if} + CodeMirrorSearchAddon, EventHandler, DomTraverse, DomUtil, ) => { const codemirrorCss = document.head.querySelector('link[href$="codemirror.css"]'); if (codemirrorCss === null) { - const link = document.createElement('link'); + let link = document.createElement('link'); link.rel = 'stylesheet'; link.href = '{@$__wcf->getPath()}js/3rdParty/codemirror/codemirror.css'; document.head.appendChild(link); + + link = document.createElement('link'); + link.rel = 'stylesheet'; + link.href = '{@$__wcf->getPath()}js/3rdParty/codemirror/addon/dialog/dialog.css'; + document.head.appendChild(link); } var elements = document.querySelectorAll('{@$codemirrorSelector|encodeJS}'); -- 2.20.1