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

issue-715: insert method in blocks API #753

Closed

Conversation

kleoxhindoli
Copy link

Does the following:

  1. Adds a insertAt method in the blockManager. Same as insert but accepts an index param as well
  2. Refactored insert to use insertAt to avoid code duplication
  3. Exposes the insertAt method to the public API, via the editor.blocks.insert method, to allow insertion of any blocks programmatically at any index

Solves #715

First PR, feedback is welcomed

@@ -26,6 +26,12 @@ export default class BlocksAPI extends Module {
getBlocksCount: () => this.getBlocksCount(),
stretchBlock: (index: number, status: boolean = true) => this.stretchBlock(index, status),
insertNewBlock: () => this.insertNewBlock(),
insert: (
index: number,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe make index optional and insert new block at the current position?

@gohabereg
Copy link
Member

Hi @kleoxhindoli
Thank you for the contribution, the issue resolved by #814

@gohabereg gohabereg closed this Jun 30, 2019
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