![](/img/trans.png)
[英]React.js CKEditor5 component - problem in creating the component
[英]CKEditor5 react component - add plugins problems
在將CKEditor5組件添加到我的React應用程序中時,我發現我需要添加更多插件-已經完成,每個文檔都添加並重建編輯器,特別是添加:
import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment';
import Font from '@ckeditor/ckeditor5-font/src/font';
import Highlight from '@ckeditor/ckeditor5-highlight/src/highlight';
和重建。 首要問題:
我看過幾個地方:
Array.from( editor.ui.componentFactory.names() );
應該給我一個工具欄項目列表,以便我可以驗證自己是否有需要。.我已更新為使用我正在使用的編輯器的名稱,因此:
Array.from( ClassicEditor.ui.componentFactory.names() );
失敗的原因是ClassicEditor中沒有“ ui” ...我在這里想念什么?
其次-現在我已經安裝了插件,並重建了ckeditor.js,我正在嘗試確保將新內容添加到我現有的React項目中-那里有一個public / ckeditor目錄。 我假設我應該從“ ckeditor5-build-classic / build /”目錄中獲取ckeditor.js,並將其放入public / ckeditor中。 但是我從哪里可以得到實際的插件? 在ckeditor5-build-classic / node_modules / @ ckeditor中似乎有一個設置,但這似乎不起作用。 思考?
我看過幾個地方:
Array.from(editor.ui.componentFactory.names()); 應該給我一個工具欄項目列表,以便我可以驗證自己是否有所需。
我更新為使用正在使用的編輯器的名稱,因此:
Array.from(ClassicEditor.ui.componentFactory.names());
ClassicEditor
是一個類,而不是實例。
您必須這樣做:
ClassicEditor.create( el, config ).then( editor => {
console.log( Array.from( editor.ui.componentFactory.names() ) );
} );
獲取所有可用的工具欄按鈕。
其次-現在我已經安裝了插件,並重建了ckeditor.js,我正在嘗試確保將新內容添加到我現有的React項目中-那里有一個public / ckeditor目錄。 我假設我應該從“ ckeditor5-build-classic / build /”目錄中獲取ckeditor.js,並將其放入public / ckeditor中。 但是我從哪里可以得到實際的插件? 在ckeditor5-build-classic / node_modules / @ ckeditor中似乎有一個設置,但這似乎不起作用。 思想
當您在React組件之外構建編輯器時,您需要的所有插件都應捆綁到構建中,因此您所要做的就是將構建的編輯器復制到React項目中。 在這里描述。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.