Different ckeditor toolbar for inline editing
This commit is contained in:
parent
9d1ebac86e
commit
efbb68cf55
@ -69,6 +69,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].
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -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];
|
||||
},
|
||||
|
@ -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');
|
||||
@ -1472,7 +1473,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);
|
||||
},
|
||||
@ -1497,7 +1498,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 : '';
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user