-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add some handy markdown editor features #32400
Conversation
textarea.selectionEnd = startPos + value.length; | ||
textarea.focus(); | ||
triggerEditorContentChanged(textarea); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it use replaceTextareaSelection
? That method has the benefit that CTRL-Z works after it.
Line 277 in ec2d159
export function replaceTextareaSelection(textarea: HTMLTextAreaElement, text: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it can't at the moment.
I know the existence of replaceTextareaSelection but it needs some extra work to merge these two.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only difference seems to be that this function re-selects the inserted text and focuses the textarea. The re-selection could be pictured in a option and the focus could be done after the function call.
replaceTextareaSelection(textarea: HTMLTextAreaElement, text: string, {reselect: false}: {reselect: boolean})
triggerEditorContentChanged
does the same as a change
event, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
triggerEditorContentChanged
does the same as achange
event, right?
No.
I do not think making more changes is in this PR's scope since it has been fully tested.
And this textareaInsertText
is not a new function, it is just extracted from insertPlaceholder
, nothing worse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer if this at least does not break the textarea history. Does CTRL-Z work after inserting content?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This textareaInsertText is not a new function, it is just extracted from insertPlaceholder, nothing worse.
There is always a chance to propose new improvements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should fix it later.
Co-authored-by: silverwind <[email protected]>
* giteaofficial/main: (21 commits) Use 8 as default value for git lfs concurrency (go-gitea#32421) Fix milestone deadline and date related problems (go-gitea#32339) Only query team tables if repository is under org when getting assignees (go-gitea#32414) Refactor RepoRefByType (go-gitea#32413) Refactor template ctx and render utils (go-gitea#32422) Refactor DateUtils and merge TimeSince (go-gitea#32409) Refactor markup package (go-gitea#32399) Add some handy markdown editor features (go-gitea#32400) Make LFS http_client parallel within a batch. (go-gitea#32369) Refactor repo legacy (go-gitea#32404) Replace DateTime with proper functions (go-gitea#32402) Fix git error handling (go-gitea#32401) Fix created_unix for mirroring (go-gitea#32342) Replace DateTime with DateUtils (go-gitea#32383) improve performance of diffs (go-gitea#32393) Refactor tests to prevent from unnecessary preparations (go-gitea#32398) Add artifacts test fixture (go-gitea#30300) Fix `missing signature key` error when pulling Docker images with `SERVE_DIRECT` enabled (go-gitea#32365) Fix a number of typescript issues (go-gitea#32308) Update go dependencies (go-gitea#32389) ...
There were some missing features from EasyMDE:
And added some tests