mirror of
https://github.com/AppFlowy-IO/AppFlowy-Web.git
synced 2025-08-06 19:20:25 +08:00
fix: update pnpm to 10.9 (embedded pnpm version of node 18) (#119)
* fix: update pnpm to default one feat: autofix unused import fix: use pnpm in corepack * fix: update coverage workflow
This commit is contained in:
6
.github/workflows/web_ci.yaml
vendored
6
.github/workflows/web_ci.yaml
vendored
@ -7,7 +7,7 @@ on:
|
|||||||
- "release/*"
|
- "release/*"
|
||||||
env:
|
env:
|
||||||
NODE_VERSION: "18.16.0"
|
NODE_VERSION: "18.16.0"
|
||||||
PNPM_VERSION: "8.5.0"
|
PNPM_VERSION: "10.9.0"
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
@ -35,11 +35,11 @@ jobs:
|
|||||||
sudo rm -rf ${GITHUB_WORKSPACE}/.git
|
sudo rm -rf ${GITHUB_WORKSPACE}/.git
|
||||||
sudo rm -rf $ANDROID_HOME/ndk
|
sudo rm -rf $ANDROID_HOME/ndk
|
||||||
- name: setup node
|
- name: setup node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
- name: setup pnpm
|
- name: setup pnpm
|
||||||
uses: pnpm/action-setup@v2
|
uses: pnpm/action-setup@v3
|
||||||
with:
|
with:
|
||||||
version: ${{ env.PNPM_VERSION }}
|
version: ${{ env.PNPM_VERSION }}
|
||||||
|
|
||||||
|
41
.github/workflows/web_coverage.yaml
vendored
41
.github/workflows/web_coverage.yaml
vendored
@ -8,8 +8,10 @@ on:
|
|||||||
- "release/*"
|
- "release/*"
|
||||||
env:
|
env:
|
||||||
NODE_VERSION: "18.16.0"
|
NODE_VERSION: "18.16.0"
|
||||||
PNPM_VERSION: "8.5.0"
|
PNPM_VERSION: "10.9.0"
|
||||||
COVERAGE: "true"
|
COVERAGE: "true"
|
||||||
|
CYPRESS_CACHE_FOLDER: ${{ github.workspace }}/.cypress_cache
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
@ -19,25 +21,34 @@ jobs:
|
|||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Maximize build space (ubuntu only)
|
# - name: Maximize build space (ubuntu only)
|
||||||
run: |
|
# run: |
|
||||||
sudo rm -rf /usr/share/dotnet
|
# sudo rm -rf /usr/share/dotnet
|
||||||
sudo rm -rf /opt/ghc
|
# sudo rm -rf /opt/ghc
|
||||||
sudo rm -rf "/usr/local/share/boost"
|
# sudo rm -rf "/usr/local/share/boost"
|
||||||
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
# sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
||||||
sudo docker image prune --all --force
|
# sudo docker image prune --all --force
|
||||||
sudo rm -rf /opt/hostedtoolcache/codeQL
|
# sudo rm -rf /opt/hostedtoolcache/codeQL
|
||||||
sudo rm -rf ${GITHUB_WORKSPACE}/.git
|
# sudo rm -rf ${GITHUB_WORKSPACE}/.git
|
||||||
sudo rm -rf $ANDROID_HOME/ndk
|
# sudo rm -rf $ANDROID_HOME/ndk
|
||||||
|
|
||||||
- name: setup node
|
- name: setup node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
|
||||||
- name: setup pnpm
|
- name: setup pnpm
|
||||||
uses: pnpm/action-setup@v2
|
uses: pnpm/action-setup@v3
|
||||||
with:
|
with:
|
||||||
version: ${{ env.PNPM_VERSION }}
|
version: ${{ env.PNPM_VERSION }}
|
||||||
|
|
||||||
# Install pnpm dependencies, cache them correctly
|
# Install pnpm dependencies, cache them correctly
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm install
|
||||||
|
|
||||||
|
- name: Install Cypress
|
||||||
|
run: npx cypress install
|
||||||
|
|
||||||
# and run all Cypress tests
|
# and run all Cypress tests
|
||||||
- name: Cypress run
|
- name: Cypress run
|
||||||
uses: cypress-io/github-action@v6
|
uses: cypress-io/github-action@v6
|
||||||
@ -45,6 +56,8 @@ jobs:
|
|||||||
component: true
|
component: true
|
||||||
build: pnpm run build
|
build: pnpm run build
|
||||||
browser: chrome
|
browser: chrome
|
||||||
|
# cache-key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
# install-command: pnpm add --save-dev cypress
|
||||||
env:
|
env:
|
||||||
COVERAGE: "true"
|
COVERAGE: "true"
|
||||||
|
|
||||||
@ -55,7 +68,7 @@ jobs:
|
|||||||
COVERAGE: "true"
|
COVERAGE: "true"
|
||||||
|
|
||||||
- name: Upload coverage to Codecov
|
- name: Upload coverage to Codecov
|
||||||
uses: codecov/codecov-action@v2
|
uses: codecov/codecov-action@v4
|
||||||
with:
|
with:
|
||||||
token: cf9245e0-e136-4e21-b0ee-35755fa0c493
|
token: cf9245e0-e136-4e21-b0ee-35755fa0c493
|
||||||
files: coverage/jest/lcov.info, coverage/cypress/lcov.info
|
files: coverage/jest/lcov.info, coverage/cypress/lcov.info
|
||||||
|
@ -76,7 +76,7 @@ For local development, please follow the steps below:
|
|||||||
1. Copy .development.env to .env. The default value assumes that AppFlowy Cloud is deployed on localhost. If not, please update the value of the API endpoints.
|
1. Copy .development.env to .env. The default value assumes that AppFlowy Cloud is deployed on localhost. If not, please update the value of the API endpoints.
|
||||||
2. Make sure `npm` has been installed on your dev environment, then run the following:
|
2. Make sure `npm` has been installed on your dev environment, then run the following:
|
||||||
```
|
```
|
||||||
# npm install pnpm@8.5.0
|
corepack enable
|
||||||
pnpm install
|
pnpm install
|
||||||
|
|
||||||
pnpm run dev
|
pnpm run dev
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
"@floating-ui/react": "^0.26.27",
|
"@floating-ui/react": "^0.26.27",
|
||||||
"@jest/globals": "^29.7.0",
|
"@jest/globals": "^29.7.0",
|
||||||
"@mui/icons-material": "^5.11.11",
|
"@mui/icons-material": "^5.11.11",
|
||||||
"@mui/material": "6.0.0-alpha.2",
|
"@mui/material": "^6.0.0",
|
||||||
"@mui/x-date-pickers-pro": "^6.18.2",
|
"@mui/x-date-pickers-pro": "^6.18.2",
|
||||||
"@radix-ui/react-avatar": "^1.1.3",
|
"@radix-ui/react-avatar": "^1.1.3",
|
||||||
"@radix-ui/react-dialog": "^1.1.6",
|
"@radix-ui/react-dialog": "^1.1.6",
|
||||||
@ -215,6 +215,9 @@
|
|||||||
"vite-plugin-total-bundle-size": "^1.0.7"
|
"vite-plugin-total-bundle-size": "^1.0.7"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"pnpm": "^8.0.0"
|
"node": ">=18.0.0",
|
||||||
}
|
"npm": ">=8.0.0",
|
||||||
|
"pnpm": "^10.9.0"
|
||||||
|
},
|
||||||
|
"packageManager": "pnpm@10.9.0+sha512.0486e394640d3c1fb3c9d43d49cf92879ff74f8516959c235308f5a8f62e2e19528a65cdc2a3058f587cde71eba3d5b56327c8c33a97e4c4051ca48a10ca2d5f"
|
||||||
}
|
}
|
23844
pnpm-lock.yaml
generated
23844
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -156,9 +156,9 @@ export const CustomEditor = {
|
|||||||
|
|
||||||
const blockEntry = getBlockEntry(editor, point);
|
const blockEntry = getBlockEntry(editor, point);
|
||||||
|
|
||||||
const [node, path] = blockEntry as NodeEntry<Element>;
|
const [node, path] = blockEntry;
|
||||||
const block = getBlock(node.blockId as string, sharedRoot);
|
const block = getBlock(node.blockId as string, sharedRoot);
|
||||||
const blockType = block.get(YjsEditorKey.block_type) as BlockType;
|
const blockType = block.get(YjsEditorKey.block_type);
|
||||||
const parent = getParent(node.blockId as string, sharedRoot);
|
const parent = getParent(node.blockId as string, sharedRoot);
|
||||||
|
|
||||||
if(blockType !== BlockType.Paragraph && parent?.get(YjsEditorKey.block_type) === BlockType.QuoteBlock && LIST_BLOCK_TYPES.includes(blockType)) {
|
if(blockType !== BlockType.Paragraph && parent?.get(YjsEditorKey.block_type) === BlockType.QuoteBlock && LIST_BLOCK_TYPES.includes(blockType)) {
|
||||||
@ -194,7 +194,7 @@ export const CustomEditor = {
|
|||||||
|
|
||||||
const blockEntry = getBlockEntry(editor, point);
|
const blockEntry = getBlockEntry(editor, point);
|
||||||
|
|
||||||
const [node] = blockEntry as NodeEntry<Element>;
|
const [node] = blockEntry;
|
||||||
|
|
||||||
handleMergeBlockForwardWithTxn(editor, node, point);
|
handleMergeBlockForwardWithTxn(editor, node, point);
|
||||||
} else {
|
} else {
|
||||||
@ -389,7 +389,7 @@ export const CustomEditor = {
|
|||||||
const operations: (() => void)[] = [];
|
const operations: (() => void)[] = [];
|
||||||
const sharedRoot = getSharedRoot(editor);
|
const sharedRoot = getSharedRoot(editor);
|
||||||
const sourceBlock = getBlock(blockId, sharedRoot);
|
const sourceBlock = getBlock(blockId, sharedRoot);
|
||||||
const sourceType = sourceBlock.get(YjsEditorKey.block_type) as BlockType;
|
const sourceType = sourceBlock.get(YjsEditorKey.block_type);
|
||||||
const oldData = dataStringTOJson(sourceBlock.get(YjsEditorKey.block_data));
|
const oldData = dataStringTOJson(sourceBlock.get(YjsEditorKey.block_data));
|
||||||
|
|
||||||
if(sourceType === type && isEqual(oldData, data)) {
|
if(sourceType === type && isEqual(oldData, data)) {
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
import { YjsEditor } from '@/application/slate-yjs';
|
import { YjsEditor } from '@/application/slate-yjs';
|
||||||
import { BlockJson } from '@/application/slate-yjs/types';
|
import { BlockJson } from '@/application/slate-yjs/types';
|
||||||
import { blockToSlateNode, deltaInsertToSlateNode } from '@/application/slate-yjs/utils/convert';
|
import { blockToSlateNode, deltaInsertToSlateNode } from '@/application/slate-yjs/utils/convert';
|
||||||
|
import { findSlateEntryByBlockId } from '@/application/slate-yjs/utils/editor';
|
||||||
|
import { dataStringTOJson, getBlock, getChildrenArray, getPageId, getText } from '@/application/slate-yjs/utils/yjs';
|
||||||
import { YBlock, YjsEditorKey } from '@/application/types';
|
import { YBlock, YjsEditorKey } from '@/application/types';
|
||||||
import isEqual from 'lodash-es/isEqual';
|
import isEqual from 'lodash-es/isEqual';
|
||||||
import { Editor, Element, NodeEntry } from 'slate';
|
import { Editor, Element } from 'slate';
|
||||||
import { YEvent, YMapEvent, YTextEvent } from 'yjs';
|
import { YEvent, YMapEvent, Text as YText, YTextEvent } from 'yjs';
|
||||||
import * as Y from 'yjs';
|
|
||||||
import { dataStringTOJson, getBlock, getChildrenArray, getPageId, getText } from '@/application/slate-yjs/utils/yjs';
|
|
||||||
import { findSlateEntryByBlockId } from '@/application/slate-yjs/utils/editor';
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
type BlockMapEvent = YMapEvent<any>
|
type BlockMapEvent = YMapEvent<any>
|
||||||
@ -47,7 +46,7 @@ function applyUpdateBlockYEvent(editor: YjsEditor, blockId: string, event: YMapE
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const [node, path] = entry as NodeEntry<Element>;
|
const [node, path] = entry;
|
||||||
const oldData = node.data as Record<string, unknown>;
|
const oldData = node.data as Record<string, unknown>;
|
||||||
|
|
||||||
editor.apply({
|
editor.apply({
|
||||||
@ -65,7 +64,7 @@ function applyUpdateBlockYEvent(editor: YjsEditor, blockId: string, event: YMapE
|
|||||||
function applyTextYEvent(editor: YjsEditor, textId: string, event: YTextEvent) {
|
function applyTextYEvent(editor: YjsEditor, textId: string, event: YTextEvent) {
|
||||||
const { target } = event;
|
const { target } = event;
|
||||||
|
|
||||||
const yText = target as Y.Text;
|
const yText = target as YText;
|
||||||
const delta = yText.toDelta();
|
const delta = yText.toDelta();
|
||||||
const slateDelta = delta.flatMap(deltaInsertToSlateNode);
|
const slateDelta = delta.flatMap(deltaInsertToSlateNode);
|
||||||
const [entry] = editor.nodes({
|
const [entry] = editor.nodes({
|
||||||
|
@ -141,7 +141,7 @@ export function relativePositionToSlatePoint(
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const [node, path] = entry as NodeEntry<Element>;
|
const [node, path] = entry;
|
||||||
|
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,19 +1,18 @@
|
|||||||
import { notify } from '@/components/_shared/notify';
|
import { notify } from '@/components/_shared/notify';
|
||||||
|
|
||||||
import TaskAltRounded from '@mui/icons-material/TaskAltRounded';
|
|
||||||
import DeleteIcon from '@mui/icons-material/Delete';
|
import DeleteIcon from '@mui/icons-material/Delete';
|
||||||
|
import TaskAltRounded from '@mui/icons-material/TaskAltRounded';
|
||||||
|
|
||||||
import React, { useState, useEffect } from 'react';
|
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
List,
|
List, ListItemButton,
|
||||||
ListItem,
|
|
||||||
ListItemIcon,
|
ListItemIcon,
|
||||||
ListItemText,
|
ListItemText,
|
||||||
Typography,
|
Typography
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
const MAX_DELETE = 50;
|
const MAX_DELETE = 50;
|
||||||
const IndexedDBCleaner = () => {
|
const IndexedDBCleaner = () => {
|
||||||
@ -88,10 +87,9 @@ const IndexedDBCleaner = () => {
|
|||||||
const labelId = `checkbox-list-label-${dbName}`;
|
const labelId = `checkbox-list-label-${dbName}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ListItem
|
<ListItemButton
|
||||||
key={dbName}
|
key={dbName}
|
||||||
dense
|
dense
|
||||||
button
|
|
||||||
onClick={() => handleToggle(dbName)}
|
onClick={() => handleToggle(dbName)}
|
||||||
>
|
>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
@ -104,7 +102,7 @@ const IndexedDBCleaner = () => {
|
|||||||
/>
|
/>
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText id={labelId} primary={dbName} />
|
<ListItemText id={labelId} primary={dbName} />
|
||||||
</ListItem>
|
</ListItemButton>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</List>
|
</List>
|
||||||
|
@ -3,11 +3,11 @@ import { useCalendarSetup } from '@/components/database/calendar/Calendar.hooks'
|
|||||||
import { Toolbar, Event } from '@/components/database/components/calendar';
|
import { Toolbar, Event } from '@/components/database/components/calendar';
|
||||||
import { useConditionsContext } from '@/components/database/components/conditions/context';
|
import { useConditionsContext } from '@/components/database/components/conditions/context';
|
||||||
import { debounce } from 'lodash-es';
|
import { debounce } from 'lodash-es';
|
||||||
import React, { useEffect, useRef } from 'react';
|
import { useEffect, useRef } from 'react';
|
||||||
import { Calendar as BigCalendar } from 'react-big-calendar';
|
import { Calendar as BigCalendar } from 'react-big-calendar';
|
||||||
import './calendar.scss';
|
import './calendar.scss';
|
||||||
|
|
||||||
export function Calendar () {
|
export function Calendar() {
|
||||||
const { dayPropGetter, localizer, formats, events, emptyEvents } = useCalendarSetup();
|
const { dayPropGetter, localizer, formats, events, emptyEvents } = useCalendarSetup();
|
||||||
const scrollLeft = useDatabaseContext().scrollLeft;
|
const scrollLeft = useDatabaseContext().scrollLeft;
|
||||||
const isDocumentBlock = useDatabaseContext().isDocumentBlock;
|
const isDocumentBlock = useDatabaseContext().isDocumentBlock;
|
||||||
|
@ -1,23 +1,25 @@
|
|||||||
import { CalendarEvent } from '@/application/database-yjs';
|
import { CalendarEvent } from '@/application/database-yjs';
|
||||||
|
import { ReactComponent as DownArrow } from '@/assets/icons/alt_arrow_down.svg';
|
||||||
|
import { ReactComponent as LeftArrow } from '@/assets/icons/alt_arrow_left.svg';
|
||||||
|
import { ReactComponent as RightArrow } from '@/assets/icons/alt_arrow_right.svg';
|
||||||
import NoDate from '@/components/database/components/calendar/toolbar/NoDate';
|
import NoDate from '@/components/database/components/calendar/toolbar/NoDate';
|
||||||
import { IconButton } from '@mui/material';
|
import { IconButton } from '@mui/material';
|
||||||
import Button from '@mui/material/Button';
|
import Button from '@mui/material/Button';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import React, { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { ToolbarProps } from 'react-big-calendar';
|
import { ToolbarProps } from 'react-big-calendar';
|
||||||
import { ReactComponent as LeftArrow } from '@/assets/icons/alt_arrow_left.svg';
|
|
||||||
import { ReactComponent as RightArrow } from '@/assets/icons/alt_arrow_right.svg';
|
|
||||||
import { ReactComponent as DownArrow } from '@/assets/icons/alt_arrow_down.svg';
|
|
||||||
|
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
interface ExtendedToolbarProps extends ToolbarProps<CalendarEvent, object> {
|
||||||
|
emptyEvents: CalendarEvent[];
|
||||||
|
}
|
||||||
|
|
||||||
export function Toolbar({
|
export function Toolbar({
|
||||||
onNavigate,
|
onNavigate,
|
||||||
date,
|
date,
|
||||||
emptyEvents,
|
emptyEvents,
|
||||||
}: ToolbarProps & {
|
}: ExtendedToolbarProps) {
|
||||||
emptyEvents: CalendarEvent[];
|
|
||||||
}) {
|
|
||||||
const dateStr = useMemo(() => dayjs(date).format('MMM YYYY'), [date]);
|
const dateStr = useMemo(() => dayjs(date).format('MMM YYYY'), [date]);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ export const DatabaseTabs = forwardRef<HTMLDivElement, DatabaseTabBarProps>(
|
|||||||
className={`flex items-center database-tabs w-full gap-1.5 ${expanded || [
|
className={`flex items-center database-tabs w-full gap-1.5 ${expanded || [
|
||||||
DatabaseViewLayout.Board,
|
DatabaseViewLayout.Board,
|
||||||
DatabaseViewLayout.Calendar,
|
DatabaseViewLayout.Calendar,
|
||||||
].includes(layout as DatabaseViewLayout) ? 'border-b' : ''} border-line-divider `}
|
].includes(layout) ? 'border-b' : ''} border-line-divider `}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
|
@ -9,13 +9,12 @@ import { notify } from '@/components/_shared/notify';
|
|||||||
import { insertDataAfterBlock } from '@/components/ai-chat/utils';
|
import { insertDataAfterBlock } from '@/components/ai-chat/utils';
|
||||||
import { useEditorContext } from '@/components/editor/EditorContext';
|
import { useEditorContext } from '@/components/editor/EditorContext';
|
||||||
import { getScrollParent } from '@/components/global-comment/utils';
|
import { getScrollParent } from '@/components/global-comment/utils';
|
||||||
|
|
||||||
import { AIAssistantProvider, ContextPlaceholder, WriterRequest } from '@appflowyinc/ai-chat';
|
import { AIAssistantProvider, ContextPlaceholder, WriterRequest } from '@appflowyinc/ai-chat';
|
||||||
import { EditorData } from '@appflowyinc/editor';
|
import { EditorData } from '@appflowyinc/editor';
|
||||||
import { Portal } from '@mui/material';
|
import { Portal } from '@mui/material';
|
||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { ErrorBoundary } from 'react-error-boundary';
|
import { ErrorBoundary } from 'react-error-boundary';
|
||||||
import { Element, NodeEntry, Range, Text, Transforms } from 'slate';
|
import { Range, Text, Transforms } from 'slate';
|
||||||
import { ReactEditor, useSlate } from 'slate-react';
|
import { ReactEditor, useSlate } from 'slate-react';
|
||||||
|
|
||||||
import BlockPopover from './components/block-popover';
|
import BlockPopover from './components/block-popover';
|
||||||
@ -61,7 +60,7 @@ function EditorOverlay({
|
|||||||
const handleInsertBelow = useCallback((data: EditorData) => {
|
const handleInsertBelow = useCallback((data: EditorData) => {
|
||||||
if (!endBlock) return;
|
if (!endBlock) return;
|
||||||
try {
|
try {
|
||||||
const [node] = endBlock as NodeEntry<Element>;
|
const [node] = endBlock;
|
||||||
|
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
|
|
||||||
@ -110,7 +109,7 @@ function EditorOverlay({
|
|||||||
|
|
||||||
if (!startBlock) return;
|
if (!startBlock) return;
|
||||||
|
|
||||||
const [node] = startBlock as NodeEntry<Element>;
|
const [node] = startBlock;
|
||||||
|
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { BaseRange, NodeEntry, Element, Point, Range, Text, Transforms } from 'slate';
|
|
||||||
import { ReactEditor } from 'slate-react';
|
|
||||||
import { TextInsertTextOptions } from 'slate/dist/interfaces/transforms/text';
|
|
||||||
import { getBlockEntry } from '@/application/slate-yjs/utils/editor';
|
|
||||||
import { YjsEditor } from '@/application/slate-yjs';
|
import { YjsEditor } from '@/application/slate-yjs';
|
||||||
import { isEmbedBlockTypes } from '@/application/slate-yjs/command/const';
|
import { isEmbedBlockTypes } from '@/application/slate-yjs/command/const';
|
||||||
|
import { getBlockEntry } from '@/application/slate-yjs/utils/editor';
|
||||||
import { BlockType } from '@/application/types';
|
import { BlockType } from '@/application/types';
|
||||||
|
import { BaseRange, NodeEntry, Point, Range, Text, Transforms } from 'slate';
|
||||||
|
import { ReactEditor } from 'slate-react';
|
||||||
|
import { TextInsertTextOptions } from 'slate/dist/interfaces/transforms/text';
|
||||||
|
|
||||||
export const withInsertText = (editor: ReactEditor) => {
|
export const withInsertText = (editor: ReactEditor) => {
|
||||||
const { insertText } = editor;
|
const { insertText } = editor;
|
||||||
@ -18,7 +18,7 @@ export const withInsertText = (editor: ReactEditor) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const point = newAt.anchor;
|
const point = newAt.anchor;
|
||||||
const [blockNode] = getBlockEntry(editor as YjsEditor, point) as NodeEntry<Element>;
|
const [blockNode] = getBlockEntry(editor as YjsEditor, point);
|
||||||
|
|
||||||
if (blockNode && isEmbedBlockTypes(blockNode.type as BlockType)) {
|
if (blockNode && isEmbedBlockTypes(blockNode.type as BlockType)) {
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user