@scm-manager/ui-components 2.27.3-20211114-175217 → 2.27.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/package.json +8 -7
  2. package/src/BranchSelector.tsx +2 -2
  3. package/src/CardColumnGroup.tsx +2 -2
  4. package/src/DateFromNow.tsx +1 -2
  5. package/src/DateShort.tsx +1 -2
  6. package/src/ErrorBoundary.tsx +2 -2
  7. package/src/Icon.tsx +3 -3
  8. package/src/OverviewPageActions.tsx +2 -2
  9. package/src/SplitAndReplace.tsx +2 -3
  10. package/src/SyntaxHighlighter.stories.tsx +1 -1
  11. package/src/Tooltip.tsx +1 -1
  12. package/src/__snapshots__/storyshots.test.ts.snap +1623 -613
  13. package/src/buttons/Button.tsx +34 -33
  14. package/src/forms/FilterInput.tsx +0 -1
  15. package/src/forms/InputField.tsx +2 -2
  16. package/src/forms/Select.tsx +4 -4
  17. package/src/index.ts +3 -4
  18. package/src/languages.test.ts +5 -1
  19. package/src/languages.ts +10 -1
  20. package/src/layout/Footer.tsx +1 -1
  21. package/src/layout/Header.tsx +2 -2
  22. package/src/layout/index.ts +1 -2
  23. package/src/modals/Modal.tsx +1 -1
  24. package/src/navigation/RoutingProps.ts +1 -3
  25. package/src/navigation/SecondaryNavigation.stories.tsx +3 -3
  26. package/src/navigation/SecondaryNavigation.tsx +1 -1
  27. package/src/repos/DiffFile.tsx +15 -21
  28. package/src/repos/RepositoryFlags.tsx +2 -2
  29. package/src/repos/TokenizedDiffView.tsx +2 -20
  30. package/src/repos/annotate/Annotate.stories.tsx +1 -1
  31. package/src/repos/index.ts +0 -2
  32. package/src/repos/refractorAdapter.ts +6 -11
  33. package/src/search/HighlightedFragment.tsx +4 -7
  34. package/src/search/TextHitField.tsx +18 -34
  35. package/src/syntax-highlighting.module.css +1 -1
  36. package/src/SmallLoadingSpinner.stories.tsx +0 -32
  37. package/src/SmallLoadingSpinner.tsx +0 -34
  38. package/src/__resources__/ContentSearchHit.ts +0 -67
  39. package/src/layout/SubSubtitle.tsx +0 -41
  40. package/src/search/SyntaxHighlightedFragment.tsx +0 -130
  41. package/src/search/TextHitField.stories.tsx +0 -54
@@ -61,43 +61,32 @@ const Button: FC<Props> = ({
61
61
  loading,
62
62
  disabled,
63
63
  action,
64
- color = "default"
64
+ color = "default",
65
65
  }) => {
66
66
  const renderIcon = () => {
67
67
  return <>{icon ? <Icon name={icon} color="inherit" className="is-medium pr-1" /> : null}</>;
68
68
  };
69
69
 
70
- const classes = classNames(
71
- "button",
72
- "is-" + color,
73
- { "is-loading": loading },
74
- { "is-fullwidth": fullWidth },
75
- { "is-reduced-mobile": reducedMobile },
76
- className
77
- );
78
-
79
- const content = (
80
- <>
81
- {renderIcon()}{" "}
82
- {(label || children) && (
83
- <>
84
- {label} {children}
85
- </>
86
- )}
87
- </>
88
- );
89
-
90
70
  if (link && !disabled) {
91
- if (link.includes("://")) {
92
- return (
93
- <a className={classes} href={link} aria-label={label}>
94
- {content}
95
- </a>
96
- );
97
- }
98
71
  return (
99
- <Link className={classes} to={link} aria-label={label}>
100
- {content}
72
+ <Link
73
+ className={classNames(
74
+ "button",
75
+ "is-" + color,
76
+ { "is-loading": loading },
77
+ { "is-fullwidth": fullWidth },
78
+ { "is-reduced-mobile": reducedMobile },
79
+ className
80
+ )}
81
+ to={link}
82
+ aria-label={label}
83
+ >
84
+ {renderIcon()}{" "}
85
+ {(label || children) && (
86
+ <>
87
+ {label} {children}
88
+ </>
89
+ )}
101
90
  </Link>
102
91
  );
103
92
  }
@@ -107,11 +96,23 @@ const Button: FC<Props> = ({
107
96
  type={type}
108
97
  title={title}
109
98
  disabled={disabled}
110
- onClick={event => action && action(event)}
111
- className={classes}
99
+ onClick={(event) => action && action(event)}
100
+ className={classNames(
101
+ "button",
102
+ "is-" + color,
103
+ { "is-loading": loading },
104
+ { "is-fullwidth": fullWidth },
105
+ { "is-reduced-mobile": reducedMobile },
106
+ className
107
+ )}
112
108
  {...createAttributesForTesting(testId)}
113
109
  >
114
- {content}
110
+ {renderIcon()}{" "}
111
+ {(label || children) && (
112
+ <>
113
+ {label} {children}
114
+ </>
115
+ )}
115
116
  </button>
116
117
  );
117
118
  };
@@ -77,7 +77,6 @@ const FilterInput: FC<Props> = ({ filter, value, testId, placeholder, autoFocus,
77
77
  onChange={event => setStateValue(event.target.value)}
78
78
  autoFocus={autoFocus || false}
79
79
  aria-describedby={id}
80
- aria-label={t("filterEntries")}
81
80
  {...createAttributesForTesting(testId)}
82
81
  />
83
82
  <span className="icon is-small is-left">
@@ -33,7 +33,7 @@ type BaseProps = {
33
33
  label?: string;
34
34
  name?: string;
35
35
  placeholder?: string;
36
- value?: string | number;
36
+ value?: string;
37
37
  type?: string;
38
38
  autofocus?: boolean;
39
39
  onReturnPressed?: () => void;
@@ -44,7 +44,7 @@ type BaseProps = {
44
44
  helpText?: string;
45
45
  className?: string;
46
46
  testId?: string;
47
- defaultValue?: string | number;
47
+ defaultValue?: string;
48
48
  readOnly?: boolean;
49
49
  };
50
50
 
@@ -69,7 +69,7 @@ const InnerSelect: FC<FieldProps<BaseProps, HTMLSelectElement, string>> = ({
69
69
  const field = useInnerRef(props.innerRef);
70
70
 
71
71
  let opts = options;
72
- if (value && addValueToOptions && !options.some(o => o.value === value)) {
72
+ if (value && addValueToOptions && !options.some((o) => o.value === value)) {
73
73
  opts = [{ label: value, value }, ...options];
74
74
  }
75
75
 
@@ -124,11 +124,11 @@ const InnerSelect: FC<FieldProps<BaseProps, HTMLSelectElement, string>> = ({
124
124
  onChange={handleInput}
125
125
  onBlur={handleBlur}
126
126
  disabled={disabled}
127
- aria-labelledby={label ? a11yId : undefined}
128
- aria-describedby={helpText ? helpId : undefined}
127
+ aria-labelledby={a11yId}
128
+ aria-describedby={helpId}
129
129
  {...createAttributesForTesting(testId)}
130
130
  >
131
- {opts.map(opt => {
131
+ {opts.map((opt) => {
132
132
  return (
133
133
  <option value={opt.value} key={"KEY_" + opt.value}>
134
134
  {opt.label}
package/src/index.ts CHANGED
@@ -37,7 +37,7 @@ import {
37
37
  DiffEventHandler,
38
38
  File,
39
39
  FileChangeType,
40
- Hunk
40
+ Hunk,
41
41
  } from "./repos";
42
42
 
43
43
  export { validation, repositories };
@@ -51,7 +51,6 @@ export { default as ErrorPage } from "./ErrorPage";
51
51
  export { default as Icon } from "./Icon";
52
52
  export { default as Image } from "./Image";
53
53
  export { default as Loading } from "./Loading";
54
- export { default as SmallLoadingSpinner } from "./SmallLoadingSpinner";
55
54
  export { default as Logo } from "./Logo";
56
55
  export { default as MailLink } from "./MailLink";
57
56
  export { default as Notification } from "./Notification";
@@ -114,7 +113,7 @@ export {
114
113
  AnnotationFactory,
115
114
  AnnotationFactoryContext,
116
115
  DiffEventHandler,
117
- DiffEventContext
116
+ DiffEventContext,
118
117
  };
119
118
 
120
119
  // Re-export from ui-api
@@ -131,7 +130,7 @@ export {
131
130
  MissingLinkError,
132
131
  createBackendError,
133
132
  isBackendError,
134
- TOKEN_EXPIRED_ERROR_CODE
133
+ TOKEN_EXPIRED_ERROR_CODE,
135
134
  } from "@scm-manager/ui-api";
136
135
 
137
136
  export { urls };
@@ -35,7 +35,7 @@ describe("syntax highlighter", () => {
35
35
  expect(java).toBe("java");
36
36
  });
37
37
 
38
- it("should return text if language is undefined", () => {
38
+ it("should return text if language is undefied", () => {
39
39
  const lang = determineLanguage();
40
40
  expect(lang).toBe("text");
41
41
  });
@@ -45,4 +45,8 @@ describe("syntax highlighter", () => {
45
45
  expect(lang).toBe("text");
46
46
  });
47
47
 
48
+ it("should use alias go for golang", () => {
49
+ const go = determineLanguage("golang");
50
+ expect(go).toBe("go");
51
+ });
48
52
  });
package/src/languages.ts CHANGED
@@ -22,11 +22,20 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ // this aliases are only to map from spotter detection to prismjs
26
+ const languageAliases: { [key: string]: string } = {
27
+ golang: "go",
28
+ };
29
+
25
30
  export const defaultLanguage = "text";
26
31
 
27
32
  export const determineLanguage = (language?: string) => {
28
33
  if (!language) {
29
34
  return defaultLanguage;
30
35
  }
31
- return language.toLowerCase();
36
+ const lang = language.toLowerCase();
37
+ if (languageAliases[lang]) {
38
+ return languageAliases[lang];
39
+ }
40
+ return lang;
32
41
  };
@@ -97,7 +97,7 @@ const Footer: FC<Props> = ({ me, version, links }) => {
97
97
  <div className="columns is-size-7">
98
98
  {me ? (
99
99
  <FooterSection title={meSectionTile}>
100
- <NavLink to="/me/settings/theme" label={t("footer.user.profile")} testId="footer-user-profile" />
100
+ <NavLink to="/me" label={t("footer.user.profile")} testId="footer-user-profile" />
101
101
  {me?._links?.password && (
102
102
  <NavLink to="/me/settings/password" label={t("profile.changePasswordNavLink")} />
103
103
  )}
@@ -37,7 +37,7 @@ const SmallHeader: FC<{ children: ReactNode }> = ({ children }) => {
37
37
 
38
38
  const LargeHeader: FC = () => {
39
39
  return (
40
- <div className="hero has-scm-background is-small">
40
+ <section className="hero has-scm-background is-small">
41
41
  <div className="hero-body">
42
42
  <div className="container">
43
43
  <div className="columns is-vcentered">
@@ -47,7 +47,7 @@ const LargeHeader: FC = () => {
47
47
  </div>
48
48
  </div>
49
49
  </div>
50
- </div>
50
+ </section>
51
51
  );
52
52
  };
53
53
 
@@ -29,9 +29,8 @@ export { default as Header } from "./Header";
29
29
  export { default as Level } from "./Level";
30
30
  export { default as Page } from "./Page";
31
31
  export { default as PageActions } from "./PageActions";
32
- export { default as Title } from "./Title";
33
32
  export { default as Subtitle } from "./Subtitle";
34
- export { default as SubSubtitle } from "./SubSubtitle";
33
+ export { default as Title } from "./Title";
35
34
  export { default as CustomQueryFlexWrappedColumns } from "./CustomQueryFlexWrappedColumns";
36
35
  export { default as PrimaryContentColumn } from "./PrimaryContentColumn";
37
36
  export { default as SecondaryNavigationColumn } from "./SecondaryNavigationColumn";
@@ -90,7 +90,7 @@ export const Modal: FC<Props> = ({
90
90
  <div className="modal-background" onClick={closeFunction} />
91
91
  <SizedModal className="modal-card" size={size}>
92
92
  <header className={classNames("modal-card-head", `has-background-${headColor}`)}>
93
- <h2 className={`modal-card-title m-0 has-text-${headTextColor}`}>{title}</h2>
93
+ <p className={`modal-card-title m-0 has-text-${headTextColor}`}>{title}</p>
94
94
  <button className="delete" aria-label="close" onClick={closeFunction} ref={initialFocusRef} autoFocus />
95
95
  </header>
96
96
  <section className="modal-card-body">{body}</section>
@@ -22,10 +22,8 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import { RouteProps } from "react-router-dom";
26
-
27
25
  export type RoutingProps = {
28
26
  to: string;
29
27
  activeOnlyWhenExact?: boolean;
30
- activeWhenMatch?: (route: RouteProps) => boolean;
28
+ activeWhenMatch?: (route: any) => boolean;
31
29
  };
@@ -53,8 +53,8 @@ const withRoute = (route: string) => {
53
53
  };
54
54
 
55
55
  storiesOf("Secondary Navigation", module)
56
- .addDecorator(story => <StateMenuContextProvider>{story()}</StateMenuContextProvider>)
57
- .addDecorator(story => (
56
+ .addDecorator((story) => <StateMenuContextProvider>{story()}</StateMenuContextProvider>)
57
+ .addDecorator((story) => (
58
58
  <Columns className="columns">
59
59
  <div className="column is-3">{story()}</div>
60
60
  </Columns>
@@ -92,7 +92,7 @@ storiesOf("Secondary Navigation", module)
92
92
  <SecondaryNavigation label="Hitchhiker">
93
93
  <SecondaryNavigationItem to="/42" icon="fas fa-puzzle-piece" label="Puzzle 42" title="Puzzle 42" />
94
94
  <SecondaryNavigationItem
95
- activeWhenMatch={route => route.location?.pathname === "/hog"}
95
+ activeWhenMatch={(route) => route.location.pathname === "/hog"}
96
96
  to="/heart-of-gold"
97
97
  icon="fas fa-star"
98
98
  label="Heart Of Gold"
@@ -91,7 +91,7 @@ const SecondaryNavigation: FC<Props> = ({ label, children, collapsible = true })
91
91
  aria-label={menuAriaLabel}
92
92
  >
93
93
  {collapsible ? (
94
- <Icon className="is-medium" collapsed={isCollapsed}>
94
+ <Icon color="info" className="is-medium" collapsed={isCollapsed}>
95
95
  {arrowIcon}
96
96
  </Icon>
97
97
  ) : null}
@@ -81,7 +81,7 @@ const MarginlessModalContent = styled.div`
81
81
  class DiffFile extends React.Component<Props, State> {
82
82
  static defaultProps: Partial<Props> = {
83
83
  defaultCollapse: false,
84
- markConflicts: true
84
+ markConflicts: true,
85
85
  };
86
86
 
87
87
  constructor(props: Props) {
@@ -90,14 +90,14 @@ class DiffFile extends React.Component<Props, State> {
90
90
  collapsed: this.defaultCollapse(),
91
91
  sideBySide: props.sideBySide,
92
92
  diffExpander: new DiffExpander(props.file),
93
- file: props.file
93
+ file: props.file,
94
94
  };
95
95
  }
96
96
 
97
97
  componentDidUpdate(prevProps: Readonly<Props>) {
98
98
  if (!this.props.isCollapsed && this.props.defaultCollapse !== prevProps.defaultCollapse) {
99
99
  this.setState({
100
- collapsed: this.defaultCollapse()
100
+ collapsed: this.defaultCollapse(),
101
101
  });
102
102
  }
103
103
  }
@@ -120,8 +120,8 @@ class DiffFile extends React.Component<Props, State> {
120
120
  if (onCollapseStateChange) {
121
121
  onCollapseStateChange(file);
122
122
  } else {
123
- this.setState(state => ({
124
- collapsed: !state.collapsed
123
+ this.setState((state) => ({
124
+ collapsed: !state.collapsed,
125
125
  }));
126
126
  }
127
127
  }
@@ -129,8 +129,8 @@ class DiffFile extends React.Component<Props, State> {
129
129
 
130
130
  toggleSideBySide = (callback: () => void) => {
131
131
  this.setState(
132
- state => ({
133
- sideBySide: !state.sideBySide
132
+ (state) => ({
133
+ sideBySide: !state.sideBySide,
134
134
  }),
135
135
  () => callback()
136
136
  );
@@ -142,7 +142,7 @@ class DiffFile extends React.Component<Props, State> {
142
142
  onCollapseStateChange(this.state.file, collapsed);
143
143
  } else {
144
144
  this.setState({
145
- collapsed
145
+ collapsed,
146
146
  });
147
147
  }
148
148
  };
@@ -236,19 +236,13 @@ class DiffFile extends React.Component<Props, State> {
236
236
 
237
237
  expandHead = (expandableHunk: ExpandableHunk, count: number) => {
238
238
  return () => {
239
- return expandableHunk
240
- .expandHead(count)
241
- .then(this.diffExpanded)
242
- .catch(this.diffExpansionFailed);
239
+ return expandableHunk.expandHead(count).then(this.diffExpanded).catch(this.diffExpansionFailed);
243
240
  };
244
241
  };
245
242
 
246
243
  expandBottom = (expandableHunk: ExpandableHunk, count: number) => {
247
244
  return () => {
248
- return expandableHunk
249
- .expandBottom(count)
250
- .then(this.diffExpanded)
251
- .catch(this.diffExpansionFailed);
245
+ return expandableHunk.expandBottom(count).then(this.diffExpanded).catch(this.diffExpansionFailed);
252
246
  };
253
247
  };
254
248
 
@@ -266,7 +260,7 @@ class DiffFile extends React.Component<Props, State> {
266
260
  if (annotationFactory) {
267
261
  return annotationFactory({
268
262
  hunk,
269
- file
263
+ file,
270
264
  });
271
265
  } else {
272
266
  return EMPTY_ANNOTATION_FACTORY;
@@ -280,7 +274,7 @@ class DiffFile extends React.Component<Props, State> {
280
274
  changeId: getChangeKey(change),
281
275
  change,
282
276
  hunk,
283
- file
277
+ file,
284
278
  };
285
279
  if (onClick) {
286
280
  onClick(context);
@@ -293,7 +287,7 @@ class DiffFile extends React.Component<Props, State> {
293
287
  return {
294
288
  onClick: (event: ChangeEvent) => {
295
289
  this.handleClickEvent(event.change, hunk);
296
- }
290
+ },
297
291
  };
298
292
  }
299
293
  };
@@ -502,9 +496,9 @@ class DiffFile extends React.Component<Props, State> {
502
496
  title={this.hoverFileTitle(file)}
503
497
  >
504
498
  {collapseIcon}
505
- <h4 className={classNames("has-text-weight-bold", "is-ellipsis-overflow", "is-size-6", "ml-1")}>
499
+ <span className={classNames("is-ellipsis-overflow", "is-size-6", "ml-1")}>
506
500
  {this.renderFileTitle(file)}
507
- </h4>
501
+ </span>
508
502
  {this.renderChangeTag(file)}
509
503
  </FullWidthTitleHeader>
510
504
  {headerButtons}
@@ -86,13 +86,13 @@ const RepositoryFlags: FC<Props> = ({ repository, className, tooltipLocation = "
86
86
  );
87
87
 
88
88
  return (
89
- <div className={classNames("is-flex", "is-align-items-center", className)}>
89
+ <span className={classNames("is-flex", "is-align-items-center", className)}>
90
90
  {modal}
91
91
  <RepositoryFlagContainer>
92
92
  {repositoryFlags}
93
93
  <ExtensionPoint name="repository.flags" props={{ repository, tooltipLocation }} renderAll={true} />
94
94
  </RepositoryFlagContainer>
95
- </div>
95
+ </span>
96
96
  );
97
97
  };
98
98
 
@@ -26,46 +26,35 @@ import styled from "styled-components";
26
26
  // @ts-ignore we have no typings for react-diff-view
27
27
  import { Diff, useTokenizeWorker } from "react-diff-view";
28
28
  import { FileDiff } from "@scm-manager/ui-types";
29
+ import { determineLanguage } from "../languages";
29
30
 
30
31
  // @ts-ignore no types for css modules
31
32
  import theme from "../syntax-highlighting.module.css";
32
- import { determineLanguage } from "../languages";
33
33
 
34
34
  const DiffView = styled(Diff)`
35
35
  /* align line numbers */
36
-
37
36
  & .diff-gutter {
38
37
  text-align: right;
39
38
  }
40
-
41
39
  /* column sizing */
42
-
43
40
  > colgroup .diff-gutter-col {
44
41
  width: 3.25rem;
45
42
  }
46
-
47
43
  /* prevent following content from moving down */
48
-
49
44
  > .diff-gutter:empty:hover::after {
50
45
  font-size: 0.7rem;
51
46
  }
52
-
53
47
  /* smaller font size for code and
54
48
  ensure same monospace font throughout whole scmm */
55
-
56
49
  & .diff-line {
57
50
  font-size: 0.75rem;
58
51
  font-family: "Courier New", Monaco, Menlo, "Ubuntu Mono", "source-code-pro", monospace;
59
52
  }
60
-
61
53
  /* comment padding for sidebyside view */
62
-
63
54
  &.split .diff-widget-content .is-indented-line {
64
55
  padding-left: 3.25rem;
65
56
  }
66
-
67
57
  /* comment padding for combined view */
68
-
69
58
  &.unified .diff-widget-content .is-indented-line {
70
59
  padding-left: 6.5rem;
71
60
  }
@@ -82,17 +71,10 @@ type Props = {
82
71
  className?: string;
83
72
  };
84
73
 
85
- const findSyntaxHighlightingLanguage = (file: FileDiff) => {
86
- if (file.syntaxModes) {
87
- return file.syntaxModes["prism"] || file.syntaxModes["codemirror"] || file.syntaxModes["ace"] || file.language;
88
- }
89
- return file.language;
90
- };
91
-
92
74
  const TokenizedDiffView: FC<Props> = ({ file, viewType, className, children }) => {
93
75
  const { tokens } = useTokenizeWorker(tokenize, {
94
76
  hunks: file.hunks,
95
- language: determineLanguage(findSyntaxHighlightingLanguage(file))
77
+ language: determineLanguage(file.language),
96
78
  });
97
79
 
98
80
  return (
@@ -67,7 +67,7 @@ const commitImplementMain = {
67
67
  };
68
68
 
69
69
  const source: AnnotatedSource = {
70
- language: "go",
70
+ language: "golang",
71
71
  lines: [
72
72
  {
73
73
  lineNumber: 1,
@@ -30,7 +30,6 @@ import {
30
30
  AnnotationFactoryContext,
31
31
  DiffEventHandler,
32
32
  DiffEventContext,
33
- DiffObjectProps
34
33
  } from "./DiffTypes";
35
34
 
36
35
  import { FileDiff as File, FileChangeType, Hunk, Change, ChangeType } from "@scm-manager/ui-types";
@@ -65,5 +64,4 @@ export {
65
64
  AnnotationFactoryContext,
66
65
  DiffEventHandler,
67
66
  DiffEventContext,
68
- DiffObjectProps
69
67
  };
@@ -46,15 +46,10 @@ const createAdapter = (theme: { [key: string]: string }): RefractorAdapter => {
46
46
  import(
47
47
  /* webpackChunkName: "tokenizer-refractor-[request]" */
48
48
  `refractor/lang/${lang}`
49
- )
50
- .then(loadedLanguage => {
51
- refractor.register(loadedLanguage.default);
52
- callback();
53
- })
54
- .catch(e => {
55
- // eslint-disable-next-line no-console
56
- console.log(`failed to load refractor language ${lang}: ${e}`);
57
- });
49
+ ).then((loadedLanguage) => {
50
+ refractor.register(loadedLanguage.default);
51
+ callback();
52
+ });
58
53
  }
59
54
  };
60
55
 
@@ -63,7 +58,7 @@ const createAdapter = (theme: { [key: string]: string }): RefractorAdapter => {
63
58
  const runHook = (name: string, env: RunHookEnv) => {
64
59
  originalRunHook.apply(name, env);
65
60
  if (env.classes) {
66
- env.classes = env.classes.map(className => theme[className] || className);
61
+ env.classes = env.classes.map((className) => theme[className] || className);
67
62
  }
68
63
  };
69
64
  // @ts-ignore hooks are not in the type definition
@@ -72,7 +67,7 @@ const createAdapter = (theme: { [key: string]: string }): RefractorAdapter => {
72
67
  return {
73
68
  isLanguageRegistered,
74
69
  loadLanguage,
75
- ...refractor
70
+ ...refractor,
76
71
  };
77
72
  };
78
73
 
@@ -24,9 +24,6 @@
24
24
 
25
25
  import React, { FC } from "react";
26
26
 
27
- const PRE_TAG = "<|[[--";
28
- const POST_TAG = "--]]|>";
29
-
30
27
  type Props = {
31
28
  value: string;
32
29
  };
@@ -36,14 +33,14 @@ const HighlightedFragment: FC<Props> = ({ value }) => {
36
33
 
37
34
  const result = [];
38
35
  while (content.length > 0) {
39
- const start = content.indexOf(PRE_TAG);
40
- const end = content.indexOf(POST_TAG);
36
+ const start = content.indexOf("<>");
37
+ const end = content.indexOf("</>");
41
38
  if (start >= 0 && end > 0) {
42
39
  if (start > 0) {
43
40
  result.push(content.substring(0, start));
44
41
  }
45
- result.push(<mark>{content.substring(start + PRE_TAG.length, end)}</mark>);
46
- content = content.substring(end + POST_TAG.length);
42
+ result.push(<strong>{content.substring(start + 2, end)}</strong>);
43
+ content = content.substring(end + 3);
47
44
  } else {
48
45
  result.push(content);
49
46
  break;
@@ -26,51 +26,35 @@ import React, { FC } from "react";
26
26
  import { HighlightedHitField, Hit } from "@scm-manager/ui-types";
27
27
  import HighlightedFragment from "./HighlightedFragment";
28
28
  import { isHighlightedHitField } from "./fields";
29
- import SyntaxHighlightedFragment from "./SyntaxHighlightedFragment";
30
-
31
- type HighlightedTextFieldProps = {
32
- field: HighlightedHitField;
33
- syntaxHighlightingLanguage?: string;
34
- };
35
-
36
- const HighlightedTextField: FC<HighlightedTextFieldProps> = ({ field, syntaxHighlightingLanguage }) => {
37
- const separator = syntaxHighlightingLanguage ? "...\n" : " ... ";
38
- return (
39
- <>
40
- {field.fragments.map((fragment, i) => (
41
- <React.Fragment key={fragment}>
42
- {separator}
43
- {syntaxHighlightingLanguage ? (
44
- <SyntaxHighlightedFragment value={fragment} language={syntaxHighlightingLanguage} />
45
- ) : (
46
- <HighlightedFragment value={fragment} />
47
- )}
48
- {i + 1 >= field.fragments.length ? separator : null}
49
- </React.Fragment>
50
- ))}
51
- </>
52
- );
53
- };
54
29
 
55
30
  type Props = {
56
31
  hit: Hit;
57
32
  field: string;
58
33
  truncateValueAt?: number;
59
- syntaxHighlightingLanguage?: string;
60
34
  };
61
35
 
62
- const TextHitField: FC<Props> = ({
63
- hit,
64
- field: fieldName,
65
- children,
66
- syntaxHighlightingLanguage,
67
- truncateValueAt = 0
68
- }) => {
36
+ type HighlightedTextFieldProps = {
37
+ field: HighlightedHitField;
38
+ };
39
+
40
+ const HighlightedTextField: FC<HighlightedTextFieldProps> = ({ field }) => (
41
+ <>
42
+ {field.fragments.map((fr, i) => (
43
+ <React.Fragment key={fr}>
44
+ {" ... "}
45
+ <HighlightedFragment value={fr} />
46
+ {i + 1 >= field.fragments.length ? " ... " : null}
47
+ </React.Fragment>
48
+ ))}
49
+ </>
50
+ );
51
+
52
+ const TextHitField: FC<Props> = ({ hit, field: fieldName, children, truncateValueAt = 0 }) => {
69
53
  const field = hit.fields[fieldName];
70
54
  if (!field) {
71
55
  return <>{children}</>;
72
56
  } else if (isHighlightedHitField(field)) {
73
- return <HighlightedTextField field={field} syntaxHighlightingLanguage={syntaxHighlightingLanguage} />;
57
+ return <HighlightedTextField field={field} />;
74
58
  } else {
75
59
  let value = field.value;
76
60
  if (value === "") {