mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 22:45:45 +01:00
support permalinks to lines in source code view (#1472)
This features adjusts the syntax checker to render a little link icon next to a hovered line. When clicked, a permanent link to this line is created and copied to the user's clipboard. When visiting the link, the focused row is highlighted. Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
This commit is contained in:
committed by
GitHub
parent
1ef0b42eb5
commit
fed16f296a
@@ -21,7 +21,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
import React from "react";
|
||||
import React, { ReactNode } from "react";
|
||||
import { storiesOf } from "@storybook/react";
|
||||
import styled from "styled-components";
|
||||
import SyntaxHighlighter from "./SyntaxHighlighter";
|
||||
@@ -31,12 +31,16 @@ import GoHttpServer from "./__resources__/HttpServer.go";
|
||||
import JsHttpServer from "./__resources__/HttpServer.js";
|
||||
import PyHttpServer from "./__resources__/HttpServer.py";
|
||||
import Markdown from "./__resources__/test-page.md";
|
||||
import { MemoryRouter } from "react-router-dom";
|
||||
|
||||
const Spacing = styled.div`
|
||||
padding: 1em;
|
||||
`;
|
||||
|
||||
const RoutingDecorator = (story: () => ReactNode) => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>;
|
||||
|
||||
storiesOf("SyntaxHighlighter", module)
|
||||
.addDecorator(RoutingDecorator)
|
||||
.add("Java", () => (
|
||||
<Spacing>
|
||||
<SyntaxHighlighter language="java" value={JavaHttpServer} />
|
||||
|
||||
Reference in New Issue
Block a user