Browse Source

#3783 - Quill - allowed formats

roman.lesnikov@gmail.com 4 years ago
parent
commit
1e1f78f454
3 changed files with 6 additions and 3 deletions
  1. 4 1
      inc/js/editor.quill.js
  2. 1 1
      install/sql/system.sql
  3. 1 1
      template/scripts/BxBaseEditorQuill.php

+ 4 - 1
inc/js/editor.quill.js

@@ -167,7 +167,6 @@ function bx_editor_init(oEditor, oParams){
 
     var oConfig = {              
          theme: oParams.skin,
-         formats: oParams.allowed_tags,
          modules: {
             syntax: true, 
             imageResize: {},
@@ -199,6 +198,10 @@ function bx_editor_init(oEditor, oParams){
         }
     };
     
+    if (oParams.allowed_tags){
+        oConfig.formats = oParams.allowed_tags;
+    }
+    
     oConfig.modules.imageUploader = {
         upload: file => {
             return new Promise((resolve, reject) => {

+ 1 - 1
install/sql/system.sql

@@ -323,7 +323,7 @@ INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `ex
 
 (@iCategoryId, 'sys_quill_insert_as_plain_text', '_adm_stg_cpt_option_sys_quill_insert_as_plain_text', '', 'checkbox', '', '', '', '', 65),
 
-(@iCategoryId, 'sys_quill_allowed_tags', '_adm_stg_cpt_option_sys_quill_allowed_tags', '[\'link\', \'size\', \'image\']', 'digit', '', '', '', '', 67),
+(@iCategoryId, 'sys_quill_allowed_tags', '_adm_stg_cpt_option_sys_quill_allowed_tags', '[\'link\', \'size\', \'image\', \'menthion-link\', \'embed-link\']', 'digit', '', '', '', '', 67),
 
 (@iCategoryId, 'sys_quill_toolbar_mini', '_adm_stg_cpt_option_sys_quill_toolbar_mini', '[\'bold\',\'italic\',\'underline\',\'clean\',{\'list\':\'ordered\'}, {\'list\':\'bullet\'},{ \'align\':\'\'},{\'align\':\'center\'},{\'align\':\'right\'},\'blockquote\',\'link\',\'image\',\'embed\']', 'digit', '', '', '', '', 70),
 (@iCategoryId, 'sys_quill_toolbar_standard', '_adm_stg_cpt_option_sys_quill_toolbar_standard', '[\'bold\',\'italic\',\'underline\',\'clean\',{ \'header\': [1, 2, 3, 4, 5, 6, false] },{\'list\':\'ordered\'}, {\'list\':\'bullet\'},{\'indent\': \'-1\'},{\'indent\': \'+1\'},{ \'align\':\'\'},{\'align\':\'center\'},{\'align\':\'right\'},{\'align\':\'justify\'},\'blockquote\',\'link\',\'image\',\'embed\']', 'digit', '', '', '', '', 73),

+ 1 - 1
template/scripts/BxBaseEditorQuill.php

@@ -122,7 +122,7 @@ class BxBaseEditorQuill extends BxDolEditor
             'bx_var_form_id' => $aAttrs['form_id'],
             'toolbar' => $sToolbarItems ? '[' . $sToolbarItems . ']' : 'false',
             'insert_as_plain_text' => getParam('sys_quill_insert_as_plain_text') == 'on' ? 'true' : 'false',
-            'allowed_tags' => getParam('sys_quill_allowed_tags'),
+            'allowed_tags' => getParam('sys_quill_allowed_tags') == '' ? 'false' : getParam('sys_quill_allowed_tags'),
             'bx_var_css_additional_class' => $sToolbarItems ? '' : 'bx-form-input-html-quill-empty',
             'bx_var_element_name' => str_replace(['-', ' '], '_', $aAttrs['element_name']),
             'bx_var_editor_name' => $sEditorName,