標籤:style blog http color io os ar 使用 java
一、jquery.qeditor簡介 1、連結地址
2、其他富文字編輯器的優缺點
首先,正如你在找的很多富文字編輯器,功能有很多,也很複雜,但是很多功能根本用不到,儘管很多編輯器提供選擇功能的功能,但又介面不好看,或者載入較慢,代碼較多
其次,很多編輯器調用麻煩,編輯的內容有太多的style標籤,影響布局。
3.jquery.qeditor編輯器功能介紹
1.介面乾淨整潔,非常適合於小部落格或功能排版功能較少的頁面
2.所有產生的標籤都是html的標準標籤,沒有css的樣式,保持了代碼的整潔
3.自動根據一個 textarea 綁定,讓編輯器無縫的和 form 結合
4.使用 Font-awsome 作為 Toolbar 的按鈕表徵圖,使用簡單,並且支援 Retina Display
5.沈浸式的全屏介面,讓你在全屏介面找到真實預覽的感覺(這個真心推薦)
4.個人認為jquery.qeditor的小小不足
1.相容性略有不足,其作者並沒有測試IE,但是我試了試,在IE9(包括)以下都不可以使用
2.沒有顏色的設定及字型的設定(其實為了保持內容及代碼的乾淨,這些可以沒有)
二、使用jquery.qeditor
jquery.qeditor的使用很簡單,這裡做一個簡單的樣本與說明,可以下載其git上的demo,在本地就行測試
1、引入檔案
該編輯器是基於jquery的,表徵圖是基於Font-awsome,此外,還要引入必須的一個js和css檔案,如下:
<!DOCTYPE html><html><head> <meta charset=utf-8"> <title>jquery.qeditor</title> <link href="//libs.baidu.com/fontawesome/4.0.3/css/font-awesome.min.css" rel="stylesheet"> <link rel="stylesheet" href="css/jquery.qeditor.css" type="text/css"> <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> <script src="js/jquery.qeditor.js" type="text/javascript"></script></head><body> <textarea id="post_body" name="body" class="textarea" placeholder="Type your post"></textarea> <script type="text/javascript"> $("#post_body").qeditor({}); </script></body></html>
基本的格式便是如此,如果想讓邊界好看點,還可以自己寫一點點的css,如下:
2、加點樣式
<style type="text/css" media="screen"> .textarea { background-color: #ffffff; border: 1px solid #cccccc; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -webkit-transition: border linear .2s, box-shadow linear .2s; -moz-transition: border linear .2s, box-shadow linear .2s; -o-transition: border linear .2s, box-shadow linear .2s; transition: border linear .2s, box-shadow linear .2s; padding: 4px 6px; font-size: 14px; line-height: 20px; color: #555555; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; vertical-align: middle; outline: none; height: 400px; } </style>
jquery.qeditor——輕量級文字編輯器