技术支持:KUOQPS@163.com
-

超链接使用

更新时间:2020-07-22 10:01:10 | 简介:幻冰小站富文本编辑器超链接插入

点击图标【超链接】,填入相关信息即可,

编辑时【左键双击】文本中的超链接标签即可快速修改该超链接信息

原始代码如下:

{
    name:'超链接',
    _click:function(option)
    {
    var code = options.ths.getRange();
    var card = options.ths.f.confirm({
    tips:'超链接设置器',
    text:'超链接配置',
    html:'',
    autoCreate:false,
    success:function(data){
    var html = options.ths.e(card.formHtml).val();
    var link = options.ths.e(card.formLink).val();
    var isnew= options.ths.e(card.formNewop).getProp('checked');
    var title= options.ths.e(card.formTitle).val();
    var str = ''+html+'';
    options.ths.print('','delete');
    var status = options.ths.print(str,'code',false);
    options.ths.write();
    }
    });
    //尝试获取有用信息,只从结尾的元素中获取信息
    var text = code.getText();
    card.form = options.ths.f.createElement("form");
    options.ths.e(card.form).addClass('form-kapi');
    //options.ths.e(options.form).submit(false);
    card.formHtml = options.ths.f.createElement('input');
    options.ths.e(card.formHtml).css(options.ths.config.formLineIpt);
    options.ths.e(card.formHtml).attr('placeholder','标签内容');
    options.ths.e(card.formHtml).val(text);
    option.text&&options.ths.e(card.formHtml).val(option.text);
    card.formLink = options.ths.f.createElement('input');
    option.href&&options.ths.e(card.formLink).val(option.href);
    options.ths.e(card.formLink).css(options.ths.config.formLineIpt);
    options.ths.e(card.formLink).attr('placeholder','连接地址');
    card.formNewop = options.ths.f.createElement('input');
    card.formNewbox = options.ths.f.createElement('div');
    options.ths.e(card.formNewbox).append('是否新页面打开:');
    options.ths.e(card.formNewbox).append(card.formNewop);
    options.ths.e(card.formNewop).attr('placeholder','是否新页面打开');
    options.ths.e(card.formNewop).attr('value',1);
    options.ths.e(card.formNewop).attr('type','checkbox');
    if(option.target!='_self'){
    options.ths.e(card.formNewop).prop('checked','checked');
    }
    card.formTitle = options.ths.f.createElement('input');
    option.title&&options.ths.e(card.formTitle).val(option.title);
    options.ths.e(card.formTitle).css(options.ths.config.formLineIpt);
    options.ths.e(card.formTitle).attr('placeholder','标签提示');
    options.ths.e(card.form).append(card.formHtml);
    options.ths.e(card.form).append(card.formLink);
    options.ths.e(card.form).append(card.formNewbox);
    options.ths.e(card.form).append(card.formTitle);
    options.ths.e(card.textHtml).append(card.form);
    card.card.create();
    }
    },