跳到主要內容

安裝CKEditor 4.11

下載路徑
選擇版本

安裝到網站
將下載的資料夾移至網站目錄。

下載路徑

網站目錄
html檔案內容
<script src="CKEditor路徑/ckeditor.js"></script>
<form><code class="prettyprint">內容:<textarea id="ckedit"></textarea></code></form>
<script>CKEDITOR.replace('ckedit');</script>


呈現結果


設定toolbar
見到如此煩雜的工具列,看了就是不舒服。
有些工具其實也不必用到,只要在config.js檔設定一些內容,就可以有清爽的工具列了。


 config.toolbar = 'Full';
 config.toolbar_Full =
 [
  { name: 'document', items : [ 'Source'] },
  { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Subscript','Superscript' ] },
  { name: 'paragraph', items : [ 'NumberedList','BulletedList','CreateDiv' ] },
  { name: 'links', items : [ 'Link','Unlink' ] },
  { name: 'insert', items : [ 'Image','Table','HorizontalRule'] },
  { name: 'colors', items : [ 'TextColor','BGColor' ] },
  { name: 'styles', items : [ 'Format','FontSize' ] },
  { name: 'tools', items : [ 'ShowBlocks'] }
 ];
 config.toolbar_Basic =
 [
  ['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink','-','About']
 ];
然後,呈現結果

清爽。

留言

這個網誌中的熱門文章

CentOS 7 + PHP 7 無法上傳檔案

下以動作請使用root權限控制,確保指令可以正確運作。 查看 vi /etc/php.ini ;;;;;;;;;;;;;;;;;;;;;; ; File Uploads ; ;;;;;;;;;;;;;;;;;;;;;; ; Whether to allow HTTP file uploads. ; http://php.net/file-uploads file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). ; http://php.net/upload-tmp-dir ; upload_tmp_dir = ; Maximum allowed size for uploaded files. ; http://php.net/upload-max-filesize upload_max_filesize = 2M 此設定說明,上傳檔案時,會先將檔案存放在預設/tmp 資料夾。 查看 /tmp 的權限應該為 drwxrwxrwt. 10 root root tmp 再往下檢查 /tmp下的檔案權限 ls /tmp -all drwx------. 3 root root systemd-private-xxxxx-httpd.service-xxxxxx 將其擁有者修改為apache chown -R apache /tmp/systemd-private-xxxxx-httpd.service-xxxxxx 再將其權限設定為755 chmod -R 755 /tmp/systemd-private-xxxxx-httpd.service-xxxxxx -------------------------------------------------------------------------------- 再來我們也需檢查PHP程式指定上傳的路徑 假設上傳路徑為 /var/www/html/upload ls /var/www/html/upload drwxr-xr-x. 2 myname web upload 將其擁有者修改...

Colorbox 使用筆記

Colorbox 詳細使用說明請參考 a jQuery lightbox 情境一: 當開發RWD網頁時,我想將 lightbox 的寬度依顯示螢幕的寬度來決定。 想讓 lightbox 的內容不會太擁擠或太空洞。 <script> var deviceWidth = 0; $(function() { deviceWidth = $(window).width(); $(window).resize(function(){ deviceWidth = $(window).width(); }); }); function showMessage() { var colorboxWidth = "100%"; if (deviceWidth > 767) { colorboxWidth = "70%"; } $.colorbox({innerWidth: colorbox}); } </script> 情境二: 為了讓使用者確實閱讀完 lightbox 內的訊息,想將關閉 lightbox 的熱鍵移除。 <script> function showMessage() { $.colorbox({ escKey: false,  // 按下esc鍵關閉 Colorbox 視窗 arrowKey: false,  // 按下方向鍵關閉 Colorbox 視窗 overlayClose: false  // 在背景遮罩點一下滑鼠左鍵,關閉 Colorbox 視窗 }); } </script> 情境三: 當 Lightbox 內的訊息太長,或需要互動性質的內容,開啓 iframe 功能,互動換頁才不會讓整個網頁換掉。 <script> function showMessage() { $.colorbox({ escKey: false, arrowKey: false, o...