Skip to content

Commit

Permalink
pr changes
Browse files Browse the repository at this point in the history
  • Loading branch information
stephmilovic committed Mar 24, 2020
1 parent cfc50d7 commit ae34a98
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
13 changes: 12 additions & 1 deletion x-pack/legacy/plugins/siem/public/components/markdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@
import { EuiLink, EuiTableRow, EuiTableRowCell, EuiText, EuiToolTip } from '@elastic/eui';
import React from 'react';
import ReactMarkdown from 'react-markdown';
import styled from 'styled-components';
import styled, { css } from 'styled-components';

const TableHeader = styled.thead`
font-weight: bold;
`;

const MyBlockquote = styled.div`
${({ theme }) => css`
padding: 0 ${theme.eui.euiSize};
color: ${theme.eui.euiColorMediumShade};
border-left: ${theme.eui.euiSizeXS} solid ${theme.eui.euiColorLightShade};
`}
`;

TableHeader.displayName = 'TableHeader';

/** prevents links to the new pages from accessing `window.opener` */
Expand Down Expand Up @@ -63,6 +71,9 @@ export const Markdown = React.memo<{
</EuiLink>
</EuiToolTip>
),
blockquote: ({ children }: { children: React.ReactNode[] }) => (
<MyBlockquote>{children}</MyBlockquote>
),
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ export const UserActionTree = React.memo(
[manageMarkdownEditIds]
);

const handleManageQuote = useCallback((quote: string) => {
const addCarrots = quote.replace(new RegExp('\r?\n', 'g'), ' \n> ');
setInsertQuote(`> ${addCarrots}`);
handleOutlineComment('add-comment');
}, []);

const handleSaveComment = useCallback(
(id: string, content: string) => {
handleManageMarkdownEditId(id);
Expand All @@ -99,6 +93,9 @@ export const UserActionTree = React.memo(
top: y,
behavior: 'smooth',
});
if (id === 'add-comment') {
moveToTarget.getElementsByTagName('textarea')[0].focus();
}
}
window.clearTimeout(handlerTimeoutId.current);
setSelectedOutlineCommentId(id);
Expand All @@ -110,6 +107,15 @@ export const UserActionTree = React.memo(
[handlerTimeoutId.current]
);

const handleManageQuote = useCallback(
(quote: string) => {
const addCarrots = quote.replace(new RegExp('\r?\n', 'g'), ' \n> ');
setInsertQuote(`> ${addCarrots} \n`);
handleOutlineComment('add-comment');
},
[handleOutlineComment]
);

const handleUpdate = useCallback(
(comment: Comment) => {
addPostedComment(comment);
Expand Down

0 comments on commit ae34a98

Please sign in to comment.