mirror of
https://github.com/docmost/docmost
synced 2025-03-28 21:13:28 +00:00
fixes and cleanups
This commit is contained in:
parent
fde6c9a2e3
commit
e2646b7afc
@ -1,5 +1,4 @@
|
||||
import { Group } from "@mantine/core";
|
||||
import { IconSquareLetterDFilled } from "@tabler/icons-react";
|
||||
import { Group, Text } from "@mantine/core";
|
||||
import classes from "./app-header.module.css";
|
||||
import React from "react";
|
||||
import TopMenu from "@/components/layouts/global/top-menu.tsx";
|
||||
@ -33,9 +32,7 @@ export function AppHeader() {
|
||||
return (
|
||||
<>
|
||||
<Group h="100%" px="md" justify="space-between" wrap={"nowrap"}>
|
||||
<Group>
|
||||
<IconSquareLetterDFilled size={30} />
|
||||
|
||||
<Group wrap="nowrap">
|
||||
{!isHomeRoute && (
|
||||
<>
|
||||
<SidebarToggle
|
||||
@ -56,6 +53,14 @@ export function AppHeader() {
|
||||
</>
|
||||
)}
|
||||
|
||||
<Text
|
||||
size="lg"
|
||||
fw={600}
|
||||
style={{ cursor: "pointer", userSelect: "none" }}
|
||||
>
|
||||
Docmost
|
||||
</Text>
|
||||
|
||||
<Group ml={50} gap={5} className={classes.links} visibleFrom="sm">
|
||||
{items}
|
||||
</Group>
|
||||
|
@ -1,10 +1,3 @@
|
||||
.authBackground {
|
||||
position: relative;
|
||||
min-height: 100vh;
|
||||
background-size: cover;
|
||||
background-image: url(https://images.unsplash.com/photo-1701010063921-5f3255259e6d?q=80&w=3024&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D);
|
||||
}
|
||||
|
||||
.container {
|
||||
box-shadow: rgba(0, 0, 0, 0.07) 0px 2px 45px 4px;
|
||||
border-radius: 4px;
|
||||
|
@ -4,7 +4,7 @@ import {
|
||||
isNodeSelection,
|
||||
useEditor,
|
||||
} from "@tiptap/react";
|
||||
import { FC, memo, useEffect, useRef, useState } from "react";
|
||||
import { FC, useEffect, useRef, useState } from "react";
|
||||
import {
|
||||
IconBold,
|
||||
IconCode,
|
||||
@ -24,7 +24,7 @@ import {
|
||||
} from "@/features/comment/atoms/comment-atom";
|
||||
import { useAtom } from "jotai";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { isCellSelection } from "@docmost/editor-ext";
|
||||
import { isCellSelection, isTextSelected } from "@docmost/editor-ext";
|
||||
import { LinkSelector } from "@/features/editor/components/bubble-menu/link-selector.tsx";
|
||||
|
||||
export interface BubbleMenuItem {
|
||||
@ -110,7 +110,7 @@ export const EditorBubbleMenu: FC<EditorBubbleMenuProps> = (props) => {
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return isTextSelected(editor);
|
||||
},
|
||||
tippyOptions: {
|
||||
moveTransition: "transform 0.15s ease-out",
|
||||
|
@ -4,11 +4,6 @@ import { ActionIcon, Popover, Tooltip } from "@mantine/core";
|
||||
import { useEditor } from "@tiptap/react";
|
||||
import { LinkEditorPanel } from "@/features/editor/components/link/link-editor-panel.tsx";
|
||||
|
||||
export interface BubbleColorMenuItem {
|
||||
name: string;
|
||||
color: string;
|
||||
}
|
||||
|
||||
interface LinkSelectorProps {
|
||||
editor: ReturnType<typeof useEditor>;
|
||||
isOpen: boolean;
|
||||
@ -22,11 +17,10 @@ export const LinkSelector: FC<LinkSelectorProps> = ({
|
||||
}) => {
|
||||
const onLink = useCallback(
|
||||
(url: string) => {
|
||||
editor.chain().focus().setLink({ href: url }).run();
|
||||
setIsOpen(false);
|
||||
console.log("is p[e ");
|
||||
editor.chain().focus().setLink({ href: url }).run();
|
||||
},
|
||||
[editor],
|
||||
[editor, setIsOpen],
|
||||
);
|
||||
|
||||
return (
|
||||
|
@ -61,7 +61,7 @@ export function CalloutMenu({ editor }: EditorMenuProps) {
|
||||
updateDelay={0}
|
||||
tippyOptions={{
|
||||
getReferenceClientRect,
|
||||
offset: [0, 2],
|
||||
offset: [0, 10],
|
||||
placement: "bottom",
|
||||
zIndex: 99,
|
||||
popperOptions: {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// @ts-nocheck
|
||||
import { Editor, findParentNode } from "@tiptap/core";
|
||||
import { Editor, findParentNode, isTextSelection } from "@tiptap/core";
|
||||
import { Selection, Transaction } from "@tiptap/pm/state";
|
||||
import { CellSelection, TableMap } from "@tiptap/pm/tables";
|
||||
import { Node, ResolvedPos } from "@tiptap/pm/model";
|
||||
@ -345,15 +345,23 @@ export const isRowGripSelected = ({
|
||||
return !!gripRow;
|
||||
};
|
||||
|
||||
export function parseAttributes(value: string) {
|
||||
const regex = /([^=\s]+)="?([^"]+)"?/g;
|
||||
const attrs: Record<string, string> = {};
|
||||
let match: RegExpExecArray | null;
|
||||
// eslint-disable-next-line no-cond-assign
|
||||
while ((match = regex.exec(value))) {
|
||||
attrs[match[1]] = match[2];
|
||||
export function isTextSelected(editor: Editor) {
|
||||
const {
|
||||
state: {
|
||||
doc,
|
||||
selection,
|
||||
selection: { empty, from, to },
|
||||
},
|
||||
} = editor;
|
||||
|
||||
const isEmptyTextBlock =
|
||||
!doc.textBetween(from, to).length && isTextSelection(selection);
|
||||
|
||||
if (empty || isEmptyTextBlock || !editor.isEditable) {
|
||||
return false;
|
||||
}
|
||||
return attrs;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
export function setAttributes(
|
||||
|
Loading…
x
Reference in New Issue
Block a user