html前端获取富文本数据库,如何使用脚本和HTML从富文本编辑器获取包括HTML在内的数据...

我在网上获得了一个富文本框编辑器窗体,并且已添加到我的网页中。富文本框的图像附在此处。在我的html身体 YnmUq.png如何使用脚本和HTML从富文本编辑器获取包括HTML在内的数据

代码

剧本

\t \t \t jQuery(function($){

\t

\t function showErrorAlert (reason, detail) {

\t \t var msg='';

\t \t if (reason==='unsupported-file-type') { msg = "Unsupported format " +detail; }

\t \t else {

\t \t \t //console.log("error uploading file", reason, detail);

\t \t }

\t \t $('

×'+

\t \t 'File upload error '+msg+'

').prependTo('#alerts');

\t }

\t //$('#editor1').ace_wysiwyg();//this will create the default editor will all buttons

\t //but we want to change a few buttons colors for the third style

\t $('#editor1').ace_wysiwyg({

\t \t toolbar:

\t \t [

\t \t \t 'font',

\t \t \t null,

\t \t \t 'fontSize',

\t \t \t null,

\t \t \t {name:'bold', className:'btn-info'},

\t \t \t {name:'italic', className:'btn-info'},

\t \t \t {name:'strikethrough', className:'btn-info'},

\t \t \t {name:'underline', className:'btn-info'},

\t \t \t null,

\t \t \t {name:'insertunorderedlist', className:'btn-success'},

\t \t \t {name:'insertorderedlist', className:'btn-success'},

\t \t \t {name:'outdent', className:'btn-purple'},

\t \t \t {name:'indent', className:'btn-purple'},

\t \t \t null,

\t \t \t {name:'justifyleft', className:'btn-primary'},

\t \t \t {name:'justifycenter', className:'btn-primary'},

\t \t \t {name:'justifyright', className:'btn-primary'},

\t \t \t {name:'justifyfull', className:'btn-inverse'},

\t \t \t null,

\t \t \t {name:'createLink', className:'btn-pink'},

\t \t \t {name:'unlink', className:'btn-pink'},

\t \t \t null,

\t \t \t {name:'insertImage', className:'btn-success'},

\t \t \t null,

\t \t \t 'foreColor',

\t \t \t null,

\t \t \t {name:'undo', className:'btn-grey'},

\t \t \t {name:'redo', className:'btn-grey'}

\t \t ],

\t \t 'wysiwyg': {

\t \t \t fileUploadError: showErrorAlert

\t \t }

\t }).prev().addClass('wysiwyg-style1');

\t

\t /**

\t //make the editor have all the available height

\t $(window).on('resize.editor', function() {

\t \t var offset = $('#editor1').parent().offset();

\t \t var winHeight = $(this).height();

\t \t

\t \t $('#editor1').css({'height':winHeight - offset.top - 10, 'max-height': 'none'});

\t }).triggerHandler('resize.editor');

\t */

\t

\t

\t

\t

\t

\t

\t //RESIZE IMAGE

\t

\t //Add Image Resize Functionality to Chrome and Safari

\t //webkit browsers don't have image resize functionality when content is editable

\t //so let's add something using jQuery UI resizable

\t //another option would be opening a dialog for user to enter dimensions.

\t if (typeof jQuery.ui !== 'undefined' && ace.vars['webkit']) {

\t \t

\t \t var lastResizableImg = null;

\t \t function destroyResizable() {

\t \t \t if(lastResizableImg == null) return;

\t \t \t lastResizableImg.resizable("destroy");

\t \t \t lastResizableImg.removeData('resizable');

\t \t \t lastResizableImg = null;

\t \t }

\t \t var enableImageResize = function() {

\t \t \t $('.wysiwyg-editor')

\t \t \t .on('mousedown', function(e) {

\t \t \t \t var target = $(e.target);

\t \t \t \t if(e.target instanceof HTMLImageElement) {

\t \t \t \t \t if(!target.data('resizable')) {

\t \t \t \t \t \t target.resizable({

\t \t \t \t \t \t \t aspectRatio: e.target.width/e.target.height,

\t \t \t \t \t \t });

\t \t \t \t \t \t target.data('resizable', true);

\t \t \t \t \t \t

\t \t \t \t \t \t if(lastResizableImg != null) {

\t \t \t \t \t \t \t //disable previous resizable image

\t \t \t \t \t \t \t lastResizableImg.resizable("destroy");

\t \t \t \t \t \t \t lastResizableImg.removeData('resizable');

\t \t \t \t \t \t }

\t \t \t \t \t \t lastResizableImg = target;

\t \t \t \t \t }

\t \t \t \t }

\t \t \t })

\t \t \t .on('click', function(e) {

\t \t \t \t if(lastResizableImg != null && !(e.target instanceof HTMLImageElement)) {

\t \t \t \t \t destroyResizable();

\t \t \t \t }

\t \t \t })

\t \t \t .on('keydown', function() {

\t \t \t \t destroyResizable();

\t \t \t });

\t }

\t \t enableImageResize();

\t \t /**

\t \t //or we can load the jQuery UI dynamically only if needed

\t \t if (typeof jQuery.ui !== 'undefined') enableImageResize();

\t \t else {//load jQuery UI if not loaded

\t \t \t //in Ace demo dist will be replaced by correct assets path

\t \t \t $.getScript("assets/js/jquery-ui.custom.min.js", function(data, textStatus, jqxhr) {

\t \t \t \t enableImageResize()

\t \t \t });

\t \t }

\t \t */

\t }

});

\t \t

如何发布我在富文本框中输入的数据。我想用它的HTML代码保存到数据库。请帮帮我。我是一名初学者。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值