mirror of
https://github.com/outline/outline.git
synced 2026-12-04 02:20:17 +03:00
Minor tweaks
This commit is contained in:
1 parent
c8e16e8de0
commit
c40caea4ab
5 files changed
+35
-36
No files matched your search
@@ -331,7 +331,7 @@ function DocumentMenu({
|
||||
to: newDocumentUrl(collection?.id, {
|
||||
parentDocumentId: document.id,
|
||||
}),
|
||||
visible: !!can.createChildDocument,
|
||||
visible: !!can.createChildDocument && !!collection?.id,
|
||||
icon: <NewDocumentIcon />,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -178,7 +178,7 @@ function DocumentHeader({
|
||||
<TemplatesMenu document={document} />
|
||||
</Action>
|
||||
)}
|
||||
{!isEditing && !isMobile && !isTemplate && hasCollection && (
|
||||
{!isEditing && !isMobile && !isTemplate && (
|
||||
<Action>
|
||||
<ShareButton document={document} />
|
||||
</Action>
|
||||
|
||||
@@ -53,29 +53,32 @@ const PublishDialog = ({ dialog, document, onSave }: Props) => {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handlePublishFromModal = async (selectedPath) => {
|
||||
if (!document) return;
|
||||
if (!selectedPath) {
|
||||
showToast(t("Please select a path"));
|
||||
return;
|
||||
}
|
||||
const handlePublishFromModal = React.useCallback(
|
||||
async (selectedPath) => {
|
||||
if (!document) return;
|
||||
if (!selectedPath) {
|
||||
showToast(t("Please select a path"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedPath.type === "collection") {
|
||||
await onSave({
|
||||
done: true,
|
||||
publish: true,
|
||||
collectionId: selectedPath.collectionId,
|
||||
});
|
||||
} else {
|
||||
await onSave({
|
||||
done: true,
|
||||
publish: true,
|
||||
collectionId: selectedPath.collectionId,
|
||||
parentDocumentId: selectedPath.id,
|
||||
});
|
||||
}
|
||||
dialog.setVisible(false);
|
||||
};
|
||||
if (selectedPath.type === "collection") {
|
||||
await onSave({
|
||||
done: true,
|
||||
publish: true,
|
||||
collectionId: selectedPath.collectionId,
|
||||
});
|
||||
} else {
|
||||
await onSave({
|
||||
done: true,
|
||||
publish: true,
|
||||
collectionId: selectedPath.collectionId,
|
||||
parentDocumentId: selectedPath.id,
|
||||
});
|
||||
}
|
||||
dialog.setVisible(false);
|
||||
},
|
||||
[dialog, document, onSave, showToast, t]
|
||||
);
|
||||
|
||||
const selected = React.useCallback(
|
||||
(result) => {
|
||||
@@ -100,12 +103,10 @@ const PublishDialog = ({ dialog, document, onSave }: Props) => {
|
||||
let paths = collections.pathsToDocuments;
|
||||
|
||||
paths = paths.filter((path) => {
|
||||
if (path.type === "collection" && policies.abilities(path.id).update)
|
||||
return true;
|
||||
|
||||
if (
|
||||
path.type === "document" &&
|
||||
policies.abilities(path.collectionId).update
|
||||
(path.type === "collection" && policies.abilities(path.id).update) ||
|
||||
(path.type === "document" &&
|
||||
policies.abilities(path.collectionId).update)
|
||||
)
|
||||
return true;
|
||||
|
||||
@@ -164,6 +165,7 @@ const PublishDialog = ({ dialog, document, onSave }: Props) => {
|
||||
const result = data[index];
|
||||
return (
|
||||
<PathToDocument
|
||||
key={result.url}
|
||||
result={result}
|
||||
document={document}
|
||||
collection={collections.get(result.collectionId)}
|
||||
|
||||
@@ -53,12 +53,10 @@ function DocumentMove({ document, onRequestClose }: Props) {
|
||||
let paths = collections.pathsToDocuments;
|
||||
|
||||
paths = paths.filter((path) => {
|
||||
if (path.type === "collection" && policies.abilities(path.id).update)
|
||||
return true;
|
||||
|
||||
if (
|
||||
path.type === "document" &&
|
||||
policies.abilities(path.collectionId).update
|
||||
(path.type === "collection" && policies.abilities(path.id).update) ||
|
||||
(path.type === "document" &&
|
||||
policies.abilities(path.collectionId).update)
|
||||
)
|
||||
return true;
|
||||
|
||||
@@ -153,7 +151,7 @@ function DocumentMove({ document, onRequestClose }: Props) {
|
||||
|
||||
return (
|
||||
<PathToDocument
|
||||
key={result.id + result.type}
|
||||
key={result.url}
|
||||
result={result}
|
||||
document={document}
|
||||
collection={collections.get(result.collectionId)}
|
||||
|
||||
@@ -135,7 +135,6 @@
|
||||
"Dismiss": "Dismiss",
|
||||
"Keyboard shortcuts": "Keyboard shortcuts",
|
||||
"Back": "Back",
|
||||
"New draft doc": "New draft doc",
|
||||
"Document archived": "Document archived",
|
||||
"Collections could not be loaded, please reload the app": "Collections could not be loaded, please reload the app",
|
||||
"New collection": "New collection",
|
||||
|
||||
Reference in new issue
Block a user