aboutsummaryrefslogtreecommitdiff
path: root/editor/editor.ts
AgeCommit message (Collapse)Author
2024-10-03editor: allow inserting tab on editorShulhan
Previously pressing tab on editor will move focus to the next component on page or browser. Now, pressing tab will insert "\t" on the current cursor.
2023-12-08editor: set the caret color to redShulhan
Since we cannot change its shape, changing the color to red make the text cursor position visible to eyes.
2023-12-08editor: set key control to false on blurShulhan
Sometimes we got an issue where pressing enter may cause the editor being saved without pressing Control key.
2023-12-08editor: reduce the padding in the contentShulhan
The gap make us confuse between space and padding.
2023-11-21editor: update layout without using floatShulhan
2023-11-21editor: fix paste that always add new lineShulhan
2023-11-21editor: replace execCommand with SelectionShulhan
The execCommand has been deprecated according to Mozilla Developer Network. This changes require the tsc target set to es2019 to be able to use the string trimEnd method. [1]: https://developer.mozilla.org/en-US/docs/Web/API/document/execCommand
2023-11-15editor: add method to set content editable or notShulhan
2023-11-15editor: use CTRL+Enter to trigger save instead of CTRL+sShulhan
Using CTRL+s sometimes cause pressing s only trigger the save.
2023-11-11editor: re-render content after saveShulhan
This is to make the content that we save and the content on editor is always same.
2023-11-11editor: handle paste event manuallyShulhan
On each paste event, re-render the line number in case the clipboard contains new lines.
2023-11-05editor: simplify using one contenteditableShulhan
Using multiple lines of content editable is hard, especially when involving selection, deletion, and managing undo-redo history.
2023-11-02editor: handle mouse selection, copy, and paste multiple linesShulhan
Previously, mouse selection only works on single line. This changes, make mouse selection works on multiple lines, also when user press CTRL+C we reformat the copied data to add line-feed so we can split later during paste.
2023-11-01editor: handle DELETE on selectionShulhan
If user select text and press delete key, the selected text should be deleted.
2023-10-30editor: fix handling control keyShulhan
Instead of binding key up and down on each line for handling, bind it to document.
2023-10-24all: fix all linter warnings from tsc and eslintShulhan
In this changes we introduce eslint as our linter for TypeScript and update our tsconfig to be more strict. The ".eslintrc.yaml" and "tsconfig.json" is taken from golang/website repository [1]. [1]: https://cs.opensource.google/go/x/website
2023-10-24all: reformat all filesShulhan
I cannot remember how I reformat those files previously, probably without any tools. This changes reformat the TypeScript files using prettier and HTML files using js-beautify.
2022-03-15all: re-licensing wui under GPL 3.0 or laterShulhan
See https://kilabit.info/journal/2022/gpl/ for more information.
2021-10-20editor: handle key DeleteShulhan
When delete key pressed on line, it will delete single character or join the current line with the next line.
2021-10-20editor: export the ClearSelection methodShulhan
The ClearSelection method clear the selection indicator on user interface.
2021-08-30editor: fix example converting the content to base64Shulhan
2021-08-29editor: remove unused import WuiResponseInterfaceShulhan
2021-08-29editor: make the lines field become publicShulhan
2021-08-29editor: always decode the node content from base64Shulhan
2021-08-29editor: simplify the Open methodShulhan
Previously, the Open method call the predefined options OpenFile, which in turn may send request to remote server. This changes simplify it by accepting node interface that has been filled with content and metadata.
2021-08-28editor: listen on key Escape on document to clear selectionShulhan
Previously, to clear selection, user must set the editor to active by selecting any line. This commit allow user to clear selection by pressing "Escape" anywhere on the document. While at it, add methods to turn on or off the editor editability.
2021-08-28all: use the WuiResponseInterface for non-void return typeShulhan
This commit changes the WuiVfsOptions.istNodes and WuiEditorOptions.OpenFile to WuiResponseInterface. WuiResponseInterface define an interface that will be returned by function or method with non-void type. If the function/method success, the code should be set to 200 (equal to HTTP OK), and the data will contains the expected data for that function. If the function/method call failed, the code should be set to other value beside 200 with a message describe why its failed.
2021-08-28all: refactoring to follow the coding style in READMEShulhan
* Use snake_case for field, variable, HTML ID, and CSS class names. * Use camelCase for class, interface, type, function, or method names. * An exported type or class. interface, type, method, or function name MUST start with an upper-case letter. * An exported class, type, interface, or function MUST be prefixed with "Wui".
2021-08-27editor: add handler to save the contentShulhan
When user press CTRL+S on the editor, it will trigger the OnSave handler. While at it, * auto scroll when pressing arrow up or down * auto scroll to bottom when pressing Enter at the end of file * fix tab key not inserting tab characters
2021-08-23editor: remove the SaveFile field from EditorShulhan
2021-08-22editor: add method GetContentShulhan
The GetContent method return the concatenated statements with new-line. While at it, set default range begin and end to -1 to fix issue where user select only line number 1 (index 0).
2021-08-15editor: add method to get file and selection rangeShulhan
The GetFile method return the current file as IVfsNode, including its content (concatenated). The GetSelectionRange return the current selection on the editor.
2021-08-12editor: add event handler for OnSelectionShulhan
The OnSelection event will be triggered when user select one or more lines.
2021-07-31editor: pressing escape key will clear the selectionShulhan
2021-07-31editor: implement redo functionality using CTRL+rShulhan
2021-07-31all: add license file and headersShulhan
2021-07-29editor: handle undo with CTRL+ZShulhan
2021-07-27editor: fix paste to plain textShulhan
Previously copy or cutting text on line and pasting it will generate <span> inside the line. This commit fix the paste function to paste only text.
2021-07-27editor: fix enter and support for backspaceShulhan
Enter on middle of line now will cut the text and move the rest text after caret to the next line. Pressing backspace on the beginning of line will merge the line with previous one.
2021-07-26editor: init the style sheet using javascript and add support for tabShulhan
2021-07-26editor: add support to move arrow up and down between textShulhan
2021-07-26all: implement editorShulhan