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

Editor hooks #84

Closed
mixonic opened this issue Aug 18, 2015 · 2 comments
Closed

Editor hooks #84

mixonic opened this issue Aug 18, 2015 · 2 comments

Comments

@mixonic
Copy link
Contributor

mixonic commented Aug 18, 2015

Per the 0.4.0 epic, create public hooks for the lifecycle of abstract changes and rendering.

editor.didUpdatePost((postEditor) => {
  postEditor.doSomething(editor.builder.createMarker());
  postEditor.forEachNode((node) => {
    if (node.type === SECTION) {
      if (node.markers.length === 1 && node.value === '*') {
        let list = editor.builder.createListSection('li');
        postEditor.replaceSection(node.section, list);
      }
    }
  });
});

editor.willRender(() => {
  if (!editor.post.isEmpty) {
    $('.placeholder').remove();
  }
});

editor.didRender(() => {
  if (editor.post.isEmpty) {
    $('.placeholder').append(document.body);
    $('.placeholder').positionAt(editor.element.firstChild);
    $('.placeholder').click(() => {
      editor.cursor.moveToSection(editor.post.sections.head);
    });
  }
});
@mixonic
Copy link
Contributor Author

mixonic commented Aug 18, 2015

@rlivsey FYI this is what we are thinking hook-wise.

@mixonic
Copy link
Contributor Author

mixonic commented Aug 27, 2015

Closing in favor of #95

@mixonic mixonic closed this as completed Aug 27, 2015
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

No branches or pull requests

1 participant