wxxsd/UEditor/_src/plugins/searchreplace.js
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
///import core
///commands 查找替换
///commandsName SearchReplace
///commandsTitle 查询替换
///commandsDialog dialogs\searchreplace\searchreplace.html
/**
* @description 查找替换
* @author zhanyi
*/
UE.plugins['searchreplace'] = function(){
var currentRange,
first,
me = this;
me.addListener('reset',function(){
currentRange = null;
first = null;
});
me.commands['searchreplace'] = {
execCommand : function(cmdName,opt){
var me = this,
sel = me.selection,
range,
nativeRange,
num = 0,
opt = utils.extend(opt,{
all : false,
casesensitive : false,
dir : 1
},true);
if(browser.ie){
while(1){
var tmpRange;
nativeRange = me.document.selection.createRange();
tmpRange = nativeRange.duplicate();
tmpRange.moveToElementText(me.document.body);
if(opt.all){
first = 0;
opt.dir = 1;
if(currentRange){
tmpRange.setEndPoint(opt.dir == -1 ? 'EndToStart' : 'StartToEnd',currentRange)
}
}else{
tmpRange.setEndPoint(opt.dir == -1 ? 'EndToStart' : 'StartToEnd',nativeRange);
if(opt.hasOwnProperty("replaceStr")){
tmpRange.setEndPoint(opt.dir == -1 ? 'StartToEnd' : 'EndToStart',nativeRange);
}
}
nativeRange = tmpRange.duplicate();
if(!tmpRange.findText(opt.searchStr,opt.dir,opt.casesensitive ? 4 : 0)){
currentRange = null;
tmpRange = me.document.selection.createRange();
tmpRange.scrollIntoView();
后面还有 77 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
