kopia lustrzana https://github.com/jedie/PyInventory
reduce CKEditor plugins
rodzic
1a9ee07f57
commit
57c0e857b3
|
@ -0,0 +1,42 @@
|
|||
"""
|
||||
Helpter
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import ckeditor
|
||||
|
||||
|
||||
ckeditor_path = Path(ckeditor.__file__).parent
|
||||
print('Django-CKEditor path:', ckeditor_path)
|
||||
|
||||
build_config_path = Path(ckeditor_path, 'static/ckeditor/ckeditor/build-config.js')
|
||||
print('Build config:', build_config_path)
|
||||
|
||||
plugins_path = Path(ckeditor_path, 'static/ckeditor/ckeditor/plugins')
|
||||
print('Plugin path:', plugins_path)
|
||||
|
||||
assert plugins_path.is_dir()
|
||||
|
||||
plugins = set(item.name for item in plugins_path.iterdir() if item.is_dir())
|
||||
|
||||
in_plugins = False
|
||||
with build_config_path.open('r') as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
if line == 'plugins : {':
|
||||
in_plugins = True
|
||||
continue
|
||||
|
||||
if in_plugins:
|
||||
if line == '},':
|
||||
break
|
||||
plugin_name = line.split(':',1)[0].strip(" '")
|
||||
plugins.add(plugin_name)
|
||||
|
||||
print("'removePlugins': (")
|
||||
for plugin_name in sorted(plugins):
|
||||
print(f" '{plugin_name}',")
|
||||
print(')')
|
|
@ -142,31 +142,121 @@ DBBACKUP_STORAGE_OPTIONS = {'location': str(__Path(BASE_PATH, 'backups'))}
|
|||
|
||||
CKEDITOR_BASEPATH = STATIC_URL + 'ckeditor/ckeditor/'
|
||||
CKEDITOR_FILENAME_GENERATOR = 'inventory.ckeditor_upload.get_filename'
|
||||
CKEDITOR_DEFAULT_CONFIG = {
|
||||
'skin': 'moono-lisa',
|
||||
'removeButtons': 'Language,Cut,Copy,Paste,Undo,Redo,Anchor',
|
||||
|
||||
# plugins are here: .../site-packages/ckeditor/static/ckeditor/ckeditor/plugins
|
||||
# and here: https://github.com/ckeditor/ckeditor4/tree/major/plugins
|
||||
# See also: .../site-packages/ckeditor/static/ckeditor/ckeditor/build-config.js
|
||||
'removePlugins': (
|
||||
# Generated with .../dev-scripts/ckeditor_info.py
|
||||
'a11yhelp',
|
||||
'about',
|
||||
'adobeair',
|
||||
'ajax',
|
||||
'autoembed',
|
||||
# 'autogrow',
|
||||
'autolink',
|
||||
# 'basicstyles',
|
||||
'bbcode',
|
||||
'bidi',
|
||||
# 'blockquote',
|
||||
'clipboard',
|
||||
'codesnippet',
|
||||
'codesnippetgeshi',
|
||||
# 'colorbutton',
|
||||
# 'colordialog',
|
||||
'contextmenu',
|
||||
'copyformatting',
|
||||
'devtools',
|
||||
'dialog',
|
||||
'dialogadvtab',
|
||||
'div',
|
||||
'divarea',
|
||||
'docprops',
|
||||
# 'elementspath',
|
||||
'embed',
|
||||
'embedbase',
|
||||
'embedsemantic',
|
||||
'enterkey',
|
||||
# 'entities',
|
||||
# 'filebrowser',
|
||||
# 'filetools',
|
||||
'find',
|
||||
'flash',
|
||||
# 'floatingspace',
|
||||
# 'font',
|
||||
# 'format',
|
||||
'forms',
|
||||
# 'horizontalrule',
|
||||
'htmlwriter',
|
||||
'iframe',
|
||||
'iframedialog',
|
||||
# 'image',
|
||||
# 'image2',
|
||||
# 'indentblock',
|
||||
# 'indentlist',
|
||||
# 'justify',
|
||||
'language',
|
||||
# 'lineutils',
|
||||
# 'link',
|
||||
# 'list',
|
||||
# 'liststyle',
|
||||
'magicline',
|
||||
'mathjax',
|
||||
# 'maximize',
|
||||
# 'menubutton',
|
||||
'newpage',
|
||||
'notification',
|
||||
'notificationaggregator',
|
||||
'pagebreak',
|
||||
'pastefromgdocs',
|
||||
'pastefromword',
|
||||
'pastetext',
|
||||
'pastetools',
|
||||
'placeholder',
|
||||
'preview',
|
||||
'print',
|
||||
# 'removeformat',
|
||||
# 'resize',
|
||||
'save',
|
||||
'scayt',
|
||||
'selectall',
|
||||
'sharedspace',
|
||||
# 'showblocks',
|
||||
# 'showborders',
|
||||
'smiley',
|
||||
'sourcearea',
|
||||
'sourcedialog',
|
||||
'specialchar',
|
||||
'stylescombo',
|
||||
'stylesheetparser',
|
||||
'tab',
|
||||
# 'table',
|
||||
# 'tableresize',
|
||||
# 'tableselection',
|
||||
# 'tabletools',
|
||||
'templates',
|
||||
# 'toolbar',
|
||||
'uicolor',
|
||||
# 'undo',
|
||||
# 'uploadimage',
|
||||
# 'uploadwidget',
|
||||
'widget',
|
||||
'wsc',
|
||||
# 'wysiwygarea',
|
||||
'xml',
|
||||
),
|
||||
'toolbar': 'full',
|
||||
'height': '25em',
|
||||
'width': '100%',
|
||||
'filebrowserWindowWidth': 940,
|
||||
'filebrowserWindowHeight': 725,
|
||||
}
|
||||
CKEDITOR_CONFIGS = {
|
||||
'ItemModel.description': {
|
||||
'skin': 'moono-lisa',
|
||||
'removeButtons': 'Language',
|
||||
|
||||
# plugins are here: site-packages/ckeditor/static/ckeditor/ckeditor/plugins
|
||||
'removePlugins': 'wsc,div,flash,iframe,bidi',
|
||||
'toolbar': 'full',
|
||||
'height': '25em',
|
||||
'width': '100%',
|
||||
'filebrowserWindowWidth': 940,
|
||||
'filebrowserWindowHeight': 725,
|
||||
},
|
||||
'LocationModel.description': {
|
||||
'skin': 'moono-lisa',
|
||||
'removeButtons': 'Language',
|
||||
|
||||
# plugins are here: site-packages/ckeditor/static/ckeditor/ckeditor/plugins
|
||||
'removePlugins': 'wsc,div,flash,iframe,bidi',
|
||||
'toolbar': 'full',
|
||||
'height': '25em',
|
||||
'width': '100%',
|
||||
'filebrowserWindowWidth': 940,
|
||||
'filebrowserWindowHeight': 725,
|
||||
}
|
||||
'ItemModel.description': CKEDITOR_DEFAULT_CONFIG,
|
||||
'LocationModel.description': CKEDITOR_DEFAULT_CONFIG
|
||||
}
|
||||
CKEDITOR_RESTRICT_BY_USER = True
|
||||
CKEDITOR_RESTRICT_BY_DATE = True
|
||||
|
|
Ładowanie…
Reference in New Issue