Commit 8e4875c6 authored by Benjamin Franzke's avatar Benjamin Franzke Committed by Christian Kuhn
Browse files

[BUGFIX] Re-add missing t3editor panel label

The t3editor panel label was removed by accident in
https://review.typo3.org/c/Packages/TYPO3.CMS/+/66225
because it was passed via the invalid textarea alt attribute.

Re-add this label via data-codemirror-config attribute.

Releases: master, 10.4
Resolves: #93115
Related: #92633
Change-Id: Ib743fa28a0249de142ac1d112865b1f2c7bdc216
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/67189


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent a0d27d91
...@@ -116,7 +116,7 @@ class T3editor { ...@@ -116,7 +116,7 @@ class T3editor {
FormEngine.Validation.markFieldAsChanged($textarea); FormEngine.Validation.markFieldAsChanged($textarea);
}); });
const bottomPanel = T3editor.createPanelNode('bottom', $textarea.attr('alt')); const bottomPanel = T3editor.createPanelNode('bottom', config.label);
cm.addPanel( cm.addPanel(
bottomPanel, bottomPanel,
{ {
......
...@@ -120,6 +120,7 @@ class T3editorElement extends AbstractFormElement ...@@ -120,6 +120,7 @@ class T3editorElement extends AbstractFormElement
'text-monospace enable-tab', 'text-monospace enable-tab',
$parameterArray['itemFormElValue'], $parameterArray['itemFormElValue'],
$attributeString, $attributeString,
$this->data['tableName'] . ' > ' . $this->data['fieldName'],
[ [
'target' => 0, 'target' => 0,
'effectivePid' => $this->data['effectivePid'] 'effectivePid' => $this->data['effectivePid']
...@@ -176,6 +177,7 @@ class T3editorElement extends AbstractFormElement ...@@ -176,6 +177,7 @@ class T3editorElement extends AbstractFormElement
* @param string $class Class attribute of HTML tag * @param string $class Class attribute of HTML tag
* @param string $content Content of the editor * @param string $content Content of the editor
* @param string $additionalParams Any additional editor parameters * @param string $additionalParams Any additional editor parameters
* @param string $label Codemirror panel label
* @param array $hiddenfields * @param array $hiddenfields
* *
* @return string Generated HTML code for editor * @return string Generated HTML code for editor
...@@ -186,6 +188,7 @@ class T3editorElement extends AbstractFormElement ...@@ -186,6 +188,7 @@ class T3editorElement extends AbstractFormElement
string $class = '', string $class = '',
string $content = '', string $content = '',
string $additionalParams = '', string $additionalParams = '',
string $label = '',
array $hiddenfields = [] array $hiddenfields = []
): string { ): string {
$code = []; $code = [];
...@@ -205,6 +208,7 @@ class T3editorElement extends AbstractFormElement ...@@ -205,6 +208,7 @@ class T3editorElement extends AbstractFormElement
$attributes['data-codemirror-config'] = json_encode([ $attributes['data-codemirror-config'] = json_encode([
'mode' => $mode->getIdentifier(), 'mode' => $mode->getIdentifier(),
'label' => $label,
'addons' => json_encode($addons), 'addons' => json_encode($addons),
'options' => json_encode($settings) 'options' => json_encode($settings)
]); ]);
......
...@@ -10,4 +10,4 @@ ...@@ -10,4 +10,4 @@
* *
* The TYPO3 project - inspiring people to share! * The TYPO3 project - inspiring people to share!
*/ */
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","cm/lib/codemirror","jquery","TYPO3/CMS/Backend/FormEngine"],(function(e,t,i,r,n){"use strict";i=__importDefault(i),r=__importDefault(r);class o{static createPanelNode(e,t){return r.default("<div />",{class:"CodeMirror-panel CodeMirror-panel-"+e,id:"panel-"+e}).append(r.default("<span />").text(t)).get(0)}constructor(){this.initialize()}initialize(){r.default(()=>{this.observeEditorCandidates()})}observeEditorCandidates(){const e={root:document.body};let t=new IntersectionObserver(e=>{e.forEach(e=>{if(e.intersectionRatio>0){const t=r.default(e.target);t.prop("is_t3editor")||this.initializeEditor(t)}})},e);document.querySelectorAll("textarea.t3editor").forEach(e=>{t.observe(e)})}initializeEditor(t){const a=t.data("codemirror-config"),l=a.mode.split("/"),s=r.default.merge([l.join("/")],JSON.parse(a.addons)),d=JSON.parse(a.options);e(s,()=>{const e=i.default.fromTextArea(t.get(0),{extraKeys:{"Ctrl-F":"findPersistent","Cmd-F":"findPersistent","Ctrl-Alt-F":e=>{e.setOption("fullScreen",!e.getOption("fullScreen"))},"Ctrl-Space":"autocomplete",Esc:e=>{e.getOption("fullScreen")&&e.setOption("fullScreen",!1)}},fullScreen:!1,lineNumbers:!0,lineWrapping:!0,mode:l[l.length-1]});r.default.each(d,(t,i)=>{e.setOption(t,i)}),e.on("change",()=>{n.Validation.markFieldAsChanged(t)});const a=o.createPanelNode("bottom",t.attr("alt"));if(e.addPanel(a,{position:"bottom",stable:!1}),t.attr("rows")){const i=18,r=4;e.setSize(null,parseInt(t.attr("rows"),10)*i+r+a.getBoundingClientRect().height)}else e.getWrapperElement().style.height=document.body.getBoundingClientRect().height-e.getWrapperElement().getBoundingClientRect().top-80+"px",e.setOption("viewportMargin",1/0)}),t.prop("is_t3editor",!0)}}return new o})); var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","cm/lib/codemirror","jquery","TYPO3/CMS/Backend/FormEngine"],(function(e,t,i,r,n){"use strict";i=__importDefault(i),r=__importDefault(r);class o{static createPanelNode(e,t){return r.default("<div />",{class:"CodeMirror-panel CodeMirror-panel-"+e,id:"panel-"+e}).append(r.default("<span />").text(t)).get(0)}constructor(){this.initialize()}initialize(){r.default(()=>{this.observeEditorCandidates()})}observeEditorCandidates(){const e={root:document.body};let t=new IntersectionObserver(e=>{e.forEach(e=>{if(e.intersectionRatio>0){const t=r.default(e.target);t.prop("is_t3editor")||this.initializeEditor(t)}})},e);document.querySelectorAll("textarea.t3editor").forEach(e=>{t.observe(e)})}initializeEditor(t){const a=t.data("codemirror-config"),l=a.mode.split("/"),s=r.default.merge([l.join("/")],JSON.parse(a.addons)),d=JSON.parse(a.options);e(s,()=>{const e=i.default.fromTextArea(t.get(0),{extraKeys:{"Ctrl-F":"findPersistent","Cmd-F":"findPersistent","Ctrl-Alt-F":e=>{e.setOption("fullScreen",!e.getOption("fullScreen"))},"Ctrl-Space":"autocomplete",Esc:e=>{e.getOption("fullScreen")&&e.setOption("fullScreen",!1)}},fullScreen:!1,lineNumbers:!0,lineWrapping:!0,mode:l[l.length-1]});r.default.each(d,(t,i)=>{e.setOption(t,i)}),e.on("change",()=>{n.Validation.markFieldAsChanged(t)});const s=o.createPanelNode("bottom",a.label);if(e.addPanel(s,{position:"bottom",stable:!1}),t.attr("rows")){const i=18,r=4;e.setSize(null,parseInt(t.attr("rows"),10)*i+r+s.getBoundingClientRect().height)}else e.getWrapperElement().style.height=document.body.getBoundingClientRect().height-e.getWrapperElement().getBoundingClientRect().top-80+"px",e.setOption("viewportMargin",1/0)}),t.prop("is_t3editor",!0)}}return new o}));
\ No newline at end of file \ 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