Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: merge blocks-editor package with web #2217

Merged
merged 1 commit into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file not shown.
12 changes: 0 additions & 12 deletions packages/blocks-editor/.eslintignore

This file was deleted.

18 changes: 0 additions & 18 deletions packages/blocks-editor/.eslintrc.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/blocks-editor/.gitignore

This file was deleted.

15 changes: 0 additions & 15 deletions packages/blocks-editor/.prettierignore

This file was deleted.

7 changes: 0 additions & 7 deletions packages/blocks-editor/.prettierrc.js

This file was deleted.

374 changes: 0 additions & 374 deletions packages/blocks-editor/CHANGELOG.md

This file was deleted.

1 change: 0 additions & 1 deletion packages/blocks-editor/README.md

This file was deleted.

32 changes: 0 additions & 32 deletions packages/blocks-editor/blocks.webpack.config.js

This file was deleted.

28 changes: 0 additions & 28 deletions packages/blocks-editor/package.json

This file was deleted.

4 changes: 0 additions & 4 deletions packages/blocks-editor/src/index.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/blocks-editor/tailwind.config.js

This file was deleted.

10 changes: 0 additions & 10 deletions packages/blocks-editor/tsconfig.json

This file was deleted.

1 change: 0 additions & 1 deletion packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"@reach/visually-hidden": "^0.18.0",
"@standardnotes/authenticator": "^2.3.9",
"@standardnotes/autobiography-theme": "^1.2.7",
"@standardnotes/blocks-editor": "workspace:*",
"@standardnotes/bold-editor": "^1.6.4",
"@standardnotes/classic-code-editor": "^1.5.7",
"@standardnotes/dynamic-theme": "^1.2.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { EditorMenuItem } from '@/Components/NotesOptions/EditorMenuItem'
import { createEditorMenuGroups } from '../../Utils/createEditorMenuGroups'
import { reloadFont } from '../NoteView/FontFunctions'
import { PremiumFeatureIconClass, PremiumFeatureIconName } from '../Icon/PremiumFeatureIcon'
import { SuperNoteImporter } from '../NoteView/SuperEditor/SuperNoteImporter'
import { SuperNoteImporter } from '../SuperEditor/SuperNoteImporter'
import MenuRadioButtonItem from '../Menu/MenuRadioButtonItem'
import { Pill } from '../Preferences/PreferencesComponents/Content'
import ModalOverlay from '../Modal/ModalOverlay'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Menu from '../Menu/Menu'
import MenuItem from '../Menu/MenuItem'
import { EditorMenuGroup } from '../NotesOptions/EditorMenuGroup'
import { EditorMenuItem } from '../NotesOptions/EditorMenuItem'
import { SuperNoteImporter } from '../NoteView/SuperEditor/SuperNoteImporter'
import { SuperNoteImporter } from '../SuperEditor/SuperNoteImporter'
import { Pill } from '../Preferences/PreferencesComponents/Content'
import ModalOverlay from '../Modal/ModalOverlay'

Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/javascripts/Components/NoteView/NoteView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from '@standardnotes/snjs'
import { confirmDialog, DELETE_NOTE_KEYBOARD_COMMAND, KeyboardKey } from '@standardnotes/ui-services'
import { ChangeEventHandler, createRef, KeyboardEventHandler, RefObject } from 'react'
import { SuperEditor } from './SuperEditor/SuperEditor'
import { SuperEditor } from '../SuperEditor/SuperEditor'
import IndicatorCircle from '../IndicatorCircle/IndicatorCircle'
import LinkedItemBubblesContainer from '../LinkedItems/LinkedItemBubblesContainer'
import LinkedItemsButton from '../LinkedItems/LinkedItemsButton'
Expand All @@ -41,7 +41,7 @@ import {
transactionForAssociateComponentWithCurrentNote,
transactionForDisassociateComponentWithCurrentNote,
} from './TransactionFunctions'
import { SuperEditorContentId } from '@standardnotes/blocks-editor'
import { SuperEditorContentId } from '../SuperEditor/Constants'
import { NoteViewController } from './Controller/NoteViewController'
import { PlainEditor, PlainEditorInterface } from './PlainEditor/PlainEditor'

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import ComponentView from '@/Components/ComponentView/ComponentView'
import { NotesController } from '@/Controllers/NotesController/NotesController'
import { NoteHistoryController } from '@/Controllers/NoteHistory/NoteHistoryController'
import { ErrorBoundary } from '@/Utils/ErrorBoundary'
import { BlocksEditorComposer, BlocksEditor } from '@standardnotes/blocks-editor'
import { FileNode } from '../NoteView/SuperEditor/Plugins/EncryptedFilePlugin/Nodes/FileNode'
import { BubbleNode } from '../NoteView/SuperEditor/Plugins/ItemBubblePlugin/Nodes/BubbleNode'
import { BlocksEditor } from '../SuperEditor/BlocksEditor'
import { BlocksEditorComposer } from '../SuperEditor/BlocksEditorComposer'

const ABSOLUTE_CENTER_CLASSNAME = 'absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2'

Expand Down Expand Up @@ -64,15 +63,11 @@ const SelectedRevisionContent: FunctionComponent<SelectedRevisionContentProps> =
</div>
) : note?.noteType === NoteType.Super ? (
<ErrorBoundary>
<div className="blocks-editor w-full flex-grow overflow-hidden overflow-y-auto p-4">
<BlocksEditorComposer
readonly
initialValue={selectedRevision?.payload.content.text}
nodes={[FileNode, BubbleNode]}
>
<div className="w-full flex-grow overflow-hidden overflow-y-auto">
<BlocksEditorComposer readonly initialValue={selectedRevision?.payload.content.text}>
<BlocksEditor
readonly
className="relative resize-none text-base focus:shadow-none focus:outline-none"
className="blocks-editor relative h-full resize-none p-4 text-base focus:shadow-none focus:outline-none"
spellcheck={note.spellcheck}
></BlocksEditor>
</BlocksEditorComposer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin'
import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin'
import { ListPlugin } from '@lexical/react/LexicalListPlugin'
import { EditorState, LexicalEditor } from 'lexical'
import HorizontalRulePlugin from '../Lexical/Plugins/HorizontalRulePlugin'
import TwitterPlugin from '../Lexical/Plugins/TwitterPlugin'
import YouTubePlugin from '../Lexical/Plugins/YouTubePlugin'
import AutoEmbedPlugin from '../Lexical/Plugins/AutoEmbedPlugin'
import CollapsiblePlugin from '../Lexical/Plugins/CollapsiblePlugin'
import DraggableBlockPlugin from '../Lexical/Plugins/DraggableBlockPlugin'
import CodeHighlightPlugin from '../Lexical/Plugins/CodeHighlightPlugin'
import FloatingTextFormatToolbarPlugin from '../Lexical/Plugins/FloatingTextFormatToolbarPlugin'
import FloatingLinkEditorPlugin from '../Lexical/Plugins/FloatingLinkEditorPlugin'
import { TabIndentationPlugin } from '../Lexical/Plugins/TabIndentationPlugin'
import HorizontalRulePlugin from './Plugins/HorizontalRulePlugin'
import TwitterPlugin from './Plugins/TwitterPlugin'
import YouTubePlugin from './Plugins/YouTubePlugin'
import AutoEmbedPlugin from './Plugins/AutoEmbedPlugin'
import CollapsiblePlugin from './Plugins/CollapsiblePlugin'
import DraggableBlockPlugin from './Plugins/DraggableBlockPlugin'
import CodeHighlightPlugin from './Plugins/CodeHighlightPlugin'
import FloatingTextFormatToolbarPlugin from './Plugins/FloatingTextFormatToolbarPlugin'
import FloatingLinkEditorPlugin from './Plugins/FloatingLinkEditorPlugin'
import { TabIndentationPlugin } from './Plugins/TabIndentationPlugin'
import { handleEditorChange } from './Utils'
import { SuperEditorContentId } from './Constants'
import { classNames } from '@standardnotes/utils'
Expand Down Expand Up @@ -106,7 +106,7 @@ export const BlocksEditor: FunctionComponent<BlocksEditorProps> = ({
{!readonly && floatingAnchorElem && (
<>
<FloatingTextFormatToolbarPlugin anchorElem={floatingAnchorElem} />
<FloatingLinkEditorPlugin />
<FloatingLinkEditorPlugin anchorElem={floatingAnchorElem} />
<DraggableBlockPlugin anchorElem={floatingAnchorElem} />
</>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FunctionComponent } from 'react'
import { LexicalComposer } from '@lexical/react/LexicalComposer'
import BlocksEditorTheme from '../Lexical/Theme/Theme'
import { BlockEditorNodes } from '../Lexical/Nodes/AllNodes'
import BlocksEditorTheme from './Lexical/Theme/Theme'
import { BlockEditorNodes } from './Lexical/Nodes/AllNodes'
import { Klass, LexicalNode } from 'lexical'

type BlocksEditorComposerProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import { HeadingNode, QuoteNode } from '@lexical/rich-text'
import { TableCellNode, TableNode, TableRowNode } from '@lexical/table'
import { TweetNode } from './TweetNode'
import { YouTubeNode } from './YouTubeNode'
import { CollapsibleContainerNode } from '../Plugins/CollapsiblePlugin/CollapsibleContainerNode'
import { CollapsibleContentNode } from '../Plugins/CollapsiblePlugin/CollapsibleContentNode'
import { CollapsibleTitleNode } from '../Plugins/CollapsiblePlugin/CollapsibleTitleNode'
import { CollapsibleContainerNode } from '../../Plugins/CollapsiblePlugin/CollapsibleContainerNode'
import { CollapsibleContentNode } from '../../Plugins/CollapsiblePlugin/CollapsibleContentNode'
import { CollapsibleTitleNode } from '../../Plugins/CollapsiblePlugin/CollapsibleTitleNode'
import { FileNode } from '../../Plugins/EncryptedFilePlugin/Nodes/FileNode'
import { BubbleNode } from '../../Plugins/ItemBubblePlugin/Nodes/BubbleNode'

export const BlockEditorNodes = [
AutoLinkNode,
Expand All @@ -34,4 +36,6 @@ export const BlockEditorNodes = [
TableRowNode,
TweetNode,
YouTubeNode,
FileNode,
BubbleNode,
]
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ import {
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react'
import { createPortal } from 'react-dom'
import { IS_APPLE } from '../Shared/environment'

import { CellContext } from '../Plugins/TablePlugin'
import { CellContext } from '../../Plugins/TablePlugin'
import {
$isTableNode,
Cell,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../Plugins//DraggableBlockPlugin/index.scss';
@import '../../Plugins/DraggableBlockPlugin/index.scss';

#typeahead-menu {
z-index: 10000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext
import { useState } from 'react'
import * as ReactDOM from 'react-dom'

import useModal from '../../Hooks/useModal'
import Button from '../../UI/Button'
import { DialogActions } from '../../UI/Dialog'
import useModal from '../../Lexical/Hooks/useModal'
import Button from '../../Lexical/UI/Button'
import { DialogActions } from '../../Lexical/UI/Dialog'
import { INSERT_TWEET_COMMAND } from '../TwitterPlugin'
import { INSERT_YOUTUBE_COMMAND } from '../YouTubePlugin'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext
import { LexicalTypeaheadMenuPlugin, useBasicTypeaheadTriggerMatch } from '@lexical/react/LexicalTypeaheadMenuPlugin'
import { TextNode } from 'lexical'
import { useCallback, useMemo, useState } from 'react'
import useModal from '@standardnotes/blocks-editor/src/Lexical/Hooks/useModal'
import { InsertTableDialog } from '@standardnotes/blocks-editor/src/Lexical/Plugins/TablePlugin'
import useModal from '../../Lexical/Hooks/useModal'
import { InsertTableDialog } from '../../Plugins/TablePlugin'
import { BlockPickerOption } from './BlockPickerOption'
import { BlockPickerMenuItem } from './BlockPickerMenuItem'
import { GetNumberedListBlockOption } from './Options/NumberedList'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LexicalEditor } from 'lexical'
import { INSERT_COLLAPSIBLE_COMMAND } from '@standardnotes/blocks-editor/src/Lexical/Plugins/CollapsiblePlugin'
import { INSERT_COLLAPSIBLE_COMMAND } from '../../Plugins/CollapsiblePlugin'
import { LexicalIconName } from '@/Components/Icon/LexicalIcons'

export function GetCollapsibleBlock(editor: LexicalEditor) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LexicalEditor } from 'lexical'
import { INSERT_EMBED_COMMAND } from '@lexical/react/LexicalAutoEmbedPlugin'
import { EmbedConfigs } from '@standardnotes/blocks-editor/src/Lexical/Plugins/AutoEmbedPlugin'
import { EmbedConfigs } from '../AutoEmbedPlugin'
import { LexicalIconName } from '@/Components/Icon/LexicalIcons'

export function GetEmbedsBlocks(editor: LexicalEditor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import { DragEvent as ReactDragEvent, TouchEvent, useCallback, useEffect, useRef
import { createPortal } from 'react-dom'
import { BlockIcon } from '@standardnotes/icons'

import { isHTMLElement } from '../../Utils/guard'
import { Point } from '../../Utils/point'
import { ContainsPointReturn, Rect } from '../../Utils/rect'
import { isHTMLElement } from '../../Lexical/Utils/guard'
import { Point } from '../../Lexical/Utils/point'
import { ContainsPointReturn, Rect } from '../../Lexical/Utils/rect'

const DRAGGABLE_BLOCK_MENU_LEFT_SPACE = -2
const TARGET_LINE_HALF_HEIGHT = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '@standardnotes/ui-services'
import { useCallback, useEffect } from 'react'
import { $convertToMarkdownString } from '@lexical/markdown'
import { MarkdownTransformers } from '@standardnotes/blocks-editor'
import { MarkdownTransformers } from '../../MarkdownTransformers'
import { $generateHtmlFromNodes } from '@lexical/html'
import { useCommandService } from '@/Components/CommandProvider'

Expand Down