[英]Use TYPO3 ckeditor in frontend
是否可以使用TYPO3(8.7.11)在前端使用的相同ckeditor? 我必須用編輯器實現一個用戶表單,我希望前端用戶能夠准確地看到后端顯示的結果 - 所以我需要使用相同的編輯器。
有沒有辦法在不再安裝ckeditor插件的情況下使用同一個編輯器? 也許任何功能很容易包含它或什么?
如果您已經配置了CK-Editor,那么只需在模板中創建這樣的內容:
<html lang="en">
<head>
<meta charset="utf-8">
<title>A Simple Page with CKEditor</title>
<!-- Make sure the path to CKEditor is correct. -->
<script src="../ckeditor.js"></script>
</head>
<body>
<form>
<textarea name="editor1" id="editor1" rows="10" cols="80">
This is my textarea to be replaced with CKEditor.
</textarea>
<script>
// Replace the <textarea id="editor1"> with a CKEditor
// instance, using default configuration.
CKEDITOR.replace( 'editor1' );
</script>
</form>
</body>
</html>
ckeditor.js應該在你的Typo3-source-folder下面: typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/ckeditor.js
代碼示例來自CKEditor 4 Dokumentation,可在此處找到: https : //ckeditor.com/docs/ckeditor4/latest/guide/index.html
編輯:
在我自己測試了這段代碼之后,我注意到這不起作用,因為CKEditor的Typo3-Installation缺少包含樣式定義的style.js-file
。
我從這里下載了標准版本的CKEditor: https : style.js-file
並在同一目錄下插入了style.js-file
(位於文件夾的根目錄下)my ckeditor.js
位於。
添加文件后,包括此代碼:
<script src="/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/ckeditor.js"></script> <form> <textarea name="editor1" id="editor1" rows="10" cols="80"> This is my textarea to be replaced with CKEditor. </textarea> <script> // Replace the <textarea id="editor1"> with a CKEditor // instance, using default configuration. CKEDITOR.replace( 'editor1' ); </script> </form>
在任何模板內部添加ck編輯器。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.