feat: add view raw markdown button to task details
This commit is contained in:
		@@ -585,3 +585,30 @@ export const ActivityItemLog = styled.span`
 | 
				
			|||||||
  margin-left: 2px;
 | 
					  margin-left: 2px;
 | 
				
			||||||
  color: rgba(${props => props.theme.colors.text.primary});
 | 
					  color: rgba(${props => props.theme.colors.text.primary});
 | 
				
			||||||
`;
 | 
					`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const ViewRawButton = styled.button`
 | 
				
			||||||
 | 
					  border-radius: 3px;
 | 
				
			||||||
 | 
					  padding: 8px 12px;
 | 
				
			||||||
 | 
					  display: flex;
 | 
				
			||||||
 | 
					  position: absolute;
 | 
				
			||||||
 | 
					  right: 4px;
 | 
				
			||||||
 | 
					  bottom: -24px;
 | 
				
			||||||
 | 
					  cursor: pointer;
 | 
				
			||||||
 | 
					  color: rgba(${props => props.theme.colors.text.primary}, 0.25);
 | 
				
			||||||
 | 
					  &:hover {
 | 
				
			||||||
 | 
					    color: rgba(${props => props.theme.colors.text.primary});
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const TaskDetailsEditor = styled(TextareaAutosize)`
 | 
				
			||||||
 | 
					  min-height: 108px;
 | 
				
			||||||
 | 
					  color: #c2c6dc;
 | 
				
			||||||
 | 
					  background: #262c49;
 | 
				
			||||||
 | 
					  border-radius: 3px;
 | 
				
			||||||
 | 
					  line-height: 20px;
 | 
				
			||||||
 | 
					  margin-left: 32px;
 | 
				
			||||||
 | 
					  margin-right: 32px;
 | 
				
			||||||
 | 
					  padding: 9px 8px 7px 8px;
 | 
				
			||||||
 | 
					  outline: none;
 | 
				
			||||||
 | 
					  border: none;
 | 
				
			||||||
 | 
					`;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,6 +30,7 @@ import {
 | 
				
			|||||||
  AssignUserLabel,
 | 
					  AssignUserLabel,
 | 
				
			||||||
  AssignUsersButton,
 | 
					  AssignUsersButton,
 | 
				
			||||||
  AssignedUsersSection,
 | 
					  AssignedUsersSection,
 | 
				
			||||||
 | 
					  ViewRawButton,
 | 
				
			||||||
  DueDateTitle,
 | 
					  DueDateTitle,
 | 
				
			||||||
  Container,
 | 
					  Container,
 | 
				
			||||||
  LeftSidebar,
 | 
					  LeftSidebar,
 | 
				
			||||||
@@ -65,6 +66,7 @@ import {
 | 
				
			|||||||
  CommentProfile,
 | 
					  CommentProfile,
 | 
				
			||||||
  CommentInnerWrapper,
 | 
					  CommentInnerWrapper,
 | 
				
			||||||
  ActivitySection,
 | 
					  ActivitySection,
 | 
				
			||||||
 | 
					  TaskDetailsEditor,
 | 
				
			||||||
} from './Styles';
 | 
					} from './Styles';
 | 
				
			||||||
import Checklist, { ChecklistItem, ChecklistItems } from '../Checklist';
 | 
					import Checklist, { ChecklistItem, ChecklistItems } from '../Checklist';
 | 
				
			||||||
import onDragEnd from './onDragEnd';
 | 
					import onDragEnd from './onDragEnd';
 | 
				
			||||||
@@ -153,6 +155,7 @@ const TaskDetails: React.FC<TaskDetailsProps> = ({
 | 
				
			|||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  const [saveTimeout, setSaveTimeout] = useState<any>(null);
 | 
					  const [saveTimeout, setSaveTimeout] = useState<any>(null);
 | 
				
			||||||
 | 
					  const [showRaw, setShowRaw] = useState(false);
 | 
				
			||||||
  const [showCommentActions, setShowCommentActions] = useState(false);
 | 
					  const [showCommentActions, setShowCommentActions] = useState(false);
 | 
				
			||||||
  const taskDescriptionRef = useRef(task.description ?? '');
 | 
					  const taskDescriptionRef = useRef(task.description ?? '');
 | 
				
			||||||
  const $noMemberBtn = useRef<HTMLDivElement>(null);
 | 
					  const $noMemberBtn = useRef<HTMLDivElement>(null);
 | 
				
			||||||
@@ -309,28 +312,34 @@ const TaskDetails: React.FC<TaskDetailsProps> = ({
 | 
				
			|||||||
        </HeaderContainer>
 | 
					        </HeaderContainer>
 | 
				
			||||||
        <InnerContentContainer>
 | 
					        <InnerContentContainer>
 | 
				
			||||||
          <DescriptionContainer>
 | 
					          <DescriptionContainer>
 | 
				
			||||||
            <EditorContainer
 | 
					            {showRaw ? (
 | 
				
			||||||
              onClick={e => {
 | 
					              <TaskDetailsEditor value={taskDescriptionRef.current} />
 | 
				
			||||||
                if (!editTaskDescription) {
 | 
					            ) : (
 | 
				
			||||||
                  setEditTaskDescription(true);
 | 
					              <EditorContainer
 | 
				
			||||||
                }
 | 
					                onClick={e => {
 | 
				
			||||||
              }}
 | 
					                  if (!editTaskDescription) {
 | 
				
			||||||
            >
 | 
					                    setEditTaskDescription(true);
 | 
				
			||||||
              <Editor
 | 
					                  }
 | 
				
			||||||
                defaultValue={task.description ?? ''}
 | 
					 | 
				
			||||||
                theme={dark}
 | 
					 | 
				
			||||||
                readOnly={!editTaskDescription}
 | 
					 | 
				
			||||||
                autoFocus
 | 
					 | 
				
			||||||
                onChange={value => {
 | 
					 | 
				
			||||||
                  setSaveTimeout(() => {
 | 
					 | 
				
			||||||
                    clearTimeout(saveTimeout);
 | 
					 | 
				
			||||||
                    return setTimeout(saveDescription, 2000);
 | 
					 | 
				
			||||||
                  });
 | 
					 | 
				
			||||||
                  const text = value();
 | 
					 | 
				
			||||||
                  taskDescriptionRef.current = text;
 | 
					 | 
				
			||||||
                }}
 | 
					                }}
 | 
				
			||||||
              />
 | 
					              >
 | 
				
			||||||
            </EditorContainer>
 | 
					                <Editor
 | 
				
			||||||
 | 
					                  defaultValue={task.description ?? ''}
 | 
				
			||||||
 | 
					                  theme={dark}
 | 
				
			||||||
 | 
					                  readOnly={!editTaskDescription}
 | 
				
			||||||
 | 
					                  autoFocus
 | 
				
			||||||
 | 
					                  onChange={value => {
 | 
				
			||||||
 | 
					                    setSaveTimeout(() => {
 | 
				
			||||||
 | 
					                      clearTimeout(saveTimeout);
 | 
				
			||||||
 | 
					                      return setTimeout(saveDescription, 2000);
 | 
				
			||||||
 | 
					                    });
 | 
				
			||||||
 | 
					                    const text = value();
 | 
				
			||||||
 | 
					                    taskDescriptionRef.current = text;
 | 
				
			||||||
 | 
					                  }}
 | 
				
			||||||
 | 
					                />
 | 
				
			||||||
 | 
					              </EditorContainer>
 | 
				
			||||||
 | 
					            )}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            <ViewRawButton onClick={() => setShowRaw(!showRaw)}>{showRaw ? 'Show editor' : 'Show raw'}</ViewRawButton>
 | 
				
			||||||
          </DescriptionContainer>
 | 
					          </DescriptionContainer>
 | 
				
			||||||
          <ChecklistSection>
 | 
					          <ChecklistSection>
 | 
				
			||||||
            <DragDropContext onDragEnd={result => onDragEnd(result, task, onChecklistDrop, onChecklistItemDrop)}>
 | 
					            <DragDropContext onDragEnd={result => onDragEnd(result, task, onChecklistDrop, onChecklistItemDrop)}>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user