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(commands)!: Add insertMarkdownContentAt command #439

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

rfgamaral
Copy link
Member

@rfgamaral rfgamaral commented Sep 12, 2023

Overview

This PR introduces the insertMarkdownContentAt command, which does the same as the insertMarkdownContent that we already have but allows one to pick the insertion position in the document. With the introduction of this command, insertMarkdownContent was changed to use insertMarkdownContentAt, and use the same API as the matching pair insertContent/insertContentAt from Tiptap, which the insertMarkdown* commands draw inspiration from.

Although the API for insertMarkdownContent changed - thus making this a breaking change - it doesn't affect our products because we are not using the part of the API that actually changed (the second parameter). But since it's technically a breaking change, it is being marked as such.

As mentioned above, the insertMarkdown* commands are inspired by the insertContent* commands from Tiptap, and do pretty much the same things in the same way, but adapted to insert Markdown instead of plain-text or HTML.

PR Checklist

Test plan

  • Open the preview Storybook deployed to Netlify
  • Open the Rich-text → Functions → Commands story
  • Press the insertMarkdownContent button
    • Observe that the content is inserted successfully
  • Place the text cursor in different positions (at the start of the document, middle, middle of a sentence/word, end, etc.), and press the inserMarkdownContent button
    • Observe that the content is always inserted exactly at the text cursor position
  • Place the text cursor in different positions (at the start of the document, middle, middle of a sentence/word, end, etc.), and press the inserMarkdownContentAt button
    • Observe that the content is always inserted exactly at the end of the document (this is how the Storybook demo is configured, but this command allows the insertion position to be picked at runtime)

@rfgamaral rfgamaral added the 🙋 Ask PR Used for PRs that need a review before merging. label Sep 12, 2023
@rfgamaral rfgamaral requested a review from a team September 12, 2023 17:18
@rfgamaral rfgamaral self-assigned this Sep 12, 2023
@rfgamaral rfgamaral requested review from craigcarlyle and removed request for a team September 12, 2023 17:18
@netlify
Copy link

netlify bot commented Sep 12, 2023

Deploy Preview for doist-typist ready!

Name Link
🔨 Latest commit 0835d97
🔍 Latest deploy log https://app.netlify.com/sites/doist-typist/deploys/6500a0465af23a0008853446
😎 Deploy Preview https://deploy-preview-439--doist-typist.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

BREAKING CHANGE: With the introduction of `insertMarkdownContentAt`, the
API for `insertMarkdownContent` was changed to match the Tiptap's
implementation of `insertContent`/`insertContentAt`, which the
`insertMarkdown*` commands draw inspiration from.
@rfgamaral rfgamaral force-pushed the ricardo/insert-markdown-content-at branch from 8e8ab30 to 0835d97 Compare September 12, 2023 17:30
@rfgamaral rfgamaral merged commit e87b892 into main Sep 13, 2023
12 checks passed
@rfgamaral rfgamaral deleted the ricardo/insert-markdown-content-at branch September 13, 2023 06:46
doistbot added a commit that referenced this pull request Sep 13, 2023
## [2.0.0](v1.5.0...v2.0.0) (2023-09-13)

### ⚠ BREAKING CHANGES

* **commands:** With the introduction of `insertMarkdownContentAt`, the
API for `insertMarkdownContent` was changed to match the Tiptap's
implementation of `insertContent`/`insertContentAt`, which the
`insertMarkdown*` commands draw inspiration from.

### Features

* **commands:** Add `insertMarkdownContentAt` command ([#439](#439)) ([e87b892](e87b892))
@doistbot
Copy link
Member

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@doistbot doistbot added the released Pull requests that have been released to production label Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙋 Ask PR Used for PRs that need a review before merging. released Pull requests that have been released to production
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants