mirror of
https://github.com/outline/outline.git
synced 2026-11-28 16:19:46 +03:00
link
feat: New doc button on template list item
This commit is contained in:
1 parent
a15c64ec4a
commit
71044c39dd
3 files changed
+23
-5
No files matched your search
@@ -113,6 +113,7 @@ export const Inner = styled.span`
|
||||
line-height: ${props => (props.hasIcon ? 24 : 32)}px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 30px;
|
||||
|
||||
${props => props.hasIcon && props.hasText && "padding-left: 4px;"};
|
||||
${props => props.hasIcon && !props.hasText && "padding: 0 4px;"};
|
||||
|
||||
@@ -12,6 +12,7 @@ import Highlight from "components/Highlight";
|
||||
import PublishingInfo from "components/PublishingInfo";
|
||||
import DocumentMenu from "menus/DocumentMenu";
|
||||
import Document from "models/Document";
|
||||
import { newDocumentUrl } from "utils/routeHelpers";
|
||||
|
||||
type Props = {
|
||||
document: Document,
|
||||
@@ -28,18 +29,22 @@ const SEARCH_RESULT_REGEX = /<b\b[^>]*>(.*?)<\/b>/gi;
|
||||
|
||||
@observer
|
||||
class DocumentPreview extends React.Component<Props> {
|
||||
star = (ev: SyntheticEvent<>) => {
|
||||
handleStar = (ev: SyntheticEvent<>) => {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
this.props.document.star();
|
||||
};
|
||||
|
||||
unstar = (ev: SyntheticEvent<>) => {
|
||||
handleUnstar = (ev: SyntheticEvent<>) => {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
this.props.document.unstar();
|
||||
};
|
||||
|
||||
handleNewFromTemplate = () => {
|
||||
//
|
||||
};
|
||||
|
||||
replaceResultMarks = (tag: string) => {
|
||||
// don't use SEARCH_RESULT_REGEX here as it causes
|
||||
// an infinite loop to trigger a regex inside it's own callback
|
||||
@@ -78,9 +83,9 @@ class DocumentPreview extends React.Component<Props> {
|
||||
!document.isTemplate && (
|
||||
<Actions>
|
||||
{document.isStarred ? (
|
||||
<StyledStar onClick={this.unstar} solid />
|
||||
<StyledStar onClick={this.handleUnstar} solid />
|
||||
) : (
|
||||
<StyledStar onClick={this.star} />
|
||||
<StyledStar onClick={this.handleStar} />
|
||||
)}
|
||||
</Actions>
|
||||
)}
|
||||
@@ -97,6 +102,19 @@ class DocumentPreview extends React.Component<Props> {
|
||||
{document.isTemplate &&
|
||||
showTemplate && <Badge primary>Template</Badge>}
|
||||
<SecondaryActions>
|
||||
{document.isTemplate && (
|
||||
<Button
|
||||
as={Link}
|
||||
to={newDocumentUrl(document.collectionId, {
|
||||
templateId: document.id,
|
||||
})}
|
||||
icon={<PlusIcon />}
|
||||
onClick={this.handleNewFromTemplate}
|
||||
neutral
|
||||
>
|
||||
New doc
|
||||
</Button>
|
||||
)}
|
||||
<DocumentMenu document={document} showPin={showPin} />
|
||||
</SecondaryActions>
|
||||
</Heading>
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
ProfileIcon,
|
||||
PadlockIcon,
|
||||
CodeIcon,
|
||||
ShapesIcon,
|
||||
UserIcon,
|
||||
GroupIcon,
|
||||
LinkIcon,
|
||||
|
||||
Reference in new issue
Block a user