Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
textBeforeCursor,
true /*exactMatch*/
);
if (rangeToDelete) {
rangeToDelete.deleteContents();
}
// If not explicitly insert br, Chrome/Safari/IE will operate on the previous line
let tempBr = editor.getDocument().createElement('BR');
if (Browser.isChrome || Browser.isSafari || Browser.isIE11OrGreater) {
editor.insertNode(tempBr);
}
if (textBeforeCursor.indexOf('1.') == 0) {
toggleNumbering(editor);
} else {
toggleBullet(editor);
}
editor.deleteNode(tempBr);
});
});
// If not explicitly insert br, Chrome will operate on the previous line
if (browserData.isChrome) {
let brNode = document.createElement('br');
editor.insertNode(brNode, {
position: ContentPosition.SelectionStart,
updateCursor: true,
replaceSelection: false,
insertOnNewLine: false,
});
}
if (identifier == '*' || identifier == '-') {
toggleBullet(editor);
} else if (identifier == '1.') {
toggleNumbering(editor);
}
});
function toggleListAndPreventDefault(event: PluginKeyboardEvent, editor: Editor) {
let listInfo = cacheGetListElement(event, editor);
if (listInfo) {
let listElement = listInfo[0];
let tag = getTagOfNode(listElement);
if (tag == 'UL') {
toggleBullet(editor);
} else if (tag == 'OL') {
toggleNumbering(editor);
}
editor.focus();
event.rawEvent.preventDefault();
}
}
document.getElementById('numberingButton').addEventListener('click', function() {
toggleNumbering(getCurrentEditor());
});
handleChange: (editor: Editor) => toggleNumbering(editor)
},
onClick: editor => toggleNumbering(editor),
};