+
+);
export default Subheading;
diff --git a/app/components/Tab.tsx b/app/components/Tab.tsx
index b020f1e5c..ff28aa1f8 100644
--- a/app/components/Tab.tsx
+++ b/app/components/Tab.tsx
@@ -17,6 +17,7 @@ const TabLink = styled(NavLink)`
font-size: 14px;
cursor: var(--pointer);
color: ${s("textTertiary")};
+ user-select: none;
margin-right: 24px;
padding: 6px 0;
diff --git a/app/components/Table.tsx b/app/components/Table.tsx
index a8e9f36af..e95ddd20f 100644
--- a/app/components/Table.tsx
+++ b/app/components/Table.tsx
@@ -195,23 +195,21 @@ export const Placeholder = ({
}: {
columns: number;
rows?: number;
-}) => {
- return (
-
-
- {new Array(rows).fill(1).map((_, row) => (
-
- {new Array(columns).fill(1).map((_, col) => (
-
-
-
- ))}
-
- ))}
-
-
- );
-};
+}) => (
+
+
+ {new Array(rows).fill(1).map((_, row) => (
+
+ {new Array(columns).fill(1).map((_, col) => (
+
+
+
+ ))}
+
+ ))}
+
+
+);
const Anchor = styled.div`
top: -32px;
diff --git a/app/components/Toast.tsx b/app/components/Toast.tsx
index a2f9bb339..6e6dfca4e 100644
--- a/app/components/Toast.tsx
+++ b/app/components/Toast.tsx
@@ -61,8 +61,9 @@ function Toast({ closeAfterMs = 3000, onRequestClose, toast }: Props) {
{type === "loading" && }
{type === "info" && }
{type === "success" && }
- {type === "warning" ||
- (type === "error" && )}
+ {(type === "warning" || type === "error") && (
+
+ )}
{toast.message}
{action && {action.text}}
diff --git a/app/editor/components/BlockMenu.tsx b/app/editor/components/BlockMenu.tsx
index 7cca6e5f5..aca9af54d 100644
--- a/app/editor/components/BlockMenu.tsx
+++ b/app/editor/components/BlockMenu.tsx
@@ -30,7 +30,7 @@ function BlockMenu(props: Props) {
return (
(
{
+ boundary: (parent) =>
// Prevents body and other parent elements from being scrolled
- return parent !== containerRef.current;
- },
+ parent !== containerRef.current,
});
}
},
diff --git a/app/editor/components/SuggestionsMenu.tsx b/app/editor/components/SuggestionsMenu.tsx
index ff126b4b5..743f59e2b 100644
--- a/app/editor/components/SuggestionsMenu.tsx
+++ b/app/editor/components/SuggestionsMenu.tsx
@@ -397,11 +397,9 @@ function SuggestionsMenu(props: Props) {
});
return filterExcessSeparators(
- filtered.sort((item) => {
- return searchInput && item.title
- ? commandScore(item.title, searchInput)
- : 0;
- })
+ filtered.sort((item) =>
+ searchInput && item.title ? commandScore(item.title, searchInput) : 0
+ )
);
}, [commands, props]);
diff --git a/app/editor/components/SuggestionsMenuItem.tsx b/app/editor/components/SuggestionsMenuItem.tsx
index 426a9443b..b45fab884 100644
--- a/app/editor/components/SuggestionsMenuItem.tsx
+++ b/app/editor/components/SuggestionsMenuItem.tsx
@@ -28,12 +28,11 @@ function SuggestionsMenuItem({
scrollIntoView(node, {
scrollMode: "if-needed",
block: "nearest",
- boundary: (parent) => {
+ boundary: (parent) =>
// All the parent elements of your target are checked until they
// reach the portal context. Prevents body and other parent
// elements from being scrolled
- return parent !== portal;
- },
+ parent !== portal,
});
}
},
diff --git a/app/editor/index.tsx b/app/editor/index.tsx
index 607fbc14e..a15ed08d8 100644
--- a/app/editor/index.tsx
+++ b/app/editor/index.tsx
@@ -355,8 +355,8 @@ export class Editor extends React.PureComponent<
decorations: Decoration<{
[key: string]: any;
}>[]
- ) => {
- return new ComponentView(extension.component, {
+ ) =>
+ new ComponentView(extension.component, {
editor: this,
extension,
node,
@@ -364,7 +364,6 @@ export class Editor extends React.PureComponent<
getPos,
decorations,
});
- };
return {
...nodeViews,
@@ -449,13 +448,12 @@ export class Editor extends React.PureComponent<
throw new Error("createView called before ref available");
}
- const isEditingCheckbox = (tr: Transaction) => {
- return tr.steps.some(
+ const isEditingCheckbox = (tr: Transaction) =>
+ tr.steps.some(
(step: any) =>
step.slice?.content?.firstChild?.type.name ===
this.schema.nodes.checkbox_item.name
);
- };
const self = this; // eslint-disable-line
const view = new EditorView(this.elementRef.current, {
@@ -579,36 +577,28 @@ export class Editor extends React.PureComponent<
*
* @returns True if the editor is empty
*/
- public isEmpty = () => {
- return ProsemirrorHelper.isEmpty(this.view.state.doc);
- };
+ public isEmpty = () => ProsemirrorHelper.isEmpty(this.view.state.doc);
/**
* Return the headings in the current editor.
*
* @returns A list of headings in the document
*/
- public getHeadings = () => {
- return ProsemirrorHelper.getHeadings(this.view.state.doc);
- };
+ public getHeadings = () => ProsemirrorHelper.getHeadings(this.view.state.doc);
/**
* Return the tasks/checkmarks in the current editor.
*
* @returns A list of tasks in the document
*/
- public getTasks = () => {
- return ProsemirrorHelper.getTasks(this.view.state.doc);
- };
+ public getTasks = () => ProsemirrorHelper.getTasks(this.view.state.doc);
/**
* Return the comments in the current editor.
*
* @returns A list of comments in the document
*/
- public getComments = () => {
- return ProsemirrorHelper.getComments(this.view.state.doc);
- };
+ public getComments = () => ProsemirrorHelper.getComments(this.view.state.doc);
/**
* Remove a specific comment mark from the document.
@@ -661,9 +651,9 @@ export class Editor extends React.PureComponent<
return;
}
- this.props.onChange((asString = true, trim = false) => {
- return this.view ? this.value(asString, trim) : undefined;
- });
+ this.props.onChange((asString = true, trim = false) =>
+ this.view ? this.value(asString, trim) : undefined
+ );
};
private handleEditorBlur = () => {
@@ -835,13 +825,11 @@ const EditorContainer = styled(Styles)<{ focusedCommentId?: string }>`
`;
const LazyLoadedEditor = React.forwardRef(
- (props: Props, ref) => {
- return (
-
- {(theme) => }
-
- );
- }
+ (props: Props, ref) => (
+
+ {(theme) => }
+
+ )
);
export default LazyLoadedEditor;
diff --git a/app/hooks/useBuildTheme.ts b/app/hooks/useBuildTheme.ts
index c629309fa..7a2fc9b9a 100644
--- a/app/hooks/useBuildTheme.ts
+++ b/app/hooks/useBuildTheme.ts
@@ -21,17 +21,19 @@ export default function useBuildTheme(customTheme: Partial = {}) {
const isMobile = useMediaQuery(`(max-width: ${breakpoints.tablet}px)`);
const isPrinting = useMediaQuery("print");
- const theme = React.useMemo(() => {
- return isPrinting
- ? buildLightTheme(customTheme)
- : isMobile
- ? ui.resolvedTheme === "dark"
- ? buildPitchBlackTheme(customTheme)
- : buildLightTheme(customTheme)
- : ui.resolvedTheme === "dark"
- ? buildDarkTheme(customTheme)
- : buildLightTheme(customTheme);
- }, [customTheme, isMobile, isPrinting, ui.resolvedTheme]);
+ const theme = React.useMemo(
+ () =>
+ isPrinting
+ ? buildLightTheme(customTheme)
+ : isMobile
+ ? ui.resolvedTheme === "dark"
+ ? buildPitchBlackTheme(customTheme)
+ : buildLightTheme(customTheme)
+ : ui.resolvedTheme === "dark"
+ ? buildDarkTheme(customTheme)
+ : buildLightTheme(customTheme),
+ [customTheme, isMobile, isPrinting, ui.resolvedTheme]
+ );
return theme;
}
diff --git a/app/hooks/useDictionary.ts b/app/hooks/useDictionary.ts
index 088d40e71..737986091 100644
--- a/app/hooks/useDictionary.ts
+++ b/app/hooks/useDictionary.ts
@@ -4,8 +4,8 @@ import { useTranslation } from "react-i18next";
export default function useDictionary() {
const { t } = useTranslation();
- return React.useMemo(() => {
- return {
+ return React.useMemo(
+ () => ({
addColumnAfter: t("Insert column after"),
addColumnBefore: t("Insert column before"),
addRowAfter: t("Insert row after"),
@@ -79,8 +79,9 @@ export default function useDictionary() {
insertDate: t("Current date"),
insertTime: t("Current time"),
insertDateTime: t("Current date and time"),
- };
- }, [t]);
+ }),
+ [t]
+ );
}
export type Dictionary = ReturnType;
diff --git a/app/hooks/useSettingsActions.tsx b/app/hooks/useSettingsActions.tsx
index dda958c17..2359cd3c7 100644
--- a/app/hooks/useSettingsActions.tsx
+++ b/app/hooks/useSettingsActions.tsx
@@ -7,18 +7,20 @@ import useSettingsConfig from "./useSettingsConfig";
const useSettingsActions = () => {
const config = useSettingsConfig();
- const actions = React.useMemo(() => {
- return config.map((item) => {
- const Icon = item.icon;
- return {
- id: item.path,
- name: item.name,
- icon: ,
- section: NavigationSection,
- perform: () => history.push(item.path),
- };
- });
- }, [config]);
+ const actions = React.useMemo(
+ () =>
+ config.map((item) => {
+ const Icon = item.icon;
+ return {
+ id: item.path,
+ name: item.name,
+ icon: ,
+ section: NavigationSection,
+ perform: () => history.push(item.path),
+ };
+ }),
+ [config]
+ );
const navigateToSettings = React.useMemo(
() =>
diff --git a/app/hooks/useSettingsConfig.ts b/app/hooks/useSettingsConfig.ts
index e8258a314..6b63596ee 100644
--- a/app/hooks/useSettingsConfig.ts
+++ b/app/hooks/useSettingsConfig.ts
@@ -160,16 +160,18 @@ const useSettingsConfig = () => {
icon: ExportIcon,
},
// Integrations
- ...mapValues(PluginLoader.plugins, (plugin) => {
- return {
- name: plugin.config.name,
- path: integrationSettingsPath(plugin.id),
- group: t("Integrations"),
- component: plugin.settings,
- enabled: !!plugin.settings && can.update,
- icon: plugin.icon,
- } as ConfigItem;
- }),
+ ...mapValues(
+ PluginLoader.plugins,
+ (plugin) =>
+ ({
+ name: plugin.config.name,
+ path: integrationSettingsPath(plugin.id),
+ group: t("Integrations"),
+ component: plugin.settings,
+ enabled: !!plugin.settings && can.update,
+ icon: plugin.icon,
+ } as ConfigItem)
+ ),
SelfHosted: {
name: t("Self Hosted"),
path: integrationSettingsPath("self-hosted"),
diff --git a/app/hooks/useUnmount.ts b/app/hooks/useUnmount.ts
index 57fa64691..5be355e00 100644
--- a/app/hooks/useUnmount.ts
+++ b/app/hooks/useUnmount.ts
@@ -4,11 +4,12 @@ const useUnmount = (callback: (...args: Array) => any) => {
const ref = React.useRef(callback);
ref.current = callback;
- React.useEffect(() => {
- return () => {
+ React.useEffect(
+ () => () => {
ref.current();
- };
- }, []);
+ },
+ []
+ );
};
export default useUnmount;
diff --git a/app/menus/AccountMenu.tsx b/app/menus/AccountMenu.tsx
index 88970b297..9f1e4e20c 100644
--- a/app/menus/AccountMenu.tsx
+++ b/app/menus/AccountMenu.tsx
@@ -36,8 +36,8 @@ const AccountMenu: React.FC = ({ children }) => {
}
}, [menu, theme, previousTheme]);
- const actions = React.useMemo(() => {
- return [
+ const actions = React.useMemo(
+ () => [
openKeyboardShortcuts,
downloadApp,
openAPIDocumentation,
@@ -50,8 +50,9 @@ const AccountMenu: React.FC = ({ children }) => {
navigateToAccountPreferences,
separator(),
logout,
- ];
- }, []);
+ ],
+ []
+ );
return (
<>
diff --git a/app/menus/ApiKeyMenu.tsx b/app/menus/ApiKeyMenu.tsx
new file mode 100644
index 000000000..1681138fd
--- /dev/null
+++ b/app/menus/ApiKeyMenu.tsx
@@ -0,0 +1,52 @@
+import { observer } from "mobx-react";
+import * as React from "react";
+import { useTranslation } from "react-i18next";
+import { useMenuState } from "reakit/Menu";
+import ApiKey from "~/models/ApiKey";
+import TokenRevokeDialog from "~/scenes/Settings/components/TokenRevokeDialog";
+import ContextMenu from "~/components/ContextMenu";
+import MenuItem from "~/components/ContextMenu/MenuItem";
+import OverflowMenuButton from "~/components/ContextMenu/OverflowMenuButton";
+import useStores from "~/hooks/useStores";
+
+type Props = {
+ /** The apiKey to associate with the menu */
+ token: ApiKey;
+ /** CSS class name */
+ className?: string;
+};
+
+function ApiKeyMenu({ token, className }: Props) {
+ const menu = useMenuState({
+ modal: true,
+ });
+ const { dialogs } = useStores();
+ const { t } = useTranslation();
+
+ const handleRevoke = React.useCallback(() => {
+ dialogs.openModal({
+ title: t("Revoke token"),
+ isCentered: true,
+ content: (
+
+ ),
+ });
+ }, [t, dialogs, token]);
+
+ return (
+ <>
+
+
+
+
+ >
+ );
+}
+
+export default observer(ApiKeyMenu);
diff --git a/app/menus/OrganizationMenu.tsx b/app/menus/OrganizationMenu.tsx
index 06beb149f..fa3fba8b7 100644
--- a/app/menus/OrganizationMenu.tsx
+++ b/app/menus/OrganizationMenu.tsx
@@ -31,15 +31,16 @@ const OrganizationMenu: React.FC = ({ children }) => {
// NOTE: it's useful to memoize on the team id and session because the action
// menu is not cached at all.
- const actions = React.useMemo(() => {
- return [
+ const actions = React.useMemo(
+ () => [
...createTeamsList(context),
createTeam,
separator(),
navigateToSettings,
logout,
- ];
- }, [context]);
+ ],
+ [context]
+ );
return (
<>
diff --git a/app/models/BaseModel.ts b/app/models/BaseModel.ts
index 7176034da..d423a728c 100644
--- a/app/models/BaseModel.ts
+++ b/app/models/BaseModel.ts
@@ -59,20 +59,17 @@ export default abstract class BaseModel {
};
updateFromJson = (data: any) => {
- //const isNew = !data.id && !this.id && this.isNew;
+ // const isNew = !data.id && !this.id && this.isNew;
set(this, { ...data, isNew: false });
this.persistedAttributes = this.toAPI();
};
- fetch = (options?: any) => {
- return this.store.fetch(this.id, options);
- };
+ fetch = (options?: any) => this.store.fetch(this.id, options);
- refresh = () => {
- return this.fetch({
+ refresh = () =>
+ this.fetch({
force: true,
});
- };
delete = async () => {
this.isSaving = true;
diff --git a/app/models/Collection.ts b/app/models/Collection.ts
index 4c0461910..932c9b278 100644
--- a/app/models/Collection.ts
+++ b/app/models/Collection.ts
@@ -209,19 +209,14 @@ export default class Collection extends ParanoidModel {
}
@action
- star = async () => {
- return this.store.star(this);
- };
+ star = async () => this.store.star(this);
@action
- unstar = async () => {
- return this.store.unstar(this);
- };
+ unstar = async () => this.store.unstar(this);
- export = (format: FileOperationFormat) => {
- return client.post("/collections.export", {
+ export = (format: FileOperationFormat) =>
+ client.post("/collections.export", {
id: this.id,
format,
});
- };
}
diff --git a/app/models/Document.ts b/app/models/Document.ts
index 28f68b2a6..d4b8c68c2 100644
--- a/app/models/Document.ts
+++ b/app/models/Document.ts
@@ -238,23 +238,17 @@ export default class Document extends ParanoidModel {
}
@action
- share = async () => {
- return this.store.rootStore.shares.create({
+ share = async () =>
+ this.store.rootStore.shares.create({
documentId: this.id,
});
- };
- archive = () => {
- return this.store.archive(this);
- };
+ archive = () => this.store.archive(this);
- restore = (options?: { revisionId?: string; collectionId?: string }) => {
- return this.store.restore(this, options);
- };
+ restore = (options?: { revisionId?: string; collectionId?: string }) =>
+ this.store.restore(this, options);
- unpublish = () => {
- return this.store.unpublish(this);
- };
+ unpublish = () => this.store.unpublish(this);
@action
enableEmbeds = () => {
@@ -267,12 +261,11 @@ export default class Document extends ParanoidModel {
};
@action
- pin = (collectionId?: string) => {
- return this.store.rootStore.pins.create({
+ pin = (collectionId?: string) =>
+ this.store.rootStore.pins.create({
documentId: this.id,
...(collectionId ? { collectionId } : {}),
});
- };
@action
unpin = (collectionId?: string) => {
@@ -287,14 +280,10 @@ export default class Document extends ParanoidModel {
};
@action
- star = () => {
- return this.store.star(this);
- };
+ star = () => this.store.star(this);
@action
- unstar = () => {
- return this.store.unstar(this);
- };
+ unstar = () => this.store.unstar(this);
/**
* Subscribes the current user to this document.
@@ -302,9 +291,7 @@ export default class Document extends ParanoidModel {
* @returns A promise that resolves when the subscription is created.
*/
@action
- subscribe = () => {
- return this.store.subscribe(this);
- };
+ subscribe = () => this.store.subscribe(this);
/**
* Unsubscribes the current user to this document.
@@ -312,9 +299,7 @@ export default class Document extends ParanoidModel {
* @returns A promise that resolves when the subscription is destroyed.
*/
@action
- unsubscribe = (userId: string) => {
- return this.store.unsubscribe(userId, this);
- };
+ unsubscribe = (userId: string) => this.store.unsubscribe(userId, this);
@action
view = () => {
@@ -336,9 +321,7 @@ export default class Document extends ParanoidModel {
};
@action
- templatize = () => {
- return this.store.templatize(this.id);
- };
+ templatize = () => this.store.templatize(this.id);
@action
save = async (options?: SaveOptions | undefined) => {
@@ -359,13 +342,10 @@ export default class Document extends ParanoidModel {
}
};
- move = (collectionId: string, parentDocumentId?: string | undefined) => {
- return this.store.move(this.id, collectionId, parentDocumentId);
- };
+ move = (collectionId: string, parentDocumentId?: string | undefined) =>
+ this.store.move(this.id, collectionId, parentDocumentId);
- duplicate = () => {
- return this.store.duplicate(this);
- };
+ duplicate = () => this.store.duplicate(this);
getSummary = (paragraphs = 4) => {
const result = this.text.trim().split("\n").slice(0, paragraphs).join("\n");
@@ -405,8 +385,8 @@ export default class Document extends ParanoidModel {
};
}
- download = (contentType: ExportContentType) => {
- return client.post(
+ download = (contentType: ExportContentType) =>
+ client.post(
`/documents.export`,
{
id: this.id,
@@ -418,5 +398,4 @@ export default class Document extends ParanoidModel {
},
}
);
- };
}
diff --git a/app/models/User.ts b/app/models/User.ts
index be5268adb..3abe065d4 100644
--- a/app/models/User.ts
+++ b/app/models/User.ts
@@ -90,13 +90,8 @@ class User extends ParanoidModel {
* @param type The type of notification event
* @returns The current preference
*/
- public subscribedToEventType = (type: NotificationEventType) => {
- return (
- this.notificationSettings[type] ??
- NotificationEventDefaults[type] ??
- false
- );
- };
+ public subscribedToEventType = (type: NotificationEventType) =>
+ this.notificationSettings[type] ?? NotificationEventDefaults[type] ?? false;
/**
* Sets a preference for the users notification settings on the model and
diff --git a/app/models/decorators/Field.ts b/app/models/decorators/Field.ts
index 4dc12abc8..5dabf8b87 100644
--- a/app/models/decorators/Field.ts
+++ b/app/models/decorators/Field.ts
@@ -1,8 +1,7 @@
const fields = new Map();
-export const getFieldsForModel = (target: any) => {
- return fields.get(target.constructor.name);
-};
+export const getFieldsForModel = (target: any) =>
+ fields.get(target.constructor.name);
/**
* A decorator that records this key as a serializable field on the model.
diff --git a/app/scenes/Document/components/CommentEditor.tsx b/app/scenes/Document/components/CommentEditor.tsx
index 737abfbac..de9e8e70c 100644
--- a/app/scenes/Document/components/CommentEditor.tsx
+++ b/app/scenes/Document/components/CommentEditor.tsx
@@ -8,8 +8,6 @@ const extensions = withComments(basicExtensions);
const CommentEditor = (
props: EditorProps,
ref: React.RefObject
-) => {
- return ;
-};
+) => ;
export default React.forwardRef(CommentEditor);
diff --git a/app/scenes/Document/components/CommentThread.tsx b/app/scenes/Document/components/CommentThread.tsx
index c8707e8c3..21d725371 100644
--- a/app/scenes/Document/components/CommentThread.tsx
+++ b/app/scenes/Document/components/CommentThread.tsx
@@ -114,10 +114,9 @@ function CommentThread({
scrollMode: "if-needed",
behavior: "smooth",
block: "start",
- boundary: (parent) => {
+ boundary: (parent) =>
// Prevents body and other parent elements from being scrolled
- return parent.id !== "comments";
- },
+ parent.id !== "comments",
});
},
isVisible ? 0 : sidebarAppearDuration
diff --git a/app/scenes/Document/components/MultiplayerEditor.tsx b/app/scenes/Document/components/MultiplayerEditor.tsx
index 7ff74a702..dc3992f5d 100644
--- a/app/scenes/Document/components/MultiplayerEditor.tsx
+++ b/app/scenes/Document/components/MultiplayerEditor.tsx
@@ -185,13 +185,14 @@ function MultiplayerEditor({ onSynced, ...props }: Props, ref: any) {
isMounted,
]);
- const user = React.useMemo(() => {
- return {
+ const user = React.useMemo(
+ () => ({
id: currentUser.id,
name: currentUser.name,
color: currentUser.color,
- };
- }, [currentUser.id, currentUser.color, currentUser.name]);
+ }),
+ [currentUser.id, currentUser.color, currentUser.name]
+ );
const extensions = React.useMemo(() => {
if (!remoteProvider) {
diff --git a/app/scenes/Document/components/PublicBreadcrumb.tsx b/app/scenes/Document/components/PublicBreadcrumb.tsx
index 639c624a8..e25d4a24f 100644
--- a/app/scenes/Document/components/PublicBreadcrumb.tsx
+++ b/app/scenes/Document/components/PublicBreadcrumb.tsx
@@ -49,13 +49,11 @@ const PublicBreadcrumb: React.FC = ({
() =>
pathToDocument(sharedTree, documentId)
.slice(0, -1)
- .map((item) => {
- return {
- ...item,
- type: "route",
- to: sharedDocumentPath(shareId, item.url),
- };
- }),
+ .map((item) => ({
+ ...item,
+ type: "route",
+ to: sharedDocumentPath(shareId, item.url),
+ })),
[sharedTree, shareId, documentId]
);
diff --git a/app/scenes/Document/index.tsx b/app/scenes/Document/index.tsx
index 211431cce..6f42bddea 100644
--- a/app/scenes/Document/index.tsx
+++ b/app/scenes/Document/index.tsx
@@ -30,9 +30,7 @@ export default function DocumentScene(props: Props) {
setLastVisitedPath(currentPath);
}, [currentPath, setLastVisitedPath]);
- React.useEffect(() => {
- return () => ui.clearActiveDocument();
- }, [ui]);
+ React.useEffect(() => () => ui.clearActiveDocument(), [ui]);
// the urlId portion of the url does not include the slugified title
// we only want to force a re-mount of the document component when the
diff --git a/app/scenes/Login/Notices.tsx b/app/scenes/Login/Notices.tsx
index d25166e0a..3d5aaee1f 100644
--- a/app/scenes/Login/Notices.tsx
+++ b/app/scenes/Login/Notices.tsx
@@ -1,6 +1,7 @@
+import { WarningIcon } from "outline-icons";
import * as React from "react";
import { Trans } from "react-i18next";
-import NoticeAlert from "~/components/NoticeAlert";
+import Notice from "~/components/Notice";
import useQuery from "~/hooks/useQuery";
export default function Notices() {
@@ -13,7 +14,7 @@ export default function Notices() {
}
return (
-
+ }>
{notice === "domain-required" && (
Unable to sign-in. Please navigate to your team's custom URL, then try
@@ -103,6 +104,6 @@ export default function Notices() {
team domain.
)}
-
+
);
}
diff --git a/app/scenes/Settings/Groups.tsx b/app/scenes/Settings/Groups.tsx
index 14b83aacc..e77cc7f0d 100644
--- a/app/scenes/Settings/Groups.tsx
+++ b/app/scenes/Settings/Groups.tsx
@@ -12,7 +12,6 @@ import Heading from "~/components/Heading";
import Modal from "~/components/Modal";
import PaginatedList from "~/components/PaginatedList";
import Scene from "~/components/Scene";
-import Subheading from "~/components/Subheading";
import Text from "~/components/Text";
import useBoolean from "~/hooks/useBoolean";
import useCurrentTeam from "~/hooks/useCurrentTeam";
@@ -57,11 +56,15 @@ function Groups() {
Groups can be used to organize and manage the people on your team.
- {t("All groups")}{t("No groups have been created yet")}}
fetch={groups.fetchPage}
+ heading={
+
+ All
+
+ }
renderItem={(item: Group) => (
,
title: t("Document published"),
description: t(
"Receive a notification whenever a new document is published"
@@ -31,6 +43,7 @@ function Notifications() {
},
{
event: NotificationEventType.UpdateDocument,
+ icon: ,
title: t("Document updated"),
description: t(
"Receive a notification when a document you are subscribed to is edited"
@@ -38,6 +51,7 @@ function Notifications() {
},
{
event: NotificationEventType.CreateComment,
+ icon: ,
title: t("Comment posted"),
description: t(
"Receive a notification when a document you are subscribed to or a thread you participated in receives a comment"
@@ -45,6 +59,7 @@ function Notifications() {
},
{
event: NotificationEventType.Mentioned,
+ icon: ,
title: t("Mentioned"),
description: t(
"Receive a notification when someone mentions you in a document or comment"
@@ -52,6 +67,7 @@ function Notifications() {
},
{
event: NotificationEventType.CreateCollection,
+ icon: ,
title: t("Collection created"),
description: t(
"Receive a notification whenever a new collection is created"
@@ -59,6 +75,7 @@ function Notifications() {
},
{
event: NotificationEventType.InviteAccepted,
+ icon: ,
title: t("Invite accepted"),
description: t(
"Receive a notification when someone you invited creates an account"
@@ -66,6 +83,7 @@ function Notifications() {
},
{
event: NotificationEventType.ExportCompleted,
+ icon: ,
title: t("Export completed"),
description: t(
"Receive a notification when an export you requested has been completed"
@@ -73,12 +91,14 @@ function Notifications() {
},
{
visible: isCloudHosted,
+ icon: ,
event: NotificationEventType.Onboarding,
title: t("Getting started"),
description: t("Tips on getting started with features and functionality"),
},
{
visible: isCloudHosted,
+ icon: ,
event: NotificationEventType.Features,
title: t("New features"),
description: t("Receive an email when new features of note are added"),
@@ -138,7 +158,11 @@ function Notifications() {
return (
+ {option.icon} {option.title}
+
+ }
name={option.event}
description={option.description}
>
diff --git a/app/scenes/Settings/Tokens.tsx b/app/scenes/Settings/Tokens.tsx
index d2a4878e5..8d9195e56 100644
--- a/app/scenes/Settings/Tokens.tsx
+++ b/app/scenes/Settings/Tokens.tsx
@@ -10,7 +10,6 @@ import Heading from "~/components/Heading";
import Modal from "~/components/Modal";
import PaginatedList from "~/components/PaginatedList";
import Scene from "~/components/Scene";
-import Subheading from "~/components/Subheading";
import Text from "~/components/Text";
import useBoolean from "~/hooks/useBoolean";
import useCurrentTeam from "~/hooks/useCurrentTeam";
@@ -59,7 +58,7 @@ function Tokens() {
{t("Tokens")}}
+ heading={
- );
- };
+ {props.node.attrs.alt}
+
+
+ );
toMarkdown(state: MarkdownSerializerState, node: ProsemirrorNode) {
let markdown =
@@ -275,17 +273,13 @@ export default class Image extends SimpleImage {
parseMarkdown() {
return {
node: "image",
- getAttrs: (token: Token) => {
- return {
- src: token.attrGet("src"),
- alt:
- (token?.children &&
- token.children[0] &&
- token.children[0].content) ||
- null,
- ...parseTitleAttribute(token?.attrGet("title") || ""),
- };
- },
+ getAttrs: (token: Token) => ({
+ src: token.attrGet("src"),
+ alt:
+ (token?.children && token.children[0] && token.children[0].content) ||
+ null,
+ ...parseTitleAttribute(token?.attrGet("title") || ""),
+ }),
};
}
diff --git a/shared/editor/nodes/Mention.ts b/shared/editor/nodes/Mention.ts
index 0fdf9eaa2..05590a320 100644
--- a/shared/editor/nodes/Mention.ts
+++ b/shared/editor/nodes/Mention.ts
@@ -47,19 +47,17 @@ export default class Mention extends Node {
}),
},
],
- toDOM: (node) => {
- return [
- "span",
- {
- class: `${node.type.name}`,
- id: node.attrs.id,
- "data-type": node.attrs.type,
- "data-id": node.attrs.modelId,
- "data-actorId": node.attrs.actorId,
- },
- node.attrs.label,
- ];
- },
+ toDOM: (node) => [
+ "span",
+ {
+ class: `${node.type.name}`,
+ id: node.attrs.id,
+ "data-type": node.attrs.type,
+ "data-id": node.attrs.modelId,
+ "data-actorId": node.attrs.actorId,
+ },
+ node.attrs.label,
+ ],
toPlainText: (node) => `@${node.attrs.label}`,
};
}
@@ -109,10 +107,10 @@ export default class Mention extends Node {
) {
const { pos } = view.state.selection.$from;
- return run(view, pos, pos, OPEN_REGEX, (state, match) => {
+ return run(view, pos, pos, OPEN_REGEX, (state, match) =>
// just tell Prosemirror we handled it and not to do anything
- return match ? true : null;
- });
+ match ? true : null
+ );
}
return false;
diff --git a/shared/editor/nodes/SimpleImage.tsx b/shared/editor/nodes/SimpleImage.tsx
index e8168f9c9..4f956700d 100644
--- a/shared/editor/nodes/SimpleImage.tsx
+++ b/shared/editor/nodes/SimpleImage.tsx
@@ -51,31 +51,27 @@ export default class SimpleImage extends Node {
},
{
tag: "img",
- getAttrs: (dom: HTMLImageElement) => {
- return {
- src: dom.getAttribute("src"),
- alt: dom.getAttribute("alt"),
- title: dom.getAttribute("title"),
- };
- },
+ getAttrs: (dom: HTMLImageElement) => ({
+ src: dom.getAttribute("src"),
+ alt: dom.getAttribute("alt"),
+ title: dom.getAttribute("title"),
+ }),
},
],
- toDOM: (node) => {
- return [
- "div",
+ toDOM: (node) => [
+ "div",
+ {
+ class: "image",
+ },
+ [
+ "img",
{
- class: "image",
+ ...node.attrs,
+ src: sanitizeUrl(node.attrs.src),
+ contentEditable: "false",
},
- [
- "img",
- {
- ...node.attrs,
- src: sanitizeUrl(node.attrs.src),
- contentEditable: "false",
- },
- ],
- ];
- },
+ ],
+ ],
};
}
@@ -155,9 +151,9 @@ export default class SimpleImage extends Node {
}
};
- component = (props: ComponentProps) => {
- return ;
- };
+ component = (props: ComponentProps) => (
+
+ );
toMarkdown(state: MarkdownSerializerState, node: ProsemirrorNode) {
state.write(
@@ -172,16 +168,12 @@ export default class SimpleImage extends Node {
parseMarkdown() {
return {
node: "image",
- getAttrs: (token: Token) => {
- return {
- src: token.attrGet("src"),
- alt:
- (token?.children &&
- token.children[0] &&
- token.children[0].content) ||
- null,
- };
- },
+ getAttrs: (token: Token) => ({
+ src: token.attrGet("src"),
+ alt:
+ (token?.children && token.children[0] && token.children[0].content) ||
+ null,
+ }),
};
}
diff --git a/shared/editor/plugins/BlockMenuTrigger.tsx b/shared/editor/plugins/BlockMenuTrigger.tsx
index 3908c0faf..36926821d 100644
--- a/shared/editor/plugins/BlockMenuTrigger.tsx
+++ b/shared/editor/plugins/BlockMenuTrigger.tsx
@@ -99,10 +99,10 @@ export default class BlockMenuTrigger extends Extension {
) {
const { pos } = view.state.selection.$from;
- return run(view, pos, pos, OPEN_REGEX, (state, match) => {
+ return run(view, pos, pos, OPEN_REGEX, (state, match) =>
// just tell Prosemirror we handled it and not to do anything
- return match ? true : null;
- });
+ match ? true : null
+ );
}
return false;
diff --git a/shared/editor/plugins/Prism.ts b/shared/editor/plugins/Prism.ts
index 0f5610720..b34fea897 100644
--- a/shared/editor/plugins/Prism.ts
+++ b/shared/editor/plugins/Prism.ts
@@ -178,9 +178,7 @@ export default function Prism({
return new Plugin({
key: new PluginKey("prism"),
state: {
- init: (_: Plugin, { doc }) => {
- return DecorationSet.create(doc, []);
- },
+ init: (_: Plugin, { doc }) => DecorationSet.create(doc, []),
apply: (transaction: Transaction, decorationSet, oldState, state) => {
const nodeName = state.selection.$head.parent.type.name;
const previousNodeName = oldState.selection.$head.parent.type.name;
diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json
index 6153d59c7..58e554fe0 100644
--- a/shared/i18n/locales/en_US/translation.json
+++ b/shared/i18n/locales/en_US/translation.json
@@ -212,7 +212,6 @@
"Empty": "Empty",
"Go back": "Go back",
"Go forward": "Go forward",
- "Starred documents could not be loaded": "Starred documents could not be loaded",
"Starred": "Starred",
"Show more": "Show more",
"Toggle sidebar": "Toggle sidebar",
@@ -314,6 +313,8 @@
"Integrations": "Integrations",
"Self Hosted": "Self Hosted",
"Google Analytics": "Google Analytics",
+ "Revoke token": "Revoke token",
+ "Revoke": "Revoke",
"Show path to document": "Show path to document",
"Path to document": "Path to document",
"Group member options": "Group member options",
@@ -688,9 +689,7 @@
"Date shared": "Date shared",
"Shared nested": "Shared nested",
"API token copied to clipboard": "API token copied to clipboard",
- "Revoke token": "Revoke token",
"Copied": "Copied",
- "Revoke": "Revoke",
"Revoking": "Revoking",
"Are you sure you want to revoke the {{ tokenName }} token?": "Are you sure you want to revoke the {{ tokenName }} token?",
"Active": "Active",
@@ -729,8 +728,8 @@
"Create a \"Web\" stream in your Google Analytics admin dashboard and copy the measurement ID from the generated code snippet to install.": "Create a \"Web\" stream in your Google Analytics admin dashboard and copy the measurement ID from the generated code snippet to install.",
"New group": "New group",
"Groups can be used to organize and manage the people on your team.": "Groups can be used to organize and manage the people on your team.",
- "All groups": "All groups",
"No groups have been created yet": "No groups have been created yet",
+ "All": "All",
"Quickly transfer your existing documents, pages, and files from other tools and services into {{appName}}. You can also drag and drop any HTML, Markdown, and text documents directly into Collections in the app.": "Quickly transfer your existing documents, pages, and files from other tools and services into {{appName}}. You can also drag and drop any HTML, Markdown, and text documents directly into Collections in the app.",
"Import a zip file of Markdown documents (exported from version 0.67.0 or earlier)": "Import a zip file of Markdown documents (exported from version 0.67.0 or earlier)",
"Import data": "Import data",
@@ -811,7 +810,6 @@
"Documents that have been shared are listed below. Anyone that has the public link can access a read-only version of the document until the link has been revoked.": "Documents that have been shared are listed below. Anyone that has the public link can access a read-only version of the document until the link has been revoked.",
"New token": "New token",
"You can create an unlimited amount of personal tokens to authenticate\n with the API. Tokens have the same permissions as your user account.\n For more details see the developer documentation.": "You can create an unlimited amount of personal tokens to authenticate\n with the API. Tokens have the same permissions as your user account.\n For more details see the developer documentation.",
- "Tokens": "Tokens",
"Create a token": "Create a token",
"Zapier is a platform that allows {{appName}} to easily integrate with thousands of other business tools. Automate your workflows, sync data, and more.": "Zapier is a platform that allows {{appName}} to easily integrate with thousands of other business tools. Automate your workflows, sync data, and more.",
"Your are creating a new workspace using your current account — {{email}}": "Your are creating a new workspace using your current account — {{email}}",
@@ -825,11 +823,6 @@
"Note: Signing back in will cause a new account to be automatically reprovisioned.": "Note: Signing back in will cause a new account to be automatically reprovisioned.",
"Are you sure? Deleting your account will destroy identifying data associated with your user and cannot be undone. You will be immediately logged out of {{appName}} and all your API tokens will be revoked.": "Are you sure? Deleting your account will destroy identifying data associated with your user and cannot be undone. You will be immediately logged out of {{appName}} and all your API tokens will be revoked.",
"Delete My Account": "Delete My Account",
- "You joined": "You joined",
- "Joined": "Joined",
- "{{ time }} ago.": "{{ time }} ago.",
- "Edit Profile": "Edit Profile",
- "{{ userName }} hasn’t updated any documents yet.": "{{ userName }} hasn’t updated any documents yet.",
"Today": "Today",
"Yesterday": "Yesterday",
"Last week": "Last week",
@@ -872,6 +865,7 @@
"Webhooks": "Webhooks",
"New webhook": "New webhook",
"Webhooks can be used to notify your application when events happen in {{appName}}. Events are sent as a https request with a JSON payload in near real-time.": "Webhooks can be used to notify your application when events happen in {{appName}}. Events are sent as a https request with a JSON payload in near real-time.",
+ "Inactive": "Inactive",
"Create a webhook": "Create a webhook",
"Uploading": "Uploading"
}
diff --git a/shared/random.ts b/shared/random.ts
index d0a7c5016..4f18a6aac 100644
--- a/shared/random.ts
+++ b/shared/random.ts
@@ -1,9 +1,6 @@
-const randomInteger = (min: number, max: number) => {
- return Math.floor(Math.random() * (max - min + 1) + min);
-};
+const randomInteger = (min: number, max: number) =>
+ Math.floor(Math.random() * (max - min + 1) + min);
-const randomElement = (arr: T[]): T => {
- return arr[randomInteger(0, arr.length - 1)];
-};
+const randomElement = (arr: T[]): T => arr[randomInteger(0, arr.length - 1)];
export { randomInteger, randomElement };
diff --git a/shared/styles/index.ts b/shared/styles/index.ts
index d11fa8ad9..495595e08 100644
--- a/shared/styles/index.ts
+++ b/shared/styles/index.ts
@@ -22,9 +22,7 @@ export const ellipsis = () => `
*/
export const s = (key: keyof DefaultTheme) => (props: {
theme: DefaultTheme;
-}) => {
- return String(props.theme[key]);
-};
+}) => String(props.theme[key]);
/**
* Mixin to hide scrollbars.
diff --git a/shared/utils/color.ts b/shared/utils/color.ts
index a09b35af3..af094445c 100644
--- a/shared/utils/color.ts
+++ b/shared/utils/color.ts
@@ -19,9 +19,8 @@ export const palette = [
darken(0.2, theme.brand.yellow),
];
-export const validateColorHex = (color: string) => {
- return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(color);
-};
+export const validateColorHex = (color: string) =>
+ /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(color);
export const stringToColor = (input: string) => {
const inputAsNumber = parseInt(md5(input).toString(), 16);
diff --git a/shared/utils/unescape.ts b/shared/utils/unescape.ts
index 6f40f3ccd..5de2587f4 100644
--- a/shared/utils/unescape.ts
+++ b/shared/utils/unescape.ts
@@ -1,7 +1,4 @@
-const unescape = (text: string) => {
- return text
- .replace(/\\([\\`*{}[\]()#+\-.!_>])/g, "$1")
- .replace(/\n\\\n/g, "\n\n");
-};
+const unescape = (text: string) =>
+ text.replace(/\\([\\`*{}[\]()#+\-.!_>])/g, "$1").replace(/\n\\\n/g, "\n\n");
export default unescape;