Skip to content

Latest commit

 

History

History
35 lines (31 loc) · 1.89 KB

README.md

File metadata and controls

35 lines (31 loc) · 1.89 KB

textarea-editor

Transform the HTML TEXTAREA tag into a basic text editor. The features include the inclusion of line numbers and the capability to input tabs.

Screen capture

HOW TO USE

First, load the sweEditor.js and sweEditor.css files.

    <link rel="stylesheet" href="/css/sweEditor.css">
    <script defer src="/js/sweEditor.js"></script>

Then, place a TEXTAREA tag in your HTML.

    <textarea id="fugafuga"></textarea>

Please attach a JavaScript class to the textarea tag.

    <script>
        window.onload = (e) => {
            const sedt = document.getElementById("fugafuga");
            if (sedt) {
                new sweEditor(sedt);
            }
        };
    </script>


The size of the editor is designed to automatically match the dimensions specified in the textarea tag.

colors,and sizes

Feel free to experiment with the CSS file for things like color, font, and text size.

issue

While it has been completed, there are performance issues. Text editing at the level of a few thousand lines poses no problem, but when it exceeds tens of thousands of lines, editing becomes difficult. The cause seems to be related to the use of HTML's TEXTAREA, possibly indicating a performance issue in the browser (perhaps a design flaw). It is likely that TEXTAREA is not designed to handle such lengthy texts.