Guest User

Untitled

a guest
Jan 19th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. diff --git a/src/components/Editor/Editor.css b/src/components/Editor/Editor.css
  2. index aed8d41c7..6f8e982f3 100644
  3. --- a/src/components/Editor/Editor.css
  4. +++ b/src/components/Editor/Editor.css
  5. @@ -9,6 +9,7 @@
  6. --debug-line-error-border: rgb(255, 0, 0);
  7. --debug-expression-error-background: rgba(231, 116, 113, 0.3);
  8. --editor-header-height: 30px;
  9. + --highlight-line-duration: 1.5s;
  10. }
  11.  
  12. .theme-dark .editor-wrapper {
  13. @@ -25,7 +26,9 @@
  14. min-width: 0 !important;
  15. }
  16.  
  17. -.CodeMirror.cm-s-mozilla, .CodeMirror-scroll, .CodeMirror-sizer {
  18. +.CodeMirror.cm-s-mozilla,
  19. +.CodeMirror-scroll,
  20. +.CodeMirror-sizer {
  21. overflow-anchor: none;
  22. }
  23.  
  24. @@ -260,8 +263,9 @@ debug-expression-error {
  25. .new-debug-line-error .CodeMirror-activeline-background {
  26. display: none;
  27. }
  28. +
  29. .highlight-line .CodeMirror-line {
  30. - animation: fade-highlight-out 1.5s normal forwards;
  31. + animation: fade-highlight-out var(--highlight-line-duration) normal forwards;
  32. }
  33.  
  34. @keyframes fade-highlight-out {
  35. diff --git a/src/components/Editor/HighlightLine.js b/src/components/Editor/HighlightLine.js
  36. index 9c6530d13..f4107f4f0 100644
  37. --- a/src/components/Editor/HighlightLine.js
  38. +++ b/src/components/Editor/HighlightLine.js
  39. @@ -121,7 +121,18 @@ export class HighlightLine extends Component<Props> {
  40. }
  41.  
  42. const doc = getDocument(sourceId);
  43. + // adds the line here, but does not remove it
  44. doc.addLineClass(editorLine, "line", "highlight-line");
  45. + this.resetHighlightLine(doc, editorLine);
  46. + }
  47. +
  48. + resetHighlightLine(doc, editorLine) {
  49. + const style = getComputedStyle(document.querySelector(".editor-wrapper"));
  50. + const duration = style.getPropertyValue("--highlight-line-duration");
  51. + setTimeout(
  52. + () => doc && doc.removeLineClass(editorLine, "line", "highlight-line"),
  53. + duration
  54. + );
  55. }
  56.  
  57. clearHighlightLine(selectedLocation: SourceLocation, selectedSource: Source) {
Add Comment
Please, Sign In to add comment