html编辑器增加超级链接,这是ueditor编辑器文章加超链接代码的link.html文件(求朋友帮忙!)...

怎么在超链接输出a标签后加入:isconvert=1这个代码

怎么修改让输出的超链接格式如链接文字

变成:链接文字这样子,本人基础浅,急用,求帮助!

HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

*{margin:0;padding:0;color: #838383;}

table{font-size: 12px;margin: 10px;line-height: 30px}

.txt{width:300px;height:21px;line-height:21px;border:1px solid #d7d7d7;}

 
 
 

var range = editor.selection.getRange(),

link = range.collapsed ? editor.queryCommandValue( "link" ) : editor.selection.getStart(),

url,

text = $G('text'),

rangeLink = domUtils.findParentByTagName(range.getCommonAncestor(),'a',true),

orgText;

link = domUtils.findParentByTagName( link, "a ", true );

if(link){

url = utils.html(link.getAttribute( '_href' ) || link.getAttribute( 'href', 2 ));

if(rangeLink === link && !link.getElementsByTagName('img').length){

text.removeAttribute('disabled');

orgText = text.value = link[browser.ie ? 'innerText':'textContent'];

}else{

text.setAttribute('disabled','true');

text.value = lang.validLink;

}

}else{

if(range.collapsed){

text.removeAttribute('disabled');

text.value = '';

}else{

text.setAttribute('disabled','true');

text.value = lang.validLink;

}

}

$G("title").value = url ? link.title : "";

$G("href").value = url ? url: '';

$G("target").checked = url && link.target == "_blank" ? true : false;

$focus($G("href"));

function handleDialogOk(){

var href ="isconvert=1" $G('href').value.replace(/^\s+|\s+$/g, '');

if(href){

if(!hrefStartWith(href,["http","/","ftp://",'#'])) {

href = "http://"+href;

}

var obj = {

'href' : href,

'target' : $G("target").checked ? "_blank" : '_self',

'title' : $G("title").value.replace(/^\s+|\s+$/g, ''),

'_href':href

};

//修改链接内容的情况太特殊了,所以先做到这里了

//todo:情况多的时候,做到command里

if(orgText && text.value != orgText){

link[browser.ie ? 'innerText' : 'textContent'] = obj.textValue = text.value;

range.selectNode(link).select()

}

if(range.collapsed){

obj.textValue = text.value;

}

editor.execCommand('link',utils.clearEmptyAttrs(obj) );

dialog.close();

}

}

dialog.onok = handleDialogOk;

$G('href').onkeydown = $G('title').onkeydown = function(evt){

evt = evt || window.event;

if (evt.keyCode == 13) {

handleDialogOk();

return false;

}

};

$G('href').onblur = function(){

if(!hrefStartWith(this.value,["http","/","ftp://",'#'])){

$G("msg").innerHTML = ""+lang.httpPrompt+"";

}else{

$G("msg").innerHTML = "";

}

};

function hrefStartWith(href,arr){

href = href.replace(/^\s+|\s+$/g, '');

for(var i=0,ai;ai=arr[i++];){

if(href.indexOf(ai)==0){

return true;

}

}

return false;

}

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值