Commit 67bce955 authored by Andreas Fernandez's avatar Andreas Fernandez Committed by Richard Haeser
Browse files

[BUGFIX] Make CodeMirror search persistent

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: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarJosef Glatz <josefglatz@gmail.com>
Tested-by: Sven Juergens's avatarSven Juergens <typo3@blue-side.de>
Tested-by: Richard Haeser's avatarRichard Haeser <richard@maxserv.com>
Reviewed-by: default avatarJosef Glatz <josefglatz@gmail.com>
Reviewed-by: Sven Juergens's avatarSven Juergens <typo3@blue-side.de>
Reviewed-by: Richard Haeser's avatarRichard Haeser <richard@maxserv.com>
parent 389bb407
......@@ -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'));
},
......
......@@ -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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment