【问题标题】:Can't customize django ckeditor toolbar无法自定义 django ckeditor 工具栏
【发布时间】:2015-09-12 00:27:18
【问题描述】:

我在 django1.6

上安装了 django-ckeditor==4.4.8

但我在工具栏中得到了最少的按钮,我试图改变工具栏以获得更多选项,特别是能够添加图片

这是我得到的:

这些是我的设置:

#ckeditor settings
CKEDITOR_UPLOAD_PATH = "images/"
CKEDITOR_IMAGE_BACKEND = 'pillow'
CKEDITOR_JQUERY_URL = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'

AWS_QUERYSTRING_AUTH = False
CKEDITOR_CONFIGS = {
'default': {
    'toolbar':'Full',
},

}


顺便说一句,我想知道当您添加图片然后从文本编辑器中删除该图片链接时会发生什么, 那张照片要删了吗?

【问题讨论】:

    标签: django ckeditor toolbar django-1.6 django-ckeditor


    【解决方案1】:

    尝试将其放入您的设置文件中:

    CKEDITOR_CONFIGS = {
       'default': {
           'toolbar_Full': [
                ['Styles', 'Format', 'Bold', 'Italic', 'Underline', 'Strike', 'SpellChecker', 'Undo', 'Redo'],
                ['Link', 'Unlink', 'Anchor'],
                ['Image', 'Flash', 'Table', 'HorizontalRule'],
                ['TextColor', 'BGColor'],
                ['Smiley', 'SpecialChar'], ['Source'],
                ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
                ['NumberedList','BulletedList'],
                ['Indent','Outdent'],
                ['Maximize'],
            ],
            'extraPlugins': 'justify,liststyle,indent',
       },
    }
    

    【讨论】:

      【解决方案2】:

      在你的 settings.py 中有这个

      CKEDITOR_CONFIGS = {
          'awesome_ckeditor': {
              'toolbar': 'Basic',
          },
      }
      

      这也是可能选项的完整列表。添加它并注释掉不必要的东西是要走的路。

      CKEDITOR_CONFIGS = {
          'default': {
              'skin': 'moono',
              # 'skin': 'office2013',
              'toolbar_Basic': [
                  ['Source', '-', 'Bold', 'Italic']
              ],
              'toolbar_YourCustomToolbarConfig': [
                  {'name': 'document', 'items': ['Source', '-', 'Save', 'NewPage', 'Preview', 'Print', '-', 'Templates']},
                  {'name': 'clipboard', 'items': ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo']},
                  {'name': 'editing', 'items': ['Find', 'Replace', '-', 'SelectAll']},
                  {'name': 'forms',
                   'items': ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton',
                             'HiddenField']},
                  '/',
                  {'name': 'basicstyles',
                   'items': ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']},
                  {'name': 'paragraph',
                   'items': ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-',
                             'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl',
                             'Language']},
                  {'name': 'links', 'items': ['Link', 'Unlink', 'Anchor']},
                  {'name': 'insert',
                   'items': ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe']},
                  '/',
                  {'name': 'styles', 'items': ['Styles', 'Format', 'Font', 'FontSize']},
                  {'name': 'colors', 'items': ['TextColor', 'BGColor']},
                  {'name': 'tools', 'items': ['Maximize', 'ShowBlocks']},
                  {'name': 'about', 'items': ['About']},
                  '/',  # put this to force next toolbar on new line
                  {'name': 'yourcustomtools', 'items': [
                      # put the name of your editor.ui.addButton here
                      'Preview',
                      'Maximize',
      
                  ]},
              ],
              'toolbar': 'YourCustomToolbarConfig',  # put selected toolbar config here
              # 'toolbarGroups': [{ 'name': 'document', 'groups': [ 'mode', 'document', 'doctools' ] }],
              # 'height': 291,
              # 'width': '100%',
              # 'filebrowserWindowHeight': 725,
              # 'filebrowserWindowWidth': 940,
              # 'toolbarCanCollapse': True,
              # 'mathJaxLib': '//cdn.mathjax.org/mathjax/2.2-latest/MathJax.js?config=TeX-AMS_HTML',
              'tabSpaces': 4,
              'extraPlugins': ','.join([
                  'uploadimage', # the upload image feature
                  # your extra plugins here
                  'div',
                  'autolink',
                  'autoembed',
                  'embedsemantic',
                  'autogrow',
                  # 'devtools',
                  'widget',
                  'lineutils',
                  'clipboard',
                  'dialog',
                  'dialogui',
                  'elementspath'
              ]),
          }
      }
      

      【讨论】:

        【解决方案3】:

        在你的 settings.py 中有这个

        CKEDITOR_CONFIGS = {
            'default': {
                'toolbar': 'none',
            },
        }
        

        【讨论】:

          猜你喜欢
          • 2014-02-15
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2014-11-02
          • 2019-02-25
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多