CKeditor(BASIC)独立的.js版本。

问题描述 投票:0回答:1

我目前有一个本地的CKeditor副本,我正在导入使用。

<script src="ckeditor.js"></script>

但是... 我注意到在这个版本中,有IMAGE和MEDIA按钮。(这是不需要的)

我读到BASIC版本没有这些选项。

但当我进入 "构建器",并选择了BASIC(没有添加额外的插件)......

https:/ckeditor.comckeditor-5online-builder。

它给了我一个巨大的.zip文件,里面有大量的其他资产...等等。

有没有办法让我创建一个独立的CKeditor.js文件......只有基本的插件选项?

(或者以某种方式编辑这个文件来删除工具栏上的IMAGE & MEDIA按钮?)

当我通过BUILDER... 我删除了IMAGE和MEDIA选项...然后建立了我的版本并下载了它。

我只抓了ckeditor.js文件(从.zip文件中提取)......然后上传。

现在我在源码中看到了它,但页面上没有显示任何可视化的CKeditor工具栏?

plugins ckeditor
1个回答
0
投票

我意识到在实现上需要添加一些额外的代码。

原始的。

<script>
    ClassicEditor.create(document.querySelector('#template_message'));
</script>

应该是这样实现的。

<!-- NEW CKEditor Approach (Customized buttons) -->
                        <script>
                            ClassicEditor.create( document.querySelector( '#template_message' ), {
                                toolbar: {
                                    items: [
                                        'heading',
                                        '|',
                                        'bold',
                                        'italic',
                                        'link',
                                        'bulletedList',
                                        'numberedList',
                                        '|',
                                        'indent',
                                        'outdent',
                                        '|',
                                        'blockQuote',
                                        'insertTable',
                                        'undo',
                                        'redo'
                                    ]
                                },
                                language: 'en-gb',
                                table: {
                                    contentToolbar: [
                                        'tableColumn',
                                        'tableRow',
                                        'mergeTableCells'
                                    ]
                                },
                                licenseKey: '',

                            } )
                            .then( editor => {
                                window.editor = editor;




                            } )
                            .catch( error => {
                                console.error( 'Oops, something gone wrong!' );
                                console.error( 'Please, report the following error in the https://github.com/ckeditor/ckeditor5 with the build id and the error stack trace:' );
                                console.warn( 'Build id: n4w33zuqu2d9-qrolc6ajm7ow' );
                                console.error( error );
                            } );
                        </script>

希望这也能帮助别人。

赞成。Brandon!

*喜欢终于有 "编辑 "了!!!

© www.soinside.com 2019 - 2024. All rights reserved.