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:
Konstantin Schaper
2020-12-14 09:15:18 +01:00
committed by GitHub
parent 1ef0b42eb5
commit fed16f296a
9 changed files with 18170 additions and 15258 deletions

View File

@@ -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} />