如何设置要在 NicEdit 的新窗口中打开的链接的默认值

How to set the default for links to open in a new window in NicEdit

本文关键字:窗口 默认值 链接 NicEdit 何设置 设置 新窗口      更新时间:2023-09-26

使用 NicEdit 时,可以使用编辑器中的"添加链接"按钮突出显示文本,以便对其进行超链接。

单击"添加链接"按钮时,将出现一个弹出窗口,您可以在其中指定链接是在新窗口中还是在当前窗口中打开。这默认为"当前窗口"。

我假设在第 72 行的 javascript 中切换这两个选项的顺序会将默认值从"当前窗口"更改为"新窗口"。但是,事实并非如此。

如何使用 NicEdit 设置添加链接的默认值,以便在新窗口中打开,而不是在当前窗口中打开?

这是来自NicEdit javascript的相关代码。

var nicLinkOptions = {
buttons : {
    'link' : {name : 'Add Link', type : 'nicLinkButton', tags : ['A']},
    'unlink' : {name : 'Remove Link',  command : 'unlink', noActive : true}
}

};

var nicLinkButton=nicEditorAdvancedButton.extend({addPane:function(){this.ln=this.ne.selectedInstance.selElm().parentTag("A");this.addForm({"":{type:"title",txt:"Add/Edit Link"},href:{type:"text",txt:"URL",value:"http://",style:{width:"150px"}},title:{type:"text",txt:"Title"},target:{type:"select",txt:"Open In",options:{_blank:"New Window","":"Current Window"},style:{width:"100px"}}},this.ln)},submit:function(C){var A=this.inputs.href.value;if(A=="http://"||A==""){alert("You must enter a URL to Create a Link");return false}this.removePane();if(!this.ln){var B="javascript:nicTemp();";this.ne.nicCommand("createlink",B);this.ln=this.findElm("A","href",B)}if(this.ln){this.ln.setAttributes({href:this.inputs.href.value,title:this.inputs.title.value,target:this.inputs.target.options[this.inputs.target.selectedIndex].value})}}});nicEditors.registerPlugin(nicPlugin,nicLinkOptions);

更改顺序是正确的方法,但对"当前窗口"使用"_self",这对我有用。

并注意双引号或单引号