how to enable the code for tab and shift+tab key in summernote.js - ckeditor

I used summernote editor in my project at all place. Can anyone have any idea how to make content indent using combination of tab & shift like notepad++.
$('#summernote').summernote({
height: (($(window).height())-150)+'px',
toolbar: [
// [groupName, [list of button]]
['style1', ['style']],
['style3', ['bold', 'italic', 'underline', 'hr']],
['para', ['ul', 'ol', 'paragraph']],
['font', ['strikethrough', 'superscript', 'subscript']],
['style4', ['fontname', 'fontsizeunit']],
['fontsize', ['fontsize', 'height']],
['color', ['color']],
['insert', [ 'ajaximageupload', 'link', 'video', 'table']],
['view', ['fullscreen', 'codeview', 'help']],
['style2', ['undo', 'redo', 'clear']]
],
disableResizeEditor: true
});
$('.note-statusbar').hide();
Thanks in advance.

Related

CKEditor 4 react dropdowns does not opening, when editor switch to full screen mode in Next.Js

I'm using CKEditor 4 react in my Next.js project. I have a problem in my dropdown toolbars when editor switched on full screen mod. My problem is as follows :‌
on clicking on the font-size drop down in toolbar the options appear and I can select a size (It works correctly as expected)
I click on "Maximize" button in toolbar and the screen size change
Now I repeat step1 again but options of font-size drop down doesn't appear (Not expected behavior)
<CKEditor
data={this.state.static_page.content}
onChange={this.onEditorChange}
config = {{
allowedContent : true ,
embed_provider: '//ckeditor.iframe.ly/api/oembed?url={url}&callback={callback}',
extraPlugins :`justify,font,colorbutton,smiley,pagebreak,iframe,find,save,exportpdf,preview,print,selectall,forms,copyformatting,showblocks,uploadfile,uploadimage,autoembed,embed`,
filebrowserBrowseUrl: photo_url,
filebrowserUploadUrl: photo_url,
toolbar : [
{ name: 'document', items: [ 'Source', '-', 'Save', 'NewPage', 'ExportPdf', 'Preview', 'Print', '-', ] },
{ name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
{ name: 'editing', items: [ 'Find', 'Replace', '-', 'SelectAll', '-'
// , 'Scayt'
] },
'/',
{ name: 'forms', items: [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton'
// , 'HiddenField'
] },
'/',
{ name: 'basicstyles', items: [ 'Bold', 'Italic', 'Underline', 'Strike',
// 'Subscript',
// 'Superscript',
'-', 'CopyFormatting', 'RemoveFormat'
] },
{ name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote',
// 'CreateDiv',
'-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-',
// 'BidiLtr', 'BidiRtl',
// 'Language'
] },
{ name: 'links', items: [ 'Link','Unlink', 'Anchor'
// ,'autolink'
] },
{ name: 'insert', items: [ 'Image','Embed','Auto-embed', 'Iframe', 'Table', 'HorizontalRule', 'Smiley','SpecialChar', 'PageBreak' ] },
'/',
{ name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
{ name: 'tools', items: [ 'Maximize', 'ShowBlocks' ] },
],
language: "fa",
uiColor :'#b9a168',
// extraAllowedContent : 'button(*)[*]' ,
extraAllowedContent :true,
copyFormatting_allowRules :true,
copyFormatting_allowedContexts:true,
contentsLanguage :'fa',
contentsLangDirection : 'rtl',
// justifyClasses :['AlignLeft', 'AlignCenter', 'AlignRight', 'AlignJustify' ],
pasteFilter:'semantic-content',
removeEmpty : false,
}}
// onPaste ={this.onEditorPaste}
// onBeforeLoad={console.log("onBeforeLoad")}
/>
I test this on a react project and it worked correctly, but in next project it doesn't work correctly so I think this problem related to my framework.

CkEditor toolbar config inside Vue component

Does anyone have any idea, what the names are in this array, to configure the toolbar of CkEditor. Like in the docs, you can simply and easily configure the tool bar like this:
editorConfig: {
toolbar: [ 'bold', 'italic', '|', 'paste' ]
},
The only issue is, that those names in the array are WELL hidden. I've been looking for an hour and not able to find anything for the editorConfig in the data elements of my component. There are TONS of examples to be placed in the mysterious config.js file, but no clue where that goes. So I'm sticking with this.
Anyone anywhere have any idea what these names are?
This example will help: https://stackoverflow.com/a/60135719/4322960
editor: ClassicEditor,
editorData: 'ckeditor 5 for laravel and vuejs',
editorConfig: {
toolbar: {
items: [
'heading',
'|',
'bold',
'italic',
'|',
'bulletedList',
'numberedList',
'|',
'insertTable',
'|',
'imageUpload',
'|',
'undo',
'redo'
]
},
image: {
toolbar: [
'imageStyle:full',
'imageStyle:side',
'|',
'imageTextAlternative'
]
},
table: {
contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ]
},
},

Executing var video_overview = $('#upl_overview_id').summernote('code'); returns object not html text

My initialization:
function init_video_summernote(id_val,my_placeholder,my_width,my_height)
{
$( id_val ).summernote('destroy');
$( id_val ).summernote(
{
placeholder: my_placeholder,
//height: my_height,
//width: my_width,
toolbar: [
['style', ['style']],
['font', ['bold', 'italic', 'underline', 'clear']],
['fontname', ['fontname']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
['table', ['table']],
['view', ['fullscreen', 'codeview']],
['help', ['help']]
],
lineHeights: ['1.0', '1.2', '1.4', '1.5', '1.6', '1.8', '2.0', '3.0'],
fontNames: [
'Arial', 'Arial Black', 'Comic Sans MS', 'Courier New',
'Helvetica Neue', 'Impact', 'Lucida Grande',
'Tahoma', 'Times New Roman', 'Verdana'
],
styleTags: ['p', 'blockquote', 'pre', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
lang: {
'en-US': {
font: {
bold: 'Bold',
italic: 'Italic',
underline: 'Underline',
clear: 'Remove Font Style',
height: 'Line Height',
name: 'Font Family'
},
image: {
image: 'Picture',
insert: 'Insert Image',
resizeFull: 'Resize Full',
resizeHalf: 'Resize Half',
resizeQuarter: 'Resize Quarter',
floatLeft: 'Float Left',
floatRight: 'Float Right',
floatNone: 'Float None',
shapeRounded: 'Shape: Rounded',
shapeCircle: 'Shape: Circle',
shapeThumbnail: 'Shape: Thumbnail',
shapeNone: 'Shape: None',
dragImageHere: 'Drag image here',
dropImage: 'Drop image',
selectFromFiles: 'Select from files',
url: 'Image URL',
remove: 'Remove Image'
},
link: {
link: 'Link',
insert: 'Insert Link',
unlink: 'Unlink',
edit: 'Edit',
textToDisplay: 'Text to display',
url: 'To what URL should this link go?',
openInNewWindow: 'Open in new window'
},
table: {
table: 'Table'
},
hr: {
insert: 'Insert Horizontal Rule'
},
style: {
style: 'Style',
normal: 'Normal',
blockquote: 'Quote',
pre: 'Code',
h1: 'Header 1',
h2: 'Header 2',
h3: 'Header 3',
h4: 'Header 4',
h5: 'Header 5',
h6: 'Header 6'
},
lists: {
unordered: 'Unordered list',
ordered: 'Ordered list'
},
options: {
help: 'Help',
fullscreen: 'Full Screen',
codeview: 'Code View'
},
paragraph: {
paragraph: 'Paragraph',
outdent: 'Outdent',
indent: 'Indent',
left: 'Align left',
center: 'Align center',
right: 'Align right',
justify: 'Justify full'
},
color: {
recent: 'Recent Color',
more: 'More Color',
background: 'Background Color',
foreground: 'Foreground Color',
transparent: 'Transparent',
setTransparent: 'Set transparent',
reset: 'Reset',
resetToDefault: 'Reset to default'
},
shortcut: {
shortcuts: 'Keyboard shortcuts',
close: 'Close',
textFormatting: 'Text formatting',
action: 'Action',
paragraphFormatting: 'Paragraph formatting',
documentStyle: 'Document Style'
},
history: {
undo: 'Undo',
redo: 'Redo'
}
}
}
} );
}
When I execute this code to get the html to store in a subsequent db insert.
var video_overview = $('#upl_overview_id').summernote('code');
console.log('OVERVIEW:'+video_overview);
This snippit of code is called from within a Dropzone sending event function.
I get the following in the console output
OVERVIEW:[object Object]
Instead of the text to store in the DB any ideas what I am missing here?
Never mind this was caused by including summernote.js more than once

Can I have a custom toolbar and custom external plugin at the same time using the CDN version of CKEditor?

Let start with I am no expert working with CKEditor but I think I have done this right and it should work but there certainly could be something I am doing wrong. Two days trying to figure it out and I think I have tweaked everything more than once and just cannot get it all to work.
I am loading https://cdn.ckeditor.com/4.6.2/full-all/ckeditor.js and loading an external plugin that I wrote. My plugin is loading great and my icon showed up in the toolbar and context menu at appropriate times and clicking on them made the right things happen. I defined a custom toolbar and I got that just the way I wanted it; defined in a local config file pointed to by customConfig:… in the CKEDITOR.replace() setup call. All was right with the world!
Then I tried to do them both at the same time – but my toolbar icon/button does not get added to my custom toolbar setup. My plugin is still loading and working and I can get my plugin through the context menu and it does what it is supposed to do so I think it is there and still working; but I cannot get the button/icon to show up in the toolbar. I have also tried setting the toolbar in the config file as an array of arrays and as an array of objects with group names – my button does not show up. I have tried defining the toolbar in the CKEDITOR.replace() object as both an array of arrays and as an array of objects and the custom toolbars show up but my toolbar button does not show up. I have tried defining my button in the custom toolbar that I created and by using the editor.ui.addButton method. No button in my custom toolbar!
If I comment out the customConfig: line then my button shows up in the document group of the default toolbar, so I think that I am adding it correctly at the right time with the right API and pointing at the right png file. However, if I uncomment the customConfig and make no other changes and hit Ctrl+F5 multiple times to flush the cache then the button does not show up no matter where I try to put it (document, insert, button group I add via API, etc).
I am fairly sure that my custom config is getting processed and used because it does change the toolbar from the standard built-in one to what I have defined.
Using the default toolbar setup I can add a toolbarButtonGroup and put my button in that but that does not work either when I try to use a custom toolbar setup (I think that I read this was not allowed except for the built in toolbar in the docs).
So my questions are
Is it possible to have a custom toolbar definition AND an external plugin AND have a custom toolbar button all while using the CDN version of CKEditor?
Will I have to build and host my own version of CKEditor so that my plugin is not an external plugin?
Is there something else I am doing wrong?
Here is the custom toolbar setup I created (this is not the end game but one that I created to prove to myself I could create a custom toolbar):
config.toolbar = [
{ name: 'document', items: [ 'Save', 'Preview', 'Print' ] },
{ name: 'basicstyles', items: [ 'Bold', 'Italic', 'Underline', '-', 'CopyFormatting', 'RemoveFormat' ] },
{ name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
{ name: 'editing', items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] },
'/',
{ name: 'forms', items: [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
{ name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language' ] },
{ name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] },
{ name: 'insert', items: [ 'Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe' ] },
'/',
{ name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize', 'Strike', 'Subscript', 'Superscript' ] },
{ name: 'tools', items: [ 'Maximize', 'ShowBlocks', 'Source' ] },
{ name: 'about', items: [ 'About' ] }
];
Here is the custom toolbar setup I created with my icon/button in it (it is the xrr first item in the document group:
config.toolbar = [
{ name: 'document', items: [ ‘xrr’, 'Save', 'Preview', 'Print' ] },
{ name: 'basicstyles', items: [ 'Bold', 'Italic', 'Underline', '-', 'CopyFormatting', 'RemoveFormat' ] },
{ name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
{ name: 'editing', items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] },
'/',
{ name: 'forms', items: [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
{ name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language' ] },
{ name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] },
{ name: 'insert', items: [ 'Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe' ] },
'/',
{ name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize', 'Strike', 'Subscript', 'Superscript' ] },
{ name: 'tools', items: [ 'Maximize', 'ShowBlocks', 'Source' ] },
{ name: 'about', items: [ 'About' ] }
];
Here is how I add the button to the toolbar – this works for the built in toolbar but not with the custom definition above:
editor.ui.addButton( 'xrr', { label: 'Create RR Placeholder', // lang.toolbar,
command: 'xrr',
toolbar: 'document',
icon: 'xrr'
}
);
Thanks so much for any help anyone can provide!

CKEditor CDN Using local plugin reverts to original textrea

After I add the wordcount plugin it just reverts back to my orignal text area.
Here is the code I have (js is not my thing by any means):
<textarea id="editor1" name="editor1" maxlength="10" placeholder="5000 Characters Max.(with HTML)"></textarea>
<script>
CKEDITOR.plugins.addExternal( 'wordcount', '/ckeditor/plugins/wordcount/');
config.wordcount = {
// Whether or not you want to show the Word Count
showWordCount: true,
// Whether or not you want to show the Char Count
showCharCount: false,
// Maximum allowed Word Count
maxWordCount: 4,
// Maximum allowed Char Count
maxCharCount: 10
};
CKEDITOR.replace( 'editor1', {
extraPlugins: 'colorbutton,colordialog,font,wordcount',
toolbar: [
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language' ] },
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat' ] },
{ name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
]
} );
</script>
Your config variable (which is undefined) doesn't do anything. You need to set your configuration either in object passed to CKEDITOR.replace or in your config.js file. For more details see Setting CKEditor Configuration guide.
Here the easiest way would be to add wordcount plugin config to the CKEDITOR.replace call, like so:
<textarea id="editor1" name="editor1" maxlength="10" placeholder="5000 Characters Max.(with HTML)"></textarea>
<script>
CKEDITOR.plugins.addExternal( 'wordcount', '../../plug/wordcount/');
CKEDITOR.replace( 'editor1', {
extraPlugins: 'colorbutton,colordialog,font,wordcount',
toolbar: [
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language' ] },
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat' ] },
{ name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
],
wordcount: {
// Whether or not you want to show the Word Count
showWordCount: true,
// Whether or not you want to show the Char Count
showCharCount: false,
// Maximum allowed Word Count
maxWordCount: 4,
// Maximum allowed Char Count
maxCharCount: 10
}
} );
</script>

Resources