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_BASEPATH = STATIC_URL + 'ckeditor/ckeditor/'
|
||||||
CKEDITOR_FILENAME_GENERATOR = 'inventory.ckeditor_upload.get_filename'
|
CKEDITOR_FILENAME_GENERATOR = 'inventory.ckeditor_upload.get_filename'
|
||||||
CKEDITOR_CONFIGS = {
|
CKEDITOR_DEFAULT_CONFIG = {
|
||||||
'ItemModel.description': {
|
|
||||||
'skin': 'moono-lisa',
|
'skin': 'moono-lisa',
|
||||||
'removeButtons': 'Language',
|
'removeButtons': 'Language,Cut,Copy,Paste,Undo,Redo,Anchor',
|
||||||
|
|
||||||
# plugins are here: site-packages/ckeditor/static/ckeditor/ckeditor/plugins
|
# plugins are here: .../site-packages/ckeditor/static/ckeditor/ckeditor/plugins
|
||||||
'removePlugins': 'wsc,div,flash,iframe,bidi',
|
# and here: https://github.com/ckeditor/ckeditor4/tree/major/plugins
|
||||||
'toolbar': 'full',
|
# See also: .../site-packages/ckeditor/static/ckeditor/ckeditor/build-config.js
|
||||||
'height': '25em',
|
'removePlugins': (
|
||||||
'width': '100%',
|
# Generated with .../dev-scripts/ckeditor_info.py
|
||||||
'filebrowserWindowWidth': 940,
|
'a11yhelp',
|
||||||
'filebrowserWindowHeight': 725,
|
'about',
|
||||||
},
|
'adobeair',
|
||||||
'LocationModel.description': {
|
'ajax',
|
||||||
'skin': 'moono-lisa',
|
'autoembed',
|
||||||
'removeButtons': 'Language',
|
# 'autogrow',
|
||||||
|
'autolink',
|
||||||
# plugins are here: site-packages/ckeditor/static/ckeditor/ckeditor/plugins
|
# 'basicstyles',
|
||||||
'removePlugins': 'wsc,div,flash,iframe,bidi',
|
'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',
|
'toolbar': 'full',
|
||||||
'height': '25em',
|
'height': '25em',
|
||||||
'width': '100%',
|
'width': '100%',
|
||||||
'filebrowserWindowWidth': 940,
|
'filebrowserWindowWidth': 940,
|
||||||
'filebrowserWindowHeight': 725,
|
'filebrowserWindowHeight': 725,
|
||||||
}
|
}
|
||||||
|
CKEDITOR_CONFIGS = {
|
||||||
|
'ItemModel.description': CKEDITOR_DEFAULT_CONFIG,
|
||||||
|
'LocationModel.description': CKEDITOR_DEFAULT_CONFIG
|
||||||
}
|
}
|
||||||
CKEDITOR_RESTRICT_BY_USER = True
|
CKEDITOR_RESTRICT_BY_USER = True
|
||||||
CKEDITOR_RESTRICT_BY_DATE = True
|
CKEDITOR_RESTRICT_BY_DATE = True
|
||||||
|
|
Ładowanie…
Reference in New Issue