-
Notifications
You must be signed in to change notification settings - Fork 0
Description
We are currently using the OverType library for syntax highlighting. Our biggest problem with it is that we are using it to modify text areas, but it's really built to create them. We're working against its nature in lots of places.
For example, right now we don't / can't enhance text areas by default, we only enhance very specific ones that we have targeted. This is because when we enhance a text area, we clobber its styling, and we have to manually put it all back how it was:
gitcasso/src/lib/enhancers/github/GitHubPrAppendEnhancer.tsx
Lines 71 to 75 in 57fe568
const overtype = new OverType(overtypeContainer, { | |
...commonGitHubOptions, | |
minHeight: "102px", | |
padding: "var(--base-size-8)", | |
placeholder: "Add your comment here...", |
Also, whatever method it uses to listen for changes doesn't always work. For example, when images get dragged on to the GitHub textarea, the preview unsyncs briefly, but this can fix it:
gitcasso/src/lib/enhancers/github/GitHubPrAppendEnhancer.tsx
Lines 77 to 82 in 57fe568
const listenForEmpty = new MutationObserver(() => { | |
if (textArea.value === "") { | |
overtype.updatePreview() | |
} | |
}) | |
listenForEmpty.observe(textArea, { attributes: true, characterData: true }) |
Changes we have made:
- several removals of functionality related to
- added support for GitHub hashlinks e.g.
#34
diffplug/overtype@f5149dc