diff --git a/CHANGELOG b/CHANGELOG index f94f21201..d4ba68a52 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -70,6 +70,7 @@ Core: - Added default sorting for agenda, motions, elections, mediafiles and users [#3334, 3348]. - Added config for disabling header and footer in the projector [#3357]. +- Reduced ckeditor toolbar for inline editing [#3368]. Mediafiles: - Fixed reloading of PDF on page change [#3274]. diff --git a/openslides/core/static/js/core/base.js b/openslides/core/static/js/core/base.js index a2cc10163..cfeb467cf 100644 --- a/openslides/core/static/js/core/base.js +++ b/openslides/core/static/js/core/base.js @@ -889,13 +889,19 @@ angular.module('OpenSlidesApp.core', [ CKEDITOR.plugins.add(name, plugin); extraPlugins.push(name); }, - getOptions: function (images) { + /* Provide special keyword in the arguments for a special behaviour: + * Example: getOptions('inline', 'YOffset') + * Available keywords: + * - inline: smaller toolbar + * - YOffset: move the editor toolbar 40px up + */ + getOptions: function () { var extraPluginsString = 'colorbutton,find,sourcedialog,justify,showblocks'; var registeredPluginsString = extraPlugins.join(','); if (registeredPluginsString) { extraPluginsString += ',' + registeredPluginsString; } - return { + var options = { on: { instanceReady: function() { // This adds a listener to ckeditor to remove unwanted blank lines on import. @@ -946,6 +952,7 @@ angular.module('OpenSlidesApp.core', [ } }, customConfig: '', + floatSpaceDockedOffsetY: _.indexOf(arguments, 'YOffset') > -1 ? 35 : 0, disableNativeSpellChecker: false, language_list: [ 'fr:français', @@ -971,7 +978,19 @@ angular.module('OpenSlidesApp.core', [ extraPlugins: extraPluginsString, removePlugins: 'wsc,scayt,a11yhelp,filebrowser,sourcearea,liststyle,tabletools,contextmenu,image', removeButtons: 'Scayt,Anchor,Styles,HorizontalRule', - toolbarGroups: [ + }; + if (_.indexOf(arguments, 'inline') > -1) { + options.toolbarGroups = [ + { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] }, + { name: 'colors', groups: [ 'colors' ] }, + { name: 'paragraph', groups: [ 'list'] }, + { name: 'links', groups: [ 'links' ] }, + { name: 'clipboard', groups: [ 'undo' ] }, + { name: 'document', groups: [ 'mode' ] }, + ]; + options.removeButtons = 'Underline,Subscript,Superscript,PasteFromWord,PasteText,Scayt,Link,Unlink,Anchor,HorizontalRule,Table,Image,Maximize,Source,Format,About,Paste,Cut,Copy'; + } else { + options.toolbarGroups = [ { name: 'clipboard', groups: [ 'clipboard', 'undo' ] }, { name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] }, { name: 'links', groups: [ 'links' ] }, @@ -985,8 +1004,9 @@ angular.module('OpenSlidesApp.core', [ { name: 'paragraph', groups: [ 'list', 'indent' ] }, { name: 'align'}, { name: 'paragraph', groups: [ 'blocks' ] } - ] - }; + ]; + } + return options; } }; } diff --git a/openslides/motions/static/js/motions/motion-services.js b/openslides/motions/static/js/motions/motion-services.js index 5f4442ce6..96acd82f4 100644 --- a/openslides/motions/static/js/motions/motion-services.js +++ b/openslides/motions/static/js/motions/motion-services.js @@ -12,21 +12,19 @@ angular.module('OpenSlidesApp.motions.motionservices', ['OpenSlidesApp.motions', * continued. Else a patch request is send. */ .factory('MotionInlineEditing', [ - 'Editor', 'Motion', '$timeout', 'gettextCatalog', - function (Editor, Motion, $timeout, gettextCatalog) { - var createInstance = function ($scope, motion, selector, versioning, getOriginalData, saveData) { + function (Motion, $timeout, gettextCatalog) { + var createInstance = function ($scope, motion, selector, versioning, ckeditorOptions, getOriginalData, saveData) { var obj = { active: false, changed: false, isEditable: false, trivialChange: false, originalHtml: null, - ckeditorOptions: Editor.getOptions(), }; - obj.ckeditorOptions.readOnly = true; + ckeditorOptions.readOnly = true; obj.setVersion = function (_motion, versionId) { motion = _motion; // If this is not updated, @@ -41,8 +39,8 @@ angular.module('OpenSlidesApp.motions.motionservices', ['OpenSlidesApp.motions', obj.enable = function () { obj.active = true; obj.isEditable = true; - obj.ckeditorOptions.language = gettextCatalog.getCurrentLanguage(); - obj.editor = CKEDITOR.inline(selector, obj.ckeditorOptions); + ckeditorOptions.language = gettextCatalog.getCurrentLanguage(); + obj.editor = CKEDITOR.inline(selector, ckeditorOptions); obj.editor.on('change', function () { $timeout(function() { if (obj.editor.getData() != obj.originalHtml) { @@ -129,14 +127,16 @@ angular.module('OpenSlidesApp.motions.motionservices', ['OpenSlidesApp.motions', .factory('MotionCommentsInlineEditing', [ 'MotionInlineEditing', - function (MotionInlineEditing) { + 'Editor', + function (MotionInlineEditing, Editor) { var createInstances = function ($scope, motion) { var commentsInlineEditing = { editors: [] }; + var options = Editor.getOptions('inline', 'YOffset'); _.forEach($scope.commentsFieldsNoSpecialComments, function (field) { var inlineEditing = MotionInlineEditing.createInstance($scope, motion, - 'view-original-comment-inline-editor-' + field.name, false, + 'view-original-comment-inline-editor-' + field.name, false, options, function (obj) { return motion['comment ' + field.name]; }, diff --git a/openslides/motions/static/js/motions/site.js b/openslides/motions/static/js/motions/site.js index f6bb8403d..dfe3af164 100644 --- a/openslides/motions/static/js/motions/site.js +++ b/openslides/motions/static/js/motions/site.js @@ -346,7 +346,7 @@ angular.module('OpenSlidesApp.motions.site', [ required: true }, data: { - ckeditorOptions: Editor.getOptions(images) + ckeditorOptions: Editor.getOptions() } }, { @@ -356,7 +356,7 @@ angular.module('OpenSlidesApp.motions.site', [ label: gettextCatalog.getString('Reason'), }, data: { - ckeditorOptions: Editor.getOptions(images) + ckeditorOptions: Editor.getOptions() } }, { @@ -1186,6 +1186,7 @@ angular.module('OpenSlidesApp.motions.site', [ 'motionId', 'MotionInlineEditing', 'MotionCommentsInlineEditing', + 'Editor', 'Projector', 'ProjectionDefault', 'MotionBlock', @@ -1195,7 +1196,7 @@ angular.module('OpenSlidesApp.motions.site', [ function($scope, $http, $timeout, operator, ngDialog, gettextCatalog, MotionForm, ChangeRecommmendationCreate, ChangeRecommmendationView, MotionChangeRecommendation, Motion, MotionComment, Category, Mediafile, Tag, User, Workflow, Config, motionId, MotionInlineEditing, - MotionCommentsInlineEditing, Projector, ProjectionDefault, MotionBlock, MotionPdfExport, + MotionCommentsInlineEditing, Editor, Projector, ProjectionDefault, MotionBlock, MotionPdfExport, PersonalNoteManager, EditingWarning) { var motion = Motion.get(motionId); Category.bindAll({}, $scope, 'categories'); @@ -1473,7 +1474,7 @@ angular.module('OpenSlidesApp.motions.site', [ // Inline editing functions $scope.inlineEditing = MotionInlineEditing.createInstance($scope, motion, - 'view-original-text-inline-editor', true, + 'view-original-text-inline-editor', true, Editor.getOptions('inline'), function (obj) { return motion.getTextWithLineBreaks($scope.version); }, @@ -1531,7 +1532,7 @@ angular.module('OpenSlidesApp.motions.site', [ }; $scope.commentsInlineEditing = MotionCommentsInlineEditing.createInstances($scope, motion); $scope.personalNoteInlineEditing = MotionInlineEditing.createInstance($scope, motion, - 'personal-note-inline-editor', false, + 'personal-note-inline-editor', false, Editor.getOptions('inline'), function (obj) { return motion.personalNote ? motion.personalNote.note : ''; },