提交 a4cf9b36 编写于 作者: C Catouse

* improve UI of table in kindeditor.

上级 91fbb0d4
......@@ -5012,9 +5012,8 @@
e.preventDefault();
if(self.afterTab) {
var tabResult = self.afterTab.call(self, e);
console.log('tabResult', tabResult);
// 如果 afterTab 回调函数返回值为 false,则继续执行原始 tab 操作,否则视为已经处理 tab 键操作
if (tabResult !== false) return;
// 如果 afterTab 回调函数返回值为 true,则视为已经处理 tab 键操作,否则继续执行原始 tab 操作
if (tabResult === true) return;
}
var cmd = self.cmd,
range = cmd.range;
......@@ -9975,16 +9974,26 @@ KindEditor.plugin('zui', function(K) {
}
});
var nextFormControl = 'input:not([type="hidden"]), textarea:not(.ke-edit-textarea), button[type="submit"], select';
self.afterTab(function() {
var $editor = $(self.edit.srcElement[0]);
var $next = $editor.next(nextFormControl);
if(!$next.length) $next = $editor.parent().next().find(nextFormControl);
if(!$next.length) $next = $editor.parent().parent().next().find(nextFormControl);
$next = $next.first();
var keditor = $next.data('keditor');
if(keditor) keditor.focus(); else $next.focus();
});
if (options.transferTab !== false) {
var nextFormControl = 'input:not([type="hidden"]), textarea:not(.ke-edit-textarea), button[type="submit"], select';
self.afterTab(function() {
var $editor = $(self.edit.srcElement[0]);
var $next = $editor.next(nextFormControl);
if(!$next.length) $next = $editor.parent().next().find(nextFormControl);
if(!$next.length) $next = $editor.parent().parent().next().find(nextFormControl);
$next = $next.first();
if ($next.length) {
var keditor = $next.data('keditor');
if(keditor) {
keditor.focus();
} else {
$next.focus();
}
return true;
}
return true;
});
}
});
/* ========================================================================
* ZUI: Kindeditor plugin - placeholder
......@@ -11245,7 +11254,7 @@ KindEditor.plugin('table', function (K) {
});
// https://zui.5upm.com/task-view-2.html
self.afterTab(function () {
self.afterTab(function (result) {
var selectedCell = self.plugin.getSelectedCell();
if (selectedCell && selectedCell.length) {
var selectNextCell = function ($currentCell) {
......@@ -11274,7 +11283,7 @@ KindEditor.plugin('table', function (K) {
return true;
}
}
return false;
return result;
});
var selectCellsRange = function ($table, startPos, endPos) {
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -5012,9 +5012,8 @@
e.preventDefault();
if(self.afterTab) {
var tabResult = self.afterTab.call(self, e);
console.log('tabResult', tabResult);
// 如果 afterTab 回调函数返回值为 false,则继续执行原始 tab 操作,否则视为已经处理 tab 键操作
if (tabResult !== false) return;
// 如果 afterTab 回调函数返回值为 true,则视为已经处理 tab 键操作,否则继续执行原始 tab 操作
if (tabResult === true) return;
}
var cmd = self.cmd,
range = cmd.range;
......
......@@ -1032,7 +1032,7 @@ KindEditor.plugin('table', function (K) {
});
// https://zui.5upm.com/task-view-2.html
self.afterTab(function () {
self.afterTab(function (result) {
var selectedCell = self.plugin.getSelectedCell();
if (selectedCell && selectedCell.length) {
var selectNextCell = function ($currentCell) {
......@@ -1061,7 +1061,7 @@ KindEditor.plugin('table', function (K) {
return true;
}
}
return false;
return result;
});
var selectCellsRange = function ($table, startPos, endPos) {
......
......@@ -40,14 +40,24 @@ KindEditor.plugin('zui', function(K) {
}
});
var nextFormControl = 'input:not([type="hidden"]), textarea:not(.ke-edit-textarea), button[type="submit"], select';
self.afterTab(function() {
var $editor = $(self.edit.srcElement[0]);
var $next = $editor.next(nextFormControl);
if(!$next.length) $next = $editor.parent().next().find(nextFormControl);
if(!$next.length) $next = $editor.parent().parent().next().find(nextFormControl);
$next = $next.first();
var keditor = $next.data('keditor');
if(keditor) keditor.focus(); else $next.focus();
});
if (options.transferTab !== false) {
var nextFormControl = 'input:not([type="hidden"]), textarea:not(.ke-edit-textarea), button[type="submit"], select';
self.afterTab(function() {
var $editor = $(self.edit.srcElement[0]);
var $next = $editor.next(nextFormControl);
if(!$next.length) $next = $editor.parent().next().find(nextFormControl);
if(!$next.length) $next = $editor.parent().parent().next().find(nextFormControl);
$next = $next.first();
if ($next.length) {
var keditor = $next.data('keditor');
if(keditor) {
keditor.focus();
} else {
$next.focus();
}
return true;
}
return true;
});
}
});
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册