Skip to content

Commit

Permalink
add postEditor#splitSectionMarkerAtOffset
Browse files Browse the repository at this point in the history
  • Loading branch information
bantic committed Sep 17, 2015
1 parent af39a5a commit 6940ecd
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/js/editor/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,20 +399,19 @@ class PostEditor {
*/
splitMarkers(range) {
const { post } = this.editor;
const {
head: {section: headSection, offset: headSectionOffset},
tail: {section: tailSection, offset: tailSectionOffset}
} = range;
const { head, tail } = range;

const headEdit = headSection.splitMarkerAtOffset(headSectionOffset);
const tailEdit = tailSection.splitMarkerAtOffset(tailSectionOffset);

headEdit.removed.forEach(m => this.removeMarker(m));
tailEdit.removed.forEach(m => this.removeMarker(m));
this.splitSectionMarkerAtOffset(head.section, head.offset);
this.splitSectionMarkerAtOffset(tail.section, tail.offset);

return post.markersContainedByRange(range);
}

splitSectionMarkerAtOffset(section, offset) {
const edit = section.splitMarkerAtOffset(offset);
edit.removed.forEach(m => this.removeMarker(m));
}

splitMarker(marker, offset) {
let beforeMarker, afterMarker;

Expand Down

0 comments on commit 6940ecd

Please sign in to comment.