Merge pull request #3368 from FinnStutzenstein/Issue3364
Different ckeditor toolbar for inline editing
This commit is contained in:
commit
ffde351718
@ -70,6 +70,7 @@ Core:
|
|||||||
- Added default sorting for agenda, motions, elections, mediafiles and
|
- Added default sorting for agenda, motions, elections, mediafiles and
|
||||||
users [#3334, 3348].
|
users [#3334, 3348].
|
||||||
- Added config for disabling header and footer in the projector [#3357].
|
- Added config for disabling header and footer in the projector [#3357].
|
||||||
|
- Reduced ckeditor toolbar for inline editing [#3368].
|
||||||
|
|
||||||
Mediafiles:
|
Mediafiles:
|
||||||
- Fixed reloading of PDF on page change [#3274].
|
- Fixed reloading of PDF on page change [#3274].
|
||||||
|
@ -889,13 +889,19 @@ angular.module('OpenSlidesApp.core', [
|
|||||||
CKEDITOR.plugins.add(name, plugin);
|
CKEDITOR.plugins.add(name, plugin);
|
||||||
extraPlugins.push(name);
|
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 extraPluginsString = 'colorbutton,find,sourcedialog,justify,showblocks';
|
||||||
var registeredPluginsString = extraPlugins.join(',');
|
var registeredPluginsString = extraPlugins.join(',');
|
||||||
if (registeredPluginsString) {
|
if (registeredPluginsString) {
|
||||||
extraPluginsString += ',' + registeredPluginsString;
|
extraPluginsString += ',' + registeredPluginsString;
|
||||||
}
|
}
|
||||||
return {
|
var options = {
|
||||||
on: {
|
on: {
|
||||||
instanceReady: function() {
|
instanceReady: function() {
|
||||||
// This adds a listener to ckeditor to remove unwanted blank lines on import.
|
// This adds a listener to ckeditor to remove unwanted blank lines on import.
|
||||||
@ -946,6 +952,7 @@ angular.module('OpenSlidesApp.core', [
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
customConfig: '',
|
customConfig: '',
|
||||||
|
floatSpaceDockedOffsetY: _.indexOf(arguments, 'YOffset') > -1 ? 35 : 0,
|
||||||
disableNativeSpellChecker: false,
|
disableNativeSpellChecker: false,
|
||||||
language_list: [
|
language_list: [
|
||||||
'fr:français',
|
'fr:français',
|
||||||
@ -971,7 +978,19 @@ angular.module('OpenSlidesApp.core', [
|
|||||||
extraPlugins: extraPluginsString,
|
extraPlugins: extraPluginsString,
|
||||||
removePlugins: 'wsc,scayt,a11yhelp,filebrowser,sourcearea,liststyle,tabletools,contextmenu,image',
|
removePlugins: 'wsc,scayt,a11yhelp,filebrowser,sourcearea,liststyle,tabletools,contextmenu,image',
|
||||||
removeButtons: 'Scayt,Anchor,Styles,HorizontalRule',
|
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: 'clipboard', groups: [ 'clipboard', 'undo' ] },
|
||||||
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] },
|
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] },
|
||||||
{ name: 'links', groups: [ 'links' ] },
|
{ name: 'links', groups: [ 'links' ] },
|
||||||
@ -985,8 +1004,9 @@ angular.module('OpenSlidesApp.core', [
|
|||||||
{ name: 'paragraph', groups: [ 'list', 'indent' ] },
|
{ name: 'paragraph', groups: [ 'list', 'indent' ] },
|
||||||
{ name: 'align'},
|
{ name: 'align'},
|
||||||
{ name: 'paragraph', groups: [ 'blocks' ] }
|
{ name: 'paragraph', groups: [ 'blocks' ] }
|
||||||
]
|
];
|
||||||
};
|
}
|
||||||
|
return options;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -12,21 +12,19 @@ angular.module('OpenSlidesApp.motions.motionservices', ['OpenSlidesApp.motions',
|
|||||||
* continued. Else a patch request is send.
|
* continued. Else a patch request is send.
|
||||||
*/
|
*/
|
||||||
.factory('MotionInlineEditing', [
|
.factory('MotionInlineEditing', [
|
||||||
'Editor',
|
|
||||||
'Motion',
|
'Motion',
|
||||||
'$timeout',
|
'$timeout',
|
||||||
'gettextCatalog',
|
'gettextCatalog',
|
||||||
function (Editor, Motion, $timeout, gettextCatalog) {
|
function (Motion, $timeout, gettextCatalog) {
|
||||||
var createInstance = function ($scope, motion, selector, versioning, getOriginalData, saveData) {
|
var createInstance = function ($scope, motion, selector, versioning, ckeditorOptions, getOriginalData, saveData) {
|
||||||
var obj = {
|
var obj = {
|
||||||
active: false,
|
active: false,
|
||||||
changed: false,
|
changed: false,
|
||||||
isEditable: false,
|
isEditable: false,
|
||||||
trivialChange: false,
|
trivialChange: false,
|
||||||
originalHtml: null,
|
originalHtml: null,
|
||||||
ckeditorOptions: Editor.getOptions(),
|
|
||||||
};
|
};
|
||||||
obj.ckeditorOptions.readOnly = true;
|
ckeditorOptions.readOnly = true;
|
||||||
|
|
||||||
obj.setVersion = function (_motion, versionId) {
|
obj.setVersion = function (_motion, versionId) {
|
||||||
motion = _motion; // If this is not updated,
|
motion = _motion; // If this is not updated,
|
||||||
@ -41,8 +39,8 @@ angular.module('OpenSlidesApp.motions.motionservices', ['OpenSlidesApp.motions',
|
|||||||
obj.enable = function () {
|
obj.enable = function () {
|
||||||
obj.active = true;
|
obj.active = true;
|
||||||
obj.isEditable = true;
|
obj.isEditable = true;
|
||||||
obj.ckeditorOptions.language = gettextCatalog.getCurrentLanguage();
|
ckeditorOptions.language = gettextCatalog.getCurrentLanguage();
|
||||||
obj.editor = CKEDITOR.inline(selector, obj.ckeditorOptions);
|
obj.editor = CKEDITOR.inline(selector, ckeditorOptions);
|
||||||
obj.editor.on('change', function () {
|
obj.editor.on('change', function () {
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
if (obj.editor.getData() != obj.originalHtml) {
|
if (obj.editor.getData() != obj.originalHtml) {
|
||||||
@ -129,14 +127,16 @@ angular.module('OpenSlidesApp.motions.motionservices', ['OpenSlidesApp.motions',
|
|||||||
|
|
||||||
.factory('MotionCommentsInlineEditing', [
|
.factory('MotionCommentsInlineEditing', [
|
||||||
'MotionInlineEditing',
|
'MotionInlineEditing',
|
||||||
function (MotionInlineEditing) {
|
'Editor',
|
||||||
|
function (MotionInlineEditing, Editor) {
|
||||||
var createInstances = function ($scope, motion) {
|
var createInstances = function ($scope, motion) {
|
||||||
var commentsInlineEditing = {
|
var commentsInlineEditing = {
|
||||||
editors: []
|
editors: []
|
||||||
};
|
};
|
||||||
|
var options = Editor.getOptions('inline', 'YOffset');
|
||||||
_.forEach($scope.commentsFieldsNoSpecialComments, function (field) {
|
_.forEach($scope.commentsFieldsNoSpecialComments, function (field) {
|
||||||
var inlineEditing = MotionInlineEditing.createInstance($scope, motion,
|
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) {
|
function (obj) {
|
||||||
return motion['comment ' + field.name];
|
return motion['comment ' + field.name];
|
||||||
},
|
},
|
||||||
|
@ -346,7 +346,7 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
ckeditorOptions: Editor.getOptions(images)
|
ckeditorOptions: Editor.getOptions()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -356,7 +356,7 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
label: gettextCatalog.getString('Reason'),
|
label: gettextCatalog.getString('Reason'),
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
ckeditorOptions: Editor.getOptions(images)
|
ckeditorOptions: Editor.getOptions()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1186,6 +1186,7 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
'motionId',
|
'motionId',
|
||||||
'MotionInlineEditing',
|
'MotionInlineEditing',
|
||||||
'MotionCommentsInlineEditing',
|
'MotionCommentsInlineEditing',
|
||||||
|
'Editor',
|
||||||
'Projector',
|
'Projector',
|
||||||
'ProjectionDefault',
|
'ProjectionDefault',
|
||||||
'MotionBlock',
|
'MotionBlock',
|
||||||
@ -1195,7 +1196,7 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
function($scope, $http, $timeout, operator, ngDialog, gettextCatalog, MotionForm,
|
function($scope, $http, $timeout, operator, ngDialog, gettextCatalog, MotionForm,
|
||||||
ChangeRecommmendationCreate, ChangeRecommmendationView, MotionChangeRecommendation,
|
ChangeRecommmendationCreate, ChangeRecommmendationView, MotionChangeRecommendation,
|
||||||
Motion, MotionComment, Category, Mediafile, Tag, User, Workflow, Config, motionId, MotionInlineEditing,
|
Motion, MotionComment, Category, Mediafile, Tag, User, Workflow, Config, motionId, MotionInlineEditing,
|
||||||
MotionCommentsInlineEditing, Projector, ProjectionDefault, MotionBlock, MotionPdfExport,
|
MotionCommentsInlineEditing, Editor, Projector, ProjectionDefault, MotionBlock, MotionPdfExport,
|
||||||
PersonalNoteManager, EditingWarning) {
|
PersonalNoteManager, EditingWarning) {
|
||||||
var motion = Motion.get(motionId);
|
var motion = Motion.get(motionId);
|
||||||
Category.bindAll({}, $scope, 'categories');
|
Category.bindAll({}, $scope, 'categories');
|
||||||
@ -1473,7 +1474,7 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
|
|
||||||
// Inline editing functions
|
// Inline editing functions
|
||||||
$scope.inlineEditing = MotionInlineEditing.createInstance($scope, motion,
|
$scope.inlineEditing = MotionInlineEditing.createInstance($scope, motion,
|
||||||
'view-original-text-inline-editor', true,
|
'view-original-text-inline-editor', true, Editor.getOptions('inline'),
|
||||||
function (obj) {
|
function (obj) {
|
||||||
return motion.getTextWithLineBreaks($scope.version);
|
return motion.getTextWithLineBreaks($scope.version);
|
||||||
},
|
},
|
||||||
@ -1531,7 +1532,7 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
};
|
};
|
||||||
$scope.commentsInlineEditing = MotionCommentsInlineEditing.createInstances($scope, motion);
|
$scope.commentsInlineEditing = MotionCommentsInlineEditing.createInstances($scope, motion);
|
||||||
$scope.personalNoteInlineEditing = MotionInlineEditing.createInstance($scope, motion,
|
$scope.personalNoteInlineEditing = MotionInlineEditing.createInstance($scope, motion,
|
||||||
'personal-note-inline-editor', false,
|
'personal-note-inline-editor', false, Editor.getOptions('inline'),
|
||||||
function (obj) {
|
function (obj) {
|
||||||
return motion.personalNote ? motion.personalNote.note : '';
|
return motion.personalNote ? motion.personalNote.note : '';
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user