[BUGFIX] Make CodeMirror search persistent 90/60490/3
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Wed, 17 Apr 2019 09:24:14 +0000 (11:24 +0200)
committerRichard Haeser <richard@maxserv.com>
Fri, 19 Apr 2019 14:35:05 +0000 (16:35 +0200)
Currently, when searching a term in CodeMirror (used in EXT:t3editor),
the search bar disappears when after the operation, which is super
annoying.

The configuration of CodeMirror is slightly changed to keep the
search bar always present until closed explicitly.

Resolves: #88162
Releases: master, 9.5
Change-Id: I8780d9b10816c1667c14b0a23f50428a5f081579
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60490
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Josef Glatz <josefglatz@gmail.com>
Tested-by: Sven Juergens <typo3@blue-side.de>
Tested-by: Richard Haeser <richard@maxserv.com>
Reviewed-by: Josef Glatz <josefglatz@gmail.com>
Reviewed-by: Sven Juergens <typo3@blue-side.de>
Reviewed-by: Richard Haeser <richard@maxserv.com>
Build/Sources/TypeScript/t3editor/Resources/Public/TypeScript/T3editor.ts
typo3/sysext/t3editor/Resources/Public/JavaScript/T3editor.js

index 722fe3b..19c616b 100644 (file)
@@ -62,6 +62,8 @@ class T3editor {
         require(addons, (): void => {
           const cm = CodeMirror.fromTextArea($textarea.get(0), {
             extraKeys: {
+              'Ctrl-F': 'findPersistent',
+              'Cmd-F': 'findPersistent',
               'Ctrl-Alt-F': (codemirror: any): void => {
                 codemirror.setOption('fullScreen', !codemirror.getOption('fullScreen'));
               },
index 1a4a960..3cce904 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","cm/lib/codemirror","jquery","TYPO3/CMS/Backend/FormEngine"],function(e,t,n,i,o){"use strict";return new(function(){function t(){this.initialize()}return t.createPanelNode=function(e,t){return i("<div />",{class:"CodeMirror-panel CodeMirror-panel-"+e,id:"panel-"+e}).append(i("<span />").text(t)).get(0)},t.prototype.findAndInitializeEditors=function(){i(document).find("textarea.t3editor").each(function(){var r=i(this);if(!r.prop("is_t3editor")){var a=r.data("codemirror-config"),c=a.mode.split("/"),l=i.merge([c.join("/")],JSON.parse(a.addons)),d=JSON.parse(a.options);e(l,function(){var e=n.fromTextArea(r.get(0),{extraKeys:{"Ctrl-Alt-F":function(e){e.setOption("fullScreen",!e.getOption("fullScreen"))},"Ctrl-Space":"autocomplete",Esc:function(e){e.getOption("fullScreen")&&e.setOption("fullScreen",!1)}},fullScreen:!1,lineNumbers:!0,lineWrapping:!0,mode:c[c.length-1]});i.each(d,function(t,n){e.setOption(t,n)}),e.on("change",function(){o.Validation.markFieldAsChanged(r)}),e.addPanel(t.createPanelNode("bottom",r.attr("alt")),{position:"bottom",stable:!0})}),r.prop("is_t3editor",!0)}})},t.prototype.initialize=function(){var e=this;i(function(){e.findAndInitializeEditors()})},t}())});
\ No newline at end of file
+define(["require","exports","cm/lib/codemirror","jquery","TYPO3/CMS/Backend/FormEngine"],function(e,t,n,i,o){"use strict";return new(function(){function t(){this.initialize()}return t.createPanelNode=function(e,t){return i("<div />",{class:"CodeMirror-panel CodeMirror-panel-"+e,id:"panel-"+e}).append(i("<span />").text(t)).get(0)},t.prototype.findAndInitializeEditors=function(){i(document).find("textarea.t3editor").each(function(){var r=i(this);if(!r.prop("is_t3editor")){var a=r.data("codemirror-config"),d=a.mode.split("/"),l=i.merge([d.join("/")],JSON.parse(a.addons)),c=JSON.parse(a.options);e(l,function(){var e=n.fromTextArea(r.get(0),{extraKeys:{"Ctrl-F":"findPersistent","Cmd-F":"findPersistent","Ctrl-Alt-F":function(e){e.setOption("fullScreen",!e.getOption("fullScreen"))},"Ctrl-Space":"autocomplete",Esc:function(e){e.getOption("fullScreen")&&e.setOption("fullScreen",!1)}},fullScreen:!1,lineNumbers:!0,lineWrapping:!0,mode:d[d.length-1]});i.each(c,function(t,n){e.setOption(t,n)}),e.on("change",function(){o.Validation.markFieldAsChanged(r)}),e.addPanel(t.createPanelNode("bottom",r.attr("alt")),{position:"bottom",stable:!0})}),r.prop("is_t3editor",!0)}})},t.prototype.initialize=function(){var e=this;i(function(){e.findAndInitializeEditors()})},t}())});
\ No newline at end of file