Ver Fonte

Ticket #5384 - Add some way to disable visual editor.

AntonLV há 6 meses atrás
pai
commit
924ba247f7

+ 16 - 0
studio/template/css/forms.css

@@ -53,4 +53,20 @@ div.bx-form-input-language {
 
 div.bx-form-input-language-current {
     font-weight: bold;
+}
+
+/**
+ * Translatable textarea with Editor switcher.
+ */
+.bx-form-input-wrapper-textarea.bx-form-input-translatable .bx-form-input-translation {
+    position: relative;
+}
+.bx-form-input-wrapper-textarea.bx-form-input-translatable .bx-form-input-textarea-switcher {
+    position: absolute;
+    bottom: 0;
+    width: 100%;
+}
+.bx-form-input-wrapper-textarea.bx-form-input-translatable .bx-form-input-textarea-switcher > div {
+    top: auto;
+    bottom: -1.75rem;
 }

+ 2 - 0
studio/template/scripts/BxBaseStudioBuilderPage.php

@@ -1554,6 +1554,7 @@ class BxBaseStudioBuilderPage extends BxDolStudioBuilderPage
                         'value' => $aBlock['content'],
                         'required' => '0',
                         'html' => 2,
+                        'html_toggle' => true,
                         'attrs' => [
                             'id' => $this->aHtmlIds['edit_block_editor_id']
                         ],
@@ -1616,6 +1617,7 @@ class BxBaseStudioBuilderPage extends BxDolStudioBuilderPage
                         'value' => $aBlock['content'],
                         'required' => '0',
                         'html' => 2,
+                        'html_toggle' => true,
                         'db' => [
                             'pass' => 'XssHtml',
                         ],

+ 8 - 0
studio/template/scripts/BxBaseStudioFormView.php

@@ -28,6 +28,14 @@ class BxBaseStudioFormView extends BxDolStudioForm
         ));
     }
 
+    function genRowStandard(&$aInput, $isOneLine = false)
+    {
+        $aInput['attrs_wrapper']['class'] ??= '';
+        $aInput['attrs_wrapper']['class'] .= ' bx-form-input-translatable';
+
+        return parent::genRowStandard($aInput, $isOneLine);
+    }
+
     function genInput(&$aInput)
     {
         $sInput = '';

+ 1 - 1
template/scripts/BxBaseFormView.php

@@ -1634,7 +1634,7 @@ BLAH;
         }
 
         $aTmplVarsSwitcher = [];
-        if($bHtmlEditor && ($aHtmlEditor = $this->getHtmlEditorInfo($aInput['html'], $aInput, $sUniq))) {
+        if(($aInput['html_toggle'] ?? false) && $bHtmlEditor && ($aHtmlEditor = $this->getHtmlEditorInfo($aInput['html'], $aInput, $sUniq))) {
             if(($sJsInit = ($aHtmlEditor['js_call_init'] ?? false)) && ($sJsDestroy = ($aHtmlEditor['js_call_destroy'] ?? false))) {
                 $aInputSwitcher = [
                     'type' => 'switcher',