我正在研究BBCode编辑器,这里是代码:
var txtarea = document.getElementById("editor_area");
function boldText() {
var start = txtarea.selectionStart;
var end = txtarea.selectionEnd;
var sel = txtarea.value.substring(start, end);
var finText = txtarea.value.substring(0, start) + '[b]' + sel + '[/b]' + txtarea.value.substring(end);
txtarea.value = finText;
txtarea.focus();
}
Run Code Online (Sandbox Code Playgroud)
一切都没问题,除了一个是文本光标的位置.当我点击boldText按钮时,它将光标位置设置在Textarea的末尾!
实际上,我希望能够将光标位置设置为某个索引.我想要这样的东西:
txtarea.setFocusAt(20);
Run Code Online (Sandbox Code Playgroud) 我试图允许用户使用电子邮件或用户名及其密码登录。
我在 FortifyServiceProvider.php 的 boot() 内添加了以下代码:
Fortify::authenticateUsing(function (Request $request) {
$user = User::where('email', $request->email)
->orWhere('username', $request->username)
->first();
if ($user &&
Hash::check($request->password, $user->password)) {
return $user;
}
});
Run Code Online (Sandbox Code Playgroud)
但现在,当用户尝试通过输入用户名而不是电子邮件登录时,他们会收到以下错误消息:
These credentials do not match our records.
Run Code Online (Sandbox Code Playgroud) php laravel laravel-authentication laravel-8 laravel-fortify
我正在为我的 JTable 使用可排序的列:
table.setAutoCreateRowSorter(true);
Run Code Online (Sandbox Code Playgroud)
问题是在用户单击列标题后无法删除箭头。即使我删除了表中的所有行。
我试图做相反的事情,但没有奏效:
table.setAutoCreateRowSorter(false);
Run Code Online (Sandbox Code Playgroud)