Skip to content

Commit 9623c12

Browse files
committed
css fix
1 parent 7895f62 commit 9623c12

File tree

2 files changed

+16
-28
lines changed

2 files changed

+16
-28
lines changed

djangocms_text_ckeditor5/static/djangocms_text/css/cms.ckeditor5.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.cms-structure-mode-content {
1+
.cms-structure-mode-content, .cms-structure-mode-structure {
22
.ck.ck-editor__editable_inline {
33
padding: 0;
44
& > :first-child {

private/js/cms.ckeditor5.js

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,8 @@ import CmsPlugin from './ckeditor5_plugins/cms.plugin';
5353
//import { CmsLink, LinkSuggestionsEditing } from "./ckeditor5_plugins/cms-link";
5454

5555
class ClassicEditor extends ClassicEditorBase {}
56-
// class InlineEditor extends InlineEditorBase {}
5756
class BalloonEditor extends BalloonEditorBase {}
5857

59-
// import CmsPlugin from './ckeditor5_plugins/cms.plugin';
60-
// import { CmsLink, LinkSuggestionsEditing } from "./ckeditor5_plugins/cms-link";
6158

6259
// Plugins to include in the build.
6360
var builtinPlugins = [
@@ -120,7 +117,6 @@ var defaultConfig = {
120117
'fontFamily', 'fontSize', 'fontColor', '|',
121118
'mediaEmbed', 'insertTable', 'horizontalLine', 'blockQuote',
122119
],
123-
shouldNotGroupWhenFull: true
124120
},
125121
heading: {
126122
options: [
@@ -208,7 +204,7 @@ class CmsCKEditor5Plugin {
208204
if (!(el.id in this._editors)) {
209205
const inline = el.tagName !== 'TEXTAREA';
210206
this._update_options(options, inline);
211-
console.log(this._blockItems, options);
207+
console.log(options);
212208
if (!inline) {
213209
ClassicEditor.create(el, options.options).then( editor => {
214210
this._editors[el.id] = editor;
@@ -276,21 +272,9 @@ class CmsCKEditor5Plugin {
276272
if (options.options.licenseKey === undefined) {
277273
options.options.licenseKey = 'GPL';
278274
}
279-
const _lowerCase = (s) => String(s[0]).toLowerCase() + String(s).slice(1);
280-
const _update_spacer = (toolbar) => {
281-
if (toolbar === undefined) {
282-
return;
283-
}
284-
for (let i = 0; i < toolbar.length; i++) {
285-
if (Array.isArray(toolbar[i])) {
286-
_update_spacer(toolbar[i]);
287-
} else if (toolbar[i] === '-') {
288-
toolbar[i] = '|';
289-
} else {
290-
toolbar[i] = _lowerCase(toolbar[i]);
291-
}
292-
}
293-
};
275+
if (options.url_endpoint) {
276+
options.options.url_endpoint = options.url_endpoint;
277+
}
294278

295279
var blockToolbar = [];
296280
var topToolbar = [];
@@ -300,21 +284,25 @@ class CmsCKEditor5Plugin {
300284

301285
for (var item of items) {
302286
if (item === 'Format') {
287+
// Expand "Format" widget in inline editor
303288
item = 'heading';
304289
if (inline) {
305290
blockToolbar.push('paragraph', 'heading2', 'heading3', 'heading4', 'heading5');
306291
addingToBlock = true;
307292
item = '|';
308293
}
309-
} else if (item === 'ShowBlocks' && inline) {
294+
} else if (item === 'ShowBlocks' && inline || item === 'Source' && inline) {
295+
// No source editing or show blocks in inline editor
310296
continue;
311297
} else if (this._pluginNames[item] !== undefined) {
312298
item = this._pluginNames[item];
313299
} else if (this._unsupportedPlugins.includes(item)) {
314-
// No CKEditor 5 equivalent
300+
// Skip items with no CKEditor 5 equivalent
315301
continue;
316302
}
317-
if (['-', '|'].includes(item)) {
303+
if (item === '-') {
304+
continue;
305+
} else if (item === '|') {
318306
if (addingToBlock) {
319307
blockToolbar.push(item);
320308
} else {
@@ -342,11 +330,11 @@ class CmsCKEditor5Plugin {
342330
};
343331

344332
buildToolbars(options.options.toolbar || []);
345-
if (topToolbar.length >= 0) {
346-
options.options.toolbar = topToolbar;
333+
if (topToolbar.length > 0) {
334+
options.options.toolbar = {items: topToolbar};
347335
}
348-
if (blockToolbar.length >= 0) {
349-
options.options.blockToolbar = blockToolbar;
336+
if (blockToolbar.length > 0) {
337+
options.options.blockToolbar = {items: blockToolbar};
350338
}
351339
}
352340

0 commit comments

Comments
 (0)