rails_kindeditor 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +115 -16
- data/app/controllers/kindeditor/assets_controller.rb +119 -42
- data/app/uploaders/kindeditor/asset_uploader.rb +68 -0
- data/app/uploaders/kindeditor/file_uploader.rb +3 -58
- data/app/uploaders/kindeditor/flash_uploader.rb +14 -0
- data/app/uploaders/kindeditor/image_uploader.rb +3 -58
- data/app/uploaders/kindeditor/media_uploader.rb +14 -0
- data/lib/generators/rails_kindeditor/install/install_generator.rb +1 -2
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/kindeditor-init.js +9 -8
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/kindeditor-min.js +158 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/lang/en.js +208 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/lang/zh_CN.js +210 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/lang/zh_TW.js +210 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/clearhtml/clearhtml.js +28 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/code/code.js +57 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/code/prettify.css +13 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/code/prettify.js +28 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/emoticons.js +129 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{0.gif → images/0.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{1.gif → images/1.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{10.gif → images/10.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{100.gif → images/100.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{101.gif → images/101.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{102.gif → images/102.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{103.gif → images/103.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{104.gif → images/104.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{105.gif → images/105.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{106.gif → images/106.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{107.gif → images/107.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{108.gif → images/108.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{109.gif → images/109.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{11.gif → images/11.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{110.gif → images/110.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{111.gif → images/111.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{112.gif → images/112.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{113.gif → images/113.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{114.gif → images/114.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{115.gif → images/115.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{116.gif → images/116.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{117.gif → images/117.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{118.gif → images/118.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{119.gif → images/119.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{12.gif → images/12.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{120.gif → images/120.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{121.gif → images/121.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{122.gif → images/122.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{123.gif → images/123.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{124.gif → images/124.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{125.gif → images/125.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{126.gif → images/126.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{127.gif → images/127.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{128.gif → images/128.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{129.gif → images/129.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{13.gif → images/13.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{130.gif → images/130.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{131.gif → images/131.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{132.gif → images/132.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{133.gif → images/133.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{134.gif → images/134.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{14.gif → images/14.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{15.gif → images/15.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{16.gif → images/16.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{17.gif → images/17.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{18.gif → images/18.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{19.gif → images/19.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{2.gif → images/2.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{20.gif → images/20.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{21.gif → images/21.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{22.gif → images/22.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{23.gif → images/23.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{24.gif → images/24.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{25.gif → images/25.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{26.gif → images/26.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{27.gif → images/27.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{28.gif → images/28.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{29.gif → images/29.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{3.gif → images/3.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{30.gif → images/30.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{31.gif → images/31.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{32.gif → images/32.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{33.gif → images/33.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{34.gif → images/34.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{35.gif → images/35.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{36.gif → images/36.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{37.gif → images/37.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{38.gif → images/38.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{39.gif → images/39.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{4.gif → images/4.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{40.gif → images/40.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{41.gif → images/41.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{42.gif → images/42.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{43.gif → images/43.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{44.gif → images/44.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{45.gif → images/45.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{46.gif → images/46.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{47.gif → images/47.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{48.gif → images/48.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{49.gif → images/49.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{5.gif → images/5.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{50.gif → images/50.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{51.gif → images/51.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{52.gif → images/52.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{53.gif → images/53.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{54.gif → images/54.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{55.gif → images/55.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{56.gif → images/56.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{57.gif → images/57.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{58.gif → images/58.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{59.gif → images/59.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{6.gif → images/6.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{60.gif → images/60.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{61.gif → images/61.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{62.gif → images/62.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{63.gif → images/63.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{64.gif → images/64.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{65.gif → images/65.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{66.gif → images/66.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{67.gif → images/67.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{68.gif → images/68.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{69.gif → images/69.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{7.gif → images/7.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{70.gif → images/70.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{71.gif → images/71.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{72.gif → images/72.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{73.gif → images/73.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{74.gif → images/74.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{75.gif → images/75.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{76.gif → images/76.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{77.gif → images/77.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{78.gif → images/78.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{79.gif → images/79.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{8.gif → images/8.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{80.gif → images/80.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{81.gif → images/81.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{82.gif → images/82.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{83.gif → images/83.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{84.gif → images/84.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{85.gif → images/85.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{86.gif → images/86.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{87.gif → images/87.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{88.gif → images/88.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{89.gif → images/89.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{9.gif → images/9.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{90.gif → images/90.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{91.gif → images/91.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{92.gif → images/92.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{93.gif → images/93.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{94.gif → images/94.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{95.gif → images/95.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{96.gif → images/96.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{97.gif → images/97.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{98.gif → images/98.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{99.gif → images/99.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{qq.gif → images/static.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/filemanager/filemanager.js +189 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/file-16.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/file-64.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/folder-16.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/folder-64.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/go-up.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/flash/flash.js +128 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/image/image.js +226 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/insertfile/insertfile.js +104 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/lineheight/lineheight.js +38 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/link/link.js +59 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/map/map.html +57 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/map/map.js +135 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/media/media.js +136 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/pagebreak/pagebreak.js +26 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/plainpaste/plainpaste.js +41 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/preview/preview.js +31 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/quickformat/quickformat.js +71 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/table/table.js +661 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/template/html/1.html +14 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/template/html/2.html +42 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/template/html/3.html +36 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/template/template.js +58 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/wordpaste/wordpaste.js +57 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/blank.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/flash.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/loading.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/media.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/rm.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/default/bg.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes/default}/default.css +427 -396
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/themes/default/default.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/themes/simple/simple.css +148 -0
- data/lib/generators/rails_kindeditor/migration/migration_generator.rb +16 -3
- data/{app/models → lib/generators/rails_kindeditor/migration/templates/models/active_record}/kindeditor/asset.rb +2 -5
- data/{app/models → lib/generators/rails_kindeditor/migration/templates/models/active_record}/kindeditor/file.rb +1 -2
- data/lib/generators/rails_kindeditor/migration/templates/models/active_record/kindeditor/flash.rb +3 -0
- data/{app/models → lib/generators/rails_kindeditor/migration/templates/models/active_record}/kindeditor/image.rb +1 -2
- data/lib/generators/rails_kindeditor/migration/templates/models/active_record/kindeditor/media.rb +3 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/asset.rb +20 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/file.rb +3 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/flash.rb +3 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/image.rb +3 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/media.rb +3 -0
- data/lib/rails_kindeditor/helper.rb +14 -2
- data/lib/rails_kindeditor/version.rb +1 -1
- data/rails_kindeditor.gemspec +3 -3
- metadata +199 -182
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/kindeditor.js +0 -4688
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/about.html +0 -52
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/accessory.html +0 -74
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/advtable/advtable.html +0 -235
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/advtable/cell.html +0 -201
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/file_manager.css +0 -64
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/file_manager.html +0 -31
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/file_manager.js +0 -221
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/flash.html +0 -69
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/image/image.html +0 -305
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/link/link.html +0 -82
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/media.html +0 -73
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/plainpaste.html +0 -44
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/wordpaste.html +0 -50
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/doc.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/editor.css +0 -47
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/mp3.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/pdf.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/rar.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/xls.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/default/default.gif +0 -0
@@ -0,0 +1,661 @@
|
|
1
|
+
/*******************************************************************************
|
2
|
+
* KindEditor - WYSIWYG HTML Editor for Internet
|
3
|
+
* Copyright (C) 2006-2011 kindsoft.net
|
4
|
+
*
|
5
|
+
* @author Roddy <luolonghao@gmail.com>
|
6
|
+
* @site http://www.kindsoft.net/
|
7
|
+
* @licence http://www.kindsoft.net/license.php
|
8
|
+
*******************************************************************************/
|
9
|
+
|
10
|
+
KindEditor.plugin('table', function(K) {
|
11
|
+
var self = this, name = 'table', lang = self.lang(name + '.'), zeroborder = 'ke-zeroborder';
|
12
|
+
// 取得下一行cell的index
|
13
|
+
function _getCellIndex(table, row, cell) {
|
14
|
+
var rowSpanCount = 0;
|
15
|
+
for (var i = 0, len = row.cells.length; i < len; i++) {
|
16
|
+
if (row.cells[i] == cell) {
|
17
|
+
break;
|
18
|
+
}
|
19
|
+
rowSpanCount += row.cells[i].rowSpan - 1;
|
20
|
+
}
|
21
|
+
return cell.cellIndex - rowSpanCount;
|
22
|
+
}
|
23
|
+
self.plugin.table = {
|
24
|
+
//insert or modify table
|
25
|
+
prop : function(isInsert) {
|
26
|
+
var html = [
|
27
|
+
'<div style="padding:10px 20px;">',
|
28
|
+
//rows, cols
|
29
|
+
'<div class="ke-dialog-row">',
|
30
|
+
'<label for="keRows" style="width:90px;">' + lang.cells + '</label>',
|
31
|
+
lang.rows + ' <input type="text" id="keRows" class="ke-input-text ke-input-number" name="rows" value="" maxlength="4" /> ',
|
32
|
+
lang.cols + ' <input type="text" class="ke-input-text ke-input-number" name="cols" value="" maxlength="4" />',
|
33
|
+
'</div>',
|
34
|
+
//width, height
|
35
|
+
'<div class="ke-dialog-row">',
|
36
|
+
'<label for="keWidth" style="width:90px;">' + lang.size + '</label>',
|
37
|
+
lang.width + ' <input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="" maxlength="4" /> ',
|
38
|
+
'<select name="widthType">',
|
39
|
+
'<option value="%">' + lang.percent + '</option>',
|
40
|
+
'<option value="px">' + lang.px + '</option>',
|
41
|
+
'</select> ',
|
42
|
+
lang.height + ' <input type="text" class="ke-input-text ke-input-number" name="height" value="" maxlength="4" /> ',
|
43
|
+
'<select name="heightType">',
|
44
|
+
'<option value="%">' + lang.percent + '</option>',
|
45
|
+
'<option value="px">' + lang.px + '</option>',
|
46
|
+
'</select>',
|
47
|
+
'</div>',
|
48
|
+
//space, padding
|
49
|
+
'<div class="ke-dialog-row">',
|
50
|
+
'<label for="kePadding" style="width:90px;">' + lang.space + '</label>',
|
51
|
+
lang.padding + ' <input type="text" id="kePadding" class="ke-input-text ke-input-number" name="padding" value="" maxlength="4" /> ',
|
52
|
+
lang.spacing + ' <input type="text" class="ke-input-text ke-input-number" name="spacing" value="" maxlength="4" />',
|
53
|
+
'</div>',
|
54
|
+
//align
|
55
|
+
'<div class="ke-dialog-row">',
|
56
|
+
'<label for="keAlign" style="width:90px;">' + lang.align + '</label>',
|
57
|
+
'<select id="keAlign" name="align">',
|
58
|
+
'<option value="">' + lang.alignDefault + '</option>',
|
59
|
+
'<option value="left">' + lang.alignLeft + '</option>',
|
60
|
+
'<option value="center">' + lang.alignCenter + '</option>',
|
61
|
+
'<option value="right">' + lang.alignRight + '</option>',
|
62
|
+
'</select>',
|
63
|
+
'</div>',
|
64
|
+
//border
|
65
|
+
'<div class="ke-dialog-row">',
|
66
|
+
'<label for="keBorder" style="width:90px;">' + lang.border + '</label>',
|
67
|
+
lang.borderWidth + ' <input type="text" id="keBorder" class="ke-input-text ke-input-number" name="border" value="" maxlength="4" /> ',
|
68
|
+
lang.borderColor + ' <span class="ke-inline-block ke-input-color"></span>',
|
69
|
+
'</div>',
|
70
|
+
//background color
|
71
|
+
'<div class="ke-dialog-row">',
|
72
|
+
'<label for="keBgColor" style="width:90px;">' + lang.backgroundColor + '</label>',
|
73
|
+
'<span class="ke-inline-block ke-input-color"></span>',
|
74
|
+
'</div>',
|
75
|
+
'</div>'
|
76
|
+
].join('');
|
77
|
+
var picker, currentElement;
|
78
|
+
function removePicker() {
|
79
|
+
if (picker) {
|
80
|
+
picker.remove();
|
81
|
+
picker = null;
|
82
|
+
currentElement = null;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
var dialog = self.createDialog({
|
86
|
+
name : name,
|
87
|
+
width : 500,
|
88
|
+
height : 300,
|
89
|
+
title : self.lang(name),
|
90
|
+
body : html,
|
91
|
+
beforeDrag : removePicker,
|
92
|
+
beforeRemove : function() {
|
93
|
+
removePicker();
|
94
|
+
colorBox.unbind();
|
95
|
+
},
|
96
|
+
yesBtn : {
|
97
|
+
name : self.lang('yes'),
|
98
|
+
click : function(e) {
|
99
|
+
var rows = rowsBox.val(),
|
100
|
+
cols = colsBox.val(),
|
101
|
+
width = widthBox.val(),
|
102
|
+
height = heightBox.val(),
|
103
|
+
widthType = widthTypeBox.val(),
|
104
|
+
heightType = heightTypeBox.val(),
|
105
|
+
padding = paddingBox.val(),
|
106
|
+
spacing = spacingBox.val(),
|
107
|
+
align = alignBox.val(),
|
108
|
+
border = borderBox.val(),
|
109
|
+
borderColor = K(colorBox[0]).html() || '',
|
110
|
+
bgColor = K(colorBox[1]).html() || '';
|
111
|
+
//modify table
|
112
|
+
if (table) {
|
113
|
+
if (width !== '') {
|
114
|
+
table.width(width + widthType);
|
115
|
+
} else {
|
116
|
+
table.css('width', '');
|
117
|
+
}
|
118
|
+
if (table[0].width !== undefined) {
|
119
|
+
table.removeAttr('width');
|
120
|
+
}
|
121
|
+
if (height !== '') {
|
122
|
+
table.height(height + heightType);
|
123
|
+
} else {
|
124
|
+
table.css('height', '');
|
125
|
+
}
|
126
|
+
if (table[0].height !== undefined) {
|
127
|
+
table.removeAttr('height');
|
128
|
+
}
|
129
|
+
table.css('background-color', bgColor);
|
130
|
+
if (table[0].bgColor !== undefined) {
|
131
|
+
table.removeAttr('bgColor');
|
132
|
+
}
|
133
|
+
if (padding !== '') {
|
134
|
+
table[0].cellPadding = padding;
|
135
|
+
} else {
|
136
|
+
table.removeAttr('cellPadding');
|
137
|
+
}
|
138
|
+
if (spacing !== '') {
|
139
|
+
table[0].cellSpacing = spacing;
|
140
|
+
} else {
|
141
|
+
table.removeAttr('cellSpacing');
|
142
|
+
}
|
143
|
+
if (align !== '') {
|
144
|
+
table[0].align = align;
|
145
|
+
} else {
|
146
|
+
table.removeAttr('align');
|
147
|
+
}
|
148
|
+
if (border !== '') {
|
149
|
+
table.attr('border', border);
|
150
|
+
} else {
|
151
|
+
table.removeAttr('border');
|
152
|
+
}
|
153
|
+
if (border === '' || border === '0') {
|
154
|
+
table.addClass(zeroborder);
|
155
|
+
} else {
|
156
|
+
table.removeClass(zeroborder);
|
157
|
+
}
|
158
|
+
if (borderColor !== '') {
|
159
|
+
table.attr('borderColor', borderColor);
|
160
|
+
} else {
|
161
|
+
table.removeAttr('borderColor');
|
162
|
+
}
|
163
|
+
self.hideDialog().focus();
|
164
|
+
return;
|
165
|
+
}
|
166
|
+
//insert new table
|
167
|
+
var style = '';
|
168
|
+
if (width !== '') {
|
169
|
+
style += 'width:' + width + widthType + ';';
|
170
|
+
}
|
171
|
+
if (height !== '') {
|
172
|
+
style += 'height:' + height + heightType + ';';
|
173
|
+
}
|
174
|
+
if (bgColor !== '') {
|
175
|
+
style += 'background-color:' + bgColor + ';';
|
176
|
+
}
|
177
|
+
var html = '<table';
|
178
|
+
if (style !== '') {
|
179
|
+
html += ' style="' + style + '"';
|
180
|
+
}
|
181
|
+
if (padding !== '') {
|
182
|
+
html += ' cellpadding="' + padding + '"';
|
183
|
+
}
|
184
|
+
if (spacing !== '') {
|
185
|
+
html += ' cellspacing="' + spacing + '"';
|
186
|
+
}
|
187
|
+
if (align !== '') {
|
188
|
+
html += ' align="' + align + '"';
|
189
|
+
}
|
190
|
+
if (border !== '') {
|
191
|
+
html += ' border="' + border + '"';
|
192
|
+
}
|
193
|
+
if (border === '' || border === '0') {
|
194
|
+
html += ' class="' + zeroborder + '"';
|
195
|
+
}
|
196
|
+
if (borderColor !== '') {
|
197
|
+
html += ' bordercolor="' + borderColor + '"';
|
198
|
+
}
|
199
|
+
html += '>';
|
200
|
+
for (var i = 0; i < rows; i++) {
|
201
|
+
html += '<tr>';
|
202
|
+
for (var j = 0; j < cols; j++) {
|
203
|
+
html += '<td>' + (K.IE ? '' : '<br />') + '</td>';
|
204
|
+
}
|
205
|
+
html += '</tr>';
|
206
|
+
}
|
207
|
+
html += '</table>';
|
208
|
+
self.insertHtml(html).select().hideDialog().focus();
|
209
|
+
self.addBookmark();
|
210
|
+
}
|
211
|
+
}
|
212
|
+
}),
|
213
|
+
div = dialog.div,
|
214
|
+
rowsBox = K('[name="rows"]', div).val(3),
|
215
|
+
colsBox = K('[name="cols"]', div).val(2),
|
216
|
+
widthBox = K('[name="width"]', div).val(100),
|
217
|
+
heightBox = K('[name="height"]', div),
|
218
|
+
widthTypeBox = K('[name="widthType"]', div),
|
219
|
+
heightTypeBox = K('[name="heightType"]', div),
|
220
|
+
paddingBox = K('[name="padding"]', div).val(2),
|
221
|
+
spacingBox = K('[name="spacing"]', div).val(0),
|
222
|
+
alignBox = K('[name="align"]', div),
|
223
|
+
borderBox = K('[name="border"]', div).val(1),
|
224
|
+
colorBox = K('.ke-input-color', div);
|
225
|
+
function setColor(box, color) {
|
226
|
+
color = color.toUpperCase();
|
227
|
+
box.css('background-color', color);
|
228
|
+
box.css('color', color === '#000000' ? '#FFFFFF' : '#000000');
|
229
|
+
box.html(color);
|
230
|
+
}
|
231
|
+
setColor(K(colorBox[0]), '#000000');
|
232
|
+
setColor(K(colorBox[1]), '');
|
233
|
+
function clickHandler(e) {
|
234
|
+
removePicker();
|
235
|
+
if (!picker || this !== currentElement) {
|
236
|
+
var box = K(this),
|
237
|
+
pos = box.pos();
|
238
|
+
picker = K.colorpicker({
|
239
|
+
x : pos.x,
|
240
|
+
y : pos.y + box.height(),
|
241
|
+
z : 811214,
|
242
|
+
selectedColor : K(this).html(),
|
243
|
+
colors : self.colorTable,
|
244
|
+
noColor : self.lang('noColor'),
|
245
|
+
click : function(color) {
|
246
|
+
setColor(box, color);
|
247
|
+
removePicker();
|
248
|
+
}
|
249
|
+
});
|
250
|
+
currentElement = this;
|
251
|
+
}
|
252
|
+
}
|
253
|
+
colorBox.click(clickHandler);
|
254
|
+
// foucs and select
|
255
|
+
rowsBox[0].focus();
|
256
|
+
rowsBox[0].select();
|
257
|
+
var table;
|
258
|
+
if (isInsert) {
|
259
|
+
return;
|
260
|
+
}
|
261
|
+
//get selected table node
|
262
|
+
table = self.plugin.getSelectedTable();
|
263
|
+
if (table) {
|
264
|
+
rowsBox.val(table[0].rows.length);
|
265
|
+
colsBox.val(table[0].rows.length > 0 ? table[0].rows[0].cells.length : 0);
|
266
|
+
rowsBox.attr('disabled', true);
|
267
|
+
colsBox.attr('disabled', true);
|
268
|
+
var match,
|
269
|
+
tableWidth = table[0].style.width || table[0].width,
|
270
|
+
tableHeight = table[0].style.height || table[0].height;
|
271
|
+
if (tableWidth !== undefined && (match = /^(\d+)((?:px|%)*)$/.exec(tableWidth))) {
|
272
|
+
widthBox.val(match[1]);
|
273
|
+
widthTypeBox.val(match[2]);
|
274
|
+
} else {
|
275
|
+
widthBox.val('');
|
276
|
+
}
|
277
|
+
if (tableHeight !== undefined && (match = /^(\d+)((?:px|%)*)$/.exec(tableHeight))) {
|
278
|
+
heightBox.val(match[1]);
|
279
|
+
heightTypeBox.val(match[2]);
|
280
|
+
}
|
281
|
+
paddingBox.val(table[0].cellPadding || '');
|
282
|
+
spacingBox.val(table[0].cellSpacing || '');
|
283
|
+
alignBox.val(table[0].align || '');
|
284
|
+
borderBox.val(table[0].border === undefined ? '' : table[0].border);
|
285
|
+
setColor(K(colorBox[0]), K.toHex(table.attr('borderColor') || ''));
|
286
|
+
setColor(K(colorBox[1]), K.toHex(table[0].style.backgroundColor || table[0].bgColor || ''));
|
287
|
+
widthBox[0].focus();
|
288
|
+
widthBox[0].select();
|
289
|
+
}
|
290
|
+
},
|
291
|
+
//modify cell
|
292
|
+
cellprop : function() {
|
293
|
+
var html = [
|
294
|
+
'<div style="padding:10px 20px;">',
|
295
|
+
//width, height
|
296
|
+
'<div class="ke-dialog-row">',
|
297
|
+
'<label for="keWidth" style="width:90px;">' + lang.size + '</label>',
|
298
|
+
lang.width + ' <input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="" maxlength="4" /> ',
|
299
|
+
'<select name="widthType">',
|
300
|
+
'<option value="%">' + lang.percent + '</option>',
|
301
|
+
'<option value="px">' + lang.px + '</option>',
|
302
|
+
'</select> ',
|
303
|
+
lang.height + ' <input type="text" class="ke-input-text ke-input-number" name="height" value="" maxlength="4" /> ',
|
304
|
+
'<select name="heightType">',
|
305
|
+
'<option value="%">' + lang.percent + '</option>',
|
306
|
+
'<option value="px">' + lang.px + '</option>',
|
307
|
+
'</select>',
|
308
|
+
'</div>',
|
309
|
+
//align
|
310
|
+
'<div class="ke-dialog-row">',
|
311
|
+
'<label for="keAlign" style="width:90px;">' + lang.align + '</label>',
|
312
|
+
lang.textAlign + ' <select id="keAlign" name="textAlign">',
|
313
|
+
'<option value="">' + lang.alignDefault + '</option>',
|
314
|
+
'<option value="left">' + lang.alignLeft + '</option>',
|
315
|
+
'<option value="center">' + lang.alignCenter + '</option>',
|
316
|
+
'<option value="right">' + lang.alignRight + '</option>',
|
317
|
+
'</select> ',
|
318
|
+
lang.verticalAlign + ' <select name="verticalAlign">',
|
319
|
+
'<option value="">' + lang.alignDefault + '</option>',
|
320
|
+
'<option value="top">' + lang.alignTop + '</option>',
|
321
|
+
'<option value="middle">' + lang.alignMiddle + '</option>',
|
322
|
+
'<option value="bottom">' + lang.alignBottom + '</option>',
|
323
|
+
'<option value="baseline">' + lang.alignBaseline + '</option>',
|
324
|
+
'</select>',
|
325
|
+
'</div>',
|
326
|
+
//border
|
327
|
+
'<div class="ke-dialog-row">',
|
328
|
+
'<label for="keBorder" style="width:90px;">' + lang.border + '</label>',
|
329
|
+
lang.borderWidth + ' <input type="text" id="keBorder" class="ke-input-text ke-input-number" name="border" value="" maxlength="4" /> ',
|
330
|
+
lang.borderColor + ' <span class="ke-inline-block ke-input-color"></span>',
|
331
|
+
'</div>',
|
332
|
+
//background color
|
333
|
+
'<div class="ke-dialog-row">',
|
334
|
+
'<label for="keBgColor" style="width:90px;">' + lang.backgroundColor + '</label>',
|
335
|
+
'<span class="ke-inline-block ke-input-color"></span>',
|
336
|
+
'</div>',
|
337
|
+
'</div>'
|
338
|
+
].join('');
|
339
|
+
var picker, currentElement;
|
340
|
+
function removePicker() {
|
341
|
+
if (picker) {
|
342
|
+
picker.remove();
|
343
|
+
picker = null;
|
344
|
+
currentElement = null;
|
345
|
+
}
|
346
|
+
}
|
347
|
+
var dialog = self.createDialog({
|
348
|
+
name : name,
|
349
|
+
width : 500,
|
350
|
+
height : 220,
|
351
|
+
title : self.lang('tablecell'),
|
352
|
+
body : html,
|
353
|
+
beforeDrag : removePicker,
|
354
|
+
beforeRemove : function() {
|
355
|
+
removePicker();
|
356
|
+
colorBox.unbind();
|
357
|
+
},
|
358
|
+
yesBtn : {
|
359
|
+
name : self.lang('yes'),
|
360
|
+
click : function(e) {
|
361
|
+
var width = widthBox.val(),
|
362
|
+
height = heightBox.val(),
|
363
|
+
widthType = widthTypeBox.val(),
|
364
|
+
heightType = heightTypeBox.val(),
|
365
|
+
padding = paddingBox.val(),
|
366
|
+
spacing = spacingBox.val(),
|
367
|
+
textAlign = textAlignBox.val(),
|
368
|
+
verticalAlign = verticalAlignBox.val(),
|
369
|
+
border = borderBox.val(),
|
370
|
+
borderColor = K(colorBox[0]).html() || '',
|
371
|
+
bgColor = K(colorBox[1]).html() || '';
|
372
|
+
cell.css({
|
373
|
+
width : width !== '' ? (width + widthType) : '',
|
374
|
+
height : height !== '' ? (height + heightType) : '',
|
375
|
+
'background-color' : bgColor,
|
376
|
+
'text-align' : textAlign,
|
377
|
+
'vertical-align' : verticalAlign,
|
378
|
+
'border-width' : border,
|
379
|
+
'border-style' : border !== '' ? 'solid' : '',
|
380
|
+
'border-color' : borderColor
|
381
|
+
});
|
382
|
+
self.hideDialog().focus();
|
383
|
+
self.addBookmark();
|
384
|
+
}
|
385
|
+
}
|
386
|
+
}),
|
387
|
+
div = dialog.div,
|
388
|
+
widthBox = K('[name="width"]', div).val(100),
|
389
|
+
heightBox = K('[name="height"]', div),
|
390
|
+
widthTypeBox = K('[name="widthType"]', div),
|
391
|
+
heightTypeBox = K('[name="heightType"]', div),
|
392
|
+
paddingBox = K('[name="padding"]', div).val(2),
|
393
|
+
spacingBox = K('[name="spacing"]', div).val(0),
|
394
|
+
textAlignBox = K('[name="textAlign"]', div),
|
395
|
+
verticalAlignBox = K('[name="verticalAlign"]', div),
|
396
|
+
borderBox = K('[name="border"]', div).val(1),
|
397
|
+
colorBox = K('.ke-input-color', div);
|
398
|
+
function setColor(box, color) {
|
399
|
+
color = color.toUpperCase();
|
400
|
+
box.css('background-color', color);
|
401
|
+
box.css('color', color === '#000000' ? '#FFFFFF' : '#000000');
|
402
|
+
box.html(color);
|
403
|
+
}
|
404
|
+
setColor(K(colorBox[0]), '#000000');
|
405
|
+
setColor(K(colorBox[1]), '');
|
406
|
+
function clickHandler(e) {
|
407
|
+
removePicker();
|
408
|
+
if (!picker || this !== currentElement) {
|
409
|
+
var box = K(this),
|
410
|
+
pos = box.pos();
|
411
|
+
picker = K.colorpicker({
|
412
|
+
x : pos.x,
|
413
|
+
y : pos.y + box.height(),
|
414
|
+
z : 811214,
|
415
|
+
selectedColor : K(this).html(),
|
416
|
+
colors : self.colorTable,
|
417
|
+
noColor : self.lang('noColor'),
|
418
|
+
click : function(color) {
|
419
|
+
setColor(box, color);
|
420
|
+
removePicker();
|
421
|
+
}
|
422
|
+
});
|
423
|
+
currentElement = this;
|
424
|
+
}
|
425
|
+
}
|
426
|
+
colorBox.click(clickHandler);
|
427
|
+
// foucs and select
|
428
|
+
widthBox[0].focus();
|
429
|
+
widthBox[0].select();
|
430
|
+
// get selected cell
|
431
|
+
var cell = self.plugin.getSelectedCell();
|
432
|
+
var match,
|
433
|
+
cellWidth = cell[0].style.width || cell[0].width || '',
|
434
|
+
cellHeight = cell[0].style.height || cell[0].height || '';
|
435
|
+
if ((match = /^(\d+)((?:px|%)*)$/.exec(cellWidth))) {
|
436
|
+
widthBox.val(match[1]);
|
437
|
+
widthTypeBox.val(match[2]);
|
438
|
+
} else {
|
439
|
+
widthBox.val('');
|
440
|
+
}
|
441
|
+
if ((match = /^(\d+)((?:px|%)*)$/.exec(cellHeight))) {
|
442
|
+
heightBox.val(match[1]);
|
443
|
+
heightTypeBox.val(match[2]);
|
444
|
+
}
|
445
|
+
textAlignBox.val(cell[0].style.textAlign || '');
|
446
|
+
verticalAlignBox.val(cell[0].style.verticalAlign || '');
|
447
|
+
var border = cell[0].style.borderWidth || '';
|
448
|
+
if (border) {
|
449
|
+
border = parseInt(border);
|
450
|
+
}
|
451
|
+
borderBox.val(border);
|
452
|
+
setColor(K(colorBox[0]), K.toHex(cell[0].style.borderColor || ''));
|
453
|
+
setColor(K(colorBox[1]), K.toHex(cell[0].style.backgroundColor || ''));
|
454
|
+
widthBox[0].focus();
|
455
|
+
widthBox[0].select();
|
456
|
+
},
|
457
|
+
insert : function() {
|
458
|
+
this.prop(true);
|
459
|
+
},
|
460
|
+
'delete' : function() {
|
461
|
+
var table = self.plugin.getSelectedTable();
|
462
|
+
self.cmd.range.setStartBefore(table[0]).collapse(true);
|
463
|
+
self.cmd.select();
|
464
|
+
table.remove();
|
465
|
+
self.addBookmark();
|
466
|
+
},
|
467
|
+
colinsert : function(offset) {
|
468
|
+
var table = self.plugin.getSelectedTable()[0],
|
469
|
+
row = self.plugin.getSelectedRow()[0],
|
470
|
+
cell = self.plugin.getSelectedCell()[0],
|
471
|
+
index = cell.cellIndex + offset;
|
472
|
+
for (var i = 0, len = table.rows.length; i < len; i++) {
|
473
|
+
var newRow = table.rows[i],
|
474
|
+
newCell = newRow.insertCell(index);
|
475
|
+
newCell.innerHTML = K.IE ? '' : '<br />';
|
476
|
+
// 调整下一行的单元格index
|
477
|
+
index = _getCellIndex(table, newRow, newCell);
|
478
|
+
}
|
479
|
+
self.cmd.range.selectNodeContents(cell).collapse(true);
|
480
|
+
self.cmd.select();
|
481
|
+
self.addBookmark();
|
482
|
+
},
|
483
|
+
colinsertleft : function() {
|
484
|
+
this.colinsert(0);
|
485
|
+
},
|
486
|
+
colinsertright : function() {
|
487
|
+
this.colinsert(1);
|
488
|
+
},
|
489
|
+
rowinsert : function(offset) {
|
490
|
+
var table = self.plugin.getSelectedTable()[0],
|
491
|
+
row = self.plugin.getSelectedRow()[0],
|
492
|
+
cell = self.plugin.getSelectedCell()[0],
|
493
|
+
newRow;
|
494
|
+
if (offset === 1) {
|
495
|
+
newRow = table.insertRow(row.rowIndex + (cell.rowSpan - 1) + offset);
|
496
|
+
} else {
|
497
|
+
newRow = table.insertRow(row.rowIndex);
|
498
|
+
}
|
499
|
+
for (var i = 0, len = row.cells.length; i < len; i++) {
|
500
|
+
var newCell = newRow.insertCell(i);
|
501
|
+
// copy colspan
|
502
|
+
if (offset === 1 && row.cells[i].colSpan > 1) {
|
503
|
+
newCell.colSpan = row.cells[i].colSpan;
|
504
|
+
}
|
505
|
+
newCell.innerHTML = K.IE ? '' : '<br />';
|
506
|
+
}
|
507
|
+
self.cmd.range.selectNodeContents(cell).collapse(true);
|
508
|
+
self.cmd.select();
|
509
|
+
self.addBookmark();
|
510
|
+
},
|
511
|
+
rowinsertabove : function() {
|
512
|
+
this.rowinsert(0);
|
513
|
+
},
|
514
|
+
rowinsertbelow : function() {
|
515
|
+
this.rowinsert(1);
|
516
|
+
},
|
517
|
+
rowmerge : function() {
|
518
|
+
var table = self.plugin.getSelectedTable()[0],
|
519
|
+
row = self.plugin.getSelectedRow()[0],
|
520
|
+
cell = self.plugin.getSelectedCell()[0],
|
521
|
+
rowIndex = row.rowIndex, // 当前行的index
|
522
|
+
nextRowIndex = rowIndex + cell.rowSpan, // 下一行的index
|
523
|
+
nextRow = table.rows[nextRowIndex]; // 下一行
|
524
|
+
// 最后一行不能合并
|
525
|
+
if (table.rows.length <= nextRowIndex) {
|
526
|
+
return;
|
527
|
+
}
|
528
|
+
var cellIndex = _getCellIndex(table, row, cell); // 下一行单元格的index
|
529
|
+
if (nextRow.cells.length <= cellIndex) {
|
530
|
+
return;
|
531
|
+
}
|
532
|
+
var nextCell = nextRow.cells[cellIndex]; // 下一行单元格
|
533
|
+
// 上下行的colspan不一致时不能合并
|
534
|
+
if (cell.colSpan !== nextCell.colSpan) {
|
535
|
+
return;
|
536
|
+
}
|
537
|
+
cell.rowSpan += nextCell.rowSpan;
|
538
|
+
nextRow.deleteCell(cellIndex);
|
539
|
+
self.cmd.range.selectNodeContents(cell).collapse(true);
|
540
|
+
self.cmd.select();
|
541
|
+
self.addBookmark();
|
542
|
+
},
|
543
|
+
colmerge : function() {
|
544
|
+
var table = self.plugin.getSelectedTable()[0],
|
545
|
+
row = self.plugin.getSelectedRow()[0],
|
546
|
+
cell = self.plugin.getSelectedCell()[0],
|
547
|
+
rowIndex = row.rowIndex, // 当前行的index
|
548
|
+
cellIndex = cell.cellIndex,
|
549
|
+
nextCellIndex = cellIndex + 1;
|
550
|
+
// 最后一列不能合并
|
551
|
+
if (row.cells.length <= nextCellIndex) {
|
552
|
+
return;
|
553
|
+
}
|
554
|
+
var nextCell = row.cells[nextCellIndex];
|
555
|
+
// 左右列的rowspan不一致时不能合并
|
556
|
+
if (cell.rowSpan !== nextCell.rowSpan) {
|
557
|
+
return;
|
558
|
+
}
|
559
|
+
cell.colSpan += nextCell.colSpan;
|
560
|
+
row.deleteCell(nextCellIndex);
|
561
|
+
self.cmd.range.selectNodeContents(cell).collapse(true);
|
562
|
+
self.cmd.select();
|
563
|
+
self.addBookmark();
|
564
|
+
},
|
565
|
+
rowsplit : function() {
|
566
|
+
var table = self.plugin.getSelectedTable()[0],
|
567
|
+
row = self.plugin.getSelectedRow()[0],
|
568
|
+
cell = self.plugin.getSelectedCell()[0],
|
569
|
+
rowIndex = row.rowIndex;
|
570
|
+
// 不是可分割单元格
|
571
|
+
if (cell.rowSpan === 1) {
|
572
|
+
return;
|
573
|
+
}
|
574
|
+
var cellIndex = _getCellIndex(table, row, cell);
|
575
|
+
for (var i = 1, len = cell.rowSpan; i < len; i++) {
|
576
|
+
var newRow = table.rows[rowIndex + i],
|
577
|
+
newCell = newRow.insertCell(cellIndex);
|
578
|
+
if (cell.colSpan > 1) {
|
579
|
+
newCell.colSpan = cell.colSpan;
|
580
|
+
}
|
581
|
+
newCell.innerHTML = K.IE ? '' : '<br />';
|
582
|
+
// 调整下一行的单元格index
|
583
|
+
cellIndex = _getCellIndex(table, newRow, newCell);
|
584
|
+
}
|
585
|
+
K(cell).removeAttr('rowSpan');
|
586
|
+
self.cmd.range.selectNodeContents(cell).collapse(true);
|
587
|
+
self.cmd.select();
|
588
|
+
self.addBookmark();
|
589
|
+
},
|
590
|
+
colsplit : function() {
|
591
|
+
var table = self.plugin.getSelectedTable()[0],
|
592
|
+
row = self.plugin.getSelectedRow()[0],
|
593
|
+
cell = self.plugin.getSelectedCell()[0],
|
594
|
+
cellIndex = cell.cellIndex;
|
595
|
+
// 不是可分割单元格
|
596
|
+
if (cell.colSpan === 1) {
|
597
|
+
return;
|
598
|
+
}
|
599
|
+
for (var i = 1, len = cell.colSpan; i < len; i++) {
|
600
|
+
var newCell = row.insertCell(cellIndex + i);
|
601
|
+
if (cell.rowSpan > 1) {
|
602
|
+
newCell.rowSpan = cell.rowSpan;
|
603
|
+
}
|
604
|
+
newCell.innerHTML = K.IE ? '' : '<br />';
|
605
|
+
}
|
606
|
+
K(cell).removeAttr('colSpan');
|
607
|
+
self.cmd.range.selectNodeContents(cell).collapse(true);
|
608
|
+
self.cmd.select();
|
609
|
+
self.addBookmark();
|
610
|
+
},
|
611
|
+
coldelete : function() {
|
612
|
+
var table = self.plugin.getSelectedTable()[0],
|
613
|
+
row = self.plugin.getSelectedRow()[0],
|
614
|
+
cell = self.plugin.getSelectedCell()[0],
|
615
|
+
index = cell.cellIndex;
|
616
|
+
for (var i = 0, len = table.rows.length; i < len; i++) {
|
617
|
+
var newRow = table.rows[i],
|
618
|
+
newCell = newRow.cells[index];
|
619
|
+
if (newCell.colSpan > 1) {
|
620
|
+
newCell.colSpan -= 1;
|
621
|
+
if (newCell.colSpan === 1) {
|
622
|
+
K(newCell).removeAttr('colSpan');
|
623
|
+
}
|
624
|
+
} else {
|
625
|
+
newRow.deleteCell(index);
|
626
|
+
}
|
627
|
+
// 跳过不需要删除的行
|
628
|
+
if (newCell.rowSpan > 1) {
|
629
|
+
i += newCell.rowSpan - 1;
|
630
|
+
}
|
631
|
+
}
|
632
|
+
if (row.cells.length === 0) {
|
633
|
+
self.cmd.range.setStartBefore(table).collapse(true);
|
634
|
+
self.cmd.select();
|
635
|
+
K(table).remove();
|
636
|
+
} else {
|
637
|
+
self.cmd.selection(true);
|
638
|
+
}
|
639
|
+
self.addBookmark();
|
640
|
+
},
|
641
|
+
rowdelete : function() {
|
642
|
+
var table = self.plugin.getSelectedTable()[0],
|
643
|
+
row = self.plugin.getSelectedRow()[0],
|
644
|
+
cell = self.plugin.getSelectedCell()[0],
|
645
|
+
rowIndex = row.rowIndex;
|
646
|
+
// 从下到上删除
|
647
|
+
for (var i = cell.rowSpan - 1; i >= 0; i--) {
|
648
|
+
table.deleteRow(rowIndex + i);
|
649
|
+
}
|
650
|
+
if (table.rows.length === 0) {
|
651
|
+
self.cmd.range.setStartBefore(table).collapse(true);
|
652
|
+
self.cmd.select();
|
653
|
+
K(table).remove();
|
654
|
+
} else {
|
655
|
+
self.cmd.selection(true);
|
656
|
+
}
|
657
|
+
self.addBookmark();
|
658
|
+
}
|
659
|
+
};
|
660
|
+
self.clickToolbar(name, self.plugin.table.prop);
|
661
|
+
});
|