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

feat(tiptap): blocks editor #1656

Closed
wants to merge 30 commits into from
Closed

feat(tiptap): blocks editor #1656

wants to merge 30 commits into from

Conversation

seaerchin
Copy link
Contributor

@seaerchin seaerchin commented Nov 7, 2023

NOTE: We will not be doing block editing the way this PR is done, but rather it will be integrated as part of the editor itself. Simple text editing will be done normally but complex blocks will have a border around them with a different flow for changing their contents. --@dcshzj

Problem

This PR implements a first pass block editor with draggables

Solution

  • add a custom hook to add the preview editor
  • migrate Preview to a PagePreview component -> this is because we want to nest the editor inside the preview
  • Add a custom draggable extension -> this provides the drag handle and draggable functionality
  • Add a custom context to handle teh various click interaction - this is to transition the states to different views
  • We add in a prop for editor -> we choose the prop preferentially over the context's; this is because we need to support multiple editors at present (:sadge:)

.focus()
.setLink({ href: selectedMediaPath })
.run()
<BlocksContextProvider blocks={[DEFAULT_BLOCKS.text]}>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation from new context

@seaerchin seaerchin requested a review from a team November 7, 2023 06:36
@seaerchin seaerchin changed the title Feat/preview editor feat(tiptap): tiptap editor Nov 7, 2023
@seaerchin seaerchin changed the title feat(tiptap): tiptap editor feat(tiptap): preview editor Nov 7, 2023
@seaerchin seaerchin marked this pull request as ready for review November 7, 2023 06:50
@seaerchin seaerchin changed the title feat(tiptap): preview editor feat(tiptap): blocks editor Nov 8, 2023
@@ -293,10 +296,11 @@ interface DraggableAccordionItemProps {
// TODO: Should get these props automatically
// rather than having us pass in manually
index: number
draggableId: string
draggableId?: string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this means not everything is draggable now?

@@ -40,8 +40,9 @@ const PagePreview = ({ title, chunk, ...rest }) => {

return (
<Box
w="50%"
w="100%"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this 100% now?

@@ -73,7 +73,7 @@ const getDraggableAccordionItemStyle = ({
interface SidebarHeaderProps {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe can add ss in pr desc + test plan including common steps to test if all working


const editor = usePreviewEditor()

if (!editor) return null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would this happen? is it on the first paint?

>
<IconButton
variant="clear"
isActive={curTab === "content"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if there is a list of tab and ids, can we namespace it like CurTabs.content?

</Editable.Sidebar>
</VStack>
</GridItem>
{/* Preview */}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove?

TableHeader,
TableCell,
Placeholder,
CharacterCount,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So just to check understanding, anything with CharacterCount will be counted towards the char count displayed?

@seaerchin seaerchin closed this Nov 30, 2023
@seaerchin seaerchin deleted the feat/preview-editor branch November 30, 2023 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants