Follow us on

Codestar Support Forum » WordPress Plugins » Codestar Framework

请问csf是有禁止填写一些style样式么

  1. 使用Code Editor 填写此段代码 <view style="display:flex;" ><view>,保存后整段代码会消失,怎么才能不过滤这个代码?

    Posted 11 months ago #

  2. Codestar
    Admin

    Hi,

    Please try to write english with google translate.

    Hmm, If I undestand the question, just you must add sanitize => false parameter like this:

    array(
      'id'       => 'opt-code-editor-5',
      'type'     => 'code_editor',
      'title'    => 'Code Editor without sanitize',
      'sanitize' => false, // <--- see this.
    ),CopyCopied!

    Regards, Codestar

    Posted 11 months ago #
  3. I wrote 'sanitize' = > false according to the document, but it didn't work, and I still couldn't save the code

    Posted 11 months ago #

  4. Codestar
    Admin

    Hi,

    Uh interesting. It works normally in my side. take a look screenshot.

    Regards, Codestar

    Posted 11 months ago #

  5. Posted 11 months ago #

  6. Posted 11 months ago #

  7. Posted 11 months ago #
  8. 保存后 能看到 但是刷新整个页面 就消失了

    Posted 11 months ago #
  9. After saving, you can see it normally, but the refresh page will disappear.

    Posted 11 months ago #

  10. Codestar
    Admin

    Hi,

    All settings are correct. Yes looks so, problem is caused by server. You should talk about that with server provider.

    Also you can test "sanitize => false" in your localhost, you will see that work

    Regards, Codestar

    Posted 11 months ago #
  11. not work! After saving, you can see it normally, but the refresh page will disappear.

    Posted 11 months ago #
  12. After various tests, it is found that this problem will occur if it is used in 'Group'。

    CSF::createSection($prefix, array(
        'title'       => 'Code Editor',
        'description' => 'Visit documentation for more details on this field: <a target="_blank" rel="nofollow"  href="http://codestarframework.com/documentation/#/fields?id=code-editor" target="_blank">Field: code_editor</a>',
        'fields'      => array(
            array(
                'id' => 'forum_modules',
                'type' => 'group',
                'button_title' => '+ 添加新模块',
                'accordion_title_auto' => 'true',
                'fields' => array(
    
                    array(
                        'id'       => 'opt-code-editor-1',
                        'type'     => 'code_editor',
                        'title'    => 'Code Editor',
                        'sanitize' => false,
                        'subtitle' => '<strong>Default Editor</strong> Using: theme: default and mode: htmlmixed',
                    ),
    
                ),
            ),
    
        )
    ));CopyCopied!
    Posted 11 months ago #

  13. Codestar
    Admin

    Hi,

    Oh you mean in "group" field ? If so, you must write "sanitize => false" to group parameter. for eg:

    .
    ..
    ...
      'id' => 'forum_modules',
      'type' => 'group',
      'button_title' => '+ 添加新模块',
      'accordion_title_auto' => 'true',
      'sanitize' => false, // <------------------------------ It must here.
      'fields' => array(
        array(
          'id'       => 'opt-code-editor-1',
          'type'     => 'code_editor',
          'title'    => 'Code Editor',
          'subtitle' => '<strong>Default Editor</strong> Using: theme: default and mode: htmlmixed',
        ),
      ),
    ),
    .
    ..
    ...CopyCopied!

    Regards, Codestar

    Posted 11 months ago #
  14. According to your code, it still doesn't work. Have you tested it

    Posted 11 months ago #

  15. Codestar
    Admin

    Hi,

    I haven't any idea really, It works correctly in my side.

    Hey, I have created "textarea" and "code_editor" in demo. You can test it on: http://codestarthemes.com/plugins/codestar-framework/wp-login.php?login=demo

    See "jianbo" tab:

    Btw, my code is like this:

    CSF::createSection( $prefix, array(
      'title'  => 'Jianbo',
      'icon'   => 'fas fa-check',
      'fields' => array(
    
        array(
          'id'       => 'opt-textarea-without-sanitize',
          'type'     => 'textarea',
          'title'    => 'Textarea without sanitize',
          'sanitize' => false,
        ),
    
        array(
          'id'       => 'opt-code-editor-without-sanitize',
          'type'     => 'code_editor',
          'title'    => 'Code Editor without sanitize',
          'sanitize' => false,
        ),
    
        array(
          'id'       => 'opt-group-without-sanitize',
          'type'     => 'group',
          'title'    => 'Group',
          'sanitize' => false,
          'fields'   => array(
            array(
              'id'    => 'opt-text',
              'type'  => 'text',
              'title' => 'Text',
            ),
            array(
              'id'    => 'opt-textarea-100',
              'type'  => 'textarea',
              'title' => 'Textarea without sanitize',
            ),
    
            array(
              'id'    => 'opt-code-editor-100',
              'type'  => 'code_editor',
              'title' => 'Code Editor without sanitize',
            ),
          )
        ),
    
      )
    ) );CopyCopied!

    Regards, Codestar

    Posted 11 months ago #