reposilite icon indicating copy to clipboard operation
reposilite copied to clipboard

Reimplement code snippets in UI

Open Saladoc opened this issue 2 years ago • 8 comments

What happened?

When the repository URL is long enough that it's forced to wrap in the repository details module the result is incoherent with regards to the box size and the line numbers.

Also, if it comes close to having to wrap, the text clashes with the bounds.

image image

Reposilite version

3.x

Relevant log output

No response

Saladoc avatar Dec 27 '21 10:12 Saladoc

That's an issue of vue-prism-editor: koca/vue-prism-editor#117

WithoutAName25 avatar Dec 27 '21 11:12 WithoutAName25

This library has several issues and it's not frequently updated lately, so in the end we may just need to switch to another one :<

dzikoysk avatar Dec 27 '21 11:12 dzikoysk

Also, chaning tabs in card throws exception:

Uncaught (in promise) TypeError: Window.getComputedStyle: Argument 1 is not an object.
    setLineNumbersHeight Editor.ts:144
    handler2 Editor.ts:111
    promise callback*nextTick runtime-core.esm-bundler.js:246
    handler2 Editor.ts:110

Related to:

  • https://github.com/koca/vue-prism-editor/issues/131

dzikoysk avatar Feb 17 '22 21:02 dzikoysk

https://github.com/koca/vue-prism-editor looks kinda abandoned, I think we should migrate to a new library that provides code highlighting / try to color those snippets without any library

dzikoysk avatar Sep 11 '22 11:09 dzikoysk

No experience with Vue but how about https://github.com/justcaliturner/simple-code-editor ?

TheTechRobo avatar Sep 11 '22 13:09 TheTechRobo

Looks pretty nice, we could give it a try! Would you like to try to submit a PR? Here's the component we need to update:

  • https://github.com/dzikoysk/reposilite/blob/main/reposilite-frontend/src/components/card/CodeSnippet.vue

dzikoysk avatar Sep 11 '22 14:09 dzikoysk

I have implemented code snippets with simple-code-editor. I had to overwrite some default css (here) and i had to use this workaround. Maybe this library is better than the old one but it is not perfect. I don't know if we should search for another one or use this one.

WithoutAName25 avatar Sep 18 '22 17:09 WithoutAName25

Nice! I think it's fine 🤔

dzikoysk avatar Sep 20 '22 10:09 dzikoysk