Skip to content

Commit

Permalink
add auto focus
Browse files Browse the repository at this point in the history
  • Loading branch information
linh0804 committed Jun 10, 2024
1 parent 801067d commit fb7d5a3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
19 changes: 12 additions & 7 deletions edit_code.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

define('ACCESS', true);

include_once 'function.php';
require 'function.php';

if (!IS_LOGIN) {
goURL('login.php');
}

$title = 'Sửa tập tin dạng Code';

include_once 'header.php';
require 'header.php';

echo '<div class="tips" style="margin-top: 0 !important">
<img src="icon/tips.png" alt="">
Expand Down Expand Up @@ -152,10 +152,16 @@

echo '<script src="' . asset('js/edit_code.bundle.js') . '"></script>';
echo '<script>
const codeCheckMessageElement = document.getElementById("code_check_message");
const codeCheckPHPElement = document.getElementById("code_check_php");
const codeFormElement = document.getElementById("code_form");
const codeCheckMessageElement = document.getElementById("code_check_message")
const codeCheckPHPElement = document.getElementById("code_check_php")
const codeFormElement = document.getElementById("code_form")
const editorElement = document.getElementById("editor")
// auto focus
document.addEventListener("DOMContentLoaded", function() {
editorElement.scrollIntoView({ behavior: "smooth", block: "center" })
})
function save() {
var data = new FormData();
data.append("requestApi", 1);
Expand Down Expand Up @@ -245,5 +251,4 @@ function save() {
</ul>';
}

include_once 'footer.php';

require 'footer.php';
5 changes: 5 additions & 0 deletions edit_text.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@
var codeHighLightElement = document.getElementById("code_highlight");
var codeFormElement = document.getElementById("code_form");
// auto focus
document.addEventListener("DOMContentLoaded", function() {
editorElement.scrollIntoView({ behavior: "smooth", block: "center" })
})
function save() {
var data = new FormData();
data.append("requestApi", 1);
Expand Down

0 comments on commit fb7d5a3

Please sign in to comment.