Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setRange(range) {
range = toRange(range);
// TODO validate that the range is valid
// (does not contain marked-for-removal head or tail sections?)
this._range = range;
this.scheduleAfterRender(this._renderRange, true);
}
selectRange(range) {
range = toRange(range);
this.cursor.selectRange(range);
this.range = range;
}
toggleSection(sectionTagName, range=this._range) {
range = toRange(range);
sectionTagName = normalizeTagName(sectionTagName);
let { post } = this.editor;
let nextRange = range;
let everySectionHasTagName = true;
post.walkMarkerableSections(range, section => {
if (!this._isSameSectionType(section, sectionTagName)) {
everySectionHasTagName = false;
}
});
let tagName = everySectionHasTagName ? 'p' : sectionTagName;
let firstChanged;
post.walkMarkerableSections(range, section => {
let changedSection = this.changeSectionTagName(section, tagName);