4 Commits

10 changed files with 142 additions and 9 deletions

46
.github/workflows/publish-docker.yml vendored Normal file
View File

@@ -0,0 +1,46 @@
name: CI/CD Pipeline
on: [push]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# - name: Setup Node.js environment
# uses: actions/setup-node@v4
# with:
# node-version: "18"
# - name: Install Dependencies
# run: yarn install
# - name: Build Project
# run: yarn build
- name: Docker login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.base
push: true
tags: |
yuuza/outline-base:${{ github.ref_name == 'main' && 'latest' || github.ref_name }}
cache-from: type=registry,ref=yuuza/outline-base:${{ github.ref_name == 'main' && 'latest' || github.ref_name }}
cache-to: type=inline
- run: docker tag yuuza/outline-base:${{ github.ref_name == 'main' && 'latest' || github.ref_name }} outlinewiki/outline-base:latest
- name: Build runner image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
yuuza/outline:${{ github.ref_name == 'main' && 'latest' || github.ref_name }}
cache-from: type=registry,ref=yuuza/outline:${{ github.ref_name == 'main' && 'latest' || github.ref_name }}
cache-to: type=inline

View File

@@ -81,6 +81,13 @@ function DocumentListItem(
title: document.titleWithDefault,
},
}}
onContextMenu={(e) => {
if (menuOpen) {
return;
}
e.preventDefault();
handleMenuOpen();
}}
{...rest}
>
<Content>
@@ -137,6 +144,7 @@ function DocumentListItem(
<DocumentMenu
document={document}
showPin={showPin}
visible={menuOpen}
onOpen={handleMenuOpen}
onClose={handleMenuClose}
modal={false}

View File

@@ -131,7 +131,16 @@ const CollectionLink: React.FC<Props> = ({
return (
<>
<Relative ref={drop}>
<Relative
ref={drop}
onContextMenu={(e) => {
if (menuOpen || isEditing) {
return;
}
e.preventDefault();
handleMenuOpen();
}}
>
<DropToImport collectionId={collection.id}>
<SidebarLink
to={{
@@ -178,6 +187,7 @@ const CollectionLink: React.FC<Props> = ({
onRename={() =>
editableTitleRef.current?.setIsEditing(true)
}
visible={menuOpen}
onOpen={handleMenuOpen}
onClose={handleMenuClose}
/>

View File

@@ -310,6 +310,13 @@ function InnerDocumentLink(
$isDragging={isDragging}
$isMoving={isMoving}
onKeyDown={handleKeyDown}
onContextMenu={(e) => {
if (menuOpen || isEditing) {
return;
}
e.preventDefault();
handleMenuOpen();
}}
>
<div ref={dropToReparent}>
<DropToImport documentId={node.id} activeClassName="activeDropZone">
@@ -372,6 +379,7 @@ function InnerDocumentLink(
onRename={() =>
editableTitleRef.current?.setIsEditing(true)
}
visible={menuOpen}
onOpen={handleMenuOpen}
onClose={handleMenuClose}
/>

View File

@@ -115,7 +115,18 @@ function StarredLink({ star }: Props) {
return (
<>
<Draggable key={star.id} ref={draggableRef} $isDragging={isDragging}>
<Draggable
key={star.id}
ref={draggableRef}
$isDragging={isDragging}
onContextMenu={(e) => {
if (menuOpen) {
return;
}
e.preventDefault();
handleMenuOpen();
}}
>
<SidebarLink
depth={0}
to={{
@@ -136,6 +147,7 @@ function StarredLink({ star }: Props) {
<Fade>
<DocumentMenu
document={document}
visible={menuOpen}
onOpen={handleMenuOpen}
onClose={handleMenuClose}
/>

View File

@@ -39,6 +39,7 @@ type Props = {
collection: Collection;
placement?: Placement;
modal?: boolean;
visible?: boolean;
label?: (props: MenuButtonHTMLProps) => React.ReactNode;
onRename?: () => void;
onOpen?: () => void;
@@ -49,6 +50,7 @@ function CollectionMenu({
collection,
label,
modal = true,
visible,
placement,
onRename,
onOpen,
@@ -64,6 +66,12 @@ function CollectionMenu({
const history = useHistory();
const file = React.useRef<HTMLInputElement>(null);
React.useEffect(() => {
if (visible !== undefined && menu.visible !== visible) {
menu.setVisible(visible);
}
}, [visible]);
const handleExport = React.useCallback(() => {
dialogs.openModal({
title: t("Export collection"),

View File

@@ -61,6 +61,7 @@ type Props = {
/** Pass true if the document is currently being displayed */
showDisplayOptions?: boolean;
modal?: boolean;
visible?: boolean;
showToggleEmbeds?: boolean;
showPin?: boolean;
label?: (props: MenuButtonHTMLProps) => React.ReactNode;
@@ -74,6 +75,7 @@ function DocumentMenu({
document,
className,
modal = true,
visible,
showToggleEmbeds,
showDisplayOptions,
label,
@@ -106,6 +108,12 @@ function DocumentMenu({
})
);
React.useEffect(() => {
if (visible !== undefined && menu.visible !== visible) {
menu.setVisible(visible);
}
}, [visible]);
const handleOpen = React.useCallback(async () => {
if (!data && !loading) {
await request();

View File

@@ -346,6 +346,7 @@
"prettier": "^2.8.8",
"react-refresh": "^0.14.0",
"rimraf": "^2.5.4",
"rollup-plugin-visualizer": "^5.12.0",
"rollup-plugin-webpack-stats": "^0.2.4",
"terser": "^5.19.2",
"typescript": "^5.4.5",

View File

@@ -2,6 +2,7 @@ import fs from "fs";
import path from "path";
import react from "@vitejs/plugin-react";
import browserslistToEsbuild from "browserslist-to-esbuild";
import { visualizer } from "rollup-plugin-visualizer";
import { webpackStats } from "rollup-plugin-webpack-stats";
import { CommonServerOptions, defineConfig } from "vite";
import { VitePWA } from "vite-plugin-pwa";
@@ -140,6 +141,13 @@ export default () =>
}),
// Generate a stats.json file for webpack that will be consumed by RelativeCI
webpackStats(),
visualizer({
template: "treemap", // or sunburst
// open: true,
gzipSize: true,
brotliSize: true,
filename: "analyse.html", // will be saved in project's root
}),
],
optimizeDeps: {
esbuildOptions: {
@@ -173,10 +181,10 @@ export default () =>
index: "./app/index.tsx",
},
output: {
assetFileNames: 'assets/[name].[hash][extname]',
chunkFileNames: 'assets/[name].[hash].js',
entryFileNames: 'assets/[name].[hash].js',
}
assetFileNames: "assets/[name].[hash][extname]",
chunkFileNames: "assets/[name].[hash].js",
entryFileNames: "assets/[name].[hash].js",
},
},
},
});

View File

@@ -7208,6 +7208,11 @@ define-data-property@^1.0.1, define-data-property@^1.1.4:
es-errors "^1.3.0"
gopd "^1.0.1"
define-lazy-prop@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f"
integrity sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==
define-properties@^1.1.3, define-properties@^1.2.0, define-properties@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.1.tgz#10781cc616eb951a80a034bafcaa7377f6af2b6c"
@@ -9449,7 +9454,7 @@ is-decimal@^1.0.0:
resolved "https://registry.yarnpkg.com/is-decimal/-/is-decimal-1.0.4.tgz#65a3a5958a1c5b63a706e1b333d7cd9f630d3fa5"
integrity "sha1-ZaOllYocW2OnBuGzM9fNn2MNP6U= sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw=="
is-docker@^2.0.0:
is-docker@^2.0.0, is-docker@^2.1.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa"
integrity "sha1-M+6r4jz+hvFL3kQIoCwM+4U6zao= sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ=="
@@ -9692,7 +9697,7 @@ is-windows@^1.0.1:
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"
integrity "sha1-0YUOuXkezRjmGCzhKjDzlmNLsZ0= sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA=="
is-wsl@^2.1.1:
is-wsl@^2.1.1, is-wsl@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271"
integrity "sha1-dKTHbnfKn9P5MvKQwX6jJs0VcnE= sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww=="
@@ -11734,6 +11739,15 @@ open@^7.4.2:
is-docker "^2.0.0"
is-wsl "^2.1.1"
open@^8.4.0:
version "8.4.2"
resolved "https://registry.yarnpkg.com/open/-/open-8.4.2.tgz#5b5ffe2a8f793dcd2aad73e550cb87b59cb084f9"
integrity sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==
dependencies:
define-lazy-prop "^2.0.0"
is-docker "^2.1.1"
is-wsl "^2.2.0"
opentracing@>=0.12.1:
version "0.14.5"
resolved "https://registry.yarnpkg.com/opentracing/-/opentracing-0.14.5.tgz#891fa92cd90a24e64f99bc964370227310926c85"
@@ -13263,6 +13277,16 @@ rollup-plugin-terser@^7.0.0:
serialize-javascript "^4.0.0"
terser "^5.0.0"
rollup-plugin-visualizer@^5.12.0:
version "5.12.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-visualizer/-/rollup-plugin-visualizer-5.12.0.tgz#661542191ce78ee4f378995297260d0c1efb1302"
integrity sha512-8/NU9jXcHRs7Nnj07PF2o4gjxmm9lXIrZ8r175bT9dK8qoLlvKTwRMArRCMgpMGlq8CTLugRvEmyMeMXIU2pNQ==
dependencies:
open "^8.4.0"
picomatch "^2.3.1"
source-map "^0.7.4"
yargs "^17.5.1"
rollup-plugin-webpack-stats@^0.2.4:
version "0.2.4"
resolved "https://registry.yarnpkg.com/rollup-plugin-webpack-stats/-/rollup-plugin-webpack-stats-0.2.4.tgz#79e8cdcbd8be87310506fb9f86e49fb16de06962"
@@ -15368,7 +15392,7 @@ yargs-parser@^21.1.1:
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"
integrity "sha1-kJa87r+ZDSG7MfqVFuDt4pSnfTU= sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw=="
yargs@17.7.2, yargs@^17.3.1, yargs@^17.7.2:
yargs@17.7.2, yargs@^17.3.1, yargs@^17.5.1, yargs@^17.7.2:
version "17.7.2"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269"
integrity "sha1-mR3zmspnWhkrgW4eA2P5110qomk= sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w=="